From 33dcb1d7ec4c454e4633349c5fd3f941b4dc30d6 Mon Sep 17 00:00:00 2001 From: Xavier BESSON Date: Fri, 5 Jul 2024 12:19:09 +0200 Subject: [PATCH] Return wl_surface* QWaylandWindow::winId() Required when you want to use some of the wayland protocols (For example: Keyboard shortcuts inhibit) Fixes: QTBUG-67919 Fixes: QTBUG-93103 Fixes: QTBUG-94729 Change-Id: I112c4c3eac99187317dce8de59a77ba3b0e70d17 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 4 +--- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 45eea327193..8c553c27fb3 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -60,8 +60,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display) mFrameCallbackTimeout = frameCallbackTimeout; } - static WId id = 1; - mWindowId = id++; initializeWlSurface(); connect(this, &QWaylandWindow::wlSurfaceCreated, this, @@ -351,7 +349,7 @@ QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface) WId QWaylandWindow::winId() const { - return mWindowId; + return reinterpret_cast(wlSurface()); } void QWaylandWindow::setParent(const QPlatformWindow *parent) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 6227cda4eba..bb8c5b18826 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -295,7 +295,6 @@ protected: GestureState mGestureState = GestureNotActive; #endif - WId mWindowId; bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out int mFrameCallbackCheckIntervalTimerId = -1; QAtomicInt mWaitingForUpdateDelivery = false;