From 158fb016a4ff2d0cb0efa21b802178c3251c173e Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 9 Nov 2021 12:38:17 +0200 Subject: [PATCH] Add Workspace::geometryChanged() signal The new signal can be used to monitor workspace geometry changes. It can be used by the Scene. --- src/workspace.cpp | 5 +++++ src/workspace.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/workspace.cpp b/src/workspace.cpp index ee42b4585d..b2e1f9e0b5 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -2070,6 +2070,7 @@ void Workspace::desktopResized() { const auto outputs = kwinApp()->platform()->enabledOutputs(); + const QRect oldGeometry = m_geometry; m_geometry = QRect(); for (const AbstractOutput *output : outputs) { m_geometry = m_geometry.united(output->geometry()); @@ -2087,6 +2088,10 @@ void Workspace::desktopResized() // TODO: emit a signal instead and remove the deep function calls into edges and effects ScreenEdges::self()->recreateEdges(); + + if (m_geometry != oldGeometry) { + Q_EMIT geometryChanged(); + } } void Workspace::saveOldScreenSizes() diff --git a/src/workspace.h b/src/workspace.h index 8d61a0921b..2b8f59fbdf 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -503,6 +503,7 @@ Q_SIGNALS: * This can be used to connect to for performing post-workspace initialization. */ void workspaceInitialized(); + void geometryChanged(); //Signals required for the scripting interface void desktopPresenceChanged(KWin::AbstractClient*, int);