add (urgent=yes|no) options to ClientPattern

This commit is contained in:
Mark Tiefenbruck 2008-06-08 11:29:47 -07:00
parent 6509fe0cac
commit a84fe20c49
5 changed files with 21 additions and 4 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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;

View file

@ -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();
}

View file

@ -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?