Skip to content

Commit

Permalink
Bug 4576: remove touch/mouse duplication for linux/EVDEV
Browse files Browse the repository at this point in the history
  • Loading branch information
1bsyl committed Apr 2, 2019
1 parent 1a4c3b5 commit 6bc2d9d
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions src/core/linux/SDL_evdev.c
Expand Up @@ -90,7 +90,6 @@ typedef struct SDL_evdevlist_item
int x, y, pressure;
} * slots;

int pointerFingerID;
} * touchscreen_data;

struct SDL_evdevlist_item *next;
Expand Down Expand Up @@ -234,7 +233,6 @@ SDL_EVDEV_Poll(void)
int mouse_button;
SDL_Mouse *mouse;
float norm_x, norm_y, norm_pressure;
int abs_x, abs_y;

if (!_this) {
return;
Expand Down Expand Up @@ -383,36 +381,17 @@ SDL_EVDEV_Poll(void)
norm_pressure = 1.0f;
}

abs_x = item->touchscreen_data->slots[j].x;
abs_y = item->touchscreen_data->slots[j].y;

switch(item->touchscreen_data->slots[j].delta) {
case EVDEV_TOUCH_SLOTDELTA_DOWN:
if (item->touchscreen_data->pointerFingerID == -1) {
SDL_SendMouseMotion(mouse->focus, SDL_TOUCH_MOUSEID, 0, abs_x, abs_y);

SDL_SendMouseButton(mouse->focus, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
item->touchscreen_data->pointerFingerID = item->touchscreen_data->slots[j].tracking_id;
}

SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_TRUE, norm_x, norm_y, norm_pressure);
item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
break;
case EVDEV_TOUCH_SLOTDELTA_UP:
if (item->touchscreen_data->pointerFingerID == item->touchscreen_data->slots[j].tracking_id) {
SDL_SendMouseButton(mouse->focus, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
item->touchscreen_data->pointerFingerID = -1;
}

SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_FALSE, norm_x, norm_y, norm_pressure);
item->touchscreen_data->slots[j].tracking_id = -1;
item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
break;
case EVDEV_TOUCH_SLOTDELTA_MOVE:
if (item->touchscreen_data->pointerFingerID == item->touchscreen_data->slots[j].tracking_id) {
SDL_SendMouseMotion(mouse->focus, SDL_TOUCH_MOUSEID, 0, abs_x, abs_y);
}

SDL_SendTouchMotion(item->fd, item->touchscreen_data->slots[j].tracking_id, norm_x, norm_y, norm_pressure);
item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
break;
Expand Down Expand Up @@ -540,8 +519,6 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item)
item->touchscreen_data->slots[i].tracking_id = -1;
}

item->touchscreen_data->pointerFingerID = -1;

ret = SDL_AddTouch(item->fd, /* I guess our fd is unique enough */
SDL_TOUCH_DEVICE_DIRECT,
item->touchscreen_data->name);
Expand Down

0 comments on commit 6bc2d9d

Please sign in to comment.