diff --git a/app/dock/screenedgeghostwindow.cpp b/app/dock/screenedgeghostwindow.cpp index 3e744f993..6dad72d82 100644 --- a/app/dock/screenedgeghostwindow.cpp +++ b/app/dock/screenedgeghostwindow.cpp @@ -24,6 +24,7 @@ #include <QDebug> #include <QSurfaceFormat> #include <QQuickView> +#include <QTimer> #include <KWayland/Client/plasmashell.h> #include <KWayland/Client/surface.h> @@ -45,16 +46,21 @@ ScreenEdgeGhostWindow::ScreenEdgeGhostWindow(DockView *view) : | Qt::NoDropShadowWindowHint | Qt::WindowDoesNotAcceptFocus); - connect(this, &QQuickView::xChanged, this, &ScreenEdgeGhostWindow::fixGeometry); - connect(this, &QQuickView::yChanged, this, &ScreenEdgeGhostWindow::fixGeometry); - connect(this, &QQuickView::widthChanged, this, &ScreenEdgeGhostWindow::fixGeometry); - connect(this, &QQuickView::heightChanged, this, &ScreenEdgeGhostWindow::fixGeometry); + m_fixGeometryTimer.setSingleShot(true); + m_fixGeometryTimer.setInterval(500); + connect(&m_fixGeometryTimer, &QTimer::timeout, this, &ScreenEdgeGhostWindow::fixGeometry); + + connect(this, &QQuickView::xChanged, this, &ScreenEdgeGhostWindow::startGeometryTimer); + connect(this, &QQuickView::yChanged, this, &ScreenEdgeGhostWindow::startGeometryTimer); + connect(this, &QQuickView::widthChanged, this, &ScreenEdgeGhostWindow::startGeometryTimer); + connect(this, &QQuickView::heightChanged, this, &ScreenEdgeGhostWindow::startGeometryTimer); connect(m_dockView, &DockView::absGeometryChanged, this, &ScreenEdgeGhostWindow::updateGeometry); connect(m_dockView, &DockView::screenGeometryChanged, this, &ScreenEdgeGhostWindow::updateGeometry); connect(m_dockView, &DockView::locationChanged, this, &ScreenEdgeGhostWindow::updateGeometry); connect(m_dockView, &QQuickView::screenChanged, this, [this]() { setScreen(m_dockView->screen()); + updateGeometry(); }); @@ -169,6 +175,11 @@ void ScreenEdgeGhostWindow::fixGeometry() } } +void ScreenEdgeGhostWindow::startGeometryTimer() +{ + m_fixGeometryTimer.start(); +} + void ScreenEdgeGhostWindow::setupWaylandIntegration() { if (m_shellSurface || !KWindowSystem::isPlatformWayland() || !m_dockView || !m_dockView->containment()) { diff --git a/app/dock/screenedgeghostwindow.h b/app/dock/screenedgeghostwindow.h index 5403d9d40..c78595bd4 100644 --- a/app/dock/screenedgeghostwindow.h +++ b/app/dock/screenedgeghostwindow.h @@ -22,6 +22,7 @@ #include <QObject> #include <QQuickView> +#include <QTimer> namespace KWayland { namespace Client { @@ -75,6 +76,7 @@ protected: bool event(QEvent *ev) override; private slots: + void startGeometryTimer(); void updateGeometry(); void fixGeometry(); @@ -85,6 +87,8 @@ private: bool m_inDelete{false}; QRect m_calculatedGeometry; + QTimer m_fixGeometryTimer; + DockView *m_dockView{nullptr}; KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr};