From 27c6c16743df79c354fa5639c901a5600ee92962 Mon Sep 17 00:00:00 2001 From: Tang Haixiang Date: Fri, 15 Apr 2022 13:32:21 +0800 Subject: [PATCH] Use QPlatformWindow's API as much as possible in QPA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using highdpi, window->geometry != platformwindow->geometry. In QPA we should use QPlatformWindow's API. Fixes: QTBUG-102601 Change-Id: Ib4ff2edbc045cf441cd2d594d502875417eb4917 Reviewed-by: Tor Arne Vestbø Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 0cd42c1df8e..9566965bed9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -717,7 +717,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->window()->mapToGlobal(mSurfacePos.toPoint()); + mGlobalPos = window->mapToGlobal(mSurfacePos.toPoint()); mParent->mSerial = serial; mEnterSerial = serial; @@ -783,7 +783,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->window()->mapToGlobal(pos.toPoint()); + QPointF global = window->mapToGlobal(pos.toPoint()); global += delta; mSurfacePos = pos; @@ -795,7 +795,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->window()->mapToGlobal(pos.toPoint()); + global = grab->mapToGlobal(pos.toPoint()); window = grab; } setFrameEvent(new MotionEvent(window, time, pos, global, mButtons, mParent->modifiers())); @@ -875,7 +875,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->window()->mapToGlobal(pos.toPoint()); + global = grab->mapToGlobal(pos.toPoint()); window = grab; } @@ -1487,7 +1487,7 @@ void QWaylandInputDevice::handleTouchPoint(int id, QEventPoint::State state, con // 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->window()->mapToGlobal(localPosition.toPoint()) + delta; + QPointF globalPosition = win->mapToGlobal(localPosition.toPoint()) + delta; tp.area.moveCenter(globalPosition); }