diff --git a/ClassicalSharp/ClassicalSharp.csproj b/ClassicalSharp/ClassicalSharp.csproj index 94d96c1c3..9b59d52cb 100644 --- a/ClassicalSharp/ClassicalSharp.csproj +++ b/ClassicalSharp/ClassicalSharp.csproj @@ -253,7 +253,6 @@ - diff --git a/ClassicalSharp/Game/Game.Properties.cs b/ClassicalSharp/Game/Game.Properties.cs index bacfc2aa4..f3e12ffc5 100644 --- a/ClassicalSharp/Game/Game.Properties.cs +++ b/ClassicalSharp/Game/Game.Properties.cs @@ -207,7 +207,7 @@ namespace ClassicalSharp { } } - internal IPlatformWindow window; + internal DesktopWindow window; public MouseDevice Mouse; public KeyboardDevice Keyboard; diff --git a/ClassicalSharp/Platform/DesktopWindow.cs b/ClassicalSharp/Platform/DesktopWindow.cs index 184bef648..8500ec393 100644 --- a/ClassicalSharp/Platform/DesktopWindow.cs +++ b/ClassicalSharp/Platform/DesktopWindow.cs @@ -9,7 +9,7 @@ using Clipboard = System.Windows.Forms.Clipboard; namespace ClassicalSharp { /// Implementation of a native window and native input handling mechanism on Windows, OSX, and Linux. - public sealed class DesktopWindow : GameWindow, IPlatformWindow { + public sealed class DesktopWindow : GameWindow { public int Width { get { return ClientSize.Width; } } public int Height { get { return ClientSize.Height; } } diff --git a/ClassicalSharp/Platform/IPlatformWindow.cs b/ClassicalSharp/Platform/IPlatformWindow.cs deleted file mode 100644 index b68998b84..000000000 --- a/ClassicalSharp/Platform/IPlatformWindow.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3 -using System; -using System.Drawing; -using OpenTK; -using OpenTK.Input; -using OpenTK.Platform; - -namespace ClassicalSharp { - - /// Abstracts away a platform specific window, and input handler mechanism. - public interface IPlatformWindow { - - Size ClientSize { get; set; } - - int Width { get; } - - int Height { get; } - - bool VSync { get; set; } - - bool Exists { get; } - - bool Focused { get; } - - bool CursorVisible { get; set; } - - Point DesktopCursorPos { get; set; } - - MouseDevice Mouse { get; } - - KeyboardDevice Keyboard { get; } - - Point PointToScreen(Point coords); - - WindowState WindowState { get; set; } - - IWindowInfo WindowInfo { get; } - - string ClipboardText { get; set; } - - void LoadIcon(); - - void Run(); - - void SwapBuffers(); - - void Exit(); - - event EventHandler KeyPress; - } -} diff --git a/ClassicalSharp/Program.cs b/ClassicalSharp/Program.cs index 2429297dd..83eafbd6a 100644 --- a/ClassicalSharp/Program.cs +++ b/ClassicalSharp/Program.cs @@ -1,9 +1,8 @@ // Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3 -using System; -using System.IO; -using System.Net; -using System.Windows.Forms; -using OpenTK; +using System; +using System.IO; +using System.Net; +using OpenTK; namespace ClassicalSharp { diff --git a/Launcher2/Program.cs b/Launcher2/Program.cs index e5341164b..95056e623 100644 --- a/Launcher2/Program.cs +++ b/Launcher2/Program.cs @@ -1,8 +1,6 @@ // ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT -using System; -using System.IO; -using System.Windows.Forms; -using ClassicalSharp; +using System; +using ClassicalSharp; namespace Launcher { diff --git a/OpenTK/INativeWindow.cs b/OpenTK/INativeWindow.cs index 85c8f52f6..ddc285e12 100644 --- a/OpenTK/INativeWindow.cs +++ b/OpenTK/INativeWindow.cs @@ -131,11 +131,5 @@ namespace OpenTK { /// Occurs whenever a character is typed. event EventHandler KeyPress; - - /// Occurs whenever the mouse cursor leaves the window . - event EventHandler MouseLeave; - - /// Occurs whenever the mouse cursor enters the window . - event EventHandler MouseEnter; } } diff --git a/OpenTK/NativeWindow.cs b/OpenTK/NativeWindow.cs index e8bd0e496..b44d8c810 100644 --- a/OpenTK/NativeWindow.cs +++ b/OpenTK/NativeWindow.cs @@ -229,12 +229,6 @@ namespace OpenTK { /// Occurs whenever the window is moved. public event EventHandler Move; - /// Occurs whenever the mouse cursor enters the window . - public event EventHandler MouseEnter; - - /// Occurs whenever the mouse cursor leaves the window . - public event EventHandler MouseLeave; - /// Occurs whenever the window is resized. public event EventHandler Resize; @@ -298,16 +292,6 @@ namespace OpenTK { protected virtual void OnMove(object sender, EventArgs e) { if (Move != null) Move(this, e); } - - /// Called whenever the mouse cursor reenters the window . - protected virtual void OnMouseEnter(object sender, EventArgs e) { - if (MouseEnter != null) MouseEnter(this, e); - } - - /// Called whenever the mouse cursor leaves the window . - protected virtual void OnMouseLeave(object sender, EventArgs e) { - if (MouseLeave != null) MouseLeave(this, e); - } /// Called when the NativeWindow is resized. /// Not used. @@ -349,8 +333,6 @@ namespace OpenTK { implementation.Disposed += OnDisposed; implementation.FocusedChanged += OnFocusedChanged; implementation.KeyPress += OnKeyPress; - implementation.MouseEnter += OnMouseEnter; - implementation.MouseLeave += OnMouseLeave; implementation.Move += OnMove; implementation.Resize += OnResize; implementation.VisibleChanged += OnVisibleChanged; @@ -362,8 +344,6 @@ namespace OpenTK { implementation.Disposed -= OnDisposed; implementation.FocusedChanged -= OnFocusedChanged; implementation.KeyPress -= OnKeyPress; - implementation.MouseEnter -= OnMouseEnter; - implementation.MouseLeave -= OnMouseLeave; implementation.Move -= OnMove; implementation.Resize -= OnResize; implementation.VisibleChanged -= OnVisibleChanged; diff --git a/OpenTK/Platform/MacOS/CarbonGLNative.cs b/OpenTK/Platform/MacOS/CarbonGLNative.cs index 2698583ce..7fab54c46 100644 --- a/OpenTK/Platform/MacOS/CarbonGLNative.cs +++ b/OpenTK/Platform/MacOS/CarbonGLNative.cs @@ -55,7 +55,6 @@ namespace OpenTK.Platform.MacOS WindowState windowState = WindowState.Normal; internal static Dictionary WindowRefs = new Dictionary(); KeyPressEventArgs mKeyPressArgs = new KeyPressEventArgs(); - bool mMouseIn = false; bool mIsActive = false; Icon mIcon; @@ -367,11 +366,6 @@ namespace OpenTK.Platform.MacOS { mousePosInClient.Y -= mTitlebarHeight; } - - // check for enter/leave events - IntPtr thisEventWindow; - API.GetEventWindowRef(inEvent, out thisEventWindow); - CheckEnterLeaveEvents(thisEventWindow, mousePosInClient); switch ((MouseEventKind)evt.EventKind) { @@ -444,27 +438,6 @@ namespace OpenTK.Platform.MacOS } } - private void CheckEnterLeaveEvents(IntPtr eventWindowRef, Point pt) - { - if (window == null) - return; - - bool thisIn = eventWindowRef == window.WindowRef; - - if (pt.Y < 0) - thisIn = false; - - if (thisIn != mMouseIn) - { - mMouseIn = thisIn; - - if (mMouseIn) - OnMouseEnter(); - else - OnMouseLeave(); - } - } - private static void GetCharCodes(IntPtr inEvent, out MacOSKeyCode code, out char charCode) { code = API.GetEventKeyboardKeyCode(inEvent); @@ -877,18 +850,6 @@ namespace OpenTK.Platform.MacOS } - private void OnMouseLeave() - { - if (MouseLeave != null) - MouseLeave(this, EventArgs.Empty); - } - - private void OnMouseEnter() - { - if (MouseEnter != null) - MouseEnter(this, EventArgs.Empty); - } - private void OnActivate() { mIsActive = true; @@ -916,8 +877,6 @@ namespace OpenTK.Platform.MacOS public event EventHandler FocusedChanged; public event EventHandler WindowStateChanged; public event EventHandler KeyPress; - public event EventHandler MouseEnter; - public event EventHandler MouseLeave; #endregion diff --git a/OpenTK/Platform/Windows/WinGLNative.cs b/OpenTK/Platform/Windows/WinGLNative.cs index e1c8f97d4..91f03ff81 100644 --- a/OpenTK/Platform/Windows/WinGLNative.cs +++ b/OpenTK/Platform/Windows/WinGLNative.cs @@ -676,8 +676,6 @@ namespace OpenTK.Platform.Windows public event EventHandler FocusedChanged; public event EventHandler WindowStateChanged; public event EventHandler KeyPress; - public event EventHandler MouseEnter; - public event EventHandler MouseLeave; MSG msg; public void ProcessEvents() { diff --git a/OpenTK/Platform/X11/X11GLNative.cs b/OpenTK/Platform/X11/X11GLNative.cs index ac45d1b0b..d570671c1 100644 --- a/OpenTK/Platform/X11/X11GLNative.cs +++ b/OpenTK/Platform/X11/X11GLNative.cs @@ -631,8 +631,6 @@ namespace OpenTK.Platform.X11 { public event EventHandler FocusedChanged; public event EventHandler WindowStateChanged; public event EventHandler KeyPress; - public event EventHandler MouseEnter; - public event EventHandler MouseLeave; public KeyboardDevice Keyboard { get { return keyboard; }