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)
Thomas Lübking thomas.luebking@gmail.com
4 files changed,
20 insertions(+),
2 deletions(-)
M
src/IconButton.cc
→
src/IconButton.cc
@@ -51,8 +51,12 @@ m_has_tooltip(false),
m_theme(win, focused_theme, unfocused_theme), m_pm(win.screen().imageControl()) { + m_title_update_timer.setTimeout(100 * FbTk::FbTime::IN_MILLISECONDS); + m_title_update_timer.fireOnce(true); + FbTk::RefCount<FbTk::Command<void> > ets(new FbTk::SimpleCommand<IconButton>(*this, &IconButton::clientTitleChanged)); + m_title_update_timer.setCommand(ets); m_signals.join(m_win.titleSig(), - MemFunIgnoreArgs(*this, &IconButton::clientTitleChanged)); + MemFunIgnoreArgs(m_title_update_timer, &FbTk::Timer::start)); m_signals.join(m_win.focusSig(), MemFunIgnoreArgs(*this, &IconButton::reconfigAndClear));
M
src/IconButton.hh
→
src/IconButton.hh
@@ -28,6 +28,7 @@
#include "FbTk/CachedPixmap.hh" #include "FbTk/FbPixmap.hh" #include "FbTk/TextButton.hh" +#include "FbTk/Timer.hh" #include "FbTk/Signal.hh" class IconbarTheme;@@ -92,6 +93,7 @@ // cached pixmaps
FbTk::CachedPixmap m_pm; FbTk::SignalTracker m_signals; FbTk::Signal<> m_title_changed; + FbTk::Timer m_title_update_timer; }; #endif // ICONBUTTON_HH
M
src/WinClient.cc
→
src/WinClient.cc
@@ -119,6 +119,11 @@ // clear transient waiting list for this window
s_transient_wait.erase(win); } + m_title_update_timer.setTimeout(100 * FbTk::FbTime::IN_MILLISECONDS); + m_title_update_timer.fireOnce(true); + FbTk::RefCount<FbTk::Command<void> > ets(new FbTk::SimpleCommand<WinClient>(*this, &WinClient::emitTitleSig)); + m_title_update_timer.setCommand(ets); + // also check if this window is a transient // this needs to be done before creating an fbwindow, so this doesn't get // tabbed using the apps file@@ -314,13 +319,17 @@ if (m_title_override)
return; m_title.setLogical(FbTk::FbString(Xutil::getWMName(window()), 0, 512)); + m_title_update_timer.start(); +} + +void WinClient::emitTitleSig() { titleSig().emit(m_title.logical(), *this); } void WinClient::setTitle(const FbTk::FbString &title) { m_title.setLogical(title); m_title_override = true; - titleSig().emit(m_title.logical(), *this); + m_title_update_timer.start(); } void WinClient::setIcon(const FbTk::PixmapWithMask& pm) {
M
src/WinClient.hh
→
src/WinClient.hh
@@ -149,6 +149,9 @@ void addModal() { ++m_modal_count; }
// some transient (or us) is no longer modal void removeModal() { --m_modal_count; } + FbTk::Timer m_title_update_timer; + void emitTitleSig(); + // number of transients which we are modal for int m_modal_count; bool m_modal;