src/video/mir/SDL_mirevents.c
changeset 10180 7356b2938fba
parent 10089 25fda20d0173
child 10299 5a45e29a6ea7
equal deleted inserted replaced
10179:7cbfd97f1430 10180:7356b2938fba
   134 }
   134 }
   135 
   135 
   136 static void
   136 static void
   137 HandleMouseMotion(SDL_Window* sdl_window, int x, int y)
   137 HandleMouseMotion(SDL_Window* sdl_window, int x, int y)
   138 {
   138 {
   139     SDL_SendMouseMotion(sdl_window, 0, 0, x, y);
   139     SDL_Mouse* mouse = SDL_GetMouse();
       
   140     SDL_SendMouseMotion(sdl_window, 0, mouse->relative_mode, x, y);
   140 }
   141 }
   141 
   142 
   142 static void
   143 static void
   143 HandleTouchPress(int device_id, int source_id, SDL_bool down, float x, float y, float pressure)
   144 HandleTouchPress(int device_id, int source_id, SDL_bool down, float x, float y, float pressure)
   144 {
   145 {
   216             int x, y;
   217             int x, y;
   217             int hscroll, vscroll;
   218             int hscroll, vscroll;
   218             SDL_Mouse* mouse = SDL_GetMouse();
   219             SDL_Mouse* mouse = SDL_GetMouse();
   219             x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_x);
   220             x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_x);
   220             y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_y);
   221             y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_y);
       
   222 
       
   223             if (mouse && (mouse->x != x || mouse->y != y)) {
       
   224                 if (mouse->relative_mode) {
       
   225                     int relative_x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_relative_x);
       
   226                     int relative_y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_relative_y);
       
   227                     HandleMouseMotion(sdl_window, relative_x, relative_y);
       
   228                 }
       
   229                 else {
       
   230                     HandleMouseMotion(sdl_window, x, y);
       
   231                 }
       
   232             }
       
   233 
   221             hscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_hscroll);
   234             hscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_hscroll);
   222             vscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_vscroll);
   235             vscroll = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_vscroll);
   223 
       
   224             if (mouse && (mouse->x != x || mouse->y != y))
       
   225                 HandleMouseMotion(sdl_window, x, y);
       
   226             if (vscroll != 0 || hscroll != 0)
   236             if (vscroll != 0 || hscroll != 0)
   227                 HandleMouseScroll(sdl_window, hscroll, vscroll);
   237                 HandleMouseScroll(sdl_window, hscroll, vscroll);
   228         }
   238         }
   229             break;
   239             break;
   230         case mir_pointer_action_leave:
   240         case mir_pointer_action_leave: