From 1314b8299ccb7401c44034328080901bad21bf8d Mon Sep 17 00:00:00 2001 From: pangyi Date: Thu, 24 Nov 2022 15:03:34 +0800 Subject: [PATCH] Fix: blur background window probably shows icon in the taskbar on X11 --- src/tablet_manager.cpp | 12 ++++++++---- src/tablet_manager.h | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/tablet_manager.cpp b/src/tablet_manager.cpp index c05064738..88e01e41f 100644 --- a/src/tablet_manager.cpp +++ b/src/tablet_manager.cpp @@ -50,6 +50,7 @@ TabletManager::TabletManager(QObject *parent) { m_existTabletDesktop = QFile::exists(QStringLiteral("/usr/bin/ukui-tablet-desktop")); if (kwinApp()->operationMode() == Application::OperationMode::OperationModeX11) { + m_background->setState(NET::SkipTaskbar | NET::SkipPager | NET::SkipSwitcher); // TODO: 在这块如果不设置窗口可见和背景模糊的话,X 下无法创建成功窗口并受窗管控制 m_background->show(); // KWindowEffects::enableBlurBehind(m_background->windowHandle(), true); @@ -291,6 +292,12 @@ void TabletBackground::init() connect(screens(), &Screens::geometryChanged, this, &TabletBackground::slotGeometryChanged); } +void TabletBackground::setState(NET::States state) +{ + NETWinInfo info(QX11Info::connection(), winId(), QX11Info::appRootWindow(), NET::Properties(), NET::Properties2()); + info.setState(state, state); +} + void TabletBackground::paintEvent(QPaintEvent *event) { Q_UNUSED(event); @@ -365,14 +372,11 @@ void SingleWindowManager::setBlurBackground(TabletBackground *blurBackground) for (int i = stacking_order.count() - 1; i > -1; --i) { AbstractClient *c = qobject_cast(stacking_order.at(i)); if (c && c->keepBelow() && c->caption().contains("tablet_blur_background")) { + // only on X11 m_blurHelperWindow = c; // 设置毛玻璃背景窗口为全屏,防止在updateClientArea()->checkWorkspacePosition()时毛玻璃窗口被修改位置 m_blurHelperWindow->setFullScreen(true, false); - // only on X11 m_blurHelperWindow->setDisableActive(); - m_blurHelperWindow->setSkipSwitcher(true); - m_blurHelperWindow->setSkipPager(true); - m_blurHelperWindow->setOriginalSkipTaskbar(true); m_blurHelperWindow->minimize(true); connect(Compositor::self(), &Compositor::compositingToggled, [this](bool active){ if (active) { diff --git a/src/tablet_manager.h b/src/tablet_manager.h index ee05e9f34..e9abcb32a 100644 --- a/src/tablet_manager.h +++ b/src/tablet_manager.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -29,6 +30,8 @@ public: void init(); void autoHide(bool on); + // only on X11 + void setState(NET::States state); protected: void paintEvent(QPaintEvent *event) override;