Minor cosmetic fixes. Removed unused code.

This commit is contained in:
the_fiddler 2010-11-08 21:36:10 +00:00
parent 3a57aa777a
commit 9150a99252

View file

@ -49,9 +49,11 @@ namespace OpenTK.Platform.Windows
const ExtendedWindowStyle ParentStyleEx = ExtendedWindowStyle.WindowEdge | ExtendedWindowStyle.ApplicationWindow; const ExtendedWindowStyle ParentStyleEx = ExtendedWindowStyle.WindowEdge | ExtendedWindowStyle.ApplicationWindow;
const ExtendedWindowStyle ChildStyleEx = 0; const ExtendedWindowStyle ChildStyleEx = 0;
static readonly WinKeyMap KeyMap = new WinKeyMap();
readonly IntPtr Instance = Marshal.GetHINSTANCE(typeof(WinGLNative).Module); readonly IntPtr Instance = Marshal.GetHINSTANCE(typeof(WinGLNative).Module);
readonly IntPtr ClassName = Marshal.StringToHGlobalAuto(Guid.NewGuid().ToString()); readonly IntPtr ClassName = Marshal.StringToHGlobalAuto(Guid.NewGuid().ToString());
readonly WindowProcedure WindowProcedureDelegate; readonly WindowProcedure WindowProcedureDelegate;
readonly uint ModalLoopTimerPeriod = 1; readonly uint ModalLoopTimerPeriod = 1;
UIntPtr timer_handle; UIntPtr timer_handle;
readonly Functions.TimerProc ModalLoopCallback; readonly Functions.TimerProc ModalLoopCallback;
@ -78,16 +80,12 @@ namespace OpenTK.Platform.Windows
const ClassStyle DefaultClassStyle = ClassStyle.OwnDC; const ClassStyle DefaultClassStyle = ClassStyle.OwnDC;
readonly IntPtr DefaultWindowProcedure =
Marshal.GetFunctionPointerForDelegate(new WindowProcedure(Functions.DefWindowProc));
// Used for IInputDriver implementation // Used for IInputDriver implementation
WinMMJoystick joystick_driver = new WinMMJoystick(); WinMMJoystick joystick_driver = new WinMMJoystick();
KeyboardDevice keyboard = new KeyboardDevice(); KeyboardDevice keyboard = new KeyboardDevice();
MouseDevice mouse = new MouseDevice(); MouseDevice mouse = new MouseDevice();
IList<KeyboardDevice> keyboards = new List<KeyboardDevice>(1); IList<KeyboardDevice> keyboards = new List<KeyboardDevice>(1);
IList<MouseDevice> mice = new List<MouseDevice>(1); IList<MouseDevice> mice = new List<MouseDevice>(1);
internal static readonly WinKeyMap KeyMap = new WinKeyMap();
const long ExtendedBit = 1 << 24; // Used to distinguish left and right control, alt and enter keys. const long ExtendedBit = 1 << 24; // Used to distinguish left and right control, alt and enter keys.
static readonly uint ShiftRightScanCode = Functions.MapVirtualKey(VirtualKeys.RSHIFT, 0); // Used to distinguish left and right shift keys. static readonly uint ShiftRightScanCode = Functions.MapVirtualKey(VirtualKeys.RSHIFT, 0); // Used to distinguish left and right shift keys.
@ -95,11 +93,15 @@ namespace OpenTK.Platform.Windows
int cursor_visible_count = 0; int cursor_visible_count = 0;
static readonly object SyncRoot = new object();
#endregion #endregion
#region Contructors #region Contructors
public WinGLNative(int x, int y, int width, int height, string title, GameWindowFlags options, DisplayDevice device) public WinGLNative(int x, int y, int width, int height, string title, GameWindowFlags options, DisplayDevice device)
{
lock (SyncRoot)
{ {
// This is the main window procedure callback. We need the callback in order to create the window, so // This is the main window procedure callback. We need the callback in order to create the window, so
// don't move it below the CreateWindow calls. // don't move it below the CreateWindow calls.
@ -134,6 +136,7 @@ namespace OpenTK.Platform.Windows
keyboards.Add(keyboard); keyboards.Add(keyboard);
mice.Add(mouse); mice.Add(mouse);
} }
}
#endregion #endregion
@ -405,14 +408,14 @@ namespace OpenTK.Platform.Windows
return IntPtr.Zero; return IntPtr.Zero;
default: default:
if (!WMInput.KeyMap.ContainsKey((VirtualKeys)wParam)) if (!KeyMap.ContainsKey((VirtualKeys)wParam))
{ {
Debug.Print("Virtual key {0} ({1}) not mapped.", (VirtualKeys)wParam, (long)lParam); Debug.Print("Virtual key {0} ({1}) not mapped.", (VirtualKeys)wParam, (long)lParam);
break; break;
} }
else else
{ {
keyboard[WMInput.KeyMap[(VirtualKeys)wParam]] = pressed; keyboard[KeyMap[(VirtualKeys)wParam]] = pressed;
} }
return IntPtr.Zero; return IntPtr.Zero;
} }
@ -644,7 +647,7 @@ namespace OpenTK.Platform.Windows
Marshal.GetLastWin32Error())); Marshal.GetLastWin32Error()));
} }
static void UngrabCursor() void UngrabCursor()
{ {
if (!Functions.ClipCursor(IntPtr.Zero)) if (!Functions.ClipCursor(IntPtr.Zero))
Debug.WriteLine(String.Format("Failed to ungrab cursor. Error: {0}", Debug.WriteLine(String.Format("Failed to ungrab cursor. Error: {0}",
@ -1117,31 +1120,20 @@ namespace OpenTK.Platform.Windows
#region Events #region Events
public event EventHandler<EventArgs> Move = delegate { }; public event EventHandler<EventArgs> Move = delegate { };
public event EventHandler<EventArgs> Resize = delegate { }; public event EventHandler<EventArgs> Resize = delegate { };
public event EventHandler<System.ComponentModel.CancelEventArgs> Closing = delegate { }; public event EventHandler<System.ComponentModel.CancelEventArgs> Closing = delegate { };
public event EventHandler<EventArgs> Closed = delegate { }; public event EventHandler<EventArgs> Closed = delegate { };
public event EventHandler<EventArgs> Disposed = delegate { }; public event EventHandler<EventArgs> Disposed = delegate { };
public event EventHandler<EventArgs> IconChanged = delegate { }; public event EventHandler<EventArgs> IconChanged = delegate { };
public event EventHandler<EventArgs> TitleChanged = delegate { }; public event EventHandler<EventArgs> TitleChanged = delegate { };
public event EventHandler<EventArgs> VisibleChanged = delegate { }; public event EventHandler<EventArgs> VisibleChanged = delegate { };
public event EventHandler<EventArgs> FocusedChanged = delegate { }; public event EventHandler<EventArgs> FocusedChanged = delegate { };
public event EventHandler<EventArgs> WindowBorderChanged = delegate { }; public event EventHandler<EventArgs> WindowBorderChanged = delegate { };
public event EventHandler<EventArgs> WindowStateChanged = delegate { }; public event EventHandler<EventArgs> WindowStateChanged = delegate { };
public event EventHandler<OpenTK.Input.KeyboardKeyEventArgs> KeyDown = delegate { };
public event EventHandler<KeyPressEventArgs> KeyPress = delegate { }; public event EventHandler<KeyPressEventArgs> KeyPress = delegate { };
public event EventHandler<OpenTK.Input.KeyboardKeyEventArgs> KeyUp = delegate { };
public event EventHandler<EventArgs> MouseEnter = delegate { }; public event EventHandler<EventArgs> MouseEnter = delegate { };
public event EventHandler<EventArgs> MouseLeave = delegate { }; public event EventHandler<EventArgs> MouseLeave = delegate { };
#endregion #endregion