Fixed bug 2496 - mouse left button double click event issue
authorSam Lantinga <slouken@libsdl.org>
Thu, 17 Apr 2014 21:00:25 -0700
changeset 8713e3a80970cf0b
parent 8712 e33b5f7df761
child 8714 4e57cfd9fca8
Fixed bug 2496 - mouse left button double click event issue

cplu

When I double click on a window, the "clicks" field (newly added since 2.0.2) in SDL_MouseButtonEvent is 1 instead of 2.
However, when I "tripple" click, "clicks" field is then 2.
I'v look into the source code in SDL_windowsevents.c and found that when a double click event comes, WIN_WindowProc will get a WM_LBUTTONDBLCLK msg. The message sequence of a double click is:WM_LBUTTONDOWN->WM_LBUTTONUP->WM_LBUTTONDBLCLK->WM_LBUTTONUP.
src/video/windows/SDL_windowsevents.c
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Sat Apr 05 17:19:34 2014 +0200
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Thu Apr 17 21:00:25 2014 -0700
     1.3 @@ -407,9 +407,13 @@
     1.4      case WM_MBUTTONUP:
     1.5      case WM_XBUTTONUP:
     1.6      case WM_LBUTTONDOWN:
     1.7 +    case WM_LBUTTONDBLCLK:
     1.8      case WM_RBUTTONDOWN:
     1.9 +    case WM_RBUTTONDBLCLK:
    1.10      case WM_MBUTTONDOWN:
    1.11 +    case WM_MBUTTONDBLCLK:
    1.12      case WM_XBUTTONDOWN:
    1.13 +    case WM_XBUTTONDBLCLK:
    1.14          {
    1.15              SDL_Mouse *mouse = SDL_GetMouse();
    1.16              if (!mouse->relative_mode || mouse->relative_mode_warp) {