on xenial help sign in
respect target window's devicePixelRatio
a2958f0Lukáš Tinkl
src/MouseTouchAdaptor.cpp+6−6
@@ -104,10 +104,10 @@ bool MouseTouchAdaptor::handleButtonPress(xcb_button_press_event_t *pressEvent)
104 if (button != Qt::LeftButton)
104 if (button != Qt::LeftButton)
105 return true;
105 return true;
106
106
107− QPoint windowPos(pressEvent->event_x, pressEvent->event_y);
108−
109 QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(pressEvent->event));
107 QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(pressEvent->event));
110
108
109+ QPoint windowPos(pressEvent->event_x / targetWindow->devicePixelRatio(), pressEvent->event_y / targetWindow->devicePixelRatio());
110+
111 QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice,
111 QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice,
112 false /* autoCommit */);
112 false /* autoCommit */);
113 touchEvent.press(0 /* touchId */, windowPos);
113 touchEvent.press(0 /* touchId */, windowPos);
@@ -125,10 +125,10 @@ bool MouseTouchAdaptor::handleButtonRelease(xcb_button_release_event_t *releaseE
125 if (button != Qt::LeftButton)
125 if (button != Qt::LeftButton)
126 return true;
126 return true;
127
127
128− QPoint windowPos(releaseEvent->event_x, releaseEvent->event_y);
129−
130 QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(releaseEvent->event));
128 QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(releaseEvent->event));
131
129
130+ QPoint windowPos(releaseEvent->event_x / targetWindow->devicePixelRatio(), releaseEvent->event_y / targetWindow->devicePixelRatio());
131+
132 QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice,
132 QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice,
133 false /* autoCommit */);
133 false /* autoCommit */);
134 touchEvent.release(0 /* touchId */, windowPos);
134 touchEvent.release(0 /* touchId */, windowPos);
@@ -144,10 +144,10 @@ bool MouseTouchAdaptor::handleMotionNotify(xcb_motion_notify_event_t *event)
144 return true;
144 return true;
145 }
145 }
146
146
147− QPoint windowPos(event->event_x, event->event_y);
148−
149 QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(event->event));
147 QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(event->event));
150
148
149+ QPoint windowPos(event->event_x / targetWindow->devicePixelRatio(), event->event_y / targetWindow->devicePixelRatio());
150+
151 QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice,
151 QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice,
152 false /* autoCommit */);
152 false /* autoCommit */);
153 touchEvent.move(0 /* touchId */, windowPos);
153 touchEvent.move(0 /* touchId */, windowPos);