From 25bb1482e39d067e2306fdd2fd5a502e54d9606a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 14 Feb 2013 09:36:00 +0100 Subject: [PATCH] Adding NOTIFY signals to desktopGrid(Size/Width/Height) Since the introduction of VirtualDesktopManager we do have a signal emitted when the desktop layout changes which we can use as NOTIFY for the desktopGrid properties. REVIEW: 108953 --- scripting/workspace_wrapper.cpp | 1 + scripting/workspace_wrapper.h | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/scripting/workspace_wrapper.cpp b/scripting/workspace_wrapper.cpp index 7fe4b4fabb..31ec40a626 100644 --- a/scripting/workspace_wrapper.cpp +++ b/scripting/workspace_wrapper.cpp @@ -39,6 +39,7 @@ WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent) connect(ws, SIGNAL(clientRemoved(KWin::Client*)), SIGNAL(clientRemoved(KWin::Client*))); connect(ws, SIGNAL(clientActivated(KWin::Client*)), SIGNAL(clientActivated(KWin::Client*))); connect(vds, SIGNAL(countChanged(uint,uint)), SIGNAL(numberDesktopsChanged(uint))); + connect(vds, SIGNAL(layoutChanged(int,int)), SIGNAL(desktopLayoutChanged())); connect(ws, SIGNAL(clientDemandsAttentionChanged(KWin::Client*,bool)), SIGNAL(clientDemandsAttentionChanged(KWin::Client*,bool))); connect(ws, SIGNAL(currentActivityChanged(QString)), SIGNAL(currentActivityChanged(QString))); connect(ws, SIGNAL(activityAdded(QString)), SIGNAL(activitiesChanged(QString))); diff --git a/scripting/workspace_wrapper.h b/scripting/workspace_wrapper.h index 3d18661eb6..4b723295d8 100644 --- a/scripting/workspace_wrapper.h +++ b/scripting/workspace_wrapper.h @@ -40,9 +40,9 @@ class WorkspaceWrapper : public QObject Q_PROPERTY(int currentDesktop READ currentDesktop WRITE setCurrentDesktop NOTIFY currentDesktopChanged) Q_PROPERTY(KWin::Client *activeClient READ activeClient WRITE setActiveClient NOTIFY clientActivated) // TODO: write and notify? - Q_PROPERTY(QSize desktopGridSize READ desktopGridSize) - Q_PROPERTY(int desktopGridWidth READ desktopGridWidth) - Q_PROPERTY(int desktopGridHeight READ desktopGridHeight) + Q_PROPERTY(QSize desktopGridSize READ desktopGridSize NOTIFY desktopLayoutChanged) + Q_PROPERTY(int desktopGridWidth READ desktopGridWidth NOTIFY desktopLayoutChanged) + Q_PROPERTY(int desktopGridHeight READ desktopGridHeight NOTIFY desktopLayoutChanged) Q_PROPERTY(int workspaceWidth READ workspaceWidth) Q_PROPERTY(int workspaceHeight READ workspaceHeight) Q_PROPERTY(QSize workspaceSize READ workspaceSize) @@ -90,6 +90,12 @@ signals: * @param oldNumberOfDesktops The previous number of desktops. **/ void numberDesktopsChanged(uint oldNumberOfDesktops); + /** + * Signal emitted whenever the layout of virtual desktops changed. + * That is desktopGrid(Size/Width/Height) will have new values. + * @since 4.11 + **/ + void desktopLayoutChanged(); /** * The demands attention state for Client @p c changed to @p set. * @param c The Client for which demands attention changed