diff --git a/activation.cpp b/activation.cpp index 8e9be6594..62920f032 100644 --- a/activation.cpp +++ b/activation.cpp @@ -650,6 +650,7 @@ void Workspace::clientAttentionChanged(Client* c, bool set) attention_chain.prepend(c); } else attention_chain.removeAll(c); + emit clientDemandsAttentionChanged(c, set); } //******************************************** @@ -723,6 +724,7 @@ void Client::demandAttention(bool set) } else info->setState(set ? NET::DemandsAttention : 0, NET::DemandsAttention); workspace()->clientAttentionChanged(this, set); + emit demandsAttentionChanged(); } void Client::demandAttentionKNotify() diff --git a/client.h b/client.h index 78105cda8..6d5270e33 100644 --- a/client.h +++ b/client.h @@ -250,6 +250,15 @@ class Client * If this property gets abused by application developers, it will be removed again. **/ Q_PROPERTY(bool noBorder READ noBorder WRITE setNoBorder) + /** + * Whether window state _NET_WM_STATE_DEMANDS_ATTENTION is set. This state indicates that some + * action in or with the window happened. For example, it may be set by the Window Manager if + * the window requested activation but the Window Manager refused it, or the application may set + * it if it finished some work. This state may be set by both the Client and the Window Manager. + * It should be unset by the Window Manager when it decides the window got the required attention + * (usually, that it got activated). + **/ + Q_PROPERTY(bool demandsAttention READ isDemandingAttention WRITE demandAttention NOTIFY demandsAttentionChanged) public: Client(Workspace* ws); Window wrapperId() const; @@ -402,6 +411,9 @@ public: void takeActivity(int flags, bool handled, allowed_t); // Takes ActivityFlags as arg (in utils.h) void takeFocus(allowed_t); + bool isDemandingAttention() const { + return demands_attention; + } void demandAttention(bool set = true); void setMask(const QRegion& r, int mode = X::Unsorted); @@ -691,6 +703,10 @@ signals: * another group, but not when a Client gets added or removed to the Client's ClientGroup. **/ void tabGroupChanged(); + /** + * Emitted whenever the demands attention state changes. + **/ + void demandsAttentionChanged(); private: void exportMappingState(int s); // ICCCM 4.1.3.1, 4.1.4, NETWM 2.5.1 diff --git a/scripting/workspace_wrapper.cpp b/scripting/workspace_wrapper.cpp index ebcced6a1..c0de0783e 100644 --- a/scripting/workspace_wrapper.cpp +++ b/scripting/workspace_wrapper.cpp @@ -34,6 +34,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(ws, SIGNAL(numberDesktopsChanged(int)), SIGNAL(numberDesktopsChanged(int))); + connect(ws, SIGNAL(clientDemandsAttentionChanged(KWin::Client*,bool)), SIGNAL(clientDemandsAttentionChanged(KWin::Client*,bool))); foreach (KWin::Client *client, ws->clientList()) { setupClientConnections(client); } diff --git a/scripting/workspace_wrapper.h b/scripting/workspace_wrapper.h index 0ec9c74b3..0b44b6e24 100644 --- a/scripting/workspace_wrapper.h +++ b/scripting/workspace_wrapper.h @@ -86,6 +86,12 @@ signals: * @param oldNumberOfDesktops The previous number of desktops. **/ void numberDesktopsChanged(int oldNumberOfDesktops); + /** + * The demands attention state for Client @p c changed to @p set. + * @param c The Client for which demands attention changed + * @param set New value of demands attention + **/ + void clientDemandsAttentionChanged(KWin::Client* c, bool set); public: //------------------------------------------------------------------ diff --git a/workspace.h b/workspace.h index f8316b316..1c6a8317e 100644 --- a/workspace.h +++ b/workspace.h @@ -674,6 +674,7 @@ signals: void clientAdded(KWin::Client*); void clientRemoved(KWin::Client*); void clientActivated(KWin::Client*); + void clientDemandsAttentionChanged(KWin::Client*, bool); void groupAdded(KWin::Group*); void unmanagedAdded(KWin::Unmanaged*); void deletedRemoved(KWin::Deleted*);