Fix touch-related compile errors on Linux.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c
index 819c5bf..b33a8fd 100644
--- a/src/core/linux/SDL_evdev.c
+++ b/src/core/linux/SDL_evdev.c
@@ -401,18 +401,21 @@ SDL_EVDEV_Poll(void)
norm_pressure = 1.0f;
}
+ /* FIXME: the touch's window shouldn't be null, but
+ * the coordinate space of touch positions needs to
+ * be window-relative in that case. */
switch(item->touchscreen_data->slots[j].delta) {
case EVDEV_TOUCH_SLOTDELTA_DOWN:
- SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, /* FIXME: window */, SDL_TRUE, norm_x, norm_y, norm_pressure);
+ SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, SDL_TRUE, norm_x, norm_y, norm_pressure);
item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
break;
case EVDEV_TOUCH_SLOTDELTA_UP:
- SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, /* FIXME: window */, SDL_FALSE, norm_x, norm_y, norm_pressure);
+ SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, 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:
- SDL_SendTouchMotion(item->fd, item->touchscreen_data->slots[j].tracking_id, /* FIXME: window */, norm_x, norm_y, norm_pressure);
+ SDL_SendTouchMotion(item->fd, item->touchscreen_data->slots[j].tracking_id, NULL, norm_x, norm_y, norm_pressure);
item->touchscreen_data->slots[j].delta = EVDEV_TOUCH_SLOTDELTA_NONE;
break;
default:
diff --git a/src/video/wayland/SDL_waylandtouch.c b/src/video/wayland/SDL_waylandtouch.c
index 0750cbb..16d911e 100644
--- a/src/video/wayland/SDL_waylandtouch.c
+++ b/src/video/wayland/SDL_waylandtouch.c
@@ -26,6 +26,8 @@
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
#include "SDL_log.h"
+#include "SDL_mouse.h"
+#include "SDL_keyboard.h"
#include "SDL_waylandtouch.h"
#include "../../events/SDL_touch_c.h"
@@ -88,20 +90,29 @@ touch_handle_touch(void *data,
uint32_t capabilities = flags >> 16;
*/
+ SDL_Window* window = NULL;
+
SDL_TouchID deviceId = 1;
if (SDL_AddTouch(deviceId, SDL_TOUCH_DEVICE_DIRECT, "qt_touch_extension") < 0) {
SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__);
}
+ /* FIXME: This should be the window the given wayland surface is associated
+ * with, but how do we get the wayland surface? */
+ window = SDL_GetMouseFocus();
+ if (window == NULL) {
+ window = SDL_GetKeyboardFocus();
+ }
+
switch (touchState) {
case QtWaylandTouchPointPressed:
case QtWaylandTouchPointReleased:
- SDL_SendTouch(deviceId, (SDL_FingerID)id, /* FIXME: window */,
+ SDL_SendTouch(deviceId, (SDL_FingerID)id, window,
(touchState == QtWaylandTouchPointPressed) ? SDL_TRUE : SDL_FALSE,
xf, yf, pressuref);
break;
case QtWaylandTouchPointMoved:
- SDL_SendTouchMotion(deviceId, (SDL_FingerID)id, /* FIXME: window */, xf, yf, pressuref);
+ SDL_SendTouchMotion(deviceId, (SDL_FingerID)id, window, xf, yf, pressuref);
break;
default:
/* Should not happen */