aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-06-08 18:29:47 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-06-08 18:29:47 (GMT)
commita84fe20c49198c1ef74616e51152a5e1363fab41 (patch)
tree4fe2c2a2fa92d3452c6a8ccbba71641693a0cb38
parent6509fe0cacf25f30fb6fce9df9569d14f00f0a8f (diff)
downloadfluxbox-a84fe20c49198c1ef74616e51152a5e1363fab41.zip
fluxbox-a84fe20c49198c1ef74616e51152a5e1363fab41.tar.bz2
add (urgent=yes|no) options to ClientPattern
-rw-r--r--ChangeLog3
-rw-r--r--src/AttentionNoticeHandler.cc9
-rw-r--r--src/AttentionNoticeHandler.hh2
-rw-r--r--src/ClientPattern.cc9
-rw-r--r--src/ClientPattern.hh2
5 files changed, 21 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 8f0a6bc..d754d00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.1 2Changes for 1.1
3*08/06/08:
4 * Add (urgent=yes|no) option to client patterns (Mark)
5 ClientPattern.cc/hh
3*08/06/06: 6*08/06/06:
4 * Allow window menu items in ordinary menus (Mark) 7 * Allow window menu items in ordinary menus (Mark)
5 MenuCreator.cc/hh 8 MenuCreator.cc/hh
diff --git a/src/AttentionNoticeHandler.cc b/src/AttentionNoticeHandler.cc
index 999b9d4..26dd4b5 100644
--- a/src/AttentionNoticeHandler.cc
+++ b/src/AttentionNoticeHandler.cc
@@ -119,6 +119,11 @@ void AttentionNoticeHandler::update(FbTk::Subject *subj) {
119 119
120} 120}
121 121
122bool AttentionNoticeHandler::isDemandingAttention(Focusable &client) { 122bool AttentionNoticeHandler::isDemandingAttention(const Focusable &client) {
123 return m_attentions.find(&client) != m_attentions.end(); 123 NoticeMap::iterator it = m_attentions.begin(), it_end = m_attentions.end();
124 for (; it != it_end; ++it) {
125 if (it->first == &client)
126 return true;
127 }
128 return false;
124} 129}
diff --git a/src/AttentionNoticeHandler.hh b/src/AttentionNoticeHandler.hh
index a2ebb23..3a98b09 100644
--- a/src/AttentionNoticeHandler.hh
+++ b/src/AttentionNoticeHandler.hh
@@ -47,7 +47,7 @@ public:
47 /// removes the client from the attention map 47 /// removes the client from the attention map
48 void update(FbTk::Subject *subj); 48 void update(FbTk::Subject *subj);
49 49
50 bool isDemandingAttention(Focusable &client); 50 bool isDemandingAttention(const Focusable &client);
51 51
52private: 52private:
53 NoticeMap m_attentions; 53 NoticeMap m_attentions;
diff --git a/src/ClientPattern.cc b/src/ClientPattern.cc
index d037bb4..c08a574 100644
--- a/src/ClientPattern.cc
+++ b/src/ClientPattern.cc
@@ -22,6 +22,7 @@
22 22
23#include "ClientPattern.hh" 23#include "ClientPattern.hh"
24 24
25#include "fluxbox.hh"
25#include "FocusControl.hh" 26#include "FocusControl.hh"
26#include "Layer.hh" 27#include "Layer.hh"
27#include "Screen.hh" 28#include "Screen.hh"
@@ -132,6 +133,8 @@ ClientPattern::ClientPattern(const char *str, bool default_no_transient):
132 prop = HEAD; 133 prop = HEAD;
133 } else if (strcasecmp(memstr.c_str(), "layer") == 0) { 134 } else if (strcasecmp(memstr.c_str(), "layer") == 0) {
134 prop = LAYER; 135 prop = LAYER;
136 } else if (strcasecmp(memstr.c_str(), "urgent") == 0) {
137 prop = URGENT;
135 } else { 138 } else {
136 prop = NAME; 139 prop = NAME;
137 expr = match; 140 expr = match;
@@ -244,6 +247,8 @@ string ClientPattern::toString() const {
244 case LAYER: 247 case LAYER:
245 pat.append("layer="); 248 pat.append("layer=");
246 break; 249 break;
250 case URGENT:
251 pat.append("urgent=");
247 } 252 }
248 253
249 pat.append((*it)->orig); 254 pat.append((*it)->orig);
@@ -403,6 +408,10 @@ string ClientPattern::getProperty(WinProperty prop, const Focusable &client) {
403 case LAYER: 408 case LAYER:
404 return fbwin ? ::Layer::getString(fbwin->layerNum()) : ""; 409 return fbwin ? ::Layer::getString(fbwin->layerNum()) : "";
405 break; 410 break;
411 case URGENT:
412 return Fluxbox::instance()->attentionHandler()
413 .isDemandingAttention(client) ? "yes" : "no";
414 break;
406 } 415 }
407 return client.getWMClassName(); 416 return client.getWMClassName();
408} 417}
diff --git a/src/ClientPattern.hh b/src/ClientPattern.hh
index 1e08f35..1fd2722 100644
--- a/src/ClientPattern.hh
+++ b/src/ClientPattern.hh
@@ -53,7 +53,7 @@ public:
53 enum WinProperty { 53 enum WinProperty {
54 TITLE, CLASS, NAME, ROLE, TRANSIENT, 54 TITLE, CLASS, NAME, ROLE, TRANSIENT,
55 MAXIMIZED, MINIMIZED, SHADED, STUCK, FOCUSHIDDEN, ICONHIDDEN, 55 MAXIMIZED, MINIMIZED, SHADED, STUCK, FOCUSHIDDEN, ICONHIDDEN,
56 WORKSPACE, WORKSPACENAME, HEAD, LAYER 56 WORKSPACE, WORKSPACENAME, HEAD, LAYER, URGENT
57 }; 57 };
58 58
59 /// Does this client match this pattern? 59 /// Does this client match this pattern?