aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2016-11-20 07:43:26 (GMT)
committerThomas Lübking <thomas.luebking@gmail.com>2016-11-20 13:08:25 (GMT)
commit3d7b466e7aff343dee152d4937d824d2860aac6b (patch)
tree08af9674bc83ccdf8e7a3154879ac1fb822987b5 /src
parente480255a7974cdc4b5cf0016169ed8347b2f431a (diff)
downloadfluxbox-3d7b466e7aff343dee152d4937d824d2860aac6b.zip
fluxbox-3d7b466e7aff343dee152d4937d824d2860aac6b.tar.bz2
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()
Diffstat (limited to 'src')
-rw-r--r--src/IconButton.cc2
-rw-r--r--src/IconButton.hh2
-rw-r--r--src/IconbarTool.cc2
-rw-r--r--src/Window.cc9
-rw-r--r--src/Window.hh2
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,
52 m_theme(win, focused_theme, unfocused_theme), 52 m_theme(win, focused_theme, unfocused_theme),
53 m_pm(win.screen().imageControl()) { 53 m_pm(win.screen().imageControl()) {
54 54
55 m_title_update_timer.setTimeout(100 * FbTk::FbTime::IN_MILLISECONDS); 55 m_title_update_timer.setTimeout(updateLaziness());
56 m_title_update_timer.fireOnce(true); 56 m_title_update_timer.fireOnce(true);
57 FbTk::RefCount<FbTk::Command<void> > ets(new FbTk::SimpleCommand<IconButton>(*this, &IconButton::clientTitleChanged)); 57 FbTk::RefCount<FbTk::Command<void> > ets(new FbTk::SimpleCommand<IconButton>(*this, &IconButton::clientTitleChanged));
58 m_title_update_timer.setCommand(ets); 58 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:
70 70
71 const FbTk::Signal<> &titleChanged() { return m_title_changed; } 71 const FbTk::Signal<> &titleChanged() { return m_title_changed; }
72 72
73 static unsigned int updateLaziness() { return 100 * FbTk::FbTime::IN_MILLISECONDS; }
74
73protected: 75protected:
74 void drawText(int x, int y, FbTk::FbDrawable *drawable_override); 76 void drawText(int x, int y, FbTk::FbDrawable *drawable_override);
75private: 77private:
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,
288 m_tracker.join(screen.reconfigureSig(), 288 m_tracker.join(screen.reconfigureSig(),
289 FbTk::MemFunIgnoreArgs(*this, &IconbarTool::updateIconifiedPattern)); 289 FbTk::MemFunIgnoreArgs(*this, &IconbarTool::updateIconifiedPattern));
290 290
291 m_resizeSig_timer.setTimeout(100 * FbTk::FbTime::IN_MILLISECONDS); 291 m_resizeSig_timer.setTimeout(IconButton::updateLaziness());
292 m_resizeSig_timer.fireOnce(true); 292 m_resizeSig_timer.fireOnce(true);
293 FbTk::RefCount<FbTk::Command<void> > ers(new FbTk::SimpleCommand<IconbarTool>(*this, &IconbarTool::emitResizeSig)); 293 FbTk::RefCount<FbTk::Command<void> > ers(new FbTk::SimpleCommand<IconbarTool>(*this, &IconbarTool::emitResizeSig));
294 m_resizeSig_timer.setCommand(ers); 294 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() {
449 m_tabActivationTimer.setCommand(activate_tab_cmd); 449 m_tabActivationTimer.setCommand(activate_tab_cmd);
450 m_tabActivationTimer.fireOnce(true); 450 m_tabActivationTimer.fireOnce(true);
451 451
452 m_reposLabels_timer.setTimeout(IconButton::updateLaziness());
453 m_reposLabels_timer.fireOnce(true);
454 FbTk::RefCount<FbTk::Command<void> > elrs(new FbTk::SimpleCommand<FluxboxWindow>(*this, &FluxboxWindow::emitLabelReposSig));
455 m_reposLabels_timer.setCommand(elrs);
456
452 /**************************************************/ 457 /**************************************************/
453 /* Read state above here, apply state below here. */ 458 /* Read state above here, apply state below here. */
454 /**************************************************/ 459 /**************************************************/
@@ -2851,6 +2856,10 @@ void FluxboxWindow::setTitle(const std::string& title, Focusable &client) {
2851 frame().setFocusTitle(title); 2856 frame().setFocusTitle(title);
2852 // relay title to others that display the focus title 2857 // relay title to others that display the focus title
2853 titleSig().emit(title, *this); 2858 titleSig().emit(title, *this);
2859 m_reposLabels_timer.start();
2860}
2861
2862void FluxboxWindow::emitLabelReposSig() {
2854 frame().tabcontainer().repositionItems(); 2863 frame().tabcontainer().repositionItems();
2855} 2864}
2856 2865
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:
576 WinClient *m_client; ///< current client 576 WinClient *m_client; ///< current client
577 typedef std::map<WinClient *, IconButton *> Client2ButtonMap; 577 typedef std::map<WinClient *, IconButton *> Client2ButtonMap;
578 Client2ButtonMap m_labelbuttons; 578 Client2ButtonMap m_labelbuttons;
579 FbTk::Timer m_reposLabels_timer;
580 void emitLabelReposSig();
579 bool m_has_tooltip; 581 bool m_has_tooltip;
580 582
581 SizeHints m_size_hint; 583 SizeHints m_size_hint;