From b8884d07eae4c28e618ab9404976bb77c6c4aec9 Mon Sep 17 00:00:00 2001 From: Filippo Gentile Date: Sat, 17 Feb 2024 23:16:24 +0100 Subject: [PATCH 1/8] LXQtPanel: use LayerShell on Wayland layer_shell protocol allows to ask for placement on Wayland --- CMakeLists.txt | 2 + panel/CMakeLists.txt | 1 + panel/lxqtpanel.cpp | 173 +++++++++++++++++++++++++++++++------------ panel/lxqtpanel.h | 6 ++ 4 files changed, 135 insertions(+), 47 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25350186d..3cd60ede7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,8 @@ find_package(lxqt ${LXQT_MINIMUM_VERSION} REQUIRED) find_package(lxqt-globalkeys-ui ${LXQT_GLOBALKEYS_MINIMUM_VERSION} REQUIRED) find_package(lxqt-menu-data ${LXQT_MINIMUM_VERSION} REQUIRED) +find_package(LayerShellQt REQUIRED) + # Patch Version set(LXQT_PANEL_PATCH_VERSION 0) set(LXQT_PANEL_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_PANEL_PATCH_VERSION}) diff --git a/panel/CMakeLists.txt b/panel/CMakeLists.txt index 916fced2c..556d2212f 100644 --- a/panel/CMakeLists.txt +++ b/panel/CMakeLists.txt @@ -103,6 +103,7 @@ target_link_libraries(${PROJECT} ${LIBRARIES} ${QTX_LIBRARIES} KF6::WindowSystem + LayerShellQt::Interface ${STATIC_PLUGINS} ) diff --git a/panel/lxqtpanel.cpp b/panel/lxqtpanel.cpp index 86ba83141..e9298b7ea 100644 --- a/panel/lxqtpanel.cpp +++ b/panel/lxqtpanel.cpp @@ -53,6 +53,8 @@ #include #include +#include + // Turn on this to show the time required to load each plugin during startup // #define DEBUG_PLUGIN_LOADTIME #ifdef DEBUG_PLUGIN_LOADTIME @@ -141,6 +143,7 @@ LXQtPanel::LXQtPanel(const QString &configGroup, LXQt::Settings *settings, QWidg mAnimationTime(0), mReserveSpace(true), mAnimation(nullptr), + mLayerWindow(nullptr), mLockPanel(false) { //You can find information about the flags and widget attributes in your @@ -230,6 +233,30 @@ LXQtPanel::LXQtPanel(const QString &configGroup, LXQt::Settings *settings, QWidg loadPlugins(); + if(qGuiApp->nativeInterface()) + { + // Create backing QWindow for LayerShellQt integration + create(); + + // Init Layer Shell (Must be done before showing widget) + mLayerWindow = LayerShellQt::Window::get(windowHandle()); + mLayerWindow->setLayer(LayerShellQt::Window::LayerTop); + + mLayerWindow->setScope(QStringLiteral("dock")); + + LayerShellQt::Window::Anchors anchors; + anchors.setFlag(LayerShellQt::Window::AnchorLeft); + anchors.setFlag(LayerShellQt::Window::AnchorBottom); + anchors.setFlag(LayerShellQt::Window::AnchorRight); + mLayerWindow->setAnchors(anchors); + + mLayerWindow->setKeyboardInteractivity(LayerShellQt::Window::KeyboardInteractivityNone); + mLayerWindow->setCloseOnDismissed(false); + + mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorBottom); + mLayerWindow->setExclusiveZone(height()); + } + // NOTE: Some (X11) WMs may need the geometry to be set before QWidget::show(). setPanelGeometry(); @@ -479,6 +506,7 @@ void LXQtPanel::setPanelGeometry(bool animate) const QRect currentScreen = screens.at(mActualScreenNum)->geometry(); QRect rect; + LayerShellQt::Window::Anchors anchors; if (isHorizontal()) { @@ -515,6 +543,9 @@ void LXQtPanel::setPanelGeometry(bool animate) // Vert ....................... if (mPosition == ILXQtPanel::PositionTop) { + anchors.setFlag(LayerShellQt::Window::AnchorTop); + anchors.setFlag(LayerShellQt::Window::AnchorLeft); + anchors.setFlag(LayerShellQt::Window::AnchorRight); if (mHidden) rect.moveBottom(currentScreen.top() + PANEL_HIDE_SIZE - 1); else @@ -522,6 +553,9 @@ void LXQtPanel::setPanelGeometry(bool animate) } else { + anchors.setFlag(LayerShellQt::Window::AnchorBottom); + anchors.setFlag(LayerShellQt::Window::AnchorLeft); + anchors.setFlag(LayerShellQt::Window::AnchorRight); if (mHidden) rect.moveTop(currentScreen.bottom() - PANEL_HIDE_SIZE + 1); else @@ -563,6 +597,9 @@ void LXQtPanel::setPanelGeometry(bool animate) // Horiz ...................... if (mPosition == ILXQtPanel::PositionLeft) { + anchors.setFlag(LayerShellQt::Window::AnchorTop); + anchors.setFlag(LayerShellQt::Window::AnchorLeft); + anchors.setFlag(LayerShellQt::Window::AnchorBottom); if (mHidden) rect.moveRight(currentScreen.left() + PANEL_HIDE_SIZE - 1); else @@ -570,12 +607,19 @@ void LXQtPanel::setPanelGeometry(bool animate) } else { + anchors.setFlag(LayerShellQt::Window::AnchorTop); + anchors.setFlag(LayerShellQt::Window::AnchorRight); + anchors.setFlag(LayerShellQt::Window::AnchorBottom); if (mHidden) rect.moveLeft(currentScreen.right() - PANEL_HIDE_SIZE + 1); else rect.moveRight(currentScreen.right()); } } + + if(mLayerWindow) + mLayerWindow->setAnchors(anchors); + if (!mHidden || !mGeometry.isValid()) mGeometry = rect; if (rect != geometry()) { @@ -664,62 +708,97 @@ void LXQtPanel::updateWmStrut() if(wid == 0 || !isVisible()) return; - if (mReserveSpace && QApplication::primaryScreen()) + if(qGuiApp->nativeInterface()) { - const QRect wholeScreen = QApplication::primaryScreen()->virtualGeometry(); - const QRect rect = geometry(); - // NOTE: https://standards.freedesktop.org/wm-spec/wm-spec-latest.html - // Quote from the EWMH spec: " Note that the strut is relative to the screen edge, and not the edge of the xinerama monitor." - // So, we use the geometry of the whole screen to calculate the strut rather than using the geometry of individual monitors. - // Though the spec only mention Xinerama and did not mention XRandR, the rule should still be applied. - // At least openbox is implemented like this. - switch (mPosition) + if (mReserveSpace && QApplication::primaryScreen()) { - case LXQtPanel::PositionTop: - KX11Extras::setExtendedStrut(wid, - /* Left */ 0, 0, 0, - /* Right */ 0, 0, 0, - /* Top */ rect.top() + getReserveDimension(), rect.left(), rect.right(), - /* Bottom */ 0, 0, 0 - ); - break; + const QRect wholeScreen = QApplication::primaryScreen()->virtualGeometry(); + const QRect rect = geometry(); + // NOTE: https://standards.freedesktop.org/wm-spec/wm-spec-latest.html + // Quote from the EWMH spec: " Note that the strut is relative to the screen edge, and not the edge of the xinerama monitor." + // So, we use the geometry of the whole screen to calculate the strut rather than using the geometry of individual monitors. + // Though the spec only mention Xinerama and did not mention XRandR, the rule should still be applied. + // At least openbox is implemented like this. + switch (mPosition) + { + case LXQtPanel::PositionTop: + KX11Extras::setExtendedStrut(wid, + /* Left */ 0, 0, 0, + /* Right */ 0, 0, 0, + /* Top */ rect.top() + getReserveDimension(), rect.left(), rect.right(), + /* Bottom */ 0, 0, 0 + ); + break; - case LXQtPanel::PositionBottom: - KX11Extras::setExtendedStrut(wid, - /* Left */ 0, 0, 0, - /* Right */ 0, 0, 0, - /* Top */ 0, 0, 0, - /* Bottom */ wholeScreen.bottom() - rect.bottom() + getReserveDimension(), rect.left(), rect.right() - ); - break; + case LXQtPanel::PositionBottom: + KX11Extras::setExtendedStrut(wid, + /* Left */ 0, 0, 0, + /* Right */ 0, 0, 0, + /* Top */ 0, 0, 0, + /* Bottom */ wholeScreen.bottom() - rect.bottom() + getReserveDimension(), rect.left(), rect.right() + ); + break; - case LXQtPanel::PositionLeft: - KX11Extras::setExtendedStrut(wid, - /* Left */ rect.left() + getReserveDimension(), rect.top(), rect.bottom(), - /* Right */ 0, 0, 0, - /* Top */ 0, 0, 0, - /* Bottom */ 0, 0, 0 - ); + case LXQtPanel::PositionLeft: + KX11Extras::setExtendedStrut(wid, + /* Left */ rect.left() + getReserveDimension(), rect.top(), rect.bottom(), + /* Right */ 0, 0, 0, + /* Top */ 0, 0, 0, + /* Bottom */ 0, 0, 0 + ); - break; + break; - case LXQtPanel::PositionRight: + case LXQtPanel::PositionRight: + KX11Extras::setExtendedStrut(wid, + /* Left */ 0, 0, 0, + /* Right */ wholeScreen.right() - rect.right() + getReserveDimension(), rect.top(), rect.bottom(), + /* Top */ 0, 0, 0, + /* Bottom */ 0, 0, 0 + ); + break; + } + } else + { KX11Extras::setExtendedStrut(wid, - /* Left */ 0, 0, 0, - /* Right */ wholeScreen.right() - rect.right() + getReserveDimension(), rect.top(), rect.bottom(), - /* Top */ 0, 0, 0, - /* Bottom */ 0, 0, 0 - ); - break; + /* Left */ 0, 0, 0, + /* Right */ 0, 0, 0, + /* Top */ 0, 0, 0, + /* Bottom */ 0, 0, 0 + ); + } } - } else + else if(qGuiApp->nativeInterface()) { - KX11Extras::setExtendedStrut(wid, - /* Left */ 0, 0, 0, - /* Right */ 0, 0, 0, - /* Top */ 0, 0, 0, - /* Bottom */ 0, 0, 0 - ); + if (mReserveSpace) + { + switch (mPosition) + { + case LXQtPanel::PositionTop: + mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorTop); + mLayerWindow->setExclusiveZone(height()); + break; + + case LXQtPanel::PositionBottom: + mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorBottom); + mLayerWindow->setExclusiveZone(height()); + break; + + case LXQtPanel::PositionLeft: + mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorLeft); + mLayerWindow->setExclusiveZone(width()); + break; + + case LXQtPanel::PositionRight: + mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorRight); + mLayerWindow->setExclusiveZone(width()); + break; + } + } else + { + mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorNone); + mLayerWindow->setExclusiveZone(0); + } } } diff --git a/panel/lxqtpanel.h b/panel/lxqtpanel.h index 7d847dfa6..c1930c1bf 100644 --- a/panel/lxqtpanel.h +++ b/panel/lxqtpanel.h @@ -42,6 +42,10 @@ class QMenu; class Plugin; class QAbstractItemModel; +namespace LayerShellQt { +class Window; +} + namespace LXQt { class Settings; class PluginInfo; @@ -688,6 +692,8 @@ private slots: */ QPropertyAnimation *mAnimation; + LayerShellQt::Window *mLayerWindow; + /** * @brief Flag for providing the configuration options in panel's context menu */ From a7951e28e34c479fc020391c55a0e38d3a9f7323 Mon Sep 17 00:00:00 2001 From: Filippo Gentile Date: Thu, 22 Feb 2024 11:44:11 +0100 Subject: [PATCH 2/8] LXQtPanel: fix position not applied immediatly on Wayland --- panel/lxqtpanel.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/panel/lxqtpanel.cpp b/panel/lxqtpanel.cpp index e9298b7ea..699c684df 100644 --- a/panel/lxqtpanel.cpp +++ b/panel/lxqtpanel.cpp @@ -647,6 +647,10 @@ void LXQtPanel::setPanelGeometry(bool animate) setGeometry(rect); } } + + // Make LayerShell apply changes immediatly + if(windowHandle()) + windowHandle()->requestUpdate(); } void LXQtPanel::setMargins() From 96c2e7659adf3a1b9e1cd8dae986b1f4ca2d7838 Mon Sep 17 00:00:00 2001 From: Filippo Gentile Date: Thu, 22 Feb 2024 12:10:02 +0100 Subject: [PATCH 3/8] LXQtPanel: partially fix alignment on Wayland TODO TODO: after changing length to pixels and back to percent alignment is ignored and always kept to right --- panel/lxqtpanel.cpp | 49 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/panel/lxqtpanel.cpp b/panel/lxqtpanel.cpp index 699c684df..c84bb1328 100644 --- a/panel/lxqtpanel.cpp +++ b/panel/lxqtpanel.cpp @@ -507,6 +507,7 @@ void LXQtPanel::setPanelGeometry(bool animate) QRect rect; LayerShellQt::Window::Anchors anchors; + LayerShellQt::Window::Anchor edge; if (isHorizontal()) { @@ -528,6 +529,7 @@ void LXQtPanel::setPanelGeometry(bool animate) switch (mAlignment) { case LXQtPanel::AlignmentLeft: + anchors.setFlag(LayerShellQt::Window::AnchorLeft); rect.moveLeft(currentScreen.left()); break; @@ -536,16 +538,24 @@ void LXQtPanel::setPanelGeometry(bool animate) break; case LXQtPanel::AlignmentRight: + anchors.setFlag(LayerShellQt::Window::AnchorRight); rect.moveRight(currentScreen.right()); break; } + if(lengthInPercents() && mLength == 100) + { + //Fill all available width + anchors.setFlag(LayerShellQt::Window::AnchorLeft); + anchors.setFlag(LayerShellQt::Window::AnchorRight); + } + // Vert ....................... if (mPosition == ILXQtPanel::PositionTop) { anchors.setFlag(LayerShellQt::Window::AnchorTop); - anchors.setFlag(LayerShellQt::Window::AnchorLeft); - anchors.setFlag(LayerShellQt::Window::AnchorRight); + edge = LayerShellQt::Window::AnchorTop; + if (mHidden) rect.moveBottom(currentScreen.top() + PANEL_HIDE_SIZE - 1); else @@ -554,8 +564,8 @@ void LXQtPanel::setPanelGeometry(bool animate) else { anchors.setFlag(LayerShellQt::Window::AnchorBottom); - anchors.setFlag(LayerShellQt::Window::AnchorLeft); - anchors.setFlag(LayerShellQt::Window::AnchorRight); + edge = LayerShellQt::Window::AnchorBottom; + if (mHidden) rect.moveTop(currentScreen.bottom() - PANEL_HIDE_SIZE + 1); else @@ -582,6 +592,7 @@ void LXQtPanel::setPanelGeometry(bool animate) switch (mAlignment) { case LXQtPanel::AlignmentLeft: + anchors.setFlag(LayerShellQt::Window::AnchorTop); rect.moveTop(currentScreen.top()); break; @@ -590,16 +601,24 @@ void LXQtPanel::setPanelGeometry(bool animate) break; case LXQtPanel::AlignmentRight: + anchors.setFlag(LayerShellQt::Window::AnchorBottom); rect.moveBottom(currentScreen.bottom()); break; } + if(lengthInPercents() && mLength == 100) + { + //Fill all available width + anchors.setFlag(LayerShellQt::Window::AnchorTop); + anchors.setFlag(LayerShellQt::Window::AnchorBottom); + } + // Horiz ...................... if (mPosition == ILXQtPanel::PositionLeft) { - anchors.setFlag(LayerShellQt::Window::AnchorTop); anchors.setFlag(LayerShellQt::Window::AnchorLeft); - anchors.setFlag(LayerShellQt::Window::AnchorBottom); + edge = LayerShellQt::Window::AnchorLeft; + if (mHidden) rect.moveRight(currentScreen.left() + PANEL_HIDE_SIZE - 1); else @@ -607,9 +626,9 @@ void LXQtPanel::setPanelGeometry(bool animate) } else { - anchors.setFlag(LayerShellQt::Window::AnchorTop); anchors.setFlag(LayerShellQt::Window::AnchorRight); - anchors.setFlag(LayerShellQt::Window::AnchorBottom); + edge = LayerShellQt::Window::AnchorRight; + if (mHidden) rect.moveLeft(currentScreen.right() - PANEL_HIDE_SIZE + 1); else @@ -618,7 +637,13 @@ void LXQtPanel::setPanelGeometry(bool animate) } if(mLayerWindow) + { mLayerWindow->setAnchors(anchors); + mLayerWindow->setExclusiveEdge(edge); + + // Make LayerShell apply changes immediatly + windowHandle()->requestUpdate(); + } if (!mHidden || !mGeometry.isValid()) mGeometry = rect; if (rect != geometry()) @@ -647,10 +672,6 @@ void LXQtPanel::setPanelGeometry(bool animate) setGeometry(rect); } } - - // Make LayerShell apply changes immediatly - if(windowHandle()) - windowHandle()->requestUpdate(); } void LXQtPanel::setMargins() @@ -774,6 +795,8 @@ void LXQtPanel::updateWmStrut() } else if(qGuiApp->nativeInterface()) { + //TODO: duplicated code, also set in setPanelGeometry() + if (mReserveSpace) { switch (mPosition) @@ -803,6 +826,8 @@ void LXQtPanel::updateWmStrut() mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorNone); mLayerWindow->setExclusiveZone(0); } + + windowHandle()->requestUpdate(); } } From 57133d70ce7da322eedbb6e694d595e2f6eae025 Mon Sep 17 00:00:00 2001 From: Filippo Gentile Date: Thu, 22 Feb 2024 22:37:49 +0100 Subject: [PATCH 4/8] LXQtPanel: fix auto-hide on Wayland --- panel/lxqtpanel.cpp | 52 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/panel/lxqtpanel.cpp b/panel/lxqtpanel.cpp index c84bb1328..c1aca5ea8 100644 --- a/panel/lxqtpanel.cpp +++ b/panel/lxqtpanel.cpp @@ -672,6 +672,37 @@ void LXQtPanel::setPanelGeometry(bool animate) setGeometry(rect); } } + + if(mLayerWindow) + { + // Emulate auto-hide on Wayland + // NOTE: we cannot move window out of screen so we make it smaller + + // NOTE: a cleaner approach would be to use screen edge protocol + // but it's specific to KWin + + if(mHidden && LXQtPanelWidget->isVisible()) + { + // Make it blank + LXQtPanelWidget->hide(); + + // And make it small + if(isHorizontal()) + resize(rect.width(), PANEL_HIDE_SIZE); + else + resize(PANEL_HIDE_SIZE, rect.height()); + } + else if(!mHidden && !LXQtPanelWidget->isVisible()) + { + // Restore contents + LXQtPanelWidget->show(); + + // And make it big again + resize(rect.size()); + } + + updateWmStrut(); + } } void LXQtPanel::setMargins() @@ -799,34 +830,37 @@ void LXQtPanel::updateWmStrut() if (mReserveSpace) { + LayerShellQt::Window::Anchor edge; + switch (mPosition) { case LXQtPanel::PositionTop: - mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorTop); - mLayerWindow->setExclusiveZone(height()); + edge = LayerShellQt::Window::AnchorTop; break; case LXQtPanel::PositionBottom: - mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorBottom); - mLayerWindow->setExclusiveZone(height()); + edge = LayerShellQt::Window::AnchorBottom; break; case LXQtPanel::PositionLeft: - mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorLeft); - mLayerWindow->setExclusiveZone(width()); + edge = LayerShellQt::Window::AnchorLeft; break; case LXQtPanel::PositionRight: - mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorRight); - mLayerWindow->setExclusiveZone(width()); + edge = LayerShellQt::Window::AnchorRight; break; } - } else + + mLayerWindow->setExclusiveEdge(edge); + mLayerWindow->setExclusiveZone(getReserveDimension()); + } + else { mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorNone); mLayerWindow->setExclusiveZone(0); } + // Make LayerShell apply changes immediatly windowHandle()->requestUpdate(); } } From 3dc475bea00f18ca015c9a4631805e12391d25f0 Mon Sep 17 00:00:00 2001 From: Filippo Gentile Date: Sat, 9 Mar 2024 20:06:15 +0100 Subject: [PATCH 5/8] LXQtPanel: set LayerShellQt KeyboardInteractivityOnDemand Set layer shell keyboard interactivity on-demand --- panel/lxqtpanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panel/lxqtpanel.cpp b/panel/lxqtpanel.cpp index c1aca5ea8..e0504e45c 100644 --- a/panel/lxqtpanel.cpp +++ b/panel/lxqtpanel.cpp @@ -250,7 +250,7 @@ LXQtPanel::LXQtPanel(const QString &configGroup, LXQt::Settings *settings, QWidg anchors.setFlag(LayerShellQt::Window::AnchorRight); mLayerWindow->setAnchors(anchors); - mLayerWindow->setKeyboardInteractivity(LayerShellQt::Window::KeyboardInteractivityNone); + mLayerWindow->setKeyboardInteractivity(LayerShellQt::Window::KeyboardInteractivityOnDemand); mLayerWindow->setCloseOnDismissed(false); mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorBottom); From f1405c55e87e79f6e647642f2455d59a41915f7a Mon Sep 17 00:00:00 2001 From: Filippo Gentile Date: Tue, 9 Apr 2024 11:50:34 +0200 Subject: [PATCH 6/8] LXQtPanel: ensure QWindow is created and null-check layer shell window --- panel/lxqtpanel.cpp | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/panel/lxqtpanel.cpp b/panel/lxqtpanel.cpp index e0504e45c..fe9002bd5 100644 --- a/panel/lxqtpanel.cpp +++ b/panel/lxqtpanel.cpp @@ -238,23 +238,30 @@ LXQtPanel::LXQtPanel(const QString &configGroup, LXQt::Settings *settings, QWidg // Create backing QWindow for LayerShellQt integration create(); - // Init Layer Shell (Must be done before showing widget) - mLayerWindow = LayerShellQt::Window::get(windowHandle()); - mLayerWindow->setLayer(LayerShellQt::Window::LayerTop); + if(!windowHandle()) + { + qWarning() << "LXQtPanel: could not create QWindow for LayerShellQt integration."; + } + else + { + // Init Layer Shell (Must be done before showing widget) + mLayerWindow = LayerShellQt::Window::get(windowHandle()); + mLayerWindow->setLayer(LayerShellQt::Window::LayerTop); - mLayerWindow->setScope(QStringLiteral("dock")); + mLayerWindow->setScope(QStringLiteral("dock")); - LayerShellQt::Window::Anchors anchors; - anchors.setFlag(LayerShellQt::Window::AnchorLeft); - anchors.setFlag(LayerShellQt::Window::AnchorBottom); - anchors.setFlag(LayerShellQt::Window::AnchorRight); - mLayerWindow->setAnchors(anchors); + LayerShellQt::Window::Anchors anchors; + anchors.setFlag(LayerShellQt::Window::AnchorLeft); + anchors.setFlag(LayerShellQt::Window::AnchorBottom); + anchors.setFlag(LayerShellQt::Window::AnchorRight); + mLayerWindow->setAnchors(anchors); - mLayerWindow->setKeyboardInteractivity(LayerShellQt::Window::KeyboardInteractivityOnDemand); - mLayerWindow->setCloseOnDismissed(false); + mLayerWindow->setKeyboardInteractivity(LayerShellQt::Window::KeyboardInteractivityOnDemand); + mLayerWindow->setCloseOnDismissed(false); - mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorBottom); - mLayerWindow->setExclusiveZone(height()); + mLayerWindow->setExclusiveEdge(LayerShellQt::Window::AnchorBottom); + mLayerWindow->setExclusiveZone(height()); + } } // NOTE: Some (X11) WMs may need the geometry to be set before QWidget::show(). @@ -824,7 +831,7 @@ void LXQtPanel::updateWmStrut() ); } } - else if(qGuiApp->nativeInterface()) + else if(mLayerWindow && qGuiApp->nativeInterface()) { //TODO: duplicated code, also set in setPanelGeometry() @@ -860,7 +867,7 @@ void LXQtPanel::updateWmStrut() mLayerWindow->setExclusiveZone(0); } - // Make LayerShell apply changes immediatly + // Make LayerShellQt apply changes immediatly windowHandle()->requestUpdate(); } } From 9ff47bf3ded90a2bfc3b34ec6cef25afc574d568 Mon Sep 17 00:00:00 2001 From: Filippo Gentile Date: Tue, 9 Apr 2024 15:29:30 +0200 Subject: [PATCH 7/8] LXQtPanel: silence warning on variable initialization --- panel/lxqtpanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panel/lxqtpanel.cpp b/panel/lxqtpanel.cpp index fe9002bd5..6b9653525 100644 --- a/panel/lxqtpanel.cpp +++ b/panel/lxqtpanel.cpp @@ -514,7 +514,7 @@ void LXQtPanel::setPanelGeometry(bool animate) QRect rect; LayerShellQt::Window::Anchors anchors; - LayerShellQt::Window::Anchor edge; + LayerShellQt::Window::Anchor edge = LayerShellQt::Window::AnchorBottom; if (isHorizontal()) { From 46f593aebb9de1d329edec41eae0d5b38a03cf43 Mon Sep 17 00:00:00 2001 From: Filippo Gentile Date: Tue, 9 Apr 2024 16:08:28 +0200 Subject: [PATCH 8/8] LXQtPanel: fix again missing variable initialization --- panel/lxqtpanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panel/lxqtpanel.cpp b/panel/lxqtpanel.cpp index 6b9653525..a1fb68f35 100644 --- a/panel/lxqtpanel.cpp +++ b/panel/lxqtpanel.cpp @@ -837,7 +837,7 @@ void LXQtPanel::updateWmStrut() if (mReserveSpace) { - LayerShellQt::Window::Anchor edge; + LayerShellQt::Window::Anchor edge = LayerShellQt::Window::AnchorBottom; switch (mPosition) {