From dd16142a3ab26b9e46864fedb340ad08993d9886 Mon Sep 17 00:00:00 2001 From: thefiddler Date: Tue, 13 May 2014 23:50:39 +0200 Subject: [PATCH] [X11] Fixed GetCursorState() after SetPosition() The new position is now immediately reflected in GetCursorPos(). --- Source/OpenTK/Platform/X11/XI2Mouse.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/OpenTK/Platform/X11/XI2Mouse.cs b/Source/OpenTK/Platform/X11/XI2Mouse.cs index 4e93cc5f..5f9a756e 100644 --- a/Source/OpenTK/Platform/X11/XI2Mouse.cs +++ b/Source/OpenTK/Platform/X11/XI2Mouse.cs @@ -139,6 +139,7 @@ namespace OpenTK.Platform.X11 XIEventMasks.RawButtonPressMask | XIEventMasks.RawButtonReleaseMask | XIEventMasks.RawMotionMask | + XIEventMasks.MotionMask | XIEventMasks.DeviceChangedMask | (XIEventMasks)(1 << (int)ExitEvent))) { @@ -313,6 +314,8 @@ namespace OpenTK.Platform.X11 { Functions.XWarpPointer(API.DefaultDisplay, IntPtr.Zero, window.RootWindow, 0, 0, 0, 0, (int)x, (int)y); + Interlocked.Exchange(ref cursor_x, (long)x); + Interlocked.Exchange(ref cursor_y, (long)y); // Mark the expected warp-event so it can be ignored. if (mouse_warp_event == null) @@ -352,6 +355,10 @@ namespace OpenTK.Platform.X11 { switch ((XIEventType)cookie.evtype) { + case XIEventType.Motion: + // Nothing to do + break; + case XIEventType.RawMotion: case XIEventType.RawButtonPress: case XIEventType.RawButtonRelease: