src/video/mir/SDL_mirevents.c
changeset 10180 7356b2938fba
parent 10089 25fda20d0173
child 10299 5a45e29a6ea7
     1.1 --- a/src/video/mir/SDL_mirevents.c	Mon May 23 15:29:25 2016 -0300
     1.2 +++ b/src/video/mir/SDL_mirevents.c	Tue Jun 07 09:01:23 2016 -0700
     1.3 @@ -136,7 +136,8 @@
     1.4  static void
     1.5  HandleMouseMotion(SDL_Window* sdl_window, int x, int y)
     1.6  {
     1.7 -    SDL_SendMouseMotion(sdl_window, 0, 0, x, y);
     1.8 +    SDL_Mouse* mouse = SDL_GetMouse();
     1.9 +    SDL_SendMouseMotion(sdl_window, 0, mouse->relative_mode, x, y);
    1.10  }
    1.11  
    1.12  static void
    1.13 @@ -218,11 +219,20 @@
    1.14              SDL_Mouse* mouse = SDL_GetMouse();
    1.15              x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_x);
    1.16              y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_y);
    1.17 +
    1.18 +            if (mouse && (mouse->x != x || mouse->y != y)) {
    1.19 +                if (mouse->relative_mode) {
    1.20 +                    int relative_x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_relative_x);
    1.21 +                    int relative_y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_relative_y);
    1.22 +                    HandleMouseMotion(sdl_window, relative_x, relative_y);
    1.23 +                }
    1.24 +                else {
    1.25 +                    HandleMouseMotion(sdl_window, x, y);
    1.26 +                }
    1.27 +            }
    1.28 +
    1.29              hscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_hscroll);
    1.30              vscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_vscroll);
    1.31 -
    1.32 -            if (mouse && (mouse->x != x || mouse->y != y))
    1.33 -                HandleMouseMotion(sdl_window, x, y);
    1.34              if (vscroll != 0 || hscroll != 0)
    1.35                  HandleMouseScroll(sdl_window, hscroll, vscroll);
    1.36          }