From d40d36057a0ee9fcb4badc7ff8b56844da79dfc8 Mon Sep 17 00:00:00 2001 From: David Edmundson 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 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(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