diff --git a/frame/layershell/x11dlayershellemulation.cpp b/frame/layershell/x11dlayershellemulation.cpp index 36d3c79a4..2d2f2b405 100644 --- a/frame/layershell/x11dlayershellemulation.cpp +++ b/frame/layershell/x11dlayershellemulation.cpp @@ -6,6 +6,7 @@ #include "dlayershellwindow.h" #include "x11dlayershellemulation.h" +#include #include #include #include @@ -22,7 +23,12 @@ LayerShellEmulation::LayerShellEmulation(QWindow* window, QObject *parent) : QObject(parent) , m_window(window) , m_dlayerShellWindow(DLayerShellWindow::get(m_window)) + , m_exclusionZoneTimer(new QTimer(this)) { + m_exclusionZoneTimer->setSingleShot(true); + m_exclusionZoneTimer->setInterval(200); + connect(m_exclusionZoneTimer, &QTimer::timeout, this, &LayerShellEmulation::onExclusionZoneChanged); + onLayerChanged(); connect(m_dlayerShellWindow, &DLayerShellWindow::layerChanged, this, &LayerShellEmulation::onLayerChanged); @@ -35,12 +41,23 @@ LayerShellEmulation::LayerShellEmulation(QWindow* window, QObject *parent) connect(m_dlayerShellWindow, &DLayerShellWindow::exclusionZoneChanged, this, &LayerShellEmulation::onExclusionZoneChanged); // qml height or width may update later, need to update anchor postion and exclusion zone - connect(m_window, &QWindow::widthChanged, this, &LayerShellEmulation::onExclusionZoneChanged); + connect(m_window, &QWindow::widthChanged, this, [this](){ + m_exclusionZoneTimer->start(); + }); connect(m_window, &QWindow::widthChanged, this, &LayerShellEmulation::onPositionChanged); - connect(m_window, &QWindow::heightChanged, this, &LayerShellEmulation::onExclusionZoneChanged); + connect(m_window, &QWindow::heightChanged, this, [this](){ + m_exclusionZoneTimer->start(); + }); connect(m_window, &QWindow::heightChanged, this, &LayerShellEmulation::onPositionChanged); + connect(m_window, &QWindow::xChanged, this, [this](){ + m_exclusionZoneTimer->start(); + }); + connect(m_window, &QWindow::yChanged, this, [this](){ + m_exclusionZoneTimer->start(); + }); + auto screen = m_window->screen(); connect(screen, &QScreen::geometryChanged, this, &LayerShellEmulation::onPositionChanged); connect(m_window, &QWindow::screenChanged, this, [this](QScreen *nowScreen){ diff --git a/frame/layershell/x11dlayershellemulation.h b/frame/layershell/x11dlayershellemulation.h index 718a4da42..f7754e9fb 100644 --- a/frame/layershell/x11dlayershellemulation.h +++ b/frame/layershell/x11dlayershellemulation.h @@ -31,5 +31,6 @@ private slots: private: QWindow* m_window; DLayerShellWindow* m_dlayerShellWindow; + QTimer* m_exclusionZoneTimer; }; DS_END_NAMESPACE