John Wilson 2010-08-17 17:09:16 PDT
authorSam Lantinga <slouken@libsdl.org>
Wed, 19 Jan 2011 22:39:02 -0800
changeset 5049 28003ba91f57
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
--- a/src/video/win32/SDL_win32events.c	Wed Jan 19 22:25:40 2011 -0800
+++ b/src/video/win32/SDL_win32events.c	Wed Jan 19 22:39:02 2011 -0800
@@ -218,6 +218,40 @@
         SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_LEFT);
         break;
 
+    case WM_RBUTTONDOWN:
+        SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_RIGHT);
+        break;
+
+    case WM_RBUTTONUP:
+        SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_RIGHT);
+        break;
+
+    case WM_MBUTTONDOWN:
+        SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_MIDDLE);
+        break;
+
+    case WM_MBUTTONUP:
+        SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_MIDDLE);
+        break;
+
+    case WM_XBUTTONDOWN:
+        SDL_SendMouseButton(data->window, SDL_PRESSED, SDL_BUTTON_X1 + GET_XBUTTON_WPARAM(wParam) - 1);
+        returnCode = TRUE;
+        break;
+
+    case WM_XBUTTONUP:
+        SDL_SendMouseButton(data->window, SDL_RELEASED, SDL_BUTTON_X1 + GET_XBUTTON_WPARAM(wParam) - 1);
+        returnCode = TRUE;
+        break;
+
+    case WM_MOUSEWHEEL:
+        {
+            int motion = (short) HIWORD(wParam);
+
+            SDL_SendMouseWheel(data->window, 0, motion);
+            break;
+        }
+
     case WM_MOUSELEAVE:
         if (SDL_GetMouseFocus() == data->window) {
             SDL_SetMouseFocus(NULL);