thefiddler [Thu, 8 May 2014 23:49:51 +0000 (01:49 +0200)]
[Platform] Raise KeyUp events on focus lost
This ensures that no keys are stuck in pressed state when the user
switches away from the application window.
thefiddler [Thu, 8 May 2014 22:26:51 +0000 (00:26 +0200)]
[X11] Fixed key repeat
thefiddler [Thu, 8 May 2014 22:13:23 +0000 (00:13 +0200)]
[X11] Improved vsync support
OpenTK will now check for GLX_EXT_swap_control, GLX_MESA_swap_control
and GLX_SGI_swap_control. This allows us to control vsync on more
systems.
thefiddler [Thu, 8 May 2014 18:58:11 +0000 (20:58 +0200)]
[X11] Corrected size events
thefiddler [Tue, 6 May 2014 07:36:30 +0000 (09:36 +0200)]
[SDL] Avoid CursorVisible = true cursor jump
thefiddler [Tue, 6 May 2014 07:31:35 +0000 (09:31 +0200)]
[SDL] Report mouse in client coordinates
thefiddler [Tue, 6 May 2014 07:12:08 +0000 (09:12 +0200)]
[Examples] Test MouseCursor in GameWindowStates
thefiddler [Tue, 6 May 2014 07:03:13 +0000 (09:03 +0200)]
[Mac] Fixed PointTo* calculations
On HiDPI displays, the client rectangle is using a pixel-based
coordinate system, while the screen is using a point-based coordinate
system. PointToClient/PointToScreen now correctly accounts for that.
thefiddler [Tue, 6 May 2014 07:02:09 +0000 (09:02 +0200)]
[Platform] Forward PointToScreen to backend
thefiddler [Tue, 6 May 2014 07:01:23 +0000 (09:01 +0200)]
[Platform] More selective mouse events
We should not raise mouse events when the cursor state hasn’t changed.
thefiddler [Tue, 6 May 2014 07:00:42 +0000 (09:00 +0200)]
[Examples] Added PointToClient test
thefiddler [Mon, 5 May 2014 07:14:14 +0000 (09:14 +0200)]
[Mac] Report KeyDown/Up events for modifier flags
thefiddler [Sun, 4 May 2014 22:56:19 +0000 (00:56 +0200)]
[Examples] Print KeyboardState
thefiddler [Sun, 4 May 2014 22:43:58 +0000 (00:43 +0200)]
[Examples] Test key events for consistency
thefiddler [Sun, 4 May 2014 22:43:45 +0000 (00:43 +0200)]
[Input] Implement key repeat
thefiddler [Sun, 4 May 2014 15:05:08 +0000 (17:05 +0200)]
[OpenTK] Refactor keyboard and mouse handling
A lot of duplicated code is now moved to NativeWindowBase and
LegacyInputDriver.
thefiddler [Sun, 4 May 2014 15:04:03 +0000 (17:04 +0200)]
[X11] Added X11KeyMap.TranslateButton()
This code was duplicated on four different places before.
thefiddler [Sun, 4 May 2014 15:02:37 +0000 (17:02 +0200)]
[Mac] Moved MacOSKeys to MacOS namespace
They are used by both Carbon and Cocoa, so there is little reason to
keep them in MacOS.Carbon
thefiddler [Sun, 4 May 2014 15:02:00 +0000 (17:02 +0200)]
[Input] Update state through HandleKey* events
thefiddler [Sun, 4 May 2014 15:01:34 +0000 (17:01 +0200)]
[Input] Removed pointless unsafe region
thefiddler [Sun, 4 May 2014 14:58:59 +0000 (16:58 +0200)]
[Input] Removed pointless ValuePrecise setter
thefiddler [Sun, 4 May 2014 14:58:24 +0000 (16:58 +0200)]
[Input] Removed pointless MouseDevice.SetState
MouseDevice state should only be modified through its HandleMouse*
methods, not directly.
thefiddler [Sun, 4 May 2014 13:24:02 +0000 (15:24 +0200)]
[Mac] Add horizontal scrolling
thefiddler [Sun, 4 May 2014 13:23:40 +0000 (15:23 +0200)]
[OpenTK] Raise NativeWindow.Mouse* events
thefiddler [Sun, 4 May 2014 13:23:24 +0000 (15:23 +0200)]
[Mac] Disable momentum scrolling and key pop-ups
We might wish to add an option to re-enable momentum scrolling, as this
might be useful to some applications for a more native feel.
thefiddler [Sun, 4 May 2014 06:34:13 +0000 (08:34 +0200)]
[Platform] Remove lambdas
thefiddler [Sun, 4 May 2014 06:33:51 +0000 (08:33 +0200)]
[Examples] Hook both MouseDevice and Mouse events
They should give identical results.
thefiddler [Sun, 4 May 2014 06:33:20 +0000 (08:33 +0200)]
[Input] MouseDevice is now based on MouseState
This way we have a single state representation (MouseState), shared by
all mouse APIs and events.
thefiddler [Sun, 4 May 2014 06:32:26 +0000 (08:32 +0200)]
[Mac] Avoid calling into LegacyInputDriver
thefiddler [Sun, 4 May 2014 06:32:08 +0000 (08:32 +0200)]
[X11] Removed legacy X11Input driver
Its functionality has been moved directly into X11GLNative and
X11KeyMap.
thefiddler [Sun, 4 May 2014 06:31:11 +0000 (08:31 +0200)]
[Input] Improved MouseState.ToString()
thefiddler [Sat, 3 May 2014 23:29:55 +0000 (01:29 +0200)]
[Platform] Improved mouse interface
- The complete mouse state is now available in mouse events
- Horizontal wheels are now supported
- MouseState now takes up less memory and has a simpler internal
implementation.
thefiddler [Sat, 3 May 2014 14:47:03 +0000 (16:47 +0200)]
[Platform] Added support for horizontal wheel
thefiddler [Fri, 2 May 2014 15:39:00 +0000 (17:39 +0200)]
[SDL] Corrected SDL_Mouse* event structs
thefiddler [Fri, 2 May 2014 14:52:11 +0000 (16:52 +0200)]
[Platform] Refactored INativeWindow backends
All INativeWindow implementations are now derived from
NativeWindowBase. They no longer implement legacy IInputDriver
themselves, but rather rely on LegacyInputDriver provided by
NativeWindowBase for compatibility. They also implement the new Mouse*
events.
thefiddler [Fri, 2 May 2014 13:13:38 +0000 (15:13 +0200)]
[Mac] Fixed initial window position
Cocoa sets the desktop origin at the bottom-left of the main screen,
with +y going up. OpenTK is setting the origin at the top-left of the
main screen, so we need to invert the y-axis.
thefiddler [Fri, 2 May 2014 12:21:32 +0000 (14:21 +0200)]
[Mac] Fixed cursor coords when CursorVisible=false
thefiddler [Fri, 2 May 2014 12:18:52 +0000 (14:18 +0200)]
[Platform] Added INativeWindow.Mouse* events
thefiddler [Fri, 2 May 2014 12:18:40 +0000 (14:18 +0200)]
[Platform] Inherit NativeWindowBase
thefiddler [Sun, 27 Apr 2014 07:39:30 +0000 (09:39 +0200)]
[Mac] Use On* methods from base class
thefiddler [Sun, 27 Apr 2014 07:39:18 +0000 (09:39 +0200)]
[OpenTK] Add On* methods to raise events
thefiddler [Sun, 27 Apr 2014 07:38:55 +0000 (09:38 +0200)]
[Input] Added internal MouseDevice.Position getter
thefiddler [Sun, 27 Apr 2014 07:21:33 +0000 (09:21 +0200)]
[Mac] Inherit from NativeWindowBase
This reduces code duplication significantly.
thefiddler [Sun, 27 Apr 2014 07:20:33 +0000 (09:20 +0200)]
[OpenTK] Added NativeWindowBase
This acts as a common base class to INativeWindow implementations and
can be used to reduce code duplication.
thefiddler [Thu, 1 May 2014 21:56:25 +0000 (23:56 +0200)]
[Examples] Use Key.Enter to capture mouse
thefiddler [Thu, 1 May 2014 20:17:06 +0000 (22:17 +0200)]
[Examples] Fixed cursor hotspot
thefiddler [Thu, 1 May 2014 15:03:47 +0000 (17:03 +0200)]
[Examples] Improved MouseCursor example
thefiddler [Thu, 1 May 2014 14:49:23 +0000 (16:49 +0200)]
[Win] Only set MouseCursor in client area
This is required according to the windows documentation.
thefiddler [Thu, 1 May 2014 12:27:20 +0000 (14:27 +0200)]
[SDL][Win] Destroy custom cursor on Close()
X11 destroys the cursor after setting it and Cocoa uses an autorelease
pool, so that should not be necessary there.
thefiddler [Wed, 30 Apr 2014 18:04:31 +0000 (20:04 +0200)]
[OpenTK] Rearranged MouseCursor parameters
MouseCursor and WindowIcon now match GL.TexImage2D in the way they
arrange their parameters. The expected values of each parameter are now
documented.
thefiddler [Wed, 30 Apr 2014 11:46:44 +0000 (13:46 +0200)]
[SDL] Fixed MouseCursor getting stuck after multiple changes
thefiddler [Wed, 30 Apr 2014 11:36:16 +0000 (13:36 +0200)]
[SDL] Fixed custom MouseCursor
thefiddler [Wed, 30 Apr 2014 07:06:30 +0000 (09:06 +0200)]
[Example] Test custom cursor
thefiddler [Wed, 30 Apr 2014 07:06:18 +0000 (09:06 +0200)]
[Mac] Fixed cursor byte order
thefiddler [Wed, 30 Apr 2014 06:45:27 +0000 (08:45 +0200)]
[OpenTK] Fixed compilation error
thefiddler [Wed, 30 Apr 2014 06:44:48 +0000 (08:44 +0200)]
[OpenTK] Renamed x/y to hotx/hoty
The new name matches their functionality closer.
thefiddler [Wed, 30 Apr 2014 06:38:57 +0000 (08:38 +0200)]
[Platform] Renamed MouseCursor.Rgba to Argb
This matches the default format of System.Drawing.Bitmap.
thefiddler [Wed, 30 Apr 2014 06:38:19 +0000 (08:38 +0200)]
[Mac] Implement NSCursor rectangles
thefiddler [Wed, 30 Apr 2014 06:37:34 +0000 (08:37 +0200)]
[Platform] Make MouseCursor actor public
thefiddler [Tue, 29 Apr 2014 06:48:49 +0000 (08:48 +0200)]
[Win] Log wglSwapIntervalEXT errors
Note that we cannot use Marshal.GetLastWin32Error because we are not
using regular DllImports for WGL extensions.
thefiddler [Tue, 29 Apr 2014 06:31:47 +0000 (08:31 +0200)]
[OpenTK] Query the driver for VSyncMode getter
Otherwise, the user could call Context.SwapInterval directly, causing
the vsync property to fall out of sync.
thefiddler [Tue, 29 Apr 2014 06:10:18 +0000 (08:10 +0200)]
[All] Fixed checks for EXT_swap_control_tear
EGL and NSOpenGL do not offer an EXT_swap_control_tear equivalent so
use regular vsync for now. The relevant extension string is now
correctly checked on WGL and GLX.
thefiddler [Mon, 28 Apr 2014 15:17:34 +0000 (17:17 +0200)]
[Mac] Removed unused CarbonGLNative.cs
thefiddler [Fri, 4 Apr 2014 06:46:32 +0000 (08:46 +0200)]
[Mac] Remove call to NewEventHandlerUPP
NewEventHandlerUPP fails to load when running through MonoKickstart. It
appears that this function is only used for old PPC systems that had
trouble with function pointers - sample code online indicates that we
do not need to call this.
thefiddler [Thu, 3 Apr 2014 21:19:31 +0000 (23:19 +0200)]
[Mac] CGDisplayBounds signature now matches Mac ABI
This resolves a crash in CGDisplayBounds when running through monokick.
thefiddler [Mon, 28 Apr 2014 14:19:17 +0000 (16:19 +0200)]
Merge branch 'pr/105' into develop
thefiddler [Mon, 28 Apr 2014 14:19:04 +0000 (16:19 +0200)]
[Mac] Cmd-Q should raise Closing events
It should also be cancelable.
thefiddler [Mon, 28 Apr 2014 07:38:54 +0000 (09:38 +0200)]
Merge branch 'thefiddler-cursor' into develop
thefiddler [Mon, 28 Apr 2014 07:37:16 +0000 (09:37 +0200)]
[Win] Fixed MouseCursor.Default
It is now possible to switch from a custom cursor back to
MouseCursor.Default.
thefiddler [Mon, 28 Apr 2014 05:07:47 +0000 (07:07 +0200)]
Merge branch 'cursor' of https://github.com/thefiddler/opentk into thefiddler-cursor
thefiddler [Sun, 27 Apr 2014 23:29:34 +0000 (01:29 +0200)]
[X11] Fixed SGI_swap_control query
GLX can return valid function pointer to unsupported functions.
We need to check for extension support in addition to the
function pointer.
Fixes crash on OpenSUSE 13.1 in VirtualBox.
thefiddler [Sun, 27 Apr 2014 20:47:04 +0000 (22:47 +0200)]
[GL] Added GetPName.Max*ImageUniforms
These tokens were introduced in OpenGL 4.2 and 4.3.
thefiddler [Sun, 27 Apr 2014 20:41:24 +0000 (22:41 +0200)]
[OpenTK] Only init X11 if SDL2 is not used
thefiddler [Sun, 27 Apr 2014 20:28:10 +0000 (22:28 +0200)]
[X11] Fixed INativeWindow.Cursor getter
thefiddler [Sun, 27 Apr 2014 20:27:18 +0000 (22:27 +0200)]
[Input] Fixed key modifiers in KeyboardDevice events
thefiddler [Sun, 27 Apr 2014 19:09:51 +0000 (21:09 +0200)]
[SDL] Fixed cursor support
SDL.CreateColorCursor takes 3 arguments, not 5.
thefiddler [Sun, 27 Apr 2014 17:45:20 +0000 (19:45 +0200)]
[Mac] Implement INativeWindow.Cursor
thefiddler [Sun, 27 Apr 2014 17:45:08 +0000 (19:45 +0200)]
[OpenTK] Treat null as MouseCursor.Empty
thefiddler [Sun, 27 Apr 2014 17:44:45 +0000 (19:44 +0200)]
[OpenTK] Disable custom MouseCursors
They require further development, due to byte-order differences between
platforms.
MouseCursor is now derived from WindowIcon, which we will use for
INativeWindow.Icon support in the future, in order to remove the
dependency to System.Drawing.
thefiddler [Sun, 27 Apr 2014 17:43:16 +0000 (19:43 +0200)]
[Examples] Set a predefined cursor on Key.Space
Custom cursor are not enabled for OpenTK 1.1.2. They will be part of
OpenTK 1.1.3.
thefiddler [Sun, 27 Apr 2014 08:56:08 +0000 (10:56 +0200)]
[Mac] Stubbed INativeWindow.Cursor
Fraser Waters [Mon, 24 Feb 2014 12:58:41 +0000 (12:58 +0000)]
Fix a bug in X11 CursorVisble with custom cursors.
CursorVisible reset to the default cursor when showing the cursor, it
should instead show the custom cursor if it's defined (else the default
cursor).
Fraser Waters [Sat, 22 Feb 2014 14:08:18 +0000 (14:08 +0000)]
Change bool to IntPtr.
WindowProc returns an IntPtr not a bool, so let Handle* functions return
IntPtr?. If they return a value we return that, if they return null we
call DefWindowProc and return the result from that.
Fraser Waters [Sat, 22 Feb 2014 14:04:53 +0000 (14:04 +0000)]
Custom cursors on X11.
Fraser Waters [Sat, 22 Feb 2014 14:04:01 +0000 (14:04 +0000)]
Add XcursorImageLoadCursor function.
Fraser Waters [Sat, 22 Feb 2014 14:03:46 +0000 (14:03 +0000)]
Make xcursor fields public.
Fraser Waters [Sat, 22 Feb 2014 13:34:28 +0000 (13:34 +0000)]
Change xcursor library name.
Fraser Waters [Sat, 22 Feb 2014 12:54:34 +0000 (12:54 +0000)]
Create and Destroy functions for XcursorImage.
Fraser Waters [Sat, 22 Feb 2014 12:54:11 +0000 (12:54 +0000)]
Xcursor types.
Fraser [Fri, 21 Feb 2014 19:46:13 +0000 (19:46 +0000)]
Respond to WM_SETCURSOR messages.
Calling SetCursor on mouse moves is not enough, we need to respond to
SETCURSOR messages. If we have a custom cursor we need to call SetCursor
and then NOT call DefWindowProc, otherwise we just call DefWindowProc
for the forms default cursor.
Fraser [Fri, 21 Feb 2014 19:44:51 +0000 (19:44 +0000)]
No need for named variable.
Fraser [Fri, 21 Feb 2014 19:35:34 +0000 (19:35 +0000)]
Copy to correct offset.
Offset into image is y * stride, not y * bpp.
Fraser Waters [Fri, 21 Feb 2014 11:35:15 +0000 (11:35 +0000)]
Don't hardcode cursor.png path.
Fraser Waters [Fri, 21 Feb 2014 11:27:51 +0000 (11:27 +0000)]
Copy cursor.png to output.
Fraser [Fri, 21 Feb 2014 00:24:24 +0000 (00:24 +0000)]
Partial implementation of Windows MouseCursor.
Very buggy, but starting to show results.
Fraser [Fri, 21 Feb 2014 00:23:20 +0000 (00:23 +0000)]
MouseCursor example.
Small example to show how the MouseCursor class can be used.
Fraser [Fri, 21 Feb 2014 00:10:57 +0000 (00:10 +0000)]
DestroyIcon function.
Fraser [Fri, 21 Feb 2014 00:01:27 +0000 (00:01 +0000)]
GetCursor function.
Fraser [Thu, 20 Feb 2014 23:40:40 +0000 (23:40 +0000)]
SetCursor function.
Fraser [Thu, 20 Feb 2014 23:40:22 +0000 (23:40 +0000)]
GetIconInfo function.