Demands Attention support for KWin Scripting
Client has a property for demands attention and Workspace is emitting a signal whenever the demands attention state of any Client changes. REVIEW: 104204
This commit is contained in:
parent
d50bf4e283
commit
d4a919a9bf
5 changed files with 26 additions and 0 deletions
|
@ -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()
|
||||
|
|
16
client.h
16
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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -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*);
|
||||
|
|
Loading…
Reference in a new issue