Client: expose toplevel window state
This is an additional API from Qt 6, which we can use in QGnomePlatform
This commit is contained in:
parent
ebefeac467
commit
4b16b4f7a6
@ -3,7 +3,7 @@
|
|||||||
Summary: Qt5 - Wayland platform support and QtCompositor module
|
Summary: Qt5 - Wayland platform support and QtCompositor module
|
||||||
Name: qt5-%{qt_module}
|
Name: qt5-%{qt_module}
|
||||||
Version: 5.15.2
|
Version: 5.15.2
|
||||||
Release: 6%{?dist}
|
Release: 7%{?dist}
|
||||||
|
|
||||||
License: LGPLv3
|
License: LGPLv3
|
||||||
Url: http://www.qt.io
|
Url: http://www.qt.io
|
||||||
@ -35,15 +35,9 @@ Patch17: 0017-xdgshell-Tell-the-compositor-the-screen-we-re-expect.patch
|
|||||||
Patch18: 0018-Fix-compilation.patch
|
Patch18: 0018-Fix-compilation.patch
|
||||||
Patch19: 0019-client-Allow-QWaylandInputContext-to-accept-composed.patch
|
Patch19: 0019-client-Allow-QWaylandInputContext-to-accept-composed.patch
|
||||||
|
|
||||||
## prior patches, commented-out ones are apparent dupes from above, keep them around
|
|
||||||
## temporarily in case I botched anything -- rdieter
|
Patch51: qtwayland-fix-issue-with-repeated-window-size-changes.patch
|
||||||
#Patch50: qtwayland-scanner-avoid-accessing-dangling-pointers-in-destroy-func.patch
|
Patch52: qtwayland-client-expose-toplevel-window-state.patch
|
||||||
Patch51: qtwayland-fix-issue-with-repeated-window-size-changes.patch
|
|
||||||
#Patch52: qtwayland-get-correct-margins-decoration-region.patch
|
|
||||||
#Patch53: qtwayland-send-exposeevent-to-parent-on-subsurface-position.patch
|
|
||||||
#Patch54: qtwayland-send-set-window-geometry-only-once-configured.patch
|
|
||||||
#Patch55: qtwayland-tell-compositor-screen-we-are-expecting-to-fill.patch
|
|
||||||
#Patch56: qtwayland-translate-opaque-area-for-decorations.patch
|
|
||||||
|
|
||||||
# Upstreamable patches
|
# Upstreamable patches
|
||||||
|
|
||||||
@ -154,6 +148,9 @@ popd
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jun 02 2021 Jan Grulich <jgrulich@redhat.com> - 5.15.2-7
|
||||||
|
- Client: expose toplevel window state (change from Qt6)
|
||||||
|
|
||||||
* Tue Apr 27 2021 Rex Dieter <rdieter@fedoraproject.org> - 5.15.2-6
|
* Tue Apr 27 2021 Rex Dieter <rdieter@fedoraproject.org> - 5.15.2-6
|
||||||
- Pull in latest fixes from https://invent.kde.org/qt/qt/qtwayland
|
- Pull in latest fixes from https://invent.kde.org/qt/qt/qtwayland
|
||||||
|
|
||||||
|
172
qtwayland-client-expose-toplevel-window-state.patch
Normal file
172
qtwayland-client-expose-toplevel-window-state.patch
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
From d533901938a996367d7b6f87b0214f5a17098aed Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Grulich <jgrulich@redhat.com>
|
||||||
|
Date: Tue, 23 Mar 2021 16:03:22 +0100
|
||||||
|
Subject: [PATCH] Client: expose toplevel window state
|
||||||
|
|
||||||
|
QWaylandWindow has only basic information about window state, like if
|
||||||
|
it's active or maximized, but it has no information about tiling, which
|
||||||
|
can be useful for client-side decorations. We also need to bump version
|
||||||
|
of xdg-shell protocol we support, because additional states are not in
|
||||||
|
the version currently supported by QtWayland. It shouldn't be a problem
|
||||||
|
to increase the version as the new version adds just these additional
|
||||||
|
window states.
|
||||||
|
|
||||||
|
Change-Id: I4c46516d9c7296c69ea51a022b3bdb4ca06bef8d
|
||||||
|
Reviewed-by: David Edmundson <davidedmundson@kde.org>
|
||||||
|
---
|
||||||
|
src/client/qwaylandwindow.cpp | 15 +++++++++++++++
|
||||||
|
src/client/qwaylandwindow_p.h | 16 ++++++++++++++++
|
||||||
|
.../xdg-shell/qwaylandxdgshell.cpp | 16 +++++++++++++++-
|
||||||
|
.../xdg-shell/qwaylandxdgshell_p.h | 3 ++-
|
||||||
|
4 files changed, 48 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
|
||||||
|
index c35ccab15..65a914976 100644
|
||||||
|
--- a/src/client/qwaylandwindow.cpp
|
||||||
|
+++ b/src/client/qwaylandwindow.cpp
|
||||||
|
@@ -1107,6 +1107,21 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
+QWaylandWindow::ToplevelWindowTilingStates QWaylandWindow::toplevelWindowTilingStates() const
|
||||||
|
+{
|
||||||
|
+ return mLastReportedToplevelWindowTilingStates;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void QWaylandWindow::handleToplevelWindowTilingStatesChanged(ToplevelWindowTilingStates states)
|
||||||
|
+{
|
||||||
|
+ mLastReportedToplevelWindowTilingStates = states;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+Qt::WindowStates QWaylandWindow::windowStates() const
|
||||||
|
+{
|
||||||
|
+ return mLastReportedWindowStates;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void QWaylandWindow::handleWindowStatesChanged(Qt::WindowStates states)
|
||||||
|
{
|
||||||
|
createDecoration();
|
||||||
|
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
|
||||||
|
index 5f134568b..1d743f4e4 100644
|
||||||
|
--- a/src/client/qwaylandwindow_p.h
|
||||||
|
+++ b/src/client/qwaylandwindow_p.h
|
||||||
|
@@ -95,6 +95,15 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformW
|
||||||
|
Vulkan
|
||||||
|
};
|
||||||
|
|
||||||
|
+ enum ToplevelWindowTilingState {
|
||||||
|
+ WindowNoState = 0,
|
||||||
|
+ WindowTiledLeft = 1,
|
||||||
|
+ WindowTiledRight = 2,
|
||||||
|
+ WindowTiledTop = 4,
|
||||||
|
+ WindowTiledBottom = 8
|
||||||
|
+ };
|
||||||
|
+ Q_DECLARE_FLAGS(ToplevelWindowTilingStates, ToplevelWindowTilingState)
|
||||||
|
+
|
||||||
|
QWaylandWindow(QWindow *window, QWaylandDisplay *display);
|
||||||
|
~QWaylandWindow() override;
|
||||||
|
|
||||||
|
@@ -145,6 +154,10 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformW
|
||||||
|
void handleContentOrientationChange(Qt::ScreenOrientation orientation) override;
|
||||||
|
void setOrientationMask(Qt::ScreenOrientations mask);
|
||||||
|
|
||||||
|
+ ToplevelWindowTilingStates toplevelWindowTilingStates() const;
|
||||||
|
+ void handleToplevelWindowTilingStatesChanged(ToplevelWindowTilingStates states);
|
||||||
|
+
|
||||||
|
+ Qt::WindowStates windowStates() const;
|
||||||
|
void setWindowState(Qt::WindowStates states) override;
|
||||||
|
void setWindowFlags(Qt::WindowFlags flags) override;
|
||||||
|
void handleWindowStatesChanged(Qt::WindowStates states);
|
||||||
|
@@ -260,6 +273,7 @@ public slots:
|
||||||
|
QRegion mMask;
|
||||||
|
QRegion mOpaqueArea;
|
||||||
|
Qt::WindowStates mLastReportedWindowStates = Qt::WindowNoState;
|
||||||
|
+ ToplevelWindowTilingStates mLastReportedToplevelWindowTilingStates = WindowNoState;
|
||||||
|
|
||||||
|
QWaylandShmBackingStore *mBackingStore = nullptr;
|
||||||
|
QWaylandBuffer *mQueuedBuffer = nullptr;
|
||||||
|
@@ -295,6 +309,8 @@ public slots:
|
||||||
|
friend class QWaylandSubSurface;
|
||||||
|
};
|
||||||
|
|
||||||
|
+Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandWindow::ToplevelWindowTilingStates)
|
||||||
|
+
|
||||||
|
inline QIcon QWaylandWindow::windowIcon() const
|
||||||
|
{
|
||||||
|
return mWindowIcon;
|
||||||
|
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
|
||||||
|
index 965bc261d..5d9a21f81 100644
|
||||||
|
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
|
||||||
|
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
|
||||||
|
@@ -94,6 +94,7 @@ void QWaylandXdgSurface::Toplevel::applyConfigure()
|
||||||
|
// TODO: none of the other plugins send WindowActive either, but is it on purpose?
|
||||||
|
Qt::WindowStates statesWithoutActive = m_pending.states & ~Qt::WindowActive;
|
||||||
|
|
||||||
|
+ m_xdgSurface->m_window->handleToplevelWindowTilingStatesChanged(m_toplevelStates);
|
||||||
|
m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive);
|
||||||
|
|
||||||
|
if (m_pending.size.isEmpty()) {
|
||||||
|
@@ -126,6 +127,7 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t
|
||||||
|
size_t numStates = states->size / sizeof(uint32_t);
|
||||||
|
|
||||||
|
m_pending.states = Qt::WindowNoState;
|
||||||
|
+ m_toplevelStates = QWaylandWindow::WindowNoState;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < numStates; i++) {
|
||||||
|
switch (xdgStates[i]) {
|
||||||
|
@@ -138,6 +140,18 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t
|
||||||
|
case XDG_TOPLEVEL_STATE_FULLSCREEN:
|
||||||
|
m_pending.states |= Qt::WindowFullScreen;
|
||||||
|
break;
|
||||||
|
+ case XDG_TOPLEVEL_STATE_TILED_LEFT:
|
||||||
|
+ m_toplevelStates |= QWaylandWindow::WindowTiledLeft;
|
||||||
|
+ break;
|
||||||
|
+ case XDG_TOPLEVEL_STATE_TILED_RIGHT:
|
||||||
|
+ m_toplevelStates |= QWaylandWindow::WindowTiledRight;
|
||||||
|
+ break;
|
||||||
|
+ case XDG_TOPLEVEL_STATE_TILED_TOP:
|
||||||
|
+ m_toplevelStates |= QWaylandWindow::WindowTiledTop;
|
||||||
|
+ break;
|
||||||
|
+ case XDG_TOPLEVEL_STATE_TILED_BOTTOM:
|
||||||
|
+ m_toplevelStates |= QWaylandWindow::WindowTiledBottom;
|
||||||
|
+ break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
@@ -469,7 +483,7 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial)
|
||||||
|
}
|
||||||
|
|
||||||
|
QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion)
|
||||||
|
- : QtWayland::xdg_wm_base(display->wl_registry(), id, qMin(availableVersion, 1u))
|
||||||
|
+ : QtWayland::xdg_wm_base(display->wl_registry(), id, qMin(availableVersion, 2u))
|
||||||
|
, m_display(display)
|
||||||
|
{
|
||||||
|
display->addRegistryListener(&QWaylandXdgShell::handleRegistryGlobal, this);
|
||||||
|
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
|
||||||
|
index 5aeec2eb9..e3a90c547 100644
|
||||||
|
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
|
||||||
|
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
|
||||||
|
@@ -58,6 +58,7 @@
|
||||||
|
|
||||||
|
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||||
|
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
|
||||||
|
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
||||||
|
|
||||||
|
#include <QtCore/QSize>
|
||||||
|
#include <QtGui/QRegion>
|
||||||
|
@@ -69,7 +70,6 @@ class QWindow;
|
||||||
|
namespace QtWaylandClient {
|
||||||
|
|
||||||
|
class QWaylandDisplay;
|
||||||
|
-class QWaylandWindow;
|
||||||
|
class QWaylandInputDevice;
|
||||||
|
class QWaylandXdgShell;
|
||||||
|
|
||||||
|
@@ -125,6 +125,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface,
|
||||||
|
QSize size = {0, 0};
|
||||||
|
Qt::WindowStates states = Qt::WindowNoState;
|
||||||
|
} m_pending, m_applied;
|
||||||
|
+ QWaylandWindow::ToplevelWindowTilingStates m_toplevelStates = QWaylandWindow::WindowNoState;
|
||||||
|
QSize m_normalSize;
|
||||||
|
|
||||||
|
QWaylandXdgSurface *m_xdgSurface = nullptr;
|
Loading…
Reference in New Issue
Block a user