From a84fe20c49198c1ef74616e51152a5e1363fab41 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Sun, 8 Jun 2008 11:29:47 -0700 Subject: add (urgent=yes|no) options to ClientPattern --- ChangeLog | 3 +++ src/AttentionNoticeHandler.cc | 9 +++++++-- src/AttentionNoticeHandler.hh | 2 +- src/ClientPattern.cc | 9 +++++++++ src/ClientPattern.hh | 2 +- 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 @@ (Format: Year/Month/Day) Changes for 1.1 +*08/06/08: + * Add (urgent=yes|no) option to client patterns (Mark) + ClientPattern.cc/hh *08/06/06: * Allow window menu items in ordinary menus (Mark) 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) { } -bool AttentionNoticeHandler::isDemandingAttention(Focusable &client) { - return m_attentions.find(&client) != m_attentions.end(); +bool AttentionNoticeHandler::isDemandingAttention(const Focusable &client) { + NoticeMap::iterator it = m_attentions.begin(), it_end = m_attentions.end(); + for (; it != it_end; ++it) { + if (it->first == &client) + return true; + } + return false; } 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: /// removes the client from the attention map void update(FbTk::Subject *subj); - bool isDemandingAttention(Focusable &client); + bool isDemandingAttention(const Focusable &client); private: 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 @@ #include "ClientPattern.hh" +#include "fluxbox.hh" #include "FocusControl.hh" #include "Layer.hh" #include "Screen.hh" @@ -132,6 +133,8 @@ ClientPattern::ClientPattern(const char *str, bool default_no_transient): prop = HEAD; } else if (strcasecmp(memstr.c_str(), "layer") == 0) { prop = LAYER; + } else if (strcasecmp(memstr.c_str(), "urgent") == 0) { + prop = URGENT; } else { prop = NAME; expr = match; @@ -244,6 +247,8 @@ string ClientPattern::toString() const { case LAYER: pat.append("layer="); break; + case URGENT: + pat.append("urgent="); } pat.append((*it)->orig); @@ -403,6 +408,10 @@ string ClientPattern::getProperty(WinProperty prop, const Focusable &client) { case LAYER: return fbwin ? ::Layer::getString(fbwin->layerNum()) : ""; break; + case URGENT: + return Fluxbox::instance()->attentionHandler() + .isDemandingAttention(client) ? "yes" : "no"; + break; } return client.getWMClassName(); } 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: enum WinProperty { TITLE, CLASS, NAME, ROLE, TRANSIENT, MAXIMIZED, MINIMIZED, SHADED, STUCK, FOCUSHIDDEN, ICONHIDDEN, - WORKSPACE, WORKSPACENAME, HEAD, LAYER + WORKSPACE, WORKSPACENAME, HEAD, LAYER, URGENT }; /// Does this client match this pattern? -- cgit v0.11.2