John Wilson 2010-08-17 17:09:16 PDT
authorSam Lantinga <slouken@libsdl.org>
Wed, 19 Jan 2011 22:39:02 -0800
changeset 504928003ba91f57
parent 5048 187d7d446306
child 5050 2add0d17180b
John Wilson 2010-08-17 17:09:16 PDT

The are no event handlers for the middle mouse button, right mouse buttons, and
mouse wheel in the latest HG revision 4636. It has been like this for 3 months.
I made a patch for this, though I'm not sure if the Xbutton or mouse wheel code
is "correct" by your standards.
src/video/win32/SDL_win32events.c
     1.1 --- a/src/video/win32/SDL_win32events.c	Wed Jan 19 22:25:40 2011 -0800
     1.2 +++ b/src/video/win32/SDL_win32events.c	Wed Jan 19 22:39:02 2011 -0800
     1.3 @@ -218,6 +218,40 @@
     1.4          SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_LEFT);
     1.5          break;
     1.6  
     1.7 +    case WM_RBUTTONDOWN:
     1.8 +        SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_RIGHT);
     1.9 +        break;
    1.10 +
    1.11 +    case WM_RBUTTONUP:
    1.12 +        SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_RIGHT);
    1.13 +        break;
    1.14 +
    1.15 +    case WM_MBUTTONDOWN:
    1.16 +        SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_MIDDLE);
    1.17 +        break;
    1.18 +
    1.19 +    case WM_MBUTTONUP:
    1.20 +        SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_MIDDLE);
    1.21 +        break;
    1.22 +
    1.23 +    case WM_XBUTTONDOWN:
    1.24 +        SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_X1 + GET_XBUTTON_WPARAM(wParam) - 1);
    1.25 +        returnCode = TRUE;
    1.26 +        break;
    1.27 +
    1.28 +    case WM_XBUTTONUP:
    1.29 +        SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_X1 + GET_XBUTTON_WPARAM(wParam) - 1);
    1.30 +        returnCode = TRUE;
    1.31 +        break;
    1.32 +
    1.33 +    case WM_MOUSEWHEEL:
    1.34 +        {
    1.35 +            int motion = (short) HIWORD(wParam);
    1.36 +
    1.37 +            SDL_SendMouseWheel(data->window, 0, motion);
    1.38 +            break;
    1.39 +        }
    1.40 +
    1.41      case WM_MOUSELEAVE:
    1.42          if (SDL_GetMouseFocus() == data->window) {
    1.43              SDL_SetMouseFocus(NULL);