Sync with Fedora

Resolves: bz#2028778
This commit is contained in:
Jan Grulich 2021-12-08 11:19:32 +01:00
parent 7a35b70741
commit b398e27a3e
39 changed files with 641 additions and 148 deletions

View File

@ -1,7 +1,7 @@
From 30cb2a87fcc6265232cb5a3ffce9836da6e531d6 Mon Sep 17 00:00:00 2001
From: Jani Heikkinen <jani.heikkinen@qt.io>
Date: Tue, 27 Oct 2020 07:48:51 +0200
Subject: [PATCH 01/19] Bump version
Subject: [PATCH 01/36] Bump version
Change-Id: I6b2c26a9fea447f1de1d768a72aba72055a13cb7
---
@ -19,5 +19,5 @@ index f63b6641..bb8d0645 100644
-MODULE_VERSION = 5.15.2
+MODULE_VERSION = 5.15.3
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From f9d5fc2e94c2116130456f4b4f8bd2f3a0c88d20 Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@qt.io>
Date: Tue, 27 Oct 2020 16:12:30 +0100
Subject: [PATCH 02/19] Replace remaining LGPLv3 headers in QtWaylandCompositor
Subject: [PATCH 02/36] Replace remaining LGPLv3 headers in QtWaylandCompositor
with GPLv3
Use same header as for the rest of the module.
@ -968,5 +968,5 @@ index cd6bad57..16bb3354 100644
** $QT_END_LICENSE$
**
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From cc652bdd4ec7692a68db8afef2a709b74581c2cd Mon Sep 17 00:00:00 2001
From: Paul Wicking <paul.wicking@qt.io>
Date: Tue, 27 Oct 2020 14:56:32 +0100
Subject: [PATCH 03/19] Doc: List correct license information for the module
Subject: [PATCH 03/36] Doc: List correct license information for the module
Fixes: QTBUG-87959
Change-Id: I1c5cd15e0dd6f81e87690e54cd4e526ce668a8aa
@ -35,5 +35,5 @@ index dc95dc5b..fcdd13f7 100644
Qt Wayland Compositor and the Qt Wayland integration plugin
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 88c8df4eab81316bc055c8be82b0febc70330dbe Mon Sep 17 00:00:00 2001
From: Antti Kokko <antti.kokko@qt.io>
Date: Tue, 27 Oct 2020 10:02:11 +0200
Subject: [PATCH 04/19] Add changes file for Qt 5.15.2
Subject: [PATCH 04/36] Add changes file for Qt 5.15.2
+ 7d7ac7f0a4bd6a7956448ddb0ba44c12755dca2e Client: Send subsurface expose event when toplevel is configured
+ 18ab3edaf2a4cdd1e9df6e166cf51a69a9785ecd Client: Initialize mScale on creation instead of on show
@ -73,5 +73,5 @@ index 00000000..e12ac096
+ - [QTBUG-86176] We now send subsurface expose events when a different
+ toplevel (such as a dialog) is configured.
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
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 05/19] Scanner: Avoid accessing dangling pointers in
Subject: [PATCH 05/36] Scanner: Avoid accessing dangling pointers in
destroy_func()
Usually, the object associated with the resource gets destroyed in the
@ -34,5 +34,5 @@ index 1d635f06..e2f87bbd 100644
printf(" }\n");
printf(" delete resource;\n");
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From a825fb5f714fd79d16cc3ebbdd327e7961b07d0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@qt.io>
Date: Mon, 16 Nov 2020 19:37:33 +0100
Subject: [PATCH 06/19] Make setting QT_SCALE_FACTOR work on Wayland
Subject: [PATCH 06/36] Make setting QT_SCALE_FACTOR work on Wayland
Follow-up to 8cb1b07aea12d50b4fecc45c903705dfd368022a,
fixes one additional case (Use of minimum/maximum size).
@ -34,5 +34,5 @@ index bc031ed5..eb053406 100644
if (mSubSurfaceWindow) {
QMargins m = QPlatformWindow::parent()->frameMargins();
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 2c0a03e9aea13831d05ac03996949f888afd5085 Mon Sep 17 00:00:00 2001
From: Jaehak Lee <jaehak.lee@mobis.co.kr>
Date: Sun, 8 Nov 2020 11:40:06 +0900
Subject: [PATCH 07/19] Do not try to eglMakeCurrent for unintended case
Subject: [PATCH 07/36] Do not try to eglMakeCurrent for unintended case
The QSGThreadedRenderLoop::hide can be called at twice,
when the QWindowPrivate::setVisible(false) is called.
@ -58,5 +58,5 @@ index 46c7bb76..93edaec0 100644
}
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 10005185e06857ce119c50fe710f9eedde06ec5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@qt.io>
Date: Fri, 13 Nov 2020 11:21:50 +0100
Subject: [PATCH 08/19] Make setting QT_SCALE_FACTOR work on Wayland
Subject: [PATCH 08/36] Make setting QT_SCALE_FACTOR work on Wayland
QWindow geometry accessors return geometry in device
independent pixels. Normally this coordinate system
@ -108,5 +108,5 @@ index b6d23ac1..1c762944 100644
if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive))
m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window);
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From dba4bc4f1d6dfee9fe9433c55b15653d703bed4f Mon Sep 17 00:00:00 2001
From: Andreas Cord-Landwehr <cordlandwehr@kde.org>
Date: Wed, 2 Dec 2020 20:55:52 +0100
Subject: [PATCH 09/19] Ensure that grabbing is performed in correct context
Subject: [PATCH 09/36] Ensure that grabbing is performed in correct context
For multi-display rendering on EGL, it is mandatory that the grabbing of
the surface happens in the same EGL context as the surface belongs to.
@ -31,5 +31,5 @@ index 49f0860e..db1cf00f 100644
emit grabber->failed(QWaylandSurfaceGrabber::UnknownBufferType);
#endif
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From a8d35b3c18bdb05a0da3ed50a554a7b7bd4ebed3 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Date: Mon, 30 Nov 2020 13:13:18 +0100
Subject: [PATCH 10/19] Fix leaked subsurface wayland items
Subject: [PATCH 10/36] Fix leaked subsurface wayland items
Whenever a subsurface was added we would create a QWaylandQuickItem,
but this was never deleted. It is one-to-one with the surface, so it
@ -32,5 +32,5 @@ index 15f0195c..2218f43a 100644
bool success = QMetaObject::invokeMethod(d->subsurfaceHandler, "handleSubsurfaceAdded", Q_ARG(QWaylandSurface *, childSurface));
if (!success)
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 9ee2ea141adc7765f6c212e63839ef23a4494b30 Mon Sep 17 00:00:00 2001
From: Weng Xuetian <wengxt@gmail.com>
Date: Tue, 9 Mar 2021 10:43:59 -0800
Subject: [PATCH 11/19] Use qWarning and _exit() instead of qFatal for wayland
Subject: [PATCH 11/36] Use qWarning and _exit() instead of qFatal for wayland
error
This type of error is likely to happen upon system logout. qFatal would
@ -34,5 +34,5 @@ index fe094f6f..f10c1f79 100644
void QWaylandDisplay::flushRequests()
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 9df11e79b46c77d8c83f765b2a8e85b639fd55a2 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Date: Tue, 5 Jan 2021 09:08:50 +0100
Subject: [PATCH 12/19] Fix memory leak in QWaylandGLContext
Subject: [PATCH 12/36] Fix memory leak in QWaylandGLContext
We were leaking an EGL context with every GL context created,
which lead to rapid OOM errors in stress tests.
@ -34,5 +34,5 @@ index 681f82f4..befadedc 100644
bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 7db4f83c39d2a0c709bc0b9c0de3946d3b4ebfd5 Mon Sep 17 00:00:00 2001
From: David Edmundson <davidedmundson@kde.org>
Date: Mon, 16 Nov 2020 14:57:36 +0000
Subject: [PATCH 13/19] Client: Send set_window_geometry only once configured
Subject: [PATCH 13/36] 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.
@ -37,5 +37,5 @@ index 9b343702..e875af3a 100644
if (isOpaque() && mMask.isEmpty())
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From a3e3ac1c86a956b25b1dc24f14518b6e6c96bcfc Mon Sep 17 00:00:00 2001
From: Jan Grulich <jgrulich@redhat.com>
Date: Wed, 10 Feb 2021 17:11:27 +0100
Subject: [PATCH 14/19] Translate opaque area with frame margins
Subject: [PATCH 14/36] Translate opaque area with frame margins
The opaque area doesn't take window decorations into account, which may
result into possible graphical artefacts.
@ -36,5 +36,5 @@ index e875af3a..2af39977 100644
wl_region_destroy(region);
}
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 2073ff99e62d4f99ed3f1f45559c5b68a61c5f66 Mon Sep 17 00:00:00 2001
From: David Edmundson <davidedmundson@kde.org>
Date: Mon, 14 Sep 2020 17:08:39 +0100
Subject: [PATCH 15/19] Client: Send exposeEvent to parent on subsurface
Subject: [PATCH 15/36] Client: Send exposeEvent to parent on subsurface
position changes
When a subsurface is moved, we need the parent window to commit to apply
@ -93,5 +93,5 @@ index b8a65f15..95e4e609 100644
// Used to cause a crash in libwayland (QTBUG-79674)
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 6810b0f66a34056bfe0da7299d7a768e700e58f5 Mon Sep 17 00:00:00 2001
From: Jan Grulich <jgrulich@redhat.com>
Date: Thu, 11 Feb 2021 15:12:32 +0100
Subject: [PATCH 16/19] Get correct decoration margins region
Subject: [PATCH 16/36] 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
@ -35,5 +35,5 @@ index 87dd6cea..b6ee43c9 100644
}
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From cea69b8adec1e61adc1fa04cbf46b77c0d72c75e Mon Sep 17 00:00:00 2001
From: Aleix Pol <aleixpol@kde.org>
Date: Mon, 23 Nov 2020 20:07:02 +0100
Subject: [PATCH 17/19] xdgshell: Tell the compositor the screen we're
Subject: [PATCH 17/36] xdgshell: Tell the compositor the screen we're
expecting to fill
The xdgshell protocol allows us to tell the output to fill. This makes
@ -37,5 +37,5 @@ index 1c762944..3a1569f7 100644
}
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 2f84a874da064069461284db1da36dc818949ec1 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Sat, 10 Apr 2021 12:10:16 +0200
Subject: [PATCH 18/19] Fix compilation
Subject: [PATCH 18/36] Fix compilation
9df11e79b46c77d8c83f765b2a8e85b639fd55a2 can't be backported 1:1
---
@ -22,5 +22,5 @@ index befadedc..95d1049c 100644
bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 91c48320633e493b4cd519e5d73b836a878b2b77 Mon Sep 17 00:00:00 2001
From: Aleix Pol <aleixpol@kde.org>
Date: Wed, 10 Mar 2021 01:09:13 +0100
Subject: [PATCH 19/19] client: Allow QWaylandInputContext to accept composed
Subject: [PATCH 19/36] client: Allow QWaylandInputContext to accept composed
key combinations
At the moment, we are forcing user to choose to either compose or use
@ -253,5 +253,5 @@ index 7ad8e05e..c53ccb78 100644
}
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From d5186701e27ad6f09f3944809cec2a25c5328026 Mon Sep 17 00:00:00 2001
From: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Date: Wed, 5 May 2021 20:49:26 +0300
Subject: [PATCH 20/30] Client: Announce an output after receiving more
Subject: [PATCH 20/36] Client: Announce an output after receiving more
complete state
Output initialization is not atomic, meaning that the compositor may
@ -142,5 +142,5 @@ index df1c94f2..050cfdc0 100644
#if QT_CONFIG(cursor)
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 62494312db0f58053d1342bfacc7984186fdf3a6 Mon Sep 17 00:00:00 2001
From: Jaeyoon Jung <jaeyoon.jung@lge.com>
Date: Mon, 15 Feb 2021 08:31:06 +0900
Subject: [PATCH 21/30] Fix issue with repeated window size changes
Subject: [PATCH 21/36] Fix issue with repeated window size changes
Check if the new window size is different from the size requested
previously before calling wl_egl_window_resize. It addresses the issue
@ -54,5 +54,5 @@ index 5b1f4d56..0079dfef 100644
}
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 1ccebbab3a42690a0812e2c4c76016799bf6cf1f Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <albert.astals.cid@kdab.com>
Date: Mon, 10 May 2021 14:38:49 +0200
Subject: [PATCH 22/30] Include locale.h for setlocale/LC_CTYPE
Subject: [PATCH 22/36] Include locale.h for setlocale/LC_CTYPE
Pick-to: 5.15
Change-Id: Iced32a31a63cec71008549c1e0961d59ffc45a37
@ -27,5 +27,5 @@ index ef5aa375..503fd735 100644
Q_LOGGING_CATEGORY(qLcQpaInputMethods, "qt.qpa.input.methods")
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From fcc2f57cefa66339c8cb6632f45a47fbb99bb60d Mon Sep 17 00:00:00 2001
From: David Edmundson <davidedmundson@kde.org>
Date: Tue, 9 Feb 2021 16:09:21 +0000
Subject: [PATCH 23/30] Client: Connect drags being accepted to updating the
Subject: [PATCH 23/36] Client: Connect drags being accepted to updating the
source drag icon
Currently in a multi-process drag and drop when the other client accepts
@ -35,5 +35,5 @@ index 19944a34..54a69c3c 100644
start_drag(m_dragSource->object(), origin->wlSurface(), icon->wlSurface(), m_display->currentInputDevice()->serial());
return true;
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 1b5e43a593e917610e6245f7a272ac081c508ba4 Mon Sep 17 00:00:00 2001
From: David Edmundson <davidedmundson@kde.org>
Date: Fri, 14 May 2021 13:23:24 +0100
Subject: [PATCH 24/30] Client: Disconnect registry listener on destruction
Subject: [PATCH 24/36] Client: Disconnect registry listener on destruction
If a display outlives a QWaylandClientExtension and a new global is
announced we end up delivering an event to a now deleted extension which
@ -45,5 +45,5 @@ index 98272e57..5bd28398 100644
QtWaylandClient::QWaylandIntegration *integration() const;
int version() const;
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 36a552fa530be57091e986ebd1468d75d3061743 Mon Sep 17 00:00:00 2001
From: David Edmundson <davidedmundson@kde.org>
Date: Mon, 3 May 2021 23:01:53 +0100
Subject: [PATCH 25/30] Client: Set XdgShell size hints before the first commit
Subject: [PATCH 25/36] Client: Set XdgShell size hints before the first commit
propagateSizeHints is only called in QWindow we have platform window and
minimumSizeHint is then sent. We also need to send existing hints when
@ -54,5 +54,5 @@ index 2277bbb8..2fdd0a7c 100644
QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.minSize, QSize(100, 100));
QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_committed.maxSize, QSize(1000, 1000));
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From a8ddf1a7296e2d28b36231a391807226a7329ae4 Mon Sep 17 00:00:00 2001
From: David Edmundson <davidedmundson@kde.org>
Date: Mon, 14 Jun 2021 12:45:37 +0100
Subject: [PATCH 26/30] Fix build
Subject: [PATCH 26/36] Fix build
1b5e43a593e917610e6245f7a272ac081c508ba4 relied on a patch that we can't
backport.
@ -42,5 +42,5 @@ index 69cc46a0..9091efbe 100644
class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtensionTemplatePrivate : public QWaylandClientExtensionPrivate
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From d1c4a459faa1d514026c4834828cb33024ac2ceb Mon Sep 17 00:00:00 2001
From: Zhang Liang <zhanglianga@uniontech.com>
Date: Mon, 1 Feb 2021 19:29:43 +0800
Subject: [PATCH 27/30] Fix: remove listener
Subject: [PATCH 27/36] Fix: remove listener
Add the operation for removing the listener form listener list
@ -29,5 +29,5 @@ index f10c1f79..e0dfe8b2 100644
uint32_t QWaylandDisplay::currentTimeMillisec()
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From a6476d1a1c78eb7f17408241b268404e27b3e161 Mon Sep 17 00:00:00 2001
From: David Redondo <qt@david-redondo.de>
Date: Wed, 26 May 2021 14:49:40 +0200
Subject: [PATCH 28/30] Hook up queryKeyboardModifers
Subject: [PATCH 28/36] Hook up queryKeyboardModifers
Can be useful when upon enter a modifiers event is received but no key
event so no QKeyEvent is generated.
@ -51,5 +51,5 @@ index ff70ae25..73b80658 100644
QStringList themeNames() const override;
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From d4c41797b61a5a8da47c5821711aca72e756dcbf Mon Sep 17 00:00:00 2001
From: Aleix Pol <aleixpol@kde.org>
Date: Tue, 13 Jul 2021 13:32:15 +0200
Subject: [PATCH 29/30] Do not update the mask if we do not have a surface
Subject: [PATCH 29/36] Do not update the mask if we do not have a surface
mMask serves as a cache to remember what we've sent, the source of truth
for the value is window()->mask().
@ -40,5 +40,5 @@ index e96d8fe9..bd70f4af 100644
mSurface->set_input_region(nullptr);
--
2.31.1
2.33.1

View File

@ -1,7 +1,7 @@
From 3c420cd180397e3f42c8a436a7f1b11465925bdd Mon Sep 17 00:00:00 2001
From: Jan Blackquill <uhhadd@gmail.com>
Date: Tue, 24 Aug 2021 14:36:34 -0400
Subject: [PATCH 30/30] Correctly detect if image format is supported by
Subject: [PATCH 30/36] Correctly detect if image format is supported by
QImageWriter
The code queries potential image formats by stripping a mimetype of its
@ -64,5 +64,5 @@ index a5fdd34d..051a91dc 100644
fmt = imgFmt;
}
--
2.31.1
2.33.1

View File

@ -0,0 +1,31 @@
From 1c53ba6dfebbf1d6e87c9ad1f2bbda94e3d45bf7 Mon Sep 17 00:00:00 2001
From: Paul Olav Tvete <paul.tvete@qt.io>
Date: Tue, 14 Sep 2021 11:56:23 +0200
Subject: [PATCH 31/36] Wayland client: Fix crash when windows are shown/hidden
during drag
Fixes: QTBUG-87624
Pick-to: 6.2 5.15
Change-Id: I1b9443df091878abcd4fbe9c55927cb819aebd59
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit c64c5d3849b40617e1de0295f8690f354cab2b3a)
---
src/client/qwaylanddatadevice.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp
index 54a69c3c..bbd2d568 100644
--- a/src/client/qwaylanddatadevice.cpp
+++ b/src/client/qwaylanddatadevice.cpp
@@ -169,7 +169,7 @@ void QWaylandDataDevice::data_device_drop()
void QWaylandDataDevice::data_device_enter(uint32_t serial, wl_surface *surface, wl_fixed_t x, wl_fixed_t y, wl_data_offer *id)
{
- auto *dragWaylandWindow = QWaylandWindow::fromWlSurface(surface);
+ auto *dragWaylandWindow = surface ? QWaylandWindow::fromWlSurface(surface) : nullptr;
if (!dragWaylandWindow)
return; // Ignore foreign surfaces
--
2.33.1

View File

@ -0,0 +1,77 @@
From 3be586cd8b6c8313cb6b8b7d61be17706f79590e Mon Sep 17 00:00:00 2001
From: Georges Basile Stavracas Neto <gbsneto@gnome.org>
Date: Thu, 27 May 2021 19:55:04 -0300
Subject: [PATCH 32/36] Client: Don't always recreate frame callbacks
The main QWaylandWindow method that is executed when handling updates is
QWaylandWindow::handleUpdate(). This method always, unconditionally queues
a frame callback, regardless of whether any other one is already queued.
On some circumstances, e.g. when a window is hidden or completely obscured
by other windows, it stops receiving frame callbacks from the compositor.
However, QWaylandWindow would continue to request for them, which eventually
fills up the Wayland socket, and causes the application to crash.
This can be avoided by checking if the platform window is already waiting
for a frame callback, before queueing another one.
In QWaylandWindow::handleUpdate(), check if mWaitingForFrameCallback is true
before queueing frame callbacks, and early return if that's the case.
The XDG-shell test needed to be updated for this: The mock compositor is
not responding to any frame callbacks, so the window will be unexposed,
no longer get paint events and therefore not trigger any commit. This
worked by accident before because we were issuing updates quickly enough
to reset the timer before it had a chance to unexpose the window. The
easiest fix is just to disable the dependency on frame callbacks in
this test, since that is clearly not what it's testing.
Task-number: QTBUG-81504
Change-Id: Ieacb05c7d5a5fcf662243d9177ebcc308cb9ca84
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Georges Basile Stavracas Neto <gbsneto@gnome.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit cbc74ba6d7186457d8d07183272e952dee5f34f9)
---
src/client/qwaylandwindow.cpp | 4 ++++
tests/auto/client/xdgshell/tst_xdgshell.cpp | 2 ++
2 files changed, 6 insertions(+)
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index bd70f4af..85307875 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -1170,6 +1170,10 @@ void QWaylandWindow::requestUpdate()
void QWaylandWindow::handleUpdate()
{
qCDebug(lcWaylandBackingstore) << "handleUpdate" << QThread::currentThread();
+
+ if (mWaitingForFrameCallback)
+ return;
+
// TODO: Should sync subsurfaces avoid requesting frame callbacks?
QReadLocker lock(&mSurfaceLock);
if (!mSurface)
diff --git a/tests/auto/client/xdgshell/tst_xdgshell.cpp b/tests/auto/client/xdgshell/tst_xdgshell.cpp
index 2fdd0a7c..e2593314 100644
--- a/tests/auto/client/xdgshell/tst_xdgshell.cpp
+++ b/tests/auto/client/xdgshell/tst_xdgshell.cpp
@@ -138,6 +138,7 @@ void tst_xdgshell::configureSize()
void tst_xdgshell::configureStates()
{
+ QVERIFY(qputenv("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT", "0"));
QRasterWindow window;
window.resize(64, 48);
window.show();
@@ -186,6 +187,7 @@ void tst_xdgshell::configureStates()
QCOMPARE(window.windowStates(), Qt::WindowNoState);
QCOMPARE(window.frameGeometry().size(), windowedSize);
// QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled
+ QVERIFY(qunsetenv("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT"));
}
void tst_xdgshell::popup()
--
2.33.1

View File

@ -0,0 +1,58 @@
From efe6edcaf8eba601dff99ec6ad4457c8a4442f86 Mon Sep 17 00:00:00 2001
From: Georges Basile Stavracas Neto <gbsneto@gnome.org>
Date: Thu, 27 May 2021 20:02:53 -0300
Subject: [PATCH 33/36] Client: Always destroy frame callback in the actual
callback
It's good hygiene to destroy all frame callbacks. Destroy the
frame callback and cleanup the mFrameCallback class member in
the callback itself. The callback destruction happens before
calling handleFrameCallback() to avoid the theoretical case
where another frame callback is queued by handleFrameCallback(),
and then immediately destroyed in the callback handler.
* asturmlechner 2021-09-27:
Conflict resolved from non-backported commit in dev branch:
93058de8d7e7c2f320c22b3bd898aa06cf5babcd
Change-Id: Ide6dc95e3402932c58bfc088a9d471fda821e9a1
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 42cdc61a93cf2acb09936aebb5e431fdbc0a26c6)
---
src/client/qwaylandwindow.cpp | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 85307875..c020a58f 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -622,9 +622,13 @@ void QWaylandWindow::commit()
const wl_callback_listener QWaylandWindow::callbackListener = {
[](void *data, wl_callback *callback, uint32_t time) {
- Q_UNUSED(callback);
Q_UNUSED(time);
auto *window = static_cast<QWaylandWindow*>(data);
+
+ Q_ASSERT(callback == window->mFrameCallback);
+ wl_callback_destroy(callback);
+ window->mFrameCallback = nullptr;
+
window->handleFrameCallback();
}
};
@@ -1179,11 +1183,6 @@ void QWaylandWindow::handleUpdate()
if (!mSurface)
return;
- if (mFrameCallback) {
- wl_callback_destroy(mFrameCallback);
- mFrameCallback = nullptr;
- }
-
QMutexLocker locker(mFrameQueue.mutex);
struct ::wl_surface *wrappedSurface = reinterpret_cast<struct ::wl_surface *>(wl_proxy_create_wrapper(mSurface->object()));
wl_proxy_set_queue(reinterpret_cast<wl_proxy *>(wrappedSurface), mFrameQueue.queue);
--
2.33.1

View File

@ -0,0 +1,40 @@
From 02f9585ca19c17ae0978b864195533dc527d825e Mon Sep 17 00:00:00 2001
From: Rodney Dawes <dobey.pwns@gmail.com>
Date: Fri, 15 Oct 2021 12:55:33 -0400
Subject: [PATCH 34/36] Fix the logic for decoding modifiers map in Wayland
text input protocol
Correctly check for the flags in the modifiers map when we get it from
the compositor, instead of modifying the map in the for loop conditional.
[ChangeLog][QWaylandInputContext] Fix modifiers map decoding
logic when receiving the map from the compositor.
Fixes: QTBUG-97094
Pick-to: 6.2 5.15 5.12
Change-Id: Idad19f7b1f4560d40abbb5b31032360cfe915261
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
---
src/client/qwaylandinputcontext.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/client/qwaylandinputcontext.cpp b/src/client/qwaylandinputcontext.cpp
index 503fd735..e290baa2 100644
--- a/src/client/qwaylandinputcontext.cpp
+++ b/src/client/qwaylandinputcontext.cpp
@@ -387,8 +387,10 @@ void QWaylandTextInput::zwp_text_input_v2_input_method_changed(uint32_t serial,
Qt::KeyboardModifiers QWaylandTextInput::modifiersToQtModifiers(uint32_t modifiers)
{
Qt::KeyboardModifiers ret = Qt::NoModifier;
- for (int i = 0; modifiers >>= 1; ++i) {
- ret |= m_modifiersMap[i];
+ for (int i = 0; i < m_modifiersMap.size(); ++i) {
+ if (modifiers & (1 << i)) {
+ ret |= m_modifiersMap[i];
+ }
}
return ret;
}
--
2.33.1

View File

@ -1,7 +1,8 @@
From cc54267e93851f067aba51cae015ca8fc3147c11 Mon Sep 17 00:00:00 2001
From: Méven Car <meven.car@enioka.com>
From 5c180bdc1042e7cb1555e188051f09e219b00ec9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=C3=A9ven=20Car?= <meven.car@enioka.com>
Date: Wed, 18 Aug 2021 18:28:20 +0200
Subject: [PATCH] Wayland client: use wl_keyboard to determine active state
Subject: [PATCH 35/36] Wayland client: use wl_keyboard to determine active
state
Commit f497a5bb87270174b8e0106b7eca1992d44ff15d made QWaylandDisplay
use the xdgshell's active state for QWindow::isActive(), instead of
@ -24,17 +25,34 @@ We are still exposing it for decorations, which is the only reason to
use the Xdghint over keyboard focus - so you can keep the toplevel
active whilst you show a popup.
cherry-pick 40036a1b80e5234e6db7d5cbeff122aa7ee13e20
Change-Id: I4343d2ed9fb5b066cde95628ed0b4ccc84a424db
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
---
src/client/qwaylanddisplay.cpp | 19 +++++++++++--------
src/client/qwaylanddisplay_p.h | 1 +
src/client/qwaylandwindow.cpp | 13 +++++++++++--
src/client/qwaylandwindow_p.h | 1 +
.../qwaylandshellintegration_p.h | 7 +++----
.../qwaylandxdgshellv5integration.cpp | 7 -------
.../qwaylandxdgshellv5integration_p.h | 1 -
.../qwaylandxdgshellv6integration.cpp | 14 --------------
.../qwaylandxdgshellv6integration_p.h | 1 -
.../xdg-shell/qwaylandxdgshell.cpp | 16 +++++-----------
.../xdg-shell/qwaylandxdgshellintegration.cpp | 14 --------------
.../xdg-shell/qwaylandxdgshellintegration_p.h | 1 -
tests/auto/client/xdgshell/tst_xdgshell.cpp | 10 +++++++---
13 files changed, 39 insertions(+), 66 deletions(-)
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index e0dfe8b..2730311 100644
index e0dfe8b2..27303110 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -575,14 +575,10 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic
if (mLastKeyboardFocus == keyboardFocus)
return;
- if (mWaylandIntegration->mShellIntegration) {
- mWaylandIntegration->mShellIntegration->handleKeyboardFocusChanged(keyboardFocus, mLastKeyboardFocus);
- } else {
@ -47,13 +65,13 @@ index e0dfe8b..2730311 100644
+ handleWindowActivated(keyboardFocus);
+ if (mLastKeyboardFocus)
+ handleWindowDeactivated(mLastKeyboardFocus);
mLastKeyboardFocus = keyboardFocus;
}
@@ -627,6 +623,13 @@ QWaylandInputDevice *QWaylandDisplay::defaultInputDevice() const
return mInputDevices.isEmpty() ? 0 : mInputDevices.first();
}
+bool QWaylandDisplay::isKeyboardAvailable() const
+{
+ return std::any_of(
@ -62,22 +80,22 @@ index e0dfe8b..2730311 100644
+}
+
#if QT_CONFIG(cursor)
QWaylandCursor *QWaylandDisplay::waylandCursor()
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index 3b092bc..09a1736 100644
index 3b092bc8..09a1736a 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -215,6 +215,7 @@ public:
void destroyFrameQueue(const FrameQueue &q);
void dispatchQueueWhile(wl_event_queue *queue, std::function<bool()> condition, int timeout = -1);
+ bool isKeyboardAvailable() const;
public slots:
void blockingReadEvents();
void flushRequests();
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index e0b91dd..8d56be1 100644
index c020a58f..ba881cb3 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -96,7 +96,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display)
@ -85,19 +103,27 @@ index e0b91dd..8d56be1 100644
{
mDisplay->destroyFrameQueue(mFrameQueue);
- mDisplay->handleWindowDestroyed(this);
delete mWindowDecoration;
@@ -266,6 +265,8 @@ void QWaylandWindow::reset()
mMask = QRegion();
mQueuedBuffer = nullptr;
+
+ mDisplay->handleWindowDestroyed(this);
}
QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface)
@@ -1097,7 +1098,10 @@ Qt::WindowStates QWaylandWindow::windowStates() const
@@ -1083,10 +1084,18 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab)
return true;
}
+Qt::WindowStates QWaylandWindow::windowStates() const
+{
+ return mLastReportedWindowStates;
+}
+
void QWaylandWindow::handleWindowStatesChanged(Qt::WindowStates states)
{
createDecoration();
@ -108,32 +134,46 @@ index e0b91dd..8d56be1 100644
+ lastStatesWithoutActive);
mLastReportedWindowStates = states;
}
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
index 6cc1664b..e0687962 100644
--- a/src/client/qwaylandwindow_p.h
+++ b/src/client/qwaylandwindow_p.h
@@ -148,6 +148,7 @@ public:
void setWindowState(Qt::WindowStates states) override;
void setWindowFlags(Qt::WindowFlags flags) override;
void handleWindowStatesChanged(Qt::WindowStates states);
+ Qt::WindowStates windowStates() const;
void raise() override;
void lower() override;
diff --git a/src/client/shellintegration/qwaylandshellintegration_p.h b/src/client/shellintegration/qwaylandshellintegration_p.h
index ccad004..b308ffe 100644
index ccad0048..4cc9b3b8 100644
--- a/src/client/shellintegration/qwaylandshellintegration_p.h
+++ b/src/client/shellintegration/qwaylandshellintegration_p.h
@@ -73,12 +73,6 @@ public:
@@ -73,11 +73,10 @@ public:
return true;
}
virtual QWaylandShellSurface *createShellSurface(QWaylandWindow *window) = 0;
- virtual void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) {
+ // kept for binary compat with layer-shell-qt
virtual void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) {
- if (newFocus)
- m_display->handleWindowActivated(newFocus);
- if (oldFocus)
- m_display->handleWindowDeactivated(oldFocus);
- }
+ Q_UNUSED(newFocus);
+ Q_UNUSED(oldFocus);
}
virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) {
Q_UNUSED(resource);
Q_UNUSED(window);
diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp
index 4e25949..cfc6093 100644
index 4e25949f..cfc60939 100644
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp
+++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp
@@ -85,13 +85,6 @@ QWaylandShellSurface *QWaylandXdgShellV5Integration::createShellSurface(QWayland
return m_xdgShell->createXdgSurface(window);
}
-void QWaylandXdgShellV5Integration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) {
- if (newFocus && qobject_cast<QWaylandXdgPopupV5 *>(newFocus->shellSurface()))
- m_display->handleWindowActivated(newFocus);
@ -142,10 +182,10 @@ index 4e25949..cfc6093 100644
-}
-
}
QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h
index ce6bdb9..aed8867 100644
index ce6bdb9e..aed88670 100644
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h
+++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration_p.h
@@ -67,7 +67,6 @@ public:
@ -153,17 +193,17 @@ index ce6bdb9..aed8867 100644
bool initialize(QWaylandDisplay *display) override;
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
- void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override;
private:
QScopedPointer<QWaylandXdgShellV5> m_xdgShell;
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp
index 0316431..e8da8ba 100644
index 03164316..e8da8ba1 100644
--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp
+++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration.cpp
@@ -68,20 +68,6 @@ QWaylandShellSurface *QWaylandXdgShellV6Integration::createShellSurface(QWayland
return m_xdgShell->getXdgSurface(window);
}
-void QWaylandXdgShellV6Integration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus)
-{
- if (newFocus) {
@ -179,10 +219,10 @@ index 0316431..e8da8ba 100644
-}
-
}
QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h
index 261f8cb..c1bcd5c 100644
index 261f8cbb..c1bcd5c6 100644
--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h
+++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6integration_p.h
@@ -65,7 +65,6 @@ public:
@ -190,15 +230,15 @@ index 261f8cb..c1bcd5c 100644
bool initialize(QWaylandDisplay *display) override;
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
- void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override;
private:
QScopedPointer<QWaylandXdgShellV6> m_xdgShell;
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index cf7eb4e..2c6e84b 100644
index 7d33dabd..d7d0ddf7 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -67,11 +67,6 @@ QWaylandXdgSurface::Toplevel::Toplevel(QWaylandXdgSurface *xdgSurface)
QWaylandXdgSurface::Toplevel::~Toplevel()
{
- if (m_applied.states & Qt::WindowActive) {
@ -209,37 +249,36 @@ index cf7eb4e..2c6e84b 100644
// The protocol spec requires that the decoration object is deleted before xdg_toplevel.
delete m_decoration;
m_decoration = nullptr;
@@ -85,17 +80,16 @@ void QWaylandXdgSurface::Toplevel::applyConfigure()
@@ -85,16 +80,15 @@ void QWaylandXdgSurface::Toplevel::applyConfigure()
if (!(m_applied.states & (Qt::WindowMaximized|Qt::WindowFullScreen)))
m_normalSize = m_xdgSurface->m_window->windowFrameGeometry().size();
- if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive))
+ if ((m_pending.states & Qt::WindowActive) && !(m_applied.states & Qt::WindowActive)
+ && !m_xdgSurface->m_window->display()->isKeyboardAvailable())
m_xdgSurface->m_window->display()->handleWindowActivated(m_xdgSurface->m_window);
- if (!(m_pending.states & Qt::WindowActive) && (m_applied.states & Qt::WindowActive))
+ if (!(m_pending.states & Qt::WindowActive) && (m_applied.states & Qt::WindowActive)
+ && !m_xdgSurface->m_window->display()->isKeyboardAvailable())
m_xdgSurface->m_window->display()->handleWindowDeactivated(m_xdgSurface->m_window);
- // 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);
+ m_xdgSurface->m_window->handleWindowStatesChanged(m_pending.states);
if (m_pending.size.isEmpty()) {
// An empty size in the configure means it's up to the client to choose the size
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp
index 8769d97..da0dd6a 100644
index 8769d971..da0dd6a7 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp
@@ -69,20 +69,6 @@ QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWi
return m_xdgShell->getXdgSurface(window);
}
-void QWaylandXdgShellIntegration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus)
-{
- if (newFocus) {
@ -255,10 +294,10 @@ index 8769d97..da0dd6a 100644
-}
-
}
QT_END_NAMESPACE
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h
index b6caa6c..2f929f9 100644
index b6caa6c9..2f929f98 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration_p.h
@@ -65,7 +65,6 @@ public:
@ -266,11 +305,11 @@ index b6caa6c..2f929f9 100644
bool initialize(QWaylandDisplay *display) override;
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
- void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) override;
private:
QScopedPointer<QWaylandXdgShell> m_xdgShell;
diff --git a/tests/auto/client/xdgshell/tst_xdgshell.cpp b/tests/auto/client/xdgshell/tst_xdgshell.cpp
index 2fdd0a7..5346b6e 100644
index e2593314..73d1eb9c 100644
--- a/tests/auto/client/xdgshell/tst_xdgshell.cpp
+++ b/tests/auto/client/xdgshell/tst_xdgshell.cpp
@@ -31,6 +31,7 @@
@ -278,13 +317,13 @@ index 2fdd0a7..5346b6e 100644
#include <QtGui/qpa/qplatformnativeinterface.h>
#include <QtWaylandClient/private/wayland-wayland-client-protocol.h>
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
using namespace MockCompositor;
@@ -154,9 +155,12 @@ void tst_xdgshell::configureStates()
@@ -155,9 +156,12 @@ void tst_xdgshell::configureStates()
// Toplevel windows don't know their position on xdg-shell
// QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled
-// QEXPECT_FAIL("", "configure has already been acked, we shouldn't have to wait for isActive", Continue);
-// QVERIFY(window.isActive());
- QTRY_VERIFY(window.isActive()); // Just make sure it eventually get's set correctly
@ -294,6 +333,9 @@ index 2fdd0a7..5346b6e 100644
+ Q_ASSERT(waylandWindow);
+ QTRY_VERIFY(waylandWindow->windowStates().testFlag(
+ Qt::WindowActive)); // Just make sure it eventually get's set correctly
const QSize screenSize(640, 480);
const uint maximizedSerial = exec([=] {
--
2.33.1

View File

@ -1,7 +1,8 @@
From 5ac39d2d76735c5d1d28a16f7fbc8b28e39886dd Mon Sep 17 00:00:00 2001
From 992833ca741efe8f533c61abfaf129a1d8bfcfee Mon Sep 17 00:00:00 2001
From: Jan Grulich <jgrulich@redhat.com>
Date: Fri, 16 Jul 2021 13:00:03 +0200
Subject: [PATCH] Client: do not empty clipboard when a new popup/window is opened
Subject: [PATCH 36/36] Client: do not empty clipboard when a new popup/window
is opened
If we open a new popup or a window within the same app we have to avoid
invalidating selection offer when losing focus, because it's still the
@ -9,12 +10,18 @@ same client who has the focus and we might not get a new selection offer
by the compositor and therefore we would lose clipboard content.
Fixes: QTBUG-93474
Pick-to: 6.2 5.15
Change-Id: Ia2ef826c2967b1daf1cdeb085e8dae66d090dbcf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Cherry-pick: 1e57ebd501cfc2255300392cd4565cd034efeed8
---
src/client/qwaylanddisplay.cpp | 13 +++++++++++++
src/client/qwaylandinputdevice.cpp | 8 --------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 2730311..9f595af 100644
index 27303110..9f595af3 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -597,6 +597,19 @@ void QWaylandDisplay::handleWaylandSync()
@ -35,10 +42,10 @@ index 2730311..9f595af 100644
+ }
+ }
}
const wl_callback_listener QWaylandDisplay::syncCallbackListener = {
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
index ae045f4..514457e 100644
index ae045f4f..514457e9 100644
--- a/src/client/qwaylandinputdevice.cpp
+++ b/src/client/qwaylandinputdevice.cpp
@@ -1300,14 +1300,6 @@ void QWaylandInputDevice::Keyboard::handleFocusDestroyed()
@ -56,3 +63,6 @@ index ae045f4..514457e 100644
mParent->mQDisplay->handleKeyboardFocusChanged(mParent);
mRepeatTimer.stop();
}
--
2.33.1

View File

@ -5,7 +5,7 @@
Summary: Qt5 - Wayland platform support and QtCompositor module
Name: qt5-%{qt_module}
Version: 5.15.2
Release: 12%{?dist}
Release: 13%{?dist}
License: LGPLv3
Url: http://www.qt.io
@ -47,13 +47,16 @@ Patch27: 0027-Fix-remove-listener.patch
Patch28: 0028-Hook-up-queryKeyboardModifers.patch
Patch29: 0029-Do-not-update-the-mask-if-we-do-not-have-a-surface.patch
Patch30: 0030-Correctly-detect-if-image-format-is-supported-by-QIm.patch
Patch31: 0031-Wayland-client-Fix-crash-when-windows-are-shown-hidd.patch
Patch32: 0032-Client-Don-t-always-recreate-frame-callbacks.patch
Patch33: 0033-Client-Always-destroy-frame-callback-in-the-actual-c.patch
Patch34: 0034-Fix-the-logic-for-decoding-modifiers-map-in-Wayland-.patch
Patch35: 0035-Wayland-client-use-wl_keyboard-to-determine-active-s.patch
Patch36: 0036-Client-do-not-empty-clipboard-when-a-new-popup-windo.patch
Patch52: qtwayland-client-expose-toplevel-window-state.patch
# Upstreamable patches
# Qt6 patches
Patch60: qtwayland-client-use-wl-keyboard-to-determine-active-state.patch
Patch61: qtwayland-client-do-not-empty-clipboard-when-new-popup-or-window-is-opened.patch
# Disable for now, there is a Qt bug making this broken
# Patch52: qtwayland-decoration-support-backports-from-qt6.patch
Patch53: qtwayland-client-expose-toplevel-window-state.patch
# filter qml provides
%global __provides_exclude_from ^%{_qt5_archdatadir}/qml/.*\\.so$
@ -179,6 +182,10 @@ popd
%endif
%changelog
* Wed Dec 08 2021 Jan Grulich <jgrulich@redhat.com> - 5.15.2-13
- Sync with Fedora
Resolves: bz#2028778
* Thu Oct 14 2021 Jan Grulich <jgrulich@redhat.com> - 5.15.2-12
- Drop BR: tree
Resolves: bz#2014080

View File

@ -21,11 +21,11 @@ Reviewed-by: David Edmundson <davidedmundson@kde.org>
4 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index c35ccab15..65a914976 100644
index ba881cb..a1e891d 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -1107,6 +1107,21 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab)
return true;
@@ -1089,6 +1089,16 @@ Qt::WindowStates QWaylandWindow::windowStates() const
return mLastReportedWindowStates;
}
+QWaylandWindow::ToplevelWindowTilingStates QWaylandWindow::toplevelWindowTilingStates() const
@ -37,20 +37,15 @@ index c35ccab15..65a914976 100644
+{
+ 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
index e068796..f4e5d3d 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
};
@ -66,18 +61,17 @@ 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,9 @@ public:
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:
@@ -257,6 +269,7 @@ protected:
QRegion mMask;
QRegion mOpaqueArea;
Qt::WindowStates mLastReportedWindowStates = Qt::WindowNoState;
@ -85,7 +79,7 @@ index 5f134568b..1d743f4e4 100644
QWaylandShmBackingStore *mBackingStore = nullptr;
QWaylandBuffer *mQueuedBuffer = nullptr;
@@ -295,6 +309,8 @@ public slots:
@@ -293,6 +306,8 @@ private:
friend class QWaylandSubSurface;
};
@ -95,18 +89,18 @@ index 5f134568b..1d743f4e4 100644
{
return mWindowIcon;
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index 965bc261d..5d9a21f81 100644
index d7d0ddf..2c6e84b 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;
@@ -88,6 +88,7 @@ void QWaylandXdgSurface::Toplevel::applyConfigure()
&& !m_xdgSurface->m_window->display()->isKeyboardAvailable())
m_xdgSurface->m_window->display()->handleWindowDeactivated(m_xdgSurface->m_window);
+ m_xdgSurface->m_window->handleToplevelWindowTilingStatesChanged(m_toplevelStates);
m_xdgSurface->m_window->handleWindowStatesChanged(statesWithoutActive);
m_xdgSurface->m_window->handleWindowStatesChanged(m_pending.states);
if (m_pending.size.isEmpty()) {
@@ -126,6 +127,7 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t
@@ -120,6 +121,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;
@ -114,7 +108,7 @@ index 965bc261d..5d9a21f81 100644
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
@@ -132,6 +134,18 @@ void QWaylandXdgSurface::Toplevel::xdg_toplevel_configure(int32_t width, int32_t
case XDG_TOPLEVEL_STATE_FULLSCREEN:
m_pending.states |= Qt::WindowFullScreen;
break;
@ -133,7 +127,7 @@ index 965bc261d..5d9a21f81 100644
default:
break;
}
@@ -469,7 +483,7 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial)
@@ -451,7 +465,7 @@ void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial)
}
QWaylandXdgShell::QWaylandXdgShell(QWaylandDisplay *display, uint32_t id, uint32_t availableVersion)
@ -143,7 +137,7 @@ 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 0c98be3..d791213 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
@@ -58,6 +58,7 @@
@ -162,7 +156,7 @@ index 5aeec2eb9..e3a90c547 100644
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;

View File

@ -0,0 +1,234 @@
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 bd70f4af..0e819235 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -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;
+}
+
+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 6cc1664b..93ba0623 100644
--- a/src/client/qwaylandwindow_p.h
+++ b/src/client/qwaylandwindow_p.h
@@ -95,6 +95,15 @@ public:
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 @@ public:
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);
@@ -256,6 +269,7 @@ protected:
QRegion mMask;
QRegion mOpaqueArea;
Qt::WindowStates mLastReportedWindowStates = Qt::WindowNoState;
+ ToplevelWindowTilingStates mLastReportedToplevelWindowTilingStates = WindowNoState;
QWaylandShmBackingStore *mBackingStore = nullptr;
QWaylandBuffer *mQueuedBuffer = nullptr;
@@ -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 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
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;
}
@@ -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))
, 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 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;
@@ -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;