Fixed bug 2293 - Precise scrolling events
authorSam Lantinga <slouken@libsdl.org>
Mon, 14 Aug 2017 21:28:04 -0700
changeset 1130068a80d7afec3
parent 11299 349866a6eba0
child 11301 68c83ddf9096
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).
src/events/SDL_mouse.c
src/events/SDL_mouse_c.h
src/video/cocoa/SDL_cocoamouse.m
src/video/emscripten/SDL_emscriptenevents.c
src/video/mir/SDL_mirevents.c
src/video/nacl/SDL_naclevents.c
src/video/wayland/SDL_waylandevents.c
src/video/windows/SDL_windowsevents.c
src/video/winrt/SDL_winrtpointerinput.cpp
src/video/x11/SDL_x11events.c
     1.1 --- a/src/events/SDL_mouse.c	Mon Aug 14 20:45:14 2017 -0700
     1.2 +++ b/src/events/SDL_mouse.c	Mon Aug 14 21:28:04 2017 -0700
     1.3 @@ -508,10 +508,11 @@
     1.4  }
     1.5  
     1.6  int
     1.7 -SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction)
     1.8 +SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction)
     1.9  {
    1.10      SDL_Mouse *mouse = SDL_GetMouse();
    1.11      int posted;
    1.12 +    int integral_x, integral_y;
    1.13  
    1.14      if (window) {
    1.15          SDL_SetMouseFocus(window);
    1.16 @@ -521,6 +522,26 @@
    1.17          return 0;
    1.18      }
    1.19  
    1.20 +    mouse->accumulated_wheel_x += x;
    1.21 +    if (mouse->accumulated_wheel_x > 0) {
    1.22 +        integral_x = (int)SDL_floor(mouse->accumulated_wheel_x);
    1.23 +    } else if (mouse->accumulated_wheel_x < 0) {
    1.24 +        integral_x = (int)SDL_ceil(mouse->accumulated_wheel_x);
    1.25 +    } else {
    1.26 +        integral_x = 0;
    1.27 +    }
    1.28 +    mouse->accumulated_wheel_x -= integral_x;
    1.29 +
    1.30 +    mouse->accumulated_wheel_y += y;
    1.31 +    if (mouse->accumulated_wheel_y > 0) {
    1.32 +        integral_y = (int)SDL_floor(mouse->accumulated_wheel_y);
    1.33 +    } else if (mouse->accumulated_wheel_y < 0) {
    1.34 +        integral_y = (int)SDL_ceil(mouse->accumulated_wheel_y);
    1.35 +    } else {
    1.36 +        integral_y = 0;
    1.37 +    }
    1.38 +    mouse->accumulated_wheel_y -= integral_y;
    1.39 +
    1.40      /* Post the event, if desired */
    1.41      posted = 0;
    1.42      if (SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE) {
    1.43 @@ -528,8 +549,12 @@
    1.44          event.type = SDL_MOUSEWHEEL;
    1.45          event.wheel.windowID = mouse->focus ? mouse->focus->id : 0;
    1.46          event.wheel.which = mouseID;
    1.47 -        event.wheel.x = x;
    1.48 -        event.wheel.y = y;
    1.49 +#if 0 /* Uncomment this when it goes in for SDL 2.1 */
    1.50 +        event.wheel.preciseX = x;
    1.51 +        event.wheel.preciseY = y;
    1.52 +#endif
    1.53 +        event.wheel.x = integral_x;
    1.54 +        event.wheel.y = integral_y;
    1.55          event.wheel.direction = (Uint32)direction;
    1.56          posted = (SDL_PushEvent(&event) > 0);
    1.57      }
     2.1 --- a/src/events/SDL_mouse_c.h	Mon Aug 14 20:45:14 2017 -0700
     2.2 +++ b/src/events/SDL_mouse_c.h	Mon Aug 14 21:28:04 2017 -0700
     2.3 @@ -80,6 +80,8 @@
     2.4      int xdelta;
     2.5      int ydelta;
     2.6      int last_x, last_y;         /* the last reported x and y coordinates */
     2.7 +    float accumulated_wheel_x;
     2.8 +    float accumulated_wheel_y;
     2.9      Uint32 buttonstate;
    2.10      SDL_bool has_position;
    2.11      SDL_bool relative_mode;
    2.12 @@ -129,7 +131,7 @@
    2.13  extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks);
    2.14  
    2.15  /* Send a mouse wheel event */
    2.16 -extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction);
    2.17 +extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction);
    2.18  
    2.19  /* Shutdown the mouse subsystem */
    2.20  extern void SDL_MouseQuit(void);
     3.1 --- a/src/video/cocoa/SDL_cocoamouse.m	Mon Aug 14 20:45:14 2017 -0700
     3.2 +++ b/src/video/cocoa/SDL_cocoamouse.m	Mon Aug 14 21:28:04 2017 -0700
     3.3 @@ -432,17 +432,7 @@
     3.4          }
     3.5      }
     3.6  
     3.7 -    if (x > 0) {
     3.8 -        x = SDL_ceil(x);
     3.9 -    } else if (x < 0) {
    3.10 -        x = SDL_floor(x);
    3.11 -    }
    3.12 -    if (y > 0) {
    3.13 -        y = SDL_ceil(y);
    3.14 -    } else if (y < 0) {
    3.15 -        y = SDL_floor(y);
    3.16 -    }
    3.17 -    SDL_SendMouseWheel(window, mouse->mouseID, (int)x, (int)y, direction);
    3.18 +    SDL_SendMouseWheel(window, mouse->mouseID, x, y, direction);
    3.19  }
    3.20  
    3.21  void
     4.1 --- a/src/video/emscripten/SDL_emscriptenevents.c	Mon Aug 14 20:45:14 2017 -0700
     4.2 +++ b/src/video/emscripten/SDL_emscriptenevents.c	Mon Aug 14 21:28:04 2017 -0700
     4.3 @@ -400,7 +400,7 @@
     4.4  Emscripten_HandleWheel(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData)
     4.5  {
     4.6      SDL_WindowData *window_data = userData;
     4.7 -    SDL_SendMouseWheel(window_data->window, 0, wheelEvent->deltaX, -wheelEvent->deltaY, SDL_MOUSEWHEEL_NORMAL);
     4.8 +    SDL_SendMouseWheel(window_data->window, 0, (float)wheelEvent->deltaX, (float)-wheelEvent->deltaY, SDL_MOUSEWHEEL_NORMAL);
     4.9      return SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE;
    4.10  }
    4.11  
     5.1 --- a/src/video/mir/SDL_mirevents.c	Mon Aug 14 20:45:14 2017 -0700
     5.2 +++ b/src/video/mir/SDL_mirevents.c	Mon Aug 14 21:28:04 2017 -0700
     5.3 @@ -141,7 +141,7 @@
     5.4  }
     5.5  
     5.6  static void
     5.7 -HandleMouseScroll(SDL_Window* sdl_window, int hscroll, int vscroll)
     5.8 +HandleMouseScroll(SDL_Window* sdl_window, float hscroll, float vscroll)
     5.9  {
    5.10      SDL_SendMouseWheel(sdl_window, 0, hscroll, vscroll, SDL_MOUSEWHEEL_NORMAL);
    5.11  }
    5.12 @@ -205,7 +205,7 @@
    5.13              break;
    5.14          case mir_pointer_action_motion: {
    5.15              int x, y;
    5.16 -            int hscroll, vscroll;
    5.17 +            float hscroll, vscroll;
    5.18              SDL_Mouse* mouse = SDL_GetMouse();
    5.19              x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_x);
    5.20              y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_y);
     6.1 --- a/src/video/nacl/SDL_naclevents.c	Mon Aug 14 20:45:14 2017 -0700
     6.2 +++ b/src/video/nacl/SDL_naclevents.c	Mon Aug 14 21:28:04 2017 -0700
     6.3 @@ -298,7 +298,7 @@
     6.4              return SDL_BUTTON_MIDDLE;
     6.5          case PP_INPUTEVENT_MOUSEBUTTON_RIGHT:
     6.6              return SDL_BUTTON_RIGHT;
     6.7 -            
     6.8 +
     6.9          case PP_INPUTEVENT_MOUSEBUTTON_NONE:
    6.10          default:
    6.11              return 0;
    6.12 @@ -321,7 +321,7 @@
    6.13  
    6.14  void NACL_PumpEvents(_THIS) {
    6.15    PSEvent* ps_event;
    6.16 -  PP_Resource event;  
    6.17 +  PP_Resource event;
    6.18    PP_InputEvent_Type type;
    6.19    PP_InputEvent_Modifier modifiers;
    6.20    struct PP_Rect rect;
    6.21 @@ -333,7 +333,7 @@
    6.22    Uint32 str_len;
    6.23    SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata;
    6.24    SDL_Mouse *mouse = SDL_GetMouse();
    6.25 -  
    6.26 +
    6.27    if (driverdata->window) {
    6.28      while ((ps_event = PSEventTryAcquire()) != NULL) {
    6.29          event = ps_event->as_resource;
    6.30 @@ -344,9 +344,9 @@
    6.31                  NACL_SetScreenResolution(rect.size.width, rect.size.height, SDL_PIXELFORMAT_UNKNOWN);
    6.32                  // FIXME: Rebuild context? See life.c UpdateContext
    6.33                  break;
    6.34 -            
    6.35 +
    6.36              /* From HandleInputEvent, contains an input resource. */
    6.37 -            case PSE_INSTANCE_HANDLEINPUT: 
    6.38 +            case PSE_INSTANCE_HANDLEINPUT:
    6.39                  type = driverdata->ppb_input_event->GetType(event);
    6.40                  modifiers = driverdata->ppb_input_event->GetModifiers(event);
    6.41                  switch(type) {
    6.42 @@ -359,35 +359,35 @@
    6.43                      case PP_INPUTEVENT_TYPE_WHEEL:
    6.44                          /* FIXME: GetTicks provides high resolution scroll events */
    6.45                          fp = driverdata->ppb_wheel_input_event->GetDelta(event);
    6.46 -                        SDL_SendMouseWheel(mouse->focus, mouse->mouseID, (int) fp.x, (int) fp.y, SDL_MOUSEWHEEL_NORMAL);
    6.47 +                        SDL_SendMouseWheel(mouse->focus, mouse->mouseID, fp.x, fp.y, SDL_MOUSEWHEEL_NORMAL);
    6.48                          break;
    6.49 -                        
    6.50 +
    6.51                      case PP_INPUTEVENT_TYPE_MOUSEENTER:
    6.52                      case PP_INPUTEVENT_TYPE_MOUSELEAVE:
    6.53                          /* FIXME: Mouse Focus */
    6.54                          break;
    6.55 -                        
    6.56 -                        
    6.57 -                    case PP_INPUTEVENT_TYPE_MOUSEMOVE: 
    6.58 +
    6.59 +
    6.60 +                    case PP_INPUTEVENT_TYPE_MOUSEMOVE:
    6.61                          location = driverdata->ppb_mouse_input_event->GetPosition(event);
    6.62                          SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, location.x, location.y);
    6.63                          break;
    6.64 -                  
    6.65 +
    6.66                      case PP_INPUTEVENT_TYPE_TOUCHSTART:
    6.67                      case PP_INPUTEVENT_TYPE_TOUCHMOVE:
    6.68                      case PP_INPUTEVENT_TYPE_TOUCHEND:
    6.69                      case PP_INPUTEVENT_TYPE_TOUCHCANCEL:
    6.70                          /* FIXME: Touch events */
    6.71                          break;
    6.72 -                      
    6.73 +
    6.74                      case PP_INPUTEVENT_TYPE_KEYDOWN:
    6.75                          SDL_SendKeyboardKey(SDL_PRESSED, SDL_NACL_translate_keycode(driverdata->ppb_keyboard_input_event->GetKeyCode(event)));
    6.76                          break;
    6.77 -                        
    6.78 +
    6.79                      case PP_INPUTEVENT_TYPE_KEYUP:
    6.80                          SDL_SendKeyboardKey(SDL_RELEASED, SDL_NACL_translate_keycode(driverdata->ppb_keyboard_input_event->GetKeyCode(event)));
    6.81                          break;
    6.82 -                        
    6.83 +
    6.84                      case PP_INPUTEVENT_TYPE_CHAR:
    6.85                          var = driverdata->ppb_keyboard_input_event->GetCharacterText(event);
    6.86                          str = driverdata->ppb_var->VarToUtf8(var, &str_len);
    6.87 @@ -397,17 +397,17 @@
    6.88                          }
    6.89                          SDL_strlcpy(text, str, str_len );
    6.90                          text[str_len] = '\0';
    6.91 -                        
    6.92 +
    6.93                          SDL_SendKeyboardText(text);
    6.94                          /* FIXME: Do we have to handle ref counting? driverdata->ppb_var->Release(var);*/
    6.95                          break;
    6.96 -                        
    6.97 +
    6.98                      default:
    6.99                          break;
   6.100                  }
   6.101                  break;
   6.102 -                
   6.103 -        
   6.104 +
   6.105 +
   6.106              /* From HandleMessage, contains a PP_Var. */
   6.107              case PSE_INSTANCE_HANDLEMESSAGE:
   6.108                  break;
   6.109 @@ -419,7 +419,7 @@
   6.110              /* When the 3D context is lost, no resource. */
   6.111              case PSE_GRAPHICS3D_GRAPHICS3DCONTEXTLOST:
   6.112                  break;
   6.113 -                
   6.114 +
   6.115              /* When the mouse lock is lost. */
   6.116              case PSE_MOUSELOCK_MOUSELOCKLOST:
   6.117                  break;
   6.118 @@ -427,7 +427,7 @@
   6.119              default:
   6.120                  break;
   6.121          }
   6.122 -        
   6.123 +
   6.124          PSEventRelease(ps_event);
   6.125      }
   6.126    }
     7.1 --- a/src/video/wayland/SDL_waylandevents.c	Mon Aug 14 20:45:14 2017 -0700
     7.2 +++ b/src/video/wayland/SDL_waylandevents.c	Mon Aug 14 21:28:04 2017 -0700
     7.3 @@ -97,7 +97,7 @@
     7.4          /* enter event for a window we've just destroyed */
     7.5          return;
     7.6      }
     7.7 -    
     7.8 +
     7.9      /* This handler will be called twice in Wayland 1.4
    7.10       * Once for the window surface which has valid user data
    7.11       * and again for the mouse cursor surface which does not have valid user data
    7.12 @@ -105,7 +105,7 @@
    7.13       */
    7.14  
    7.15      window = (SDL_WindowData *)wl_surface_get_user_data(surface);
    7.16 -    
    7.17 +
    7.18      if (window) {
    7.19          input->pointer_focus = window;
    7.20          SDL_SetMouseFocus(window->sdlwindow);
    7.21 @@ -184,7 +184,7 @@
    7.22      SDL_WindowData *window = input->pointer_focus;
    7.23      enum wl_pointer_button_state state = state_w;
    7.24      uint32_t sdl_button;
    7.25 -    
    7.26 +
    7.27      if  (input->pointer_focus) {
    7.28          switch (button) {
    7.29              case BTN_LEFT:
    7.30 @@ -231,16 +231,16 @@
    7.31  {
    7.32      SDL_WindowData *window = input->pointer_focus;
    7.33      enum wl_pointer_axis a = axis;
    7.34 -    int x, y;
    7.35 +    float x, y;
    7.36  
    7.37      if (input->pointer_focus) {
    7.38          switch (a) {
    7.39              case WL_POINTER_AXIS_VERTICAL_SCROLL:
    7.40                  x = 0;
    7.41 -                y = wl_fixed_to_int(value);
    7.42 +                y = wl_fixed_to_float(value);
    7.43                  break;
    7.44              case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
    7.45 -                x = wl_fixed_to_int(value);
    7.46 +                x = wl_fixed_to_float(value);
    7.47                  y = 0;
    7.48                  break;
    7.49              default:
    7.50 @@ -324,7 +324,7 @@
    7.51          /* enter event for a window we've just destroyed */
    7.52          return;
    7.53      }
    7.54 - 
    7.55 +
    7.56      window = wl_surface_get_user_data(surface);
    7.57  
    7.58      if (window) {
     8.1 --- a/src/video/windows/SDL_windowsevents.c	Mon Aug 14 20:45:14 2017 -0700
     8.2 +++ b/src/video/windows/SDL_windowsevents.c	Mon Aug 14 21:28:04 2017 -0700
     8.3 @@ -440,11 +440,11 @@
     8.4                  if (SDL_GetKeyboardFocus() != data->window) {
     8.5                      SDL_SetKeyboardFocus(data->window);
     8.6                  }
     8.7 -                
     8.8 +
     8.9                  GetCursorPos(&cursorPos);
    8.10                  ScreenToClient(hwnd, &cursorPos);
    8.11                  SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y);
    8.12 -                
    8.13 +
    8.14                  WIN_CheckAsyncMouseRelease(data);
    8.15  
    8.16                  /*
    8.17 @@ -566,40 +566,14 @@
    8.18          break;
    8.19  
    8.20      case WM_MOUSEWHEEL:
    8.21 -        {
    8.22 -            static short s_AccumulatedMotion;
    8.23 -
    8.24 -            s_AccumulatedMotion += GET_WHEEL_DELTA_WPARAM(wParam);
    8.25 -            if (s_AccumulatedMotion > 0) {
    8.26 -                while (s_AccumulatedMotion >= WHEEL_DELTA) {
    8.27 -                    SDL_SendMouseWheel(data->window, 0, 0, 1, SDL_MOUSEWHEEL_NORMAL);
    8.28 -                    s_AccumulatedMotion -= WHEEL_DELTA;
    8.29 -                }
    8.30 -            } else {
    8.31 -                while (s_AccumulatedMotion <= -WHEEL_DELTA) {
    8.32 -                    SDL_SendMouseWheel(data->window, 0, 0, -1, SDL_MOUSEWHEEL_NORMAL);
    8.33 -                    s_AccumulatedMotion += WHEEL_DELTA;
    8.34 -                }
    8.35 -            }
    8.36 -        }
    8.37 -        break;
    8.38 -
    8.39      case WM_MOUSEHWHEEL:
    8.40          {
    8.41 -            static short s_AccumulatedMotion;
    8.42 -
    8.43 -            s_AccumulatedMotion += GET_WHEEL_DELTA_WPARAM(wParam);
    8.44 -            if (s_AccumulatedMotion > 0) {
    8.45 -                while (s_AccumulatedMotion >= WHEEL_DELTA) {
    8.46 -                    SDL_SendMouseWheel(data->window, 0, 1, 0, SDL_MOUSEWHEEL_NORMAL);
    8.47 -                    s_AccumulatedMotion -= WHEEL_DELTA;
    8.48 -                }
    8.49 -            } else {
    8.50 -                while (s_AccumulatedMotion <= -WHEEL_DELTA) {
    8.51 -                    SDL_SendMouseWheel(data->window, 0, -1, 0, SDL_MOUSEWHEEL_NORMAL);
    8.52 -                    s_AccumulatedMotion += WHEEL_DELTA;
    8.53 -                }
    8.54 -            }
    8.55 +            short amount = GET_WHEEL_DELTA_WPARAM(wParam);
    8.56 +            float fAmount = (float) amount / WHEEL_DELTA;
    8.57 +            if (msg == WM_MOUSEWHEEL)
    8.58 +                SDL_SendMouseWheel(data->window, 0, 0.0f, fAmount, SDL_MOUSEWHEEL_NORMAL);
    8.59 +            else
    8.60 +                SDL_SendMouseWheel(data->window, 0, fAmount, 0.0f, SDL_MOUSEWHEEL_NORMAL);
    8.61          }
    8.62          break;
    8.63  
    8.64 @@ -636,7 +610,7 @@
    8.65                  SDL_SendKeyboardKey(SDL_PRESSED, code);
    8.66              }
    8.67          }
    8.68 - 
    8.69 +
    8.70          returnCode = 0;
    8.71          break;
    8.72  
    8.73 @@ -793,7 +767,7 @@
    8.74              RECT rect;
    8.75              int x, y;
    8.76              int w, h;
    8.77 -            
    8.78 +
    8.79              if (data->initializing || data->in_border_change) {
    8.80                  break;
    8.81              }
     9.1 --- a/src/video/winrt/SDL_winrtpointerinput.cpp	Mon Aug 14 20:45:14 2017 -0700
     9.2 +++ b/src/video/winrt/SDL_winrtpointerinput.cpp	Mon Aug 14 21:28:04 2017 -0700
     9.3 @@ -295,7 +295,7 @@
     9.4              }
     9.5              WINRT_LeftFingerDown = 0;
     9.6          }
     9.7 -    
     9.8 +
     9.9          SDL_SendTouch(
    9.10              WINRT_TouchID,
    9.11              (SDL_FingerID) pointerPoint->PointerId,
    9.12 @@ -335,9 +335,8 @@
    9.13          return;
    9.14      }
    9.15  
    9.16 -    // FIXME: This may need to accumulate deltas up to WHEEL_DELTA
    9.17 -    short motion = pointerPoint->Properties->MouseWheelDelta / WHEEL_DELTA;
    9.18 -    SDL_SendMouseWheel(window, 0, 0, motion, SDL_MOUSEWHEEL_NORMAL);
    9.19 +    float motion = (float) pointerPoint->Properties->MouseWheelDelta / WHEEL_DELTA;
    9.20 +    SDL_SendMouseWheel(window, 0, 0, (float) motion, SDL_MOUSEWHEEL_NORMAL);
    9.21  }
    9.22  
    9.23  void
    9.24 @@ -369,7 +368,7 @@
    9.25      // http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.input.mouseeventargs.mousedelta ),
    9.26      // does not seem to indicate (to me) that its values should be so large.  It
    9.27      // says that its values should be a "change in screen location".  I could
    9.28 -    // be misinterpreting this, however a post on MSDN from a Microsoft engineer (see: 
    9.29 +    // be misinterpreting this, however a post on MSDN from a Microsoft engineer (see:
    9.30      // http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/09a9868e-95bb-4858-ba1a-cb4d2c298d62 ),
    9.31      // indicates that these values are in DIPs, which is the same unit used
    9.32      // by CoreWindow's PointerMoved events (via the Position field in its CurrentPoint
    10.1 --- a/src/video/x11/SDL_x11events.c	Mon Aug 14 20:45:14 2017 -0700
    10.2 +++ b/src/video/x11/SDL_x11events.c	Mon Aug 14 21:28:04 2017 -0700
    10.3 @@ -1005,7 +1005,7 @@
    10.4                  printf("Protocol version to use : %d\n", xdnd_version);
    10.5                  printf("More then 3 data types : %d\n", (int) use_list);
    10.6  #endif
    10.7 - 
    10.8 +
    10.9                  if (use_list) {
   10.10                      /* fetch conversion targets */
   10.11                      SDL_x11Prop p;
   10.12 @@ -1019,7 +1019,7 @@
   10.13                  }
   10.14              }
   10.15              else if (xevent.xclient.message_type == videodata->XdndPosition) {
   10.16 -            
   10.17 +
   10.18  #ifdef DEBUG_XEVENTS
   10.19                  Atom act= videodata->XdndActionCopy;
   10.20                  if(xdnd_version >= 2) {
   10.21 @@ -1027,7 +1027,7 @@
   10.22                  }
   10.23                  printf("Action requested by user is : %s\n", X11_XGetAtomName(display , act));
   10.24  #endif
   10.25 -                
   10.26 +
   10.27  
   10.28                  /* reply with status */
   10.29                  memset(&m, 0, sizeof(XClientMessageEvent));
   10.30 @@ -1130,7 +1130,7 @@
   10.31              printf("window %p: ButtonPress (X11 button = %d)\n", data, xevent.xbutton.button);
   10.32  #endif
   10.33              if (X11_IsWheelEvent(display,&xevent,&xticks, &yticks)) {
   10.34 -                SDL_SendMouseWheel(data->window, 0, xticks, yticks, SDL_MOUSEWHEEL_NORMAL);
   10.35 +                SDL_SendMouseWheel(data->window, 0, (float) xticks, (float) yticks, SDL_MOUSEWHEEL_NORMAL);
   10.36              } else {
   10.37                  SDL_bool ignore_click = SDL_FALSE;
   10.38                  int button = xevent.xbutton.button;