back/win32: Tweak the conditions for incrementing the clickCount when handling mouse clicks: (i.e. double click detection)

- Require a click to be within a distance (retrieved from Windows)
of the last click to count (previously there was no proximity check)
- Allow clicks separated by the Windows double click time interval
to count (e.g. if the Windows double click time interval is n,
clicking at times 0, n, 2n, 3n would produce events with click counts
1, 2, 3, and 4. This matches OS X behaviour. Previously, all clicks
had to be within the windows double click time interval to count as
one group.)

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@30932 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2010-07-07 05:49:13 +00:00
parent e67f20d28b
commit 6ebad82029
2 changed files with 23 additions and 2 deletions

View file

@ -1,3 +1,16 @@
2010-07-06 Eric Wasylishen <ewasylishen@gmail.com>
* Source/win32/WIN32Server.m: Tweak the conditions for incrementing the
clickCount when handling mouse clicks: (i.e. double click detection)
- Require a click to be within a distance (retrieved from Windows)
of the last click to count (previously there was no proximity check)
- Allow clicks separated by the Windows double click time interval
to count (e.g. if the Windows double click time interval is n,
clicking at times 0, n, 2n, 3n would produce events with click counts
1, 2, 3, and 4. This matches OS X behaviour. Previously, all clicks
had to be within the windows double click time interval to count as
one group.)
2010-06-23 Quentin Mathe <quentin.mathe@gmail.com>
Fixed Windows backend issues introduced with r30523 where images are

View file

@ -60,6 +60,8 @@
#include <sys/file.h>
#endif
#include <math.h>
static BOOL _enableCallbacks = YES;
static NSEvent *process_key_event(WIN32Server *svr,
@ -2024,15 +2026,21 @@ process_mouse_event(WIN32Server *svr, HWND hwnd, WPARAM wParam, LPARAM lParam,
if (ltime == lastTime) // duplicate event has identical time
return nil; // ignore it
if (lastTime + GetDoubleClickTime() > ltime)
static NSPoint lastClick = {0.0, 0.0};
if (lastTime + GetDoubleClickTime() > ltime
&& fabs(eventLocation.x - lastClick.x) < GetSystemMetrics(SM_CXDOUBLECLK)
&& fabs(eventLocation.y - lastClick.y) < GetSystemMetrics(SM_CYDOUBLECLK))
{
clickCount += 1;
}
else
{
clickCount = 1;
lastTime = ltime;
}
lastTime = ltime;
lastClick = eventLocation;
SetCapture(hwnd); // capture the mouse to get mouse moved events outside of window
}
else if ( ((eventType == NSLeftMouseUp)