mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Bug 4576: remove touch/mouse duplication for Wayland
This commit is contained in:
parent
6bc2d9de1f
commit
b8e5c561d8
@ -407,13 +407,6 @@ touch_handler_down(void *data, struct wl_touch *touch, unsigned int serial,
|
|||||||
|
|
||||||
touch_add(id, x, y, surface);
|
touch_add(id, x, y, surface);
|
||||||
|
|
||||||
if (!window_data->finger_touching) {
|
|
||||||
window_data->finger_touching = SDL_TRUE;
|
|
||||||
window_data->first_finger = id;
|
|
||||||
SDL_SendMouseMotion(window_data->sdlwindow, SDL_TOUCH_MOUSEID, 0, (int) dblx, (int) dbly);
|
|
||||||
SDL_SendMouseButton(window_data->sdlwindow, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_SendTouch(1, (SDL_FingerID)id, SDL_TRUE, x, y, 1.0f);
|
SDL_SendTouch(1, (SDL_FingerID)id, SDL_TRUE, x, y, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,11 +417,6 @@ touch_handler_up(void *data, struct wl_touch *touch, unsigned int serial,
|
|||||||
SDL_WindowData *window_data = (SDL_WindowData *)wl_surface_get_user_data(touch_surface(id));
|
SDL_WindowData *window_data = (SDL_WindowData *)wl_surface_get_user_data(touch_surface(id));
|
||||||
float x = 0, y = 0;
|
float x = 0, y = 0;
|
||||||
|
|
||||||
if ((window_data->finger_touching) && (window_data->first_finger == id)) {
|
|
||||||
SDL_SendMouseButton(window_data->sdlwindow, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
|
|
||||||
window_data->finger_touching = SDL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
touch_del(id, &x, &y);
|
touch_del(id, &x, &y);
|
||||||
SDL_SendTouch(1, (SDL_FingerID)id, SDL_FALSE, x, y, 0.0f);
|
SDL_SendTouch(1, (SDL_FingerID)id, SDL_FALSE, x, y, 0.0f);
|
||||||
}
|
}
|
||||||
@ -443,10 +431,6 @@ touch_handler_motion(void *data, struct wl_touch *touch, unsigned int timestamp,
|
|||||||
const float x = dblx / window_data->sdlwindow->w;
|
const float x = dblx / window_data->sdlwindow->w;
|
||||||
const float y = dbly / window_data->sdlwindow->h;
|
const float y = dbly / window_data->sdlwindow->h;
|
||||||
|
|
||||||
if ((window_data->finger_touching) && (window_data->first_finger == id)) {
|
|
||||||
SDL_SendMouseMotion(window_data->sdlwindow, SDL_TOUCH_MOUSEID, 0, (int) dblx, (int) dbly);
|
|
||||||
}
|
|
||||||
|
|
||||||
touch_update(id, x, y);
|
touch_update(id, x, y);
|
||||||
SDL_SendTouchMotion(1, (SDL_FingerID)id, x, y, 1.0f);
|
SDL_SendTouchMotion(1, (SDL_FingerID)id, x, y, 1.0f);
|
||||||
}
|
}
|
||||||
|
@ -76,8 +76,6 @@ typedef struct {
|
|||||||
int width, height;
|
int width, height;
|
||||||
} resize;
|
} resize;
|
||||||
|
|
||||||
SDL_bool finger_touching; /* for mapping touch events to mice */
|
|
||||||
SDL_FingerID first_finger;
|
|
||||||
} SDL_WindowData;
|
} SDL_WindowData;
|
||||||
|
|
||||||
extern void Wayland_ShowWindow(_THIS, SDL_Window *window);
|
extern void Wayland_ShowWindow(_THIS, SDL_Window *window);
|
||||||
|
Loading…
Reference in New Issue
Block a user