summaryrefslogtreecommitdiff
blob: bccc097a3b99ea29723340bda5d4afe6eb8b69ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
From d40d36057a0ee9fcb4badc7ff8b56844da79dfc8 Mon Sep 17 00:00:00 2001
From: David Edmundson <kde@davidedmundson.co.uk>
Date: Wed, 12 Jan 2022 22:21:34 +0000
Subject: [PATCH] Always sync the setPanelBehavior to wayland

Currently this code is in the else statement to if (type !=
Dialog::Normal) {

This doesn't make sense as panel roles apply explicitly to other types,
like Dialog::Dock. On X11 the equivalent always applies.

BUG: 426969

* asturm 2022-01-22: Merged with below fixup:

From b882b34d7b55975f679133ef86cfd12869e8bba5 Mon Sep 17 00:00:00 2001
From: David Edmundson <kde@davidedmundson.co.uk>
Date: Thu, 13 Jan 2022 17:03:38 +0000
Subject: [PATCH] Always sync the setPanelBehavior to wayland

The previous patch moved some code that reapplied setRole in a way that
caused issues.

BUG: 448373

--- a/src/plasmaquick/dialog.cpp
+++ b/src/plasmaquick/dialog.cpp
@@ -693,14 +693,13 @@
 
 void DialogPrivate::applyType()
 {
-    if (type != Dialog::Normal) {
         /*QXcbWindowFunctions::WmWindowType*/ int wmType = 0;
 
 #if HAVE_X11
         if (KWindowSystem::isPlatformX11()) {
             switch (type) {
             case Dialog::Normal:
-                Q_UNREACHABLE();
+                q->setFlags(Qt::FramelessWindowHint | q->flags());
                 break;
             case Dialog::Dock:
                 wmType = QXcbWindowFunctions::WmWindowType::Dock;
@@ -729,11 +728,15 @@
         }
 #endif
 
-        if (!wmType) {
+        if (!wmType && type != Dialog::Normal) {
             KWindowSystem::setType(q->winId(), static_cast<NET::WindowType>(type));
         }
 #if HAVE_KWAYLAND
         if (shellSurface) {
+            if (q->flags() & Qt::WindowStaysOnTopHint) {
+                type = Dialog::Dock;
+                shellSurface->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::WindowsGoBelow);
+            }
             switch (type) {
                 case Dialog::Dock:
                 shellSurface->setRole(KWayland::Client::PlasmaShellSurface::Role::Panel);
@@ -750,27 +753,13 @@
             case Dialog::CriticalNotification:
                 shellSurface->setRole(KWayland::Client::PlasmaShellSurface::Role::CriticalNotification);
                 break;
+            case Dialog::Normal:
+                shellSurface->setRole(KWayland::Client::PlasmaShellSurface::Role::Normal);
             default:
                 break;
             }
         }
 #endif
-    } else {
-        q->setFlags(Qt::FramelessWindowHint | q->flags());
-
-#if HAVE_KWAYLAND
-        // Only possible after setup
-        if (shellSurface) {
-            if (q->flags() & Qt::WindowStaysOnTopHint) {
-                shellSurface->setRole(KWayland::Client::PlasmaShellSurface::Role::Panel);
-                shellSurface->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::WindowsGoBelow);
-            } else {
-                shellSurface->setRole(KWayland::Client::PlasmaShellSurface::Role::Normal);
-                shellSurface->setPanelBehavior(KWayland::Client::PlasmaShellSurface::PanelBehavior::AlwaysVisible);
-            }
-        }
-#endif
-    }
 
     // an OSD can't be a Dialog, as qt xcb would attempt to set a transient parent for it
     // see bug 370433