Client: include decoration fixes and improvements from Qt6

This commit is contained in:
Jan Grulich 2021-08-30 12:31:53 +02:00
parent 273f9d8a42
commit c3f01dc6b7
8 changed files with 116 additions and 321 deletions

View File

@ -3,7 +3,7 @@
Summary: Qt5 - Wayland platform support and QtCompositor module
Name: qt5-%{qt_module}
Version: 5.15.2
Release: 8%{?dist}
Release: 9%{?dist}
License: LGPLv3
Url: http://www.qt.io
@ -35,9 +35,8 @@ Patch17: 0017-xdgshell-Tell-the-compositor-the-screen-we-re-expect.patch
Patch18: 0018-Fix-compilation.patch
Patch19: 0019-client-Allow-QWaylandInputContext-to-accept-composed.patch
Patch51: qtwayland-fix-issue-with-repeated-window-size-changes.patch
Patch52: qtwayland-client-expose-toplevel-window-state.patch
Patch52: qtwayland-decoration-support-backports-from-qt6.patch
# Upstreamable patches
@ -148,6 +147,9 @@ popd
%changelog
* Mon Aug 30 2021 Jan Grulich <jgrulich@redhat.com> - 5.15.2-9
- Client: include decoration fixes and improvements from Qt6
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.15.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

View File

@ -1,33 +1,69 @@
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/qwaylandabstractdecoration_p.h b/src/client/qwaylandabstractdecoration_p.h
index 81c8e177..61cbde77 100644
--- a/src/client/qwaylandabstractdecoration_p.h
+++ b/src/client/qwaylandabstractdecoration_p.h
@@ -82,6 +82,12 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandAbstractDecoration : public QObject
Q_OBJECT
Q_DECLARE_PRIVATE(QWaylandAbstractDecoration)
public:
+ enum MarginsType {
+ Full,
+ ShadowsExcluded,
+ ShadowsOnly
+ };
+
QWaylandAbstractDecoration();
~QWaylandAbstractDecoration() override;
@@ -91,7 +97,8 @@ public:
void update();
bool isDirty() const;
- virtual QMargins margins() const = 0;
+ virtual QMargins margins(MarginsType marginsType = Full) const = 0;
+
QWindow *window() const;
const QImage &contentImage();
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index c35ccab15..65a914976 100644
index bd70f4af..0e819235 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -1107,6 +1107,21 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab)
@@ -380,6 +380,16 @@ void QWaylandWindow::setGeometry(const QRect &rect)
void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset)
{
QMargins margins = frameMargins();
+
+ // Exclude shadows from margins once they are excluded from window geometry
+ // 1) First resizeFromApplyConfigure() call will have sizeWithMargins equal to surfaceSize()
+ // which has full margins (shadows included).
+ // 2) Following resizeFromApplyConfigure() calls should have sizeWithMargins equal to
+ // windowContentGeometry() which excludes shadows, therefore in this case we have to
+ // exclude them too in order not to accidentally apply smaller size to the window.
+ if (mWindowDecoration && (sizeWithMargins != surfaceSize()))
+ margins = mWindowDecoration->margins(QWaylandAbstractDecoration::ShadowsExcluded);
+
int widthWithoutMargins = qMax(sizeWithMargins.width() - (margins.left() + margins.right()), 1);
int heightWithoutMargins = qMax(sizeWithMargins.height() - (margins.top() + margins.bottom()), 1);
QRect geometry(windowGeometry().topLeft(), QSize(widthWithoutMargins, heightWithoutMargins));
@@ -690,7 +700,12 @@ QSize QWaylandWindow::surfaceSize() const
*/
QRect QWaylandWindow::windowContentGeometry() const
{
- return QRect(QPoint(), surfaceSize());
+ QMargins shadowMargins;
+
+ if (mWindowDecoration)
+ shadowMargins = mWindowDecoration->margins(QWaylandAbstractDecoration::ShadowsOnly);
+
+ return QRect(QPoint(shadowMargins.left(), shadowMargins.top()), surfaceSize().shrunkBy(shadowMargins));
}
/*!
@@ -1079,6 +1094,21 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab)
return true;
}
+QWaylandWindow::ToplevelWindowTilingStates QWaylandWindow::toplevelWindowTilingStates() const
+{
+ return mLastReportedToplevelWindowTilingStates;
@ -47,13 +83,13 @@ index c35ccab15..65a914976 100644
{
createDecoration();
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
index 5f134568b..1d743f4e4 100644
index 6cc1664b..93ba0623 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
@@ -95,6 +95,15 @@ public:
Vulkan
};
+ enum ToplevelWindowTilingState {
+ WindowNoState = 0,
+ WindowTiledLeft = 1,
@ -65,11 +101,11 @@ index 5f134568b..1d743f4e4 100644
+
QWaylandWindow(QWindow *window, QWaylandDisplay *display);
~QWaylandWindow() override;
@@ -145,6 +154,10 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformW
@@ -145,6 +154,10 @@ public:
void handleContentOrientationChange(Qt::ScreenOrientation orientation) override;
void setOrientationMask(Qt::ScreenOrientations mask);
+ ToplevelWindowTilingStates toplevelWindowTilingStates() const;
+ void handleToplevelWindowTilingStatesChanged(ToplevelWindowTilingStates states);
+
@ -77,41 +113,67 @@ index 5f134568b..1d743f4e4 100644
void setWindowState(Qt::WindowStates states) override;
void setWindowFlags(Qt::WindowFlags flags) override;
void handleWindowStatesChanged(Qt::WindowStates states);
@@ -260,6 +273,7 @@ public slots:
@@ -256,6 +269,7 @@ protected:
QRegion mMask;
QRegion mOpaqueArea;
Qt::WindowStates mLastReportedWindowStates = Qt::WindowNoState;
+ ToplevelWindowTilingStates mLastReportedToplevelWindowTilingStates = WindowNoState;
QWaylandShmBackingStore *mBackingStore = nullptr;
QWaylandBuffer *mQueuedBuffer = nullptr;
@@ -295,6 +309,8 @@ public slots:
@@ -292,6 +306,8 @@ private:
friend class QWaylandSubSurface;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandWindow::ToplevelWindowTilingStates)
+
inline QIcon QWaylandWindow::windowIcon() const
{
return mWindowIcon;
diff --git a/src/plugins/decorations/bradient/main.cpp b/src/plugins/decorations/bradient/main.cpp
index e75fda3c..72dda67f 100644
--- a/src/plugins/decorations/bradient/main.cpp
+++ b/src/plugins/decorations/bradient/main.cpp
@@ -72,7 +72,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstra
public:
QWaylandBradientDecoration();
protected:
- QMargins margins() const override;
+ QMargins margins(MarginsType marginsType = Full) const override;
void paint(QPaintDevice *device) override;
bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) override;
bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) override;
@@ -129,8 +129,11 @@ QRectF QWaylandBradientDecoration::minimizeButtonRect() const
(margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH);
}
-QMargins QWaylandBradientDecoration::margins() const
+QMargins QWaylandBradientDecoration::margins(MarginsType marginsType) const
{
+ if (marginsType == ShadowsOnly)
+ return QMargins();
+
return QMargins(3, 30, 3, 3);
}
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index 965bc261d..5d9a21f81 100644
index 7d33dabd..cf7eb4e9 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
@ -133,9 +195,9 @@ index 965bc261d..5d9a21f81 100644
default:
break;
}
@@ -469,7 +483,7 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial)
@@ -457,7 +471,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))
@ -143,30 +205,30 @@ index 965bc261d..5d9a21f81 100644
{
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
index 0c98be35..d7912132 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,
@@ -123,6 +123,7 @@ private:
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;

View File

@ -1,33 +0,0 @@
From 14cf9f0e45c7617d787eba8d81bf9fd1cd66754b Mon Sep 17 00:00:00 2001
From: Jan Grulich <jgrulich@redhat.com>
Date: Thu, 11 Feb 2021 15:12:32 +0100
Subject: [PATCH] Get correct decoration margins region
Size we use to calculate margins region already contains size including
margins. This resulted into bigger region and not properly damaging
region we need to update.
Pick-to: 5.15
Change-Id: Id1b7f4cd2a7b894b82db09c5af2b2d1f1f43fa2a
---
diff --git a/src/client/qwaylandabstractdecoration.cpp b/src/client/qwaylandabstractdecoration.cpp
index 87dd6ce..b6ee43c 100644
--- a/src/client/qwaylandabstractdecoration.cpp
+++ b/src/client/qwaylandabstractdecoration.cpp
@@ -108,11 +108,11 @@
static QRegion marginsRegion(const QSize &size, const QMargins &margins)
{
QRegion r;
- const int widthWithMargins = margins.left() + size.width() + margins.right();
- r += QRect(0, 0, widthWithMargins, margins.top()); // top
- r += QRect(0, size.height()+margins.top(), widthWithMargins, margins.bottom()); //bottom
+
+ r += QRect(0, 0, size.width(), margins.top()); // top
+ r += QRect(0, size.height()-margins.bottom(), size.width(), margins.bottom()); //bottom
r += QRect(0, margins.top(), margins.left(), size.height()); //left
- r += QRect(size.width()+margins.left(), margins.top(), margins.right(), size.height()); // right
+ r += QRect(size.width()-margins.left(), margins.top(), margins.right(), size.height()-margins.top()); // right
return r;
}

View File

@ -1,32 +0,0 @@
From e5c272423d1bba2825086b82fd97499237a6fa4b Mon Sep 17 00:00:00 2001
From: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Date: Fri, 30 Oct 2020 16:55:30 +0200
Subject: [PATCH] Scanner: Avoid accessing dangling pointers in destroy_func()
Usually, the object associated with the resource gets destroyed in the
destroy_resource() function.
Therefore, we need to double-check that the object is still alive before
trying to reset its m_resource.
Change-Id: I26408228f58919db17eb29584a1cbd4a9427d25c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 735164b5c2a2637a8d53a8803a2401e4ef477ff0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
---
diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp
index 1d635f0..e2f87bb 100644
--- a/src/qtwaylandscanner/qtwaylandscanner.cpp
+++ b/src/qtwaylandscanner/qtwaylandscanner.cpp
@@ -814,7 +814,9 @@
printf(" if (Q_LIKELY(that)) {\n");
printf(" that->m_resource_map.remove(resource->client(), resource);\n");
printf(" that->%s_destroy_resource(resource);\n", interfaceNameStripped);
- printf(" if (that->m_resource == resource)\n");
+ printf("\n");
+ printf(" that = resource->%s_object;\n", interfaceNameStripped);
+ printf(" if (that && that->m_resource == resource)\n");
printf(" that->m_resource = nullptr;\n");
printf(" }\n");
printf(" delete resource;\n");

View File

@ -1,94 +0,0 @@
From b36a345d727eab37ee4ec4c2dc4674d5971c81d8 Mon Sep 17 00:00:00 2001
From: David Edmundson <davidedmundson@kde.org>
Date: Mon, 14 Sep 2020 17:08:39 +0100
Subject: [PATCH] Client: Send exposeEvent to parent on subsurface position
changes
When a subsurface is moved, we need the parent window to commit to apply
that move. Ideally we want this in sync with any potential rendering on
the parent window.
Currently the code calls requestUpdate() which acts more like a frame
callback; it will only do something if the main QWindow considers itself
dirty.
We want to force a repaint, which is semantically more similar to an
ExposeEvent.
Fixes: QTBUG-86177
Pick-to: 5.15
Change-Id: I30bdfa357beee860ce2b00a256eaea6d040dd55c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
---
src/client/qwaylandwindow.cpp | 7 ++++-
tests/auto/client/surface/tst_surface.cpp | 33 +++++++++++++++++++----
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 3e26384..3cf1326 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -339,7 +339,12 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect)
if (mSubSurfaceWindow) {
QMargins m = QPlatformWindow::parent()->frameMargins();
mSubSurfaceWindow->set_position(rect.x() + m.left(), rect.y() + m.top());
- mSubSurfaceWindow->parent()->window()->requestUpdate();
+
+ QWaylandWindow *parentWindow = mSubSurfaceWindow->parent();
+ if (parentWindow && parentWindow->isExposed()) {
+ QRect parentExposeGeometry(QPoint(), parentWindow->geometry().size());
+ parentWindow->sendExposeEvent(parentExposeGeometry);
+ }
}
}
diff --git a/tests/auto/client/surface/tst_surface.cpp b/tests/auto/client/surface/tst_surface.cpp
index b8a65f1..95e4e60 100644
--- a/tests/auto/client/surface/tst_surface.cpp
+++ b/tests/auto/client/surface/tst_surface.cpp
@@ -167,17 +167,40 @@ void tst_surface::negotiateShmFormat()
void tst_surface::createSubsurface()
{
QRasterWindow window;
- window.resize(64, 64);
- window.show();
- QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
- exec([=] { xdgToplevel()->sendCompleteConfigure(); });
- QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial);
+ window.setObjectName("main");
+ window.resize(200, 200);
QRasterWindow subWindow;
+ subWindow.setObjectName("subwindow");
subWindow.setParent(&window);
subWindow.resize(64, 64);
+
+ window.show();
subWindow.show();
+
QCOMPOSITOR_TRY_VERIFY(subSurface());
+ QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
+ exec([=] { xdgToplevel()->sendCompleteConfigure(); });
+ QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial);
+
+ const Surface *mainSurface = exec([=] {return surface(0);});
+ const Surface *childSurface = exec([=] {return surface(1);});
+ QSignalSpy mainSurfaceCommitSpy(mainSurface, &Surface::commit);
+ QSignalSpy childSurfaceCommitSpy(childSurface, &Surface::commit);
+
+ // Move subsurface. The parent should redraw and commit
+ subWindow.setGeometry(100, 100, 64, 64);
+ // the toplevel should commit to indicate the subsurface moved
+ QCOMPOSITOR_TRY_COMPARE(mainSurfaceCommitSpy.count(), 1);
+ mainSurfaceCommitSpy.clear();
+ childSurfaceCommitSpy.clear();
+
+ // Move and resize the subSurface. The parent should redraw and commit
+ // The child should also redraw
+ subWindow.setGeometry(50, 50, 80, 80);
+ QCOMPOSITOR_TRY_COMPARE(mainSurfaceCommitSpy.count(), 1);
+ QCOMPOSITOR_TRY_COMPARE(childSurfaceCommitSpy.count(), 1);
+
}
// Used to cause a crash in libwayland (QTBUG-79674)

View File

@ -1,38 +0,0 @@
From 2555663c9f59b93f5fcc5d3ead233bee280e36f8 Mon Sep 17 00:00:00 2001
From: David Edmundson <davidedmundson@kde.org>
Date: Mon, 16 Nov 2020 14:57:36 +0000
Subject: [PATCH] Client: Send set_window_geometry only once configured
The geometry only makes sense when a buffer exists, our currently send
value is somewhat meaningless, but till now harmless.
A specification clarification implies that it is an error if the
calculated effective window geometry is null, rather than just checking
the sent value. This is the case if set_window_geometry is sent before a
buffer is attached.
On our first configure call we enter resizeFromApplyConfigure which will
hit this path and send the initial state.
Pick-to: 5.15
Pick-to: 6.1
Pick-to: 6.0
Change-Id: Ib57ebe8b64210eae86e79dfdd6b5cb8a986b020b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
---
src/client/qwaylandwindow.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 3e26384..80e9ffc 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -362,7 +362,7 @@ void QWaylandWindow::setGeometry(const QRect &rect)
if (isExposed() && !mInResizeFromApplyConfigure && exposeGeometry != mLastExposeGeometry)
sendExposeEvent(exposeGeometry);
- if (mShellSurface)
+ if (mShellSurface && isExposed())
mShellSurface->setWindowGeometry(windowContentGeometry());
if (isOpaque() && mMask.isEmpty())

View File

@ -1,38 +0,0 @@
From f915e53eaa596654ee1b9726a4767a1cba11336f Mon Sep 17 00:00:00 2001
From: Aleix Pol <aleixpol@kde.org>
Date: Mon, 23 Nov 2020 20:07:02 +0100
Subject: [PATCH] xdgshell: Tell the compositor the screen we're expecting to
fill
The xdgshell protocol allows us to tell the output to fill. This makes
it possible to use fullscreen confidently on systems with multiple
screens knowing that our windows won't be overlapping one another by
calling setScreen accordingly before QWindow::showFullScreen.
Pick-to: 6.1 6.0 5.15
Change-Id: I757854c3698639472f3a25ef298ddcca031e1ed5
Reviewed-by: David Edmundson <davidedmundson@kde.org>
---
.../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index b7253de2b..af8bd9264 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -178,9 +178,12 @@ void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states)
}
if (changedStates & Qt::WindowFullScreen) {
- if (states & Qt::WindowFullScreen)
- set_fullscreen(nullptr);
- else
+ if (states & Qt::WindowFullScreen) {
+ auto screen = m_xdgSurface->window()->waylandScreen();
+ if (screen) {
+ set_fullscreen(screen->output());
+ }
+ } else
unset_fullscreen();
}

View File

@ -1,34 +0,0 @@
From 1e0862acdc2e6ccf77bf3a1436b877d3af5e5fe7 Mon Sep 17 00:00:00 2001
From: Jan Grulich <jgrulich@redhat.com>
Date: Wed, 10 Feb 2021 17:11:27 +0100
Subject: [PATCH] Translate opaque area with frame margins
The opaque area doesn't take window decorations into account, which may
result into possible graphical artefacts.
Pick-to: 5.15
Change-Id: I1606e8256e7e204dad927931eb1221b576e227fd
---
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 04c2dbd..b29edfa 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -1242,12 +1242,14 @@
void QWaylandWindow::setOpaqueArea(const QRegion &opaqueArea)
{
- if (opaqueArea == mOpaqueArea || !mSurface)
+ const QRegion translatedOpaqueArea = opaqueArea.translated(frameMargins().left(), frameMargins().top());
+
+ if (translatedOpaqueArea == mOpaqueArea || !mSurface)
return;
- mOpaqueArea = opaqueArea;
+ mOpaqueArea = translatedOpaqueArea;
- struct ::wl_region *region = mDisplay->createRegion(opaqueArea);
+ struct ::wl_region *region = mDisplay->createRegion(translatedOpaqueArea);
mSurface->set_opaque_region(region);
wl_region_destroy(region);
}