struct wl_resource *resource = d->compositor->defaultInputDevice()->base()->pointer_focus_resource;
switch (state) {
case Qt::TouchPointPressed:
- wl_resource_post_event(resource, WL_INPUT_DEVICE_TOUCH_DOWN, time, id, x, y);
+ wl_resource_post_event(resource, WL_INPUT_DEVICE_TOUCH_DOWN, time, this, id, x, y);
break;
case Qt::TouchPointMoved:
wl_resource_post_event(resource, WL_INPUT_DEVICE_TOUCH_MOTION, time, id, x, y);
void QWaylandInputDevice::inputHandleTouchDown(void *data,
struct wl_input_device *wl_input_device,
uint32_t time,
+ struct wl_surface *surface,
int id,
int x,
int y)
Q_UNUSED(wl_input_device);
Q_UNUSED(time);
QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
+ inputDevice->mTouchFocus = static_cast<QWaylandWindow *>(wl_surface_get_user_data(surface));
inputDevice->handleTouchPoint(id, x, y, Qt::TouchPointPressed);
}
Q_UNUSED(wl_input_device);
Q_UNUSED(time);
QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
+ inputDevice->mTouchFocus = 0;
inputDevice->handleTouchPoint(id, 0, 0, Qt::TouchPointReleased);
}
if (!coordsOk) {
// x and y are surface relative.
// We need a global (screen) position.
- QWaylandWindow *win = mPointerFocus;
+ QWaylandWindow *win = mTouchFocus;
+
+ //is it possible that mTouchFocus is null;
+ if (!win)
+ win = mPointerFocus;
if (!win)
win = mKeyboardFocus;
if (!win || !win->window())
return;
+
tp.area = QRectF(0, 0, 8, 8);
tp.area.moveCenter(win->window()->mapToGlobal(QPoint(x, y)));
}
struct wl_data_device *mTransferDevice;
QWaylandWindow *mPointerFocus;
QWaylandWindow *mKeyboardFocus;
+ QWaylandWindow *mTouchFocus;
static const struct wl_input_device_listener inputDeviceListener;
Qt::MouseButtons mButtons;
QPoint mSurfacePos;
static void inputHandleTouchDown(void *data,
struct wl_input_device *wl_input_device,
uint32_t time,
+ struct wl_surface *surface,
int id,
int x,
int y);