diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index e2b788171a0..03cb2707330 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -653,7 +653,7 @@ void QWaylandInputDevice::Pointer::pointer_enter(uint32_t serial, struct wl_surf connect(mFocus.data(), &QObject::destroyed, this, &Pointer::handleFocusDestroyed); mSurfacePos = QPointF(wl_fixed_to_double(sx), wl_fixed_to_double(sy)); - mGlobalPos = window->mapToGlobal(mSurfacePos.toPoint()); + mGlobalPos = window->mapToGlobalF(mSurfacePos); mParent->mSerial = serial; mEnterSerial = serial; @@ -718,9 +718,7 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf } QPointF pos(wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y)); - QPointF delta = pos - pos.toPoint(); - QPointF global = window->mapToGlobal(pos.toPoint()); - global += delta; + QPointF global = window->mapToGlobalF(pos); mSurfacePos = pos; mGlobalPos = global; @@ -731,7 +729,7 @@ void QWaylandInputDevice::Pointer::pointer_motion(uint32_t time, wl_fixed_t surf // We can't know the true position since we're getting events for another surface, // so we just set it outside of the window boundaries. pos = QPointF(-1, -1); - global = grab->mapToGlobal(pos.toPoint()); + global = grab->mapToGlobalF(pos); window = grab; } setFrameEvent(new MotionEvent(window, time, pos, global, mButtons, mParent->modifiers())); @@ -813,7 +811,7 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time QPointF global = mGlobalPos; if (grab && grab != focusWindow()) { pos = QPointF(-1, -1); - global = grab->mapToGlobal(pos.toPoint()); + global = grab->mapToGlobalF(pos); window = grab; } @@ -1480,11 +1478,8 @@ void QWaylandInputDevice::handleTouchPoint(int id, QEventPoint::State state, con return; tp.area = QRectF(0, 0, 8, 8); - QPointF localPosition = win->mapFromWlSurface(surfacePosition); - // TODO: This doesn't account for high dpi scaling for the delta, but at least it matches - // what we have for mouse input. - QPointF delta = localPosition - localPosition.toPoint(); - QPointF globalPosition = win->mapToGlobal(localPosition.toPoint()) + delta; + const QPointF localPosition = win->mapFromWlSurface(surfacePosition); + const QPointF globalPosition = win->mapToGlobalF(localPosition); tp.area.moveCenter(globalPosition); } diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index 6a8c84c44a8..b29319bc9d6 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -547,9 +547,7 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) ulong timestamp = time; const QPointF localPosition = waylandWindow->mapFromWlSurface(m_pending.surfacePosition); - QPointF delta = localPosition - localPosition.toPoint(); - QPointF globalPosition = window->mapToGlobal(localPosition.toPoint()); - globalPosition += delta; + const QPointF globalPosition = waylandWindow->mapToGlobalF(localPosition); Qt::MouseButtons buttons = m_pending.down ? Qt::MouseButton::LeftButton : Qt::MouseButton::NoButton; buttons |= m_pending.buttons; @@ -564,7 +562,7 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) // but we need surface coordinates to include the decoration bool decorationHandledEvent = waylandWindow->handleTabletEventDecoration( m_tabletSeat->seat(), m_pending.surfacePosition, - window->mapToGlobal(m_pending.surfacePosition) + delta, buttons, + window->mapToGlobal(m_pending.surfacePosition), buttons, m_tabletSeat->seat()->modifiers()); if (!decorationHandledEvent) { diff --git a/src/plugins/platforms/wayland/qwaylandtouch.cpp b/src/plugins/platforms/wayland/qwaylandtouch.cpp index dfd04d44694..b38c895520a 100644 --- a/src/plugins/platforms/wayland/qwaylandtouch.cpp +++ b/src/plugins/platforms/wayland/qwaylandtouch.cpp @@ -83,8 +83,7 @@ void QWaylandTouchExtension::touch_extension_touch(uint32_t time, tp.area = QRectF(0, 0, fromFixed(width), fromFixed(height)); // Got surface-relative coords but need a (virtual) screen position. QPointF relPos = QPointF(fromFixed(x), fromFixed(y)); - QPointF delta = relPos - relPos.toPoint(); - tp.area.moveCenter(mTargetWindow->mapToGlobal(relPos.toPoint()) + delta); + tp.area.moveCenter(mTargetWindow->mapToGlobal(relPos)); tp.normalPosition.setX(fromFixed(normalized_x)); tp.normalPosition.setY(fromFixed(normalized_y));