Fixed bug 2293 - Precise scrolling events Martijn Courteaux I implemented precise scrolling events. I have been through all the folders in /src/video/[platform] to implement where possible. This works on OS X, but I can't speak for others. Build farm will figure that out, I guess. I think this patch should introduce precise scrolling on OS X, Wayland, Mir, Windows, Android, Nacl, Windows RT. The way I provide precise scrolling events is by adding two float fields to the SDL_MouseWheelScrollEvent datastructure, called "preciseX" and "preciseY". The old integer fields "x" and "y" are still present. The idea is that every platform specific code normalises the scroll amounts and forwards them to the SDL_SendMouseWheel function. It is this function that will now accumulate these (using a static variable, as I have seen how it was implemented in the Windows specific code) and once we hit a unit size, set the traditional integer "x" and "y" fields. I believe this is pretty solid way of doing it, although I'm not the expert here. There is also a fix in the patch for a typo recently introduced, that might need to be taken away by the time anybody merges this in. There is also a file in Nacl which I have stripped a horrible amount of trailing whitespaces. (Leave that part out if you want).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 7885c30..07c4d54 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -508,10 +508,11 @@ SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8
}
int
-SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction)
+SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction)
{
SDL_Mouse *mouse = SDL_GetMouse();
int posted;
+ int integral_x, integral_y;
if (window) {
SDL_SetMouseFocus(window);
@@ -521,6 +522,26 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_M
return 0;
}
+ mouse->accumulated_wheel_x += x;
+ if (mouse->accumulated_wheel_x > 0) {
+ integral_x = (int)SDL_floor(mouse->accumulated_wheel_x);
+ } else if (mouse->accumulated_wheel_x < 0) {
+ integral_x = (int)SDL_ceil(mouse->accumulated_wheel_x);
+ } else {
+ integral_x = 0;
+ }
+ mouse->accumulated_wheel_x -= integral_x;
+
+ mouse->accumulated_wheel_y += y;
+ if (mouse->accumulated_wheel_y > 0) {
+ integral_y = (int)SDL_floor(mouse->accumulated_wheel_y);
+ } else if (mouse->accumulated_wheel_y < 0) {
+ integral_y = (int)SDL_ceil(mouse->accumulated_wheel_y);
+ } else {
+ integral_y = 0;
+ }
+ mouse->accumulated_wheel_y -= integral_y;
+
/* Post the event, if desired */
posted = 0;
if (SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE) {
@@ -528,8 +549,12 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_M
event.type = SDL_MOUSEWHEEL;
event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
event.wheel.which = mouseID;
- event.wheel.x = x;
- event.wheel.y = y;
+#if 0 /* Uncomment this when it goes in for SDL 2.1 */
+ event.wheel.preciseX = x;
+ event.wheel.preciseY = y;
+#endif
+ event.wheel.x = integral_x;
+ event.wheel.y = integral_y;
event.wheel.direction = (Uint32)direction;
posted = (SDL_PushEvent(&event) > 0);
}
diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h
index c6ba729..52a41b3 100644
--- a/src/events/SDL_mouse_c.h
+++ b/src/events/SDL_mouse_c.h
@@ -80,6 +80,8 @@ typedef struct
int xdelta;
int ydelta;
int last_x, last_y; /* the last reported x and y coordinates */
+ float accumulated_wheel_x;
+ float accumulated_wheel_y;
Uint32 buttonstate;
SDL_bool has_position;
SDL_bool relative_mode;
@@ -129,7 +131,7 @@ extern int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 s
extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks);
/* Send a mouse wheel event */
-extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction);
+extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction);
/* Shutdown the mouse subsystem */
extern void SDL_MouseQuit(void);
diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m
index 61c19a9..d6fa5ff 100644
--- a/src/video/cocoa/SDL_cocoamouse.m
+++ b/src/video/cocoa/SDL_cocoamouse.m
@@ -432,17 +432,7 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
}
}
- if (x > 0) {
- x = SDL_ceil(x);
- } else if (x < 0) {
- x = SDL_floor(x);
- }
- if (y > 0) {
- y = SDL_ceil(y);
- } else if (y < 0) {
- y = SDL_floor(y);
- }
- SDL_SendMouseWheel(window, mouse->mouseID, (int)x, (int)y, direction);
+ SDL_SendMouseWheel(window, mouse->mouseID, x, y, direction);
}
void
diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c
index 9b0d12a..4ba8453 100644
--- a/src/video/emscripten/SDL_emscriptenevents.c
+++ b/src/video/emscripten/SDL_emscriptenevents.c
@@ -400,7 +400,7 @@ static EM_BOOL
Emscripten_HandleWheel(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData)
{
SDL_WindowData *window_data = userData;
- SDL_SendMouseWheel(window_data->window, 0, wheelEvent->deltaX, -wheelEvent->deltaY, SDL_MOUSEWHEEL_NORMAL);
+ SDL_SendMouseWheel(window_data->window, 0, (float)wheelEvent->deltaX, (float)-wheelEvent->deltaY, SDL_MOUSEWHEEL_NORMAL);
return SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE;
}
diff --git a/src/video/mir/SDL_mirevents.c b/src/video/mir/SDL_mirevents.c
index 0cd1801..84817c6 100644
--- a/src/video/mir/SDL_mirevents.c
+++ b/src/video/mir/SDL_mirevents.c
@@ -141,7 +141,7 @@ HandleTouchMotion(int device_id, int source_id, float x, float y, float pressure
}
static void
-HandleMouseScroll(SDL_Window* sdl_window, int hscroll, int vscroll)
+HandleMouseScroll(SDL_Window* sdl_window, float hscroll, float vscroll)
{
SDL_SendMouseWheel(sdl_window, 0, hscroll, vscroll, SDL_MOUSEWHEEL_NORMAL);
}
@@ -205,7 +205,7 @@ HandleMouseEvent(MirPointerEvent const* pointer, SDL_Window* sdl_window)
break;
case mir_pointer_action_motion: {
int x, y;
- int hscroll, vscroll;
+ float hscroll, vscroll;
SDL_Mouse* mouse = SDL_GetMouse();
x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_x);
y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_y);
diff --git a/src/video/nacl/SDL_naclevents.c b/src/video/nacl/SDL_naclevents.c
index 57e222f..7cc66dd 100644
--- a/src/video/nacl/SDL_naclevents.c
+++ b/src/video/nacl/SDL_naclevents.c
@@ -298,7 +298,7 @@ static Uint8 SDL_NACL_translate_mouse_button(int32_t button) {
return SDL_BUTTON_MIDDLE;
case PP_INPUTEVENT_MOUSEBUTTON_RIGHT:
return SDL_BUTTON_RIGHT;
-
+
case PP_INPUTEVENT_MOUSEBUTTON_NONE:
default:
return 0;
@@ -321,7 +321,7 @@ SDL_NACL_translate_keycode(int keycode)
void NACL_PumpEvents(_THIS) {
PSEvent* ps_event;
- PP_Resource event;
+ PP_Resource event;
PP_InputEvent_Type type;
PP_InputEvent_Modifier modifiers;
struct PP_Rect rect;
@@ -333,7 +333,7 @@ void NACL_PumpEvents(_THIS) {
Uint32 str_len;
SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
SDL_Mouse *mouse = SDL_GetMouse();
-
+
if (driverdata->window) {
while ((ps_event = PSEventTryAcquire()) != NULL) {
event = ps_event->as_resource;
@@ -344,9 +344,9 @@ void NACL_PumpEvents(_THIS) {
NACL_SetScreenResolution(rect.size.width, rect.size.height, SDL_PIXELFORMAT_UNKNOWN);
// FIXME: Rebuild context? See life.c UpdateContext
break;
-
+
/* From HandleInputEvent, contains an input resource. */
- case PSE_INSTANCE_HANDLEINPUT:
+ case PSE_INSTANCE_HANDLEINPUT:
type = driverdata->ppb_input_event->GetType(event);
modifiers = driverdata->ppb_input_event->GetModifiers(event);
switch(type) {
@@ -359,35 +359,35 @@ void NACL_PumpEvents(_THIS) {
case PP_INPUTEVENT_TYPE_WHEEL:
/* FIXME: GetTicks provides high resolution scroll events */
fp = driverdata->ppb_wheel_input_event->GetDelta(event);
- SDL_SendMouseWheel(mouse->focus, mouse->mouseID, (int) fp.x, (int) fp.y, SDL_MOUSEWHEEL_NORMAL);
+ SDL_SendMouseWheel(mouse->focus, mouse->mouseID, fp.x, fp.y, SDL_MOUSEWHEEL_NORMAL);
break;
-
+
case PP_INPUTEVENT_TYPE_MOUSEENTER:
case PP_INPUTEVENT_TYPE_MOUSELEAVE:
/* FIXME: Mouse Focus */
break;
-
-
- case PP_INPUTEVENT_TYPE_MOUSEMOVE:
+
+
+ case PP_INPUTEVENT_TYPE_MOUSEMOVE:
location = driverdata->ppb_mouse_input_event->GetPosition(event);
SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, location.x, location.y);
break;
-
+
case PP_INPUTEVENT_TYPE_TOUCHSTART:
case PP_INPUTEVENT_TYPE_TOUCHMOVE:
case PP_INPUTEVENT_TYPE_TOUCHEND:
case PP_INPUTEVENT_TYPE_TOUCHCANCEL:
/* FIXME: Touch events */
break;
-
+
case PP_INPUTEVENT_TYPE_KEYDOWN:
SDL_SendKeyboardKey(SDL_PRESSED, SDL_NACL_translate_keycode(driverdata->ppb_keyboard_input_event->GetKeyCode(event)));
break;
-
+
case PP_INPUTEVENT_TYPE_KEYUP:
SDL_SendKeyboardKey(SDL_RELEASED, SDL_NACL_translate_keycode(driverdata->ppb_keyboard_input_event->GetKeyCode(event)));
break;
-
+
case PP_INPUTEVENT_TYPE_CHAR:
var = driverdata->ppb_keyboard_input_event->GetCharacterText(event);
str = driverdata->ppb_var->VarToUtf8(var, &str_len);
@@ -397,17 +397,17 @@ void NACL_PumpEvents(_THIS) {
}
SDL_strlcpy(text, str, str_len );
text[str_len] = '\0';
-
+
SDL_SendKeyboardText(text);
/* FIXME: Do we have to handle ref counting? driverdata->ppb_var->Release(var);*/
break;
-
+
default:
break;
}
break;
-
-
+
+
/* From HandleMessage, contains a PP_Var. */
case PSE_INSTANCE_HANDLEMESSAGE:
break;
@@ -419,7 +419,7 @@ void NACL_PumpEvents(_THIS) {
/* When the 3D context is lost, no resource. */
case PSE_GRAPHICS3D_GRAPHICS3DCONTEXTLOST:
break;
-
+
/* When the mouse lock is lost. */
case PSE_MOUSELOCK_MOUSELOCKLOST:
break;
@@ -427,7 +427,7 @@ void NACL_PumpEvents(_THIS) {
default:
break;
}
-
+
PSEventRelease(ps_event);
}
}
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index 792081d..f335fe2 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -97,7 +97,7 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
/* enter event for a window we've just destroyed */
return;
}
-
+
/* This handler will be called twice in Wayland 1.4
* Once for the window surface which has valid user data
* and again for the mouse cursor surface which does not have valid user data
@@ -105,7 +105,7 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
*/
window = (SDL_WindowData *)wl_surface_get_user_data(surface);
-
+
if (window) {
input->pointer_focus = window;
SDL_SetMouseFocus(window->sdlwindow);
@@ -184,7 +184,7 @@ pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_t serial,
SDL_WindowData *window = input->pointer_focus;
enum wl_pointer_button_state state = state_w;
uint32_t sdl_button;
-
+
if (input->pointer_focus) {
switch (button) {
case BTN_LEFT:
@@ -231,16 +231,16 @@ pointer_handle_axis_common(struct SDL_WaylandInput *input,
{
SDL_WindowData *window = input->pointer_focus;
enum wl_pointer_axis a = axis;
- int x, y;
+ float x, y;
if (input->pointer_focus) {
switch (a) {
case WL_POINTER_AXIS_VERTICAL_SCROLL:
x = 0;
- y = wl_fixed_to_int(value);
+ y = wl_fixed_to_float(value);
break;
case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
- x = wl_fixed_to_int(value);
+ x = wl_fixed_to_float(value);
y = 0;
break;
default:
@@ -324,7 +324,7 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
/* enter event for a window we've just destroyed */
return;
}
-
+
window = wl_surface_get_user_data(surface);
if (window) {
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index bdc6814..cc6ef7e 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -440,11 +440,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (SDL_GetKeyboardFocus() != data->window) {
SDL_SetKeyboardFocus(data->window);
}
-
+
GetCursorPos(&cursorPos);
ScreenToClient(hwnd, &cursorPos);
SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
-
+
WIN_CheckAsyncMouseRelease(data);
/*
@@ -566,40 +566,14 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
case WM_MOUSEWHEEL:
- {
- static short s_AccumulatedMotion;
-
- s_AccumulatedMotion += GET_WHEEL_DELTA_WPARAM(wParam);
- if (s_AccumulatedMotion > 0) {
- while (s_AccumulatedMotion >= WHEEL_DELTA) {
- SDL_SendMouseWheel(data->window, 0, 0, 1, SDL_MOUSEWHEEL_NORMAL);
- s_AccumulatedMotion -= WHEEL_DELTA;
- }
- } else {
- while (s_AccumulatedMotion <= -WHEEL_DELTA) {
- SDL_SendMouseWheel(data->window, 0, 0, -1, SDL_MOUSEWHEEL_NORMAL);
- s_AccumulatedMotion += WHEEL_DELTA;
- }
- }
- }
- break;
-
case WM_MOUSEHWHEEL:
{
- static short s_AccumulatedMotion;
-
- s_AccumulatedMotion += GET_WHEEL_DELTA_WPARAM(wParam);
- if (s_AccumulatedMotion > 0) {
- while (s_AccumulatedMotion >= WHEEL_DELTA) {
- SDL_SendMouseWheel(data->window, 0, 1, 0, SDL_MOUSEWHEEL_NORMAL);
- s_AccumulatedMotion -= WHEEL_DELTA;
- }
- } else {
- while (s_AccumulatedMotion <= -WHEEL_DELTA) {
- SDL_SendMouseWheel(data->window, 0, -1, 0, SDL_MOUSEWHEEL_NORMAL);
- s_AccumulatedMotion += WHEEL_DELTA;
- }
- }
+ short amount = GET_WHEEL_DELTA_WPARAM(wParam);
+ float fAmount = (float) amount / WHEEL_DELTA;
+ if (msg == WM_MOUSEWHEEL)
+ SDL_SendMouseWheel(data->window, 0, 0.0f, fAmount, SDL_MOUSEWHEEL_NORMAL);
+ else
+ SDL_SendMouseWheel(data->window, 0, fAmount, 0.0f, SDL_MOUSEWHEEL_NORMAL);
}
break;
@@ -636,7 +610,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SDL_SendKeyboardKey(SDL_PRESSED, code);
}
}
-
+
returnCode = 0;
break;
@@ -793,7 +767,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
RECT rect;
int x, y;
int w, h;
-
+
if (data->initializing || data->in_border_change) {
break;
}
diff --git a/src/video/winrt/SDL_winrtpointerinput.cpp b/src/video/winrt/SDL_winrtpointerinput.cpp
index bd9c7ce..934f2a4 100644
--- a/src/video/winrt/SDL_winrtpointerinput.cpp
+++ b/src/video/winrt/SDL_winrtpointerinput.cpp
@@ -295,7 +295,7 @@ void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::P
}
WINRT_LeftFingerDown = 0;
}
-
+
SDL_SendTouch(
WINRT_TouchID,
(SDL_FingerID) pointerPoint->PointerId,
@@ -335,9 +335,8 @@ WINRT_ProcessPointerWheelChangedEvent(SDL_Window *window, Windows::UI::Input::Po
return;
}
- // FIXME: This may need to accumulate deltas up to WHEEL_DELTA
- short motion = pointerPoint->Properties->MouseWheelDelta / WHEEL_DELTA;
- SDL_SendMouseWheel(window, 0, 0, motion, SDL_MOUSEWHEEL_NORMAL);
+ float motion = (float) pointerPoint->Properties->MouseWheelDelta / WHEEL_DELTA;
+ SDL_SendMouseWheel(window, 0, 0, (float) motion, SDL_MOUSEWHEEL_NORMAL);
}
void
@@ -369,7 +368,7 @@ WINRT_ProcessMouseMovedEvent(SDL_Window * window, Windows::Devices::Input::Mouse
// http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.input.mouseeventargs.mousedelta ),
// does not seem to indicate (to me) that its values should be so large. It
// says that its values should be a "change in screen location". I could
- // be misinterpreting this, however a post on MSDN from a Microsoft engineer (see:
+ // be misinterpreting this, however a post on MSDN from a Microsoft engineer (see:
// http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/09a9868e-95bb-4858-ba1a-cb4d2c298d62 ),
// indicates that these values are in DIPs, which is the same unit used
// by CoreWindow's PointerMoved events (via the Position field in its CurrentPoint
diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index 7e8df98..ef12723 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -1005,7 +1005,7 @@ X11_DispatchEvent(_THIS)
printf("Protocol version to use : %d\n", xdnd_version);
printf("More then 3 data types : %d\n", (int) use_list);
#endif
-
+
if (use_list) {
/* fetch conversion targets */
SDL_x11Prop p;
@@ -1019,7 +1019,7 @@ X11_DispatchEvent(_THIS)
}
}
else if (xevent.xclient.message_type == videodata->XdndPosition) {
-
+
#ifdef DEBUG_XEVENTS
Atom act= videodata->XdndActionCopy;
if(xdnd_version >= 2) {
@@ -1027,7 +1027,7 @@ X11_DispatchEvent(_THIS)
}
printf("Action requested by user is : %s\n", X11_XGetAtomName(display , act));
#endif
-
+
/* reply with status */
memset(&m, 0, sizeof(XClientMessageEvent));
@@ -1130,7 +1130,7 @@ X11_DispatchEvent(_THIS)
printf("window %p: ButtonPress (X11 button = %d)\n", data, xevent.xbutton.button);
#endif
if (X11_IsWheelEvent(display,&xevent,&xticks, &yticks)) {
- SDL_SendMouseWheel(data->window, 0, xticks, yticks, SDL_MOUSEWHEEL_NORMAL);
+ SDL_SendMouseWheel(data->window, 0, (float) xticks, (float) yticks, SDL_MOUSEWHEEL_NORMAL);
} else {
SDL_bool ignore_click = SDL_FALSE;
int button = xevent.xbutton.button;