diff options
author | markt <markt> | 2007-10-14 18:05:31 (GMT) |
---|---|---|
committer | markt <markt> | 2007-10-14 18:05:31 (GMT) |
commit | 7e4f8a38531642cc9cb6cba31499d549f4c5f8a0 (patch) | |
tree | cd06e7c0330aff145744a8284bf5ff8ad4f0bbe1 /src | |
parent | 79cd21ce0fe56f4b38a96ecccc969f740b801cc8 (diff) | |
download | fluxbox-7e4f8a38531642cc9cb6cba31499d549f4c5f8a0.zip fluxbox-7e4f8a38531642cc9cb6cba31499d549f4c5f8a0.tar.bz2 |
add support for transient windows in client patterns, and merge a few more changes from pre-devel
Diffstat (limited to 'src')
-rw-r--r-- | src/ClientPattern.cc | 14 | ||||
-rw-r--r-- | src/ClientPattern.hh | 4 | ||||
-rw-r--r-- | src/Focusable.hh | 5 | ||||
-rw-r--r-- | src/Remember.cc | 15 | ||||
-rw-r--r-- | src/Window.cc | 4 | ||||
-rw-r--r-- | src/Window.hh | 1 |
6 files changed, 28 insertions, 15 deletions
diff --git a/src/ClientPattern.cc b/src/ClientPattern.cc index 9324bee..538b708 100644 --- a/src/ClientPattern.cc +++ b/src/ClientPattern.cc | |||
@@ -60,7 +60,7 @@ ClientPattern::ClientPattern(): | |||
60 | m_nummatches(0) {} | 60 | m_nummatches(0) {} |
61 | 61 | ||
62 | // parse the given pattern (to end of line) | 62 | // parse the given pattern (to end of line) |
63 | ClientPattern::ClientPattern(const char *str): | 63 | ClientPattern::ClientPattern(const char *str, bool default_no_transient): |
64 | m_matchlimit(0), | 64 | m_matchlimit(0), |
65 | m_nummatches(0) | 65 | m_nummatches(0) |
66 | { | 66 | { |
@@ -107,6 +107,9 @@ ClientPattern::ClientPattern(const char *str): | |||
107 | prop = TITLE; | 107 | prop = TITLE; |
108 | } else if (strcasecmp(memstr.c_str(), "role") == 0) { | 108 | } else if (strcasecmp(memstr.c_str(), "role") == 0) { |
109 | prop = ROLE; | 109 | prop = ROLE; |
110 | } else if (strcasecmp(memstr.c_str(), "transient") == 0) { | ||
111 | prop = TRANSIENT; | ||
112 | default_no_transient = false; | ||
110 | } else if (strcasecmp(memstr.c_str(), "maximized") == 0) { | 113 | } else if (strcasecmp(memstr.c_str(), "maximized") == 0) { |
111 | prop = MAXIMIZED; | 114 | prop = MAXIMIZED; |
112 | } else if (strcasecmp(memstr.c_str(), "minimized") == 0) { | 115 | } else if (strcasecmp(memstr.c_str(), "minimized") == 0) { |
@@ -138,6 +141,9 @@ ClientPattern::ClientPattern(const char *str): | |||
138 | had_error = true; | 141 | had_error = true; |
139 | } | 142 | } |
140 | 143 | ||
144 | if (default_no_transient) | ||
145 | had_error = !addTerm("no", TRANSIENT); | ||
146 | |||
141 | if (!had_error) { | 147 | if (!had_error) { |
142 | // otherwise, we check for a number | 148 | // otherwise, we check for a number |
143 | string number; | 149 | string number; |
@@ -201,6 +207,9 @@ string ClientPattern::toString() const { | |||
201 | case ROLE: | 207 | case ROLE: |
202 | pat.append("role="); | 208 | pat.append("role="); |
203 | break; | 209 | break; |
210 | case TRANSIENT: | ||
211 | pat.append("transient="); | ||
212 | break; | ||
204 | case MAXIMIZED: | 213 | case MAXIMIZED: |
205 | pat.append("maximized="); | 214 | pat.append("maximized="); |
206 | break; | 215 | break; |
@@ -307,6 +316,9 @@ string ClientPattern::getProperty(WinProperty prop, | |||
307 | case ROLE: | 316 | case ROLE: |
308 | return client.getWMRole(); | 317 | return client.getWMRole(); |
309 | break; | 318 | break; |
319 | case TRANSIENT: | ||
320 | return client.isTransient() ? "yes" : "no"; | ||
321 | break; | ||
310 | case MAXIMIZED: | 322 | case MAXIMIZED: |
311 | return (fbwin && fbwin->isMaximized()) ? "yes" : "no"; | 323 | return (fbwin && fbwin->isMaximized()) ? "yes" : "no"; |
312 | break; | 324 | break; |
diff --git a/src/ClientPattern.hh b/src/ClientPattern.hh index 4a3cd0b..e5f4944 100644 --- a/src/ClientPattern.hh +++ b/src/ClientPattern.hh | |||
@@ -46,7 +46,7 @@ public: | |||
46 | * apps file. the bool value returns the character at which | 46 | * apps file. the bool value returns the character at which |
47 | * there was a parse problem, or -1. | 47 | * there was a parse problem, or -1. |
48 | */ | 48 | */ |
49 | explicit ClientPattern(const char * str); | 49 | explicit ClientPattern(const char * str, bool default_no_transient = false); |
50 | 50 | ||
51 | ~ClientPattern(); | 51 | ~ClientPattern(); |
52 | 52 | ||
@@ -54,7 +54,7 @@ public: | |||
54 | std::string toString() const; | 54 | std::string toString() const; |
55 | 55 | ||
56 | enum WinProperty { | 56 | enum WinProperty { |
57 | TITLE, CLASS, NAME, ROLE, | 57 | TITLE, CLASS, NAME, ROLE, TRANSIENT, |
58 | MAXIMIZED, MINIMIZED, SHADED, STUCK, FOCUSHIDDEN, ICONHIDDEN, | 58 | MAXIMIZED, MINIMIZED, SHADED, STUCK, FOCUSHIDDEN, ICONHIDDEN, |
59 | WORKSPACE, HEAD, LAYER | 59 | WORKSPACE, HEAD, LAYER |
60 | }; | 60 | }; |
diff --git a/src/Focusable.hh b/src/Focusable.hh index e02e0d7..cd2ad49 100644 --- a/src/Focusable.hh +++ b/src/Focusable.hh | |||
@@ -84,9 +84,12 @@ public: | |||
84 | virtual const std::string &getWMClassClass() const { return m_class_name; } | 84 | virtual const std::string &getWMClassClass() const { return m_class_name; } |
85 | /// @return WM_CLASS name string (for pattern matching) | 85 | /// @return WM_CLASS name string (for pattern matching) |
86 | virtual const std::string &getWMClassName() const { return m_instance_name; } | 86 | virtual const std::string &getWMClassName() const { return m_instance_name; } |
87 | /// @return wm role string ( for pattern matching) | 87 | /// @return wm role string (for pattern matching) |
88 | virtual std::string getWMRole() const { return "Focusable"; } | 88 | virtual std::string getWMRole() const { return "Focusable"; } |
89 | 89 | ||
90 | /// @return whether this window is a transient (for pattern matching) | ||
91 | virtual bool isTransient() const { return false; } | ||
92 | |||
90 | // so we can make nice buttons, menu entries, etc. | 93 | // so we can make nice buttons, menu entries, etc. |
91 | /// @return icon pixmap of the focusable | 94 | /// @return icon pixmap of the focusable |
92 | virtual const FbTk::PixmapWithMask &icon() const { return m_icon; } | 95 | virtual const FbTk::PixmapWithMask &icon() const { return m_icon; } |
diff --git a/src/Remember.cc b/src/Remember.cc index fbb4a2e..d8f1d83 100644 --- a/src/Remember.cc +++ b/src/Remember.cc | |||
@@ -339,6 +339,7 @@ Application * Remember::add(WinClient &winclient) { | |||
339 | p->addTerm(win_class, ClientPattern::CLASS); | 339 | p->addTerm(win_class, ClientPattern::CLASS); |
340 | if (!win_role.empty()) | 340 | if (!win_role.empty()) |
341 | p->addTerm(win_role, ClientPattern::ROLE); | 341 | p->addTerm(win_role, ClientPattern::ROLE); |
342 | p->addTerm(winclient.isTransient() ? "yes" : "no", ClientPattern::TRANSIENT); | ||
342 | m_clients[&winclient] = app; | 343 | m_clients[&winclient] = app; |
343 | p->addMatch(); | 344 | p->addMatch(); |
344 | m_pats->push_back(make_pair(p, app)); | 345 | m_pats->push_back(make_pair(p, app)); |
@@ -594,7 +595,7 @@ void Remember::reconfigure() { | |||
594 | '[', ']'); | 595 | '[', ']'); |
595 | 596 | ||
596 | if (pos > 0 && strcasecmp(key.c_str(), "app") == 0) { | 597 | if (pos > 0 && strcasecmp(key.c_str(), "app") == 0) { |
597 | ClientPattern *pat = new ClientPattern(line.c_str() + pos); | 598 | ClientPattern *pat = new ClientPattern(line.c_str() + pos, true); |
598 | if (!in_group) { | 599 | if (!in_group) { |
599 | if ((err = pat->error()) == 0) { | 600 | if ((err = pat->error()) == 0) { |
600 | Application *app = findMatchingPatterns(pat, old_pats, false); | 601 | Application *app = findMatchingPatterns(pat, old_pats, false); |
@@ -620,7 +621,7 @@ void Remember::reconfigure() { | |||
620 | } else if (pos > 0 && strcasecmp(key.c_str(), "group") == 0) { | 621 | } else if (pos > 0 && strcasecmp(key.c_str(), "group") == 0) { |
621 | in_group = true; | 622 | in_group = true; |
622 | if (line.find('(') != string::npos) | 623 | if (line.find('(') != string::npos) |
623 | pat = new ClientPattern(line.c_str() + pos); | 624 | pat = new ClientPattern(line.c_str() + pos, true); |
624 | } else if (in_group) { | 625 | } else if (in_group) { |
625 | // otherwise assume that it is the start of the attributes | 626 | // otherwise assume that it is the start of the attributes |
626 | Application *app = 0; | 627 | Application *app = 0; |
@@ -1020,13 +1021,6 @@ void Remember::forgetAttrib(WinClient &winclient, Attribute attrib) { | |||
1020 | 1021 | ||
1021 | void Remember::setupFrame(FluxboxWindow &win) { | 1022 | void Remember::setupFrame(FluxboxWindow &win) { |
1022 | WinClient &winclient = win.winClient(); | 1023 | WinClient &winclient = win.winClient(); |
1023 | // we don't touch the window if it is a transient | ||
1024 | // of something else | ||
1025 | |||
1026 | |||
1027 | if (winclient.transientFor()) | ||
1028 | return; | ||
1029 | |||
1030 | Application *app = find(winclient); | 1024 | Application *app = find(winclient); |
1031 | if (app == 0) | 1025 | if (app == 0) |
1032 | return; // nothing to do | 1026 | return; // nothing to do |
@@ -1123,8 +1117,7 @@ void Remember::setupFrame(FluxboxWindow &win) { | |||
1123 | void Remember::setupClient(WinClient &winclient) { | 1117 | void Remember::setupClient(WinClient &winclient) { |
1124 | 1118 | ||
1125 | // leave windows alone on restart | 1119 | // leave windows alone on restart |
1126 | // don't apply settings to transient windows | 1120 | if (winclient.screen().isRestart()) |
1127 | if (winclient.screen().isRestart() || winclient.transientFor()) | ||
1128 | return; | 1121 | return; |
1129 | 1122 | ||
1130 | Application *app = find(winclient); | 1123 | Application *app = find(winclient); |
diff --git a/src/Window.cc b/src/Window.cc index a5cf6fd..27bc7ec 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -3636,6 +3636,10 @@ std::string FluxboxWindow::getWMRole() const { | |||
3636 | return (m_client ? m_client->getWMRole() : "FluxboxWindow"); | 3636 | return (m_client ? m_client->getWMRole() : "FluxboxWindow"); |
3637 | } | 3637 | } |
3638 | 3638 | ||
3639 | bool FluxboxWindow::isTransient() const { | ||
3640 | return (m_client && m_client->isTransient()); | ||
3641 | } | ||
3642 | |||
3639 | int FluxboxWindow::normalX() const { | 3643 | int FluxboxWindow::normalX() const { |
3640 | if (maximized & MAX_HORZ) | 3644 | if (maximized & MAX_HORZ) |
3641 | return m_old_pos_x; | 3645 | return m_old_pos_x; |
diff --git a/src/Window.hh b/src/Window.hh index d001284..3a87463 100644 --- a/src/Window.hh +++ b/src/Window.hh | |||
@@ -435,6 +435,7 @@ public: | |||
435 | const std::string &getWMClassName() const; | 435 | const std::string &getWMClassName() const; |
436 | const std::string &getWMClassClass() const; | 436 | const std::string &getWMClassClass() const; |
437 | std::string getWMRole() const; | 437 | std::string getWMRole() const; |
438 | bool isTransient() const; | ||
438 | 439 | ||
439 | inline int x() const { return frame().x(); } | 440 | inline int x() const { return frame().x(); } |
440 | inline int y() const { return frame().y(); } | 441 | inline int y() const { return frame().y(); } |