From 3d7b466e7aff343dee152d4937d824d2860aac6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 20 Nov 2016 08:43:26 +0100 Subject: delay repositioning of labels The iconbuttons delay their update to cover multiple changes, so if the labels are repositioned early, they'll operate on dated titles BUG: 1155 On the run, centralize the delay value in IconButton::updateLaziness() --- src/IconButton.cc | 2 +- src/IconButton.hh | 2 ++ src/IconbarTool.cc | 2 +- src/Window.cc | 9 +++++++++ src/Window.hh | 2 ++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/IconButton.cc b/src/IconButton.cc index a4cd8af..1290c2a 100644 --- a/src/IconButton.cc +++ b/src/IconButton.cc @@ -52,7 +52,7 @@ IconButton::IconButton(const FbTk::FbWindow &parent, 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.setTimeout(updateLaziness()); m_title_update_timer.fireOnce(true); FbTk::RefCount > ets(new FbTk::SimpleCommand(*this, &IconButton::clientTitleChanged)); m_title_update_timer.setCommand(ets); diff --git a/src/IconButton.hh b/src/IconButton.hh index 4bb57e7..638d195 100644 --- a/src/IconButton.hh +++ b/src/IconButton.hh @@ -70,6 +70,8 @@ public: const FbTk::Signal<> &titleChanged() { return m_title_changed; } + static unsigned int updateLaziness() { return 100 * FbTk::FbTime::IN_MILLISECONDS; } + protected: void drawText(int x, int y, FbTk::FbDrawable *drawable_override); private: diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index 6e561dc..8f8f128 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc @@ -288,7 +288,7 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, m_tracker.join(screen.reconfigureSig(), FbTk::MemFunIgnoreArgs(*this, &IconbarTool::updateIconifiedPattern)); - m_resizeSig_timer.setTimeout(100 * FbTk::FbTime::IN_MILLISECONDS); + m_resizeSig_timer.setTimeout(IconButton::updateLaziness()); m_resizeSig_timer.fireOnce(true); FbTk::RefCount > ers(new FbTk::SimpleCommand(*this, &IconbarTool::emitResizeSig)); m_resizeSig_timer.setCommand(ers); diff --git a/src/Window.cc b/src/Window.cc index 664c0a5..23c9789 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -449,6 +449,11 @@ void FluxboxWindow::init() { m_tabActivationTimer.setCommand(activate_tab_cmd); m_tabActivationTimer.fireOnce(true); + m_reposLabels_timer.setTimeout(IconButton::updateLaziness()); + m_reposLabels_timer.fireOnce(true); + FbTk::RefCount > elrs(new FbTk::SimpleCommand(*this, &FluxboxWindow::emitLabelReposSig)); + m_reposLabels_timer.setCommand(elrs); + /**************************************************/ /* Read state above here, apply state below here. */ /**************************************************/ @@ -2851,6 +2856,10 @@ void FluxboxWindow::setTitle(const std::string& title, Focusable &client) { frame().setFocusTitle(title); // relay title to others that display the focus title titleSig().emit(title, *this); + m_reposLabels_timer.start(); +} + +void FluxboxWindow::emitLabelReposSig() { frame().tabcontainer().repositionItems(); } diff --git a/src/Window.hh b/src/Window.hh index 0cfe73a..407d51b 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -576,6 +576,8 @@ private: WinClient *m_client; ///< current client typedef std::map Client2ButtonMap; Client2ButtonMap m_labelbuttons; + FbTk::Timer m_reposLabels_timer; + void emitLabelReposSig(); bool m_has_tooltip; SizeHints m_size_hint; -- cgit v0.11.2