Bug 4576: remove touch/mouse duplication for linux/EVDEV
authorSylvain Becker <sylvain.becker@gmail.com>
Tue, 02 Apr 2019 17:03:58 +0200
changeset 126789fdfbf246f09
parent 12677 ed8b457b0a17
child 12679 108f8fab6175
Bug 4576: remove touch/mouse duplication for linux/EVDEV
src/core/linux/SDL_evdev.c
     1.1 --- a/src/core/linux/SDL_evdev.c	Tue Apr 02 16:58:11 2019 +0200
     1.2 +++ b/src/core/linux/SDL_evdev.c	Tue Apr 02 17:03:58 2019 +0200
     1.3 @@ -90,7 +90,6 @@
     1.4              int x, y, pressure;
     1.5          } * slots;
     1.6  
     1.7 -        int pointerFingerID;
     1.8      } * touchscreen_data;
     1.9  
    1.10      struct SDL_evdevlist_item *next;
    1.11 @@ -234,7 +233,6 @@
    1.12      int mouse_button;
    1.13      SDL_Mouse *mouse;
    1.14      float norm_x, norm_y, norm_pressure;
    1.15 -    int abs_x, abs_y;
    1.16  
    1.17      if (!_this) {
    1.18          return;
    1.19 @@ -383,36 +381,17 @@
    1.20                                  norm_pressure = 1.0f;
    1.21                              }
    1.22  
    1.23 -                            abs_x = item->touchscreen_data->slots[j].x;
    1.24 -                            abs_y = item->touchscreen_data->slots[j].y;
    1.25 -
    1.26                              switch(item->touchscreen_data->slots[j].delta) {
    1.27                              case EVDEV_TOUCH_SLOTDELTA_DOWN:
    1.28 -                                if (item->touchscreen_data->pointerFingerID == -1) {
    1.29 -                                    SDL_SendMouseMotion(mouse->focus, SDL_TOUCH_MOUSEID, 0, abs_x, abs_y);
    1.30 -
    1.31 -                                    SDL_SendMouseButton(mouse->focus, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
    1.32 -                                    item->touchscreen_data->pointerFingerID = item->touchscreen_data->slots[j].tracking_id;
    1.33 -                                }
    1.34 -
    1.35                                  SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_TRUE, norm_x, norm_y, norm_pressure);
    1.36                                  item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
    1.37                                  break;
    1.38                              case EVDEV_TOUCH_SLOTDELTA_UP:
    1.39 -                                if (item->touchscreen_data->pointerFingerID == item->touchscreen_data->slots[j].tracking_id) {
    1.40 -                                    SDL_SendMouseButton(mouse->focus, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
    1.41 -                                    item->touchscreen_data->pointerFingerID = -1;
    1.42 -                                }
    1.43 -
    1.44                                  SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_FALSE, norm_x, norm_y, norm_pressure);
    1.45                                  item->touchscreen_data->slots[j].tracking_id = -1;
    1.46                                  item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
    1.47                                  break;
    1.48                              case EVDEV_TOUCH_SLOTDELTA_MOVE:
    1.49 -                                if (item->touchscreen_data->pointerFingerID == item->touchscreen_data->slots[j].tracking_id) {
    1.50 -                                    SDL_SendMouseMotion(mouse->focus, SDL_TOUCH_MOUSEID, 0, abs_x, abs_y);
    1.51 -                                }
    1.52 -
    1.53                                  SDL_SendTouchMotion(item->fd, item->touchscreen_data->slots[j].tracking_id, norm_x, norm_y, norm_pressure);
    1.54                                  item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
    1.55                                  break;
    1.56 @@ -540,8 +519,6 @@
    1.57          item->touchscreen_data->slots[i].tracking_id = -1;
    1.58      }
    1.59  
    1.60 -    item->touchscreen_data->pointerFingerID = -1;
    1.61 -
    1.62      ret = SDL_AddTouch(item->fd, /* I guess our fd is unique enough */
    1.63          SDL_TOUCH_DEVICE_DIRECT,
    1.64          item->touchscreen_data->name);