diff options
author | Thomas Lübking <thomas.luebking@gmail.com> | 2016-08-13 14:37:57 (GMT) |
---|---|---|
committer | Mathias Gumz <akira@fluxbox.org> | 2016-09-03 17:29:52 (GMT) |
commit | 3058861f8977374dff1ed6401bbdac9cce92bc99 (patch) | |
tree | 9250463d6421c52b92b7bfc8f7a3e28311473235 | |
parent | e99d940f407d37f31ecda0f4878a161bfc479a46 (diff) | |
download | fluxbox-3058861f8977374dff1ed6401bbdac9cce92bc99.zip fluxbox-3058861f8977374dff1ed6401bbdac9cce92bc99.tar.bz2 |
indicate iconified windows in iconbar
-rw-r--r-- | src/IconButton.cc | 10 | ||||
-rw-r--r-- | src/IconbarTool.cc | 19 | ||||
-rw-r--r-- | src/IconbarTool.hh | 5 |
3 files changed, 33 insertions, 1 deletions
diff --git a/src/IconButton.cc b/src/IconButton.cc index 4b0b423..d8205fb 100644 --- a/src/IconButton.cc +++ b/src/IconButton.cc | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "IconbarTheme.hh" | 25 | #include "IconbarTheme.hh" |
26 | 26 | ||
27 | #include "Screen.hh" | 27 | #include "Screen.hh" |
28 | #include "Window.hh" | ||
28 | 29 | ||
29 | #include "FbTk/App.hh" | 30 | #include "FbTk/App.hh" |
30 | #include "FbTk/Command.hh" | 31 | #include "FbTk/Command.hh" |
@@ -58,6 +59,10 @@ IconButton::IconButton(const FbTk::FbWindow &parent, | |||
58 | m_signals.join(m_win.titleSig(), | 59 | m_signals.join(m_win.titleSig(), |
59 | MemFunIgnoreArgs(m_title_update_timer, &FbTk::Timer::start)); | 60 | MemFunIgnoreArgs(m_title_update_timer, &FbTk::Timer::start)); |
60 | 61 | ||
62 | if (m_win.fbwindow()) | ||
63 | m_signals.join(m_win.fbwindow()->stateSig(), | ||
64 | MemFunIgnoreArgs(*this, &IconButton::clientTitleChanged)); | ||
65 | |||
61 | m_signals.join(m_win.focusSig(), | 66 | m_signals.join(m_win.focusSig(), |
62 | MemFunIgnoreArgs(*this, &IconButton::reconfigAndClear)); | 67 | MemFunIgnoreArgs(*this, &IconButton::reconfigAndClear)); |
63 | 68 | ||
@@ -250,7 +255,10 @@ void IconButton::clientTitleChanged() { | |||
250 | 255 | ||
251 | void IconButton::setupWindow() { | 256 | void IconButton::setupWindow() { |
252 | m_icon_window.clear(); | 257 | m_icon_window.clear(); |
253 | setText(m_win.title()); | 258 | FbTk::FbString title = m_win.title().logical(); |
259 | if (m_win.fbwindow() && m_win.fbwindow()->isIconic()) | ||
260 | title = IconbarTool::iconifiedPrefix() + title + IconbarTool::iconifiedSuffix(); | ||
261 | setText(title); | ||
254 | FbTk::TextButton::clear(); | 262 | FbTk::TextButton::clear(); |
255 | } | 263 | } |
256 | 264 | ||
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index d940b1d..128b71e 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc | |||
@@ -225,6 +225,8 @@ private: | |||
225 | 225 | ||
226 | } // end anonymous namespace | 226 | } // end anonymous namespace |
227 | 227 | ||
228 | std::string IconbarTool::s_iconifiedDecoration[2]; | ||
229 | |||
228 | IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, | 230 | IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, |
229 | FbTk::ThemeProxy<IconbarTheme> &focused_theme, | 231 | FbTk::ThemeProxy<IconbarTheme> &focused_theme, |
230 | FbTk::ThemeProxy<IconbarTheme> &unfocused_theme, | 232 | FbTk::ThemeProxy<IconbarTheme> &unfocused_theme, |
@@ -252,6 +254,8 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, | |||
252 | *screen.layerManager().getLayer(ResourceLayer::MENU)), | 254 | *screen.layerManager().getLayer(ResourceLayer::MENU)), |
253 | m_alpha(255) { | 255 | m_alpha(255) { |
254 | 256 | ||
257 | updateIconifiedPattern(); | ||
258 | |||
255 | // setup mode menu | 259 | // setup mode menu |
256 | setupModeMenu(m_menu, *this); | 260 | setupModeMenu(m_menu, *this); |
257 | _FB_USES_NLS; | 261 | _FB_USES_NLS; |
@@ -279,6 +283,8 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, | |||
279 | FbTk::MemFun(*this, &IconbarTool::themeReconfigured)); | 283 | FbTk::MemFun(*this, &IconbarTool::themeReconfigured)); |
280 | m_tracker.join(unfocused_theme.reconfigSig(), | 284 | m_tracker.join(unfocused_theme.reconfigSig(), |
281 | FbTk::MemFun(*this, &IconbarTool::themeReconfigured)); | 285 | FbTk::MemFun(*this, &IconbarTool::themeReconfigured)); |
286 | m_tracker.join(screen.reconfigureSig(), | ||
287 | FbTk::MemFunIgnoreArgs(*this, &IconbarTool::updateIconifiedPattern)); | ||
282 | themeReconfigured(); | 288 | themeReconfigured(); |
283 | } | 289 | } |
284 | 290 | ||
@@ -439,6 +445,19 @@ void IconbarTool::update(UpdateReason reason, Focusable *win) { | |||
439 | renderTheme(); | 445 | renderTheme(); |
440 | } | 446 | } |
441 | 447 | ||
448 | void IconbarTool::updateIconifiedPattern() { | ||
449 | FbTk::Resource<std::string> p(m_screen.resourceManager(), "( %t )", | ||
450 | m_screen.name() + ".iconbar.iconifiedPattern", | ||
451 | m_screen.altName() + ".Iconbar.IconifiedPattern"); | ||
452 | size_t tidx = p->find("%t"); | ||
453 | s_iconifiedDecoration[0].clear(); | ||
454 | s_iconifiedDecoration[1].clear(); | ||
455 | if (tidx != std::string::npos) { | ||
456 | s_iconifiedDecoration[0] = p->substr(0, tidx); | ||
457 | s_iconifiedDecoration[1] = p->substr(tidx+2); | ||
458 | } | ||
459 | } | ||
460 | |||
442 | void IconbarTool::insertWindow(Focusable &win, int pos) { | 461 | void IconbarTool::insertWindow(Focusable &win, int pos) { |
443 | IconButton *button = 0; | 462 | IconButton *button = 0; |
444 | 463 | ||
diff --git a/src/IconbarTool.hh b/src/IconbarTool.hh index 21c8078..6044005 100644 --- a/src/IconbarTool.hh +++ b/src/IconbarTool.hh | |||
@@ -68,6 +68,8 @@ public: | |||
68 | 68 | ||
69 | void setOrientation(FbTk::Orientation orient); | 69 | void setOrientation(FbTk::Orientation orient); |
70 | FbTk::Container::Alignment alignment() const { return m_icon_container.alignment(); } | 70 | FbTk::Container::Alignment alignment() const { return m_icon_container.alignment(); } |
71 | static std::string &iconifiedPrefix() { return s_iconifiedDecoration[0]; } | ||
72 | static std::string &iconifiedSuffix() { return s_iconifiedDecoration[1]; } | ||
71 | 73 | ||
72 | const BScreen &screen() const { return m_screen; } | 74 | const BScreen &screen() const { return m_screen; } |
73 | private: | 75 | private: |
@@ -98,6 +100,8 @@ private: | |||
98 | /// called when the list emits a signal | 100 | /// called when the list emits a signal |
99 | void update(UpdateReason reason, Focusable *win); | 101 | void update(UpdateReason reason, Focusable *win); |
100 | 102 | ||
103 | void updateIconifiedPattern(); | ||
104 | |||
101 | void themeReconfigured(); | 105 | void themeReconfigured(); |
102 | 106 | ||
103 | BScreen &m_screen; | 107 | BScreen &m_screen; |
@@ -118,6 +122,7 @@ private: | |||
118 | FbTk::Resource<bool> m_rc_use_pixmap; ///< if iconbar should use win pixmap or not | 122 | FbTk::Resource<bool> m_rc_use_pixmap; ///< if iconbar should use win pixmap or not |
119 | FbMenu m_menu; | 123 | FbMenu m_menu; |
120 | int m_alpha; | 124 | int m_alpha; |
125 | static std::string s_iconifiedDecoration[2]; | ||
121 | }; | 126 | }; |
122 | 127 | ||
123 | #endif // ICONBARTOOL_HH | 128 | #endif // ICONBARTOOL_HH |