Add signal to Scripting when number of screens changes

This commit is contained in:
Martin Gräßlin 2012-03-27 19:43:04 +02:00
parent 27643f5a9e
commit cd8a18080f
2 changed files with 9 additions and 1 deletions

View file

@ -22,6 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "workspace_wrapper.h"
#include "../client.h"
#include <QtGui/QDesktopWidget>
namespace KWin {
WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent)
@ -35,6 +37,7 @@ WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent)
connect(ws, SIGNAL(clientActivated(KWin::Client*)), SIGNAL(clientActivated(KWin::Client*)));
connect(ws, SIGNAL(numberDesktopsChanged(int)), SIGNAL(numberDesktopsChanged(int)));
connect(ws, SIGNAL(clientDemandsAttentionChanged(KWin::Client*,bool)), SIGNAL(clientDemandsAttentionChanged(KWin::Client*,bool)));
connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SIGNAL(numberScreensChanged(int)));
foreach (KWin::Client *client, ws->clientList()) {
setupClientConnections(client);
}

View file

@ -61,7 +61,7 @@ class WorkspaceWrapper : public QObject
**/
Q_PROPERTY(int displayHeight READ displayHeight)
Q_PROPERTY(int activeScreen READ activeScreen)
Q_PROPERTY(int numScreens READ numScreens)
Q_PROPERTY(int numScreens READ numScreens NOTIFY numberScreensChanged)
private:
Q_DISABLE_COPY(WorkspaceWrapper)
@ -92,6 +92,11 @@ signals:
* @param set New value of demands attention
**/
void clientDemandsAttentionChanged(KWin::Client *client, bool set);
/**
* Signal emitted when the number of screens changes.
* @param count The new number of screens
**/
void numberScreensChanged(int count);
public:
//------------------------------------------------------------------