on xenial help sign in
respect target window's devicePixelRatio

this fixes the mouse events for highdpi displays when using QT_DEVICE_PIXEL_RATIO != 1

commita2958f04bf2c9bb9ac977c26b24cda6178073181 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateSun 7 Jun 2015, 16:52 (11 years ago) parentd667b2d
1 file changed+6−6
src/MouseTouchAdaptor.cpp+6−6
src/MouseTouchAdaptor.cpp+6−6
@@ -104,10 +104,10 @@ bool MouseTouchAdaptor::handleButtonPress(xcb_button_press_event_t *pressEvent)
104104 if (button != Qt::LeftButton)
105105 return true;
106106
107− QPoint windowPos(pressEvent->event_x, pressEvent->event_y);
108−
109107 QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(pressEvent->event));
110108
109+ QPoint windowPos(pressEvent->event_x / targetWindow->devicePixelRatio(), pressEvent->event_y / targetWindow->devicePixelRatio());
110+
111111 QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice,
112112 false /* autoCommit */);
113113 touchEvent.press(0 /* touchId */, windowPos);
@@ -125,10 +125,10 @@ bool MouseTouchAdaptor::handleButtonRelease(xcb_button_release_event_t *releaseE
125125 if (button != Qt::LeftButton)
126126 return true;
127127
128− QPoint windowPos(releaseEvent->event_x, releaseEvent->event_y);
129−
130128 QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(releaseEvent->event));
131129
130+ QPoint windowPos(releaseEvent->event_x / targetWindow->devicePixelRatio(), releaseEvent->event_y / targetWindow->devicePixelRatio());
131+
132132 QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice,
133133 false /* autoCommit */);
134134 touchEvent.release(0 /* touchId */, windowPos);
@@ -144,10 +144,10 @@ bool MouseTouchAdaptor::handleMotionNotify(xcb_motion_notify_event_t *event)
144144 return true;
145145 }
146146
147− QPoint windowPos(event->event_x, event->event_y);
148−
149147 QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(event->event));
150148
149+ QPoint windowPos(event->event_x / targetWindow->devicePixelRatio(), event->event_y / targetWindow->devicePixelRatio());
150+
151151 QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice,
152152 false /* autoCommit */);
153153 touchEvent.move(0 /* touchId */, windowPos);