Reset the cursors stack when we are on a non-client area of a window. This is a workaround for an issue where we're not getting enough mouse move events when the mouse is moving very fast, and therefore occasionally find ourselves stuck with a cursor set for a rectangle that we've left.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/gnustep_testplant_branch@37271 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Frank Le Grand 2013-10-21 18:00:44 +00:00
parent 128d09da60
commit b379b7ff5b
4 changed files with 40 additions and 7 deletions

View file

@ -1,9 +1,20 @@
2013-10-21 Frank Le Grand <frank.legrand@testplant.com>
* Source/win32/WIN32Server.m
* Source/win32/WIN32Server.h
* Source/win32/win32_general.m: Reset the cursors stack
when we are on a non-client area of a window. This is
a workaround for an issue where we're not getting enough
mouse move events when the mouse is moving very fast,
and therefore occasionally find ourselves stuck with a
cursor set for a rectangle that we've left.
2013-10-03 Frank Le Grand <frank.legrand@testplant.com> 2013-10-03 Frank Le Grand <frank.legrand@testplant.com>
* Source/win32/WIN32Server.m * Source/win32/WIN32Server.m
* Source/win32/WIN32Server.h * Source/win32/WIN32Server.h
* Source/win32/win32_general.m: Fixed processing of * Source/win32/win32_general.m: Fixed processing of
WM_SETCURSOR: We now mark the event has handled in our WM_SETCURSOR: We now mark the event as handled in our
NSCursor stack is not empty, indicating that we're in a cursor NSCursor stack is not empty, indicating that we're in a cursor
rectangle and we don't want Windows to set the cursor. rectangle and we don't want Windows to set the cursor.

View file

@ -187,6 +187,7 @@ typedef struct w32serverFlags
- (void) decodeWM_COMMANDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd; - (void) decodeWM_COMMANDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
- (void) decodeWM_THEMECHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd; - (void) decodeWM_THEMECHANGEDParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
- (void) decodeWM_SETCURSORParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd; - (void) decodeWM_SETCURSORParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
- (void) decodeWM_NCMOUSELEAVEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd;
@end @end

View file

@ -1508,12 +1508,27 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
- (LRESULT) windowEventProc: (HWND)hwnd : (UINT)uMsg - (LRESULT) windowEventProc: (HWND)hwnd : (UINT)uMsg
: (WPARAM)wParam : (LPARAM)lParam : (WPARAM)wParam : (LPARAM)lParam
{ {
//NSLog(@"Win32 Event: %x", uMsg);
NSEvent *ev = nil; NSEvent *ev = nil;
[self setFlagsforEventLoop: hwnd]; [self setFlagsforEventLoop: hwnd];
switch (uMsg) switch (uMsg)
{ {
case WM_MOUSELEAVE:
case WM_NCMOUSELEAVE:
case WM_NCMOUSEMOVE:
// We have an issue where we're not getting enough
// mouse move events when the mouse is moving very
// fast, and therefore occasionally found ourselves
// with a cursor set for a rectangle that we've left.
// To get around that, we reset the cursor stack when
// we hit the non-client area. It is not a good
// permanent solution, but solves most of our issues
// for now.
[self decodeWM_NCMOUSELEAVEParams: wParam : lParam : hwnd];
break;
case WM_SIZING: case WM_SIZING:
return [self decodeWM_SIZINGParams: hwnd : wParam : lParam]; return [self decodeWM_SIZINGParams: hwnd : wParam : lParam];
break; break;
@ -1661,12 +1676,12 @@ LRESULT CALLBACK windowEnumCallback(HWND hwnd, LPARAM lParam)
case WM_NULL: case WM_NULL:
break; break;
case WM_NCHITTEST: //MOUSE // case WM_NCHITTEST: //MOUSE
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "NCHITTEST", hwnd); // NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "NCHITTEST", hwnd);
break; // break;
case WM_NCMOUSEMOVE: //MOUSE // case WM_NCMOUSEMOVE: //MOUSE
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "NCMOUSEMOVE", hwnd); // NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "NCMOUSEMOVE", hwnd);
break; // break;
case WM_NCLBUTTONDOWN: //MOUSE case WM_NCLBUTTONDOWN: //MOUSE
NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "NCLBUTTONDOWN", hwnd); NSDebugLLog(@"NSEvent", @"Got Message %s for %d", "NCLBUTTONDOWN", hwnd);
break; break;

View file

@ -36,6 +36,7 @@
@interface NSCursor (NSCursor_w32_General) @interface NSCursor (NSCursor_w32_General)
+ (NSMutableArray *) stack; + (NSMutableArray *) stack;
+ (void) resetStack;
@end @end
@ -161,4 +162,9 @@
} }
} }
- (void) decodeWM_NCMOUSELEAVEParams: (WPARAM)wParam : (LPARAM)lParam : (HWND)hwnd
{
[NSCursor resetStack];
}
@end @end