aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2016-08-03 21:55:26 (GMT)
committerThomas Lübking <thomas.luebking@gmail.com>2016-08-06 15:09:29 (GMT)
commit59d9b0703ba8efb24893528f2eb9c84aaa8f5f83 (patch)
tree30fd4de07fa1fdaaac4420c218e7fae3ff3a0382 /src
parenta8b0b3632b4ed6e6fb5f8aa26a6c0ef151a30144 (diff)
downloadfluxbox-59d9b0703ba8efb24893528f2eb9c84aaa8f5f83.zip
fluxbox-59d9b0703ba8efb24893528f2eb9c84aaa8f5f83.tar.bz2
delay title updates
Notably shells will cause brief interim titles when calling short-lived commands (try "ls"...) This covers such by waiting 100ms after every title update before reacting (the title will have returned in the mentioned cases, the UI remains steady)
Diffstat (limited to 'src')
-rw-r--r--src/IconButton.cc6
-rw-r--r--src/IconButton.hh2
-rw-r--r--src/WinClient.cc11
-rw-r--r--src/WinClient.hh3
4 files changed, 20 insertions, 2 deletions
diff --git a/src/IconButton.cc b/src/IconButton.cc
index d2bf4d3..4997365 100644
--- a/src/IconButton.cc
+++ b/src/IconButton.cc
@@ -51,8 +51,12 @@ IconButton::IconButton(const FbTk::FbWindow &parent,
51 m_theme(win, focused_theme, unfocused_theme), 51 m_theme(win, focused_theme, unfocused_theme),
52 m_pm(win.screen().imageControl()) { 52 m_pm(win.screen().imageControl()) {
53 53
54 m_title_update_timer.setTimeout(100 * FbTk::FbTime::IN_MILLISECONDS);
55 m_title_update_timer.fireOnce(true);
56 FbTk::RefCount<FbTk::Command<void> > ets(new FbTk::SimpleCommand<IconButton>(*this, &IconButton::clientTitleChanged));
57 m_title_update_timer.setCommand(ets);
54 m_signals.join(m_win.titleSig(), 58 m_signals.join(m_win.titleSig(),
55 MemFunIgnoreArgs(*this, &IconButton::clientTitleChanged)); 59 MemFunIgnoreArgs(m_title_update_timer, &FbTk::Timer::start));
56 60
57 m_signals.join(m_win.focusSig(), 61 m_signals.join(m_win.focusSig(),
58 MemFunIgnoreArgs(*this, &IconButton::reconfigAndClear)); 62 MemFunIgnoreArgs(*this, &IconButton::reconfigAndClear));
diff --git a/src/IconButton.hh b/src/IconButton.hh
index 957374e..876cfe2 100644
--- a/src/IconButton.hh
+++ b/src/IconButton.hh
@@ -28,6 +28,7 @@
28#include "FbTk/CachedPixmap.hh" 28#include "FbTk/CachedPixmap.hh"
29#include "FbTk/FbPixmap.hh" 29#include "FbTk/FbPixmap.hh"
30#include "FbTk/TextButton.hh" 30#include "FbTk/TextButton.hh"
31#include "FbTk/Timer.hh"
31#include "FbTk/Signal.hh" 32#include "FbTk/Signal.hh"
32 33
33class IconbarTheme; 34class IconbarTheme;
@@ -92,6 +93,7 @@ private:
92 FbTk::CachedPixmap m_pm; 93 FbTk::CachedPixmap m_pm;
93 FbTk::SignalTracker m_signals; 94 FbTk::SignalTracker m_signals;
94 FbTk::Signal<> m_title_changed; 95 FbTk::Signal<> m_title_changed;
96 FbTk::Timer m_title_update_timer;
95}; 97};
96 98
97#endif // ICONBUTTON_HH 99#endif // ICONBUTTON_HH
diff --git a/src/WinClient.cc b/src/WinClient.cc
index b73f27c..22ee766 100644
--- a/src/WinClient.cc
+++ b/src/WinClient.cc
@@ -119,6 +119,11 @@ WinClient::WinClient(Window win, BScreen &screen, FluxboxWindow *fbwin):
119 s_transient_wait.erase(win); 119 s_transient_wait.erase(win);
120 } 120 }
121 121
122 m_title_update_timer.setTimeout(100 * FbTk::FbTime::IN_MILLISECONDS);
123 m_title_update_timer.fireOnce(true);
124 FbTk::RefCount<FbTk::Command<void> > ets(new FbTk::SimpleCommand<WinClient>(*this, &WinClient::emitTitleSig));
125 m_title_update_timer.setCommand(ets);
126
122 // also check if this window is a transient 127 // also check if this window is a transient
123 // this needs to be done before creating an fbwindow, so this doesn't get 128 // this needs to be done before creating an fbwindow, so this doesn't get
124 // tabbed using the apps file 129 // tabbed using the apps file
@@ -314,13 +319,17 @@ void WinClient::updateTitle() {
314 return; 319 return;
315 320
316 m_title.setLogical(FbTk::FbString(Xutil::getWMName(window()), 0, 512)); 321 m_title.setLogical(FbTk::FbString(Xutil::getWMName(window()), 0, 512));
322 m_title_update_timer.start();
323}
324
325void WinClient::emitTitleSig() {
317 titleSig().emit(m_title.logical(), *this); 326 titleSig().emit(m_title.logical(), *this);
318} 327}
319 328
320void WinClient::setTitle(const FbTk::FbString &title) { 329void WinClient::setTitle(const FbTk::FbString &title) {
321 m_title.setLogical(title); 330 m_title.setLogical(title);
322 m_title_override = true; 331 m_title_override = true;
323 titleSig().emit(m_title.logical(), *this); 332 m_title_update_timer.start();
324} 333}
325 334
326void WinClient::setIcon(const FbTk::PixmapWithMask& pm) { 335void WinClient::setIcon(const FbTk::PixmapWithMask& pm) {
diff --git a/src/WinClient.hh b/src/WinClient.hh
index 5a29a5e..c46bddf 100644
--- a/src/WinClient.hh
+++ b/src/WinClient.hh
@@ -149,6 +149,9 @@ private:
149 // some transient (or us) is no longer modal 149 // some transient (or us) is no longer modal
150 void removeModal() { --m_modal_count; } 150 void removeModal() { --m_modal_count; }
151 151
152 FbTk::Timer m_title_update_timer;
153 void emitTitleSig();
154
152 // number of transients which we are modal for 155 // number of transients which we are modal for
153 int m_modal_count; 156 int m_modal_count;
154 bool m_modal; 157 bool m_modal;