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()
This commit is contained in:
parent
e480255a79
commit
3d7b466e7a
5 changed files with 15 additions and 2 deletions
|
@ -52,7 +52,7 @@ IconButton::IconButton(const FbTk::FbWindow &parent,
|
||||||
m_theme(win, focused_theme, unfocused_theme),
|
m_theme(win, focused_theme, unfocused_theme),
|
||||||
m_pm(win.screen().imageControl()) {
|
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);
|
m_title_update_timer.fireOnce(true);
|
||||||
FbTk::RefCount<FbTk::Command<void> > ets(new FbTk::SimpleCommand<IconButton>(*this, &IconButton::clientTitleChanged));
|
FbTk::RefCount<FbTk::Command<void> > ets(new FbTk::SimpleCommand<IconButton>(*this, &IconButton::clientTitleChanged));
|
||||||
m_title_update_timer.setCommand(ets);
|
m_title_update_timer.setCommand(ets);
|
||||||
|
|
|
@ -70,6 +70,8 @@ public:
|
||||||
|
|
||||||
const FbTk::Signal<> &titleChanged() { return m_title_changed; }
|
const FbTk::Signal<> &titleChanged() { return m_title_changed; }
|
||||||
|
|
||||||
|
static unsigned int updateLaziness() { return 100 * FbTk::FbTime::IN_MILLISECONDS; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void drawText(int x, int y, FbTk::FbDrawable *drawable_override);
|
void drawText(int x, int y, FbTk::FbDrawable *drawable_override);
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -288,7 +288,7 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme,
|
||||||
m_tracker.join(screen.reconfigureSig(),
|
m_tracker.join(screen.reconfigureSig(),
|
||||||
FbTk::MemFunIgnoreArgs(*this, &IconbarTool::updateIconifiedPattern));
|
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);
|
m_resizeSig_timer.fireOnce(true);
|
||||||
FbTk::RefCount<FbTk::Command<void> > ers(new FbTk::SimpleCommand<IconbarTool>(*this, &IconbarTool::emitResizeSig));
|
FbTk::RefCount<FbTk::Command<void> > ers(new FbTk::SimpleCommand<IconbarTool>(*this, &IconbarTool::emitResizeSig));
|
||||||
m_resizeSig_timer.setCommand(ers);
|
m_resizeSig_timer.setCommand(ers);
|
||||||
|
|
|
@ -449,6 +449,11 @@ void FluxboxWindow::init() {
|
||||||
m_tabActivationTimer.setCommand(activate_tab_cmd);
|
m_tabActivationTimer.setCommand(activate_tab_cmd);
|
||||||
m_tabActivationTimer.fireOnce(true);
|
m_tabActivationTimer.fireOnce(true);
|
||||||
|
|
||||||
|
m_reposLabels_timer.setTimeout(IconButton::updateLaziness());
|
||||||
|
m_reposLabels_timer.fireOnce(true);
|
||||||
|
FbTk::RefCount<FbTk::Command<void> > elrs(new FbTk::SimpleCommand<FluxboxWindow>(*this, &FluxboxWindow::emitLabelReposSig));
|
||||||
|
m_reposLabels_timer.setCommand(elrs);
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/* Read state above here, apply state below here. */
|
/* Read state above here, apply state below here. */
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
|
@ -2851,6 +2856,10 @@ void FluxboxWindow::setTitle(const std::string& title, Focusable &client) {
|
||||||
frame().setFocusTitle(title);
|
frame().setFocusTitle(title);
|
||||||
// relay title to others that display the focus title
|
// relay title to others that display the focus title
|
||||||
titleSig().emit(title, *this);
|
titleSig().emit(title, *this);
|
||||||
|
m_reposLabels_timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FluxboxWindow::emitLabelReposSig() {
|
||||||
frame().tabcontainer().repositionItems();
|
frame().tabcontainer().repositionItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -576,6 +576,8 @@ private:
|
||||||
WinClient *m_client; ///< current client
|
WinClient *m_client; ///< current client
|
||||||
typedef std::map<WinClient *, IconButton *> Client2ButtonMap;
|
typedef std::map<WinClient *, IconButton *> Client2ButtonMap;
|
||||||
Client2ButtonMap m_labelbuttons;
|
Client2ButtonMap m_labelbuttons;
|
||||||
|
FbTk::Timer m_reposLabels_timer;
|
||||||
|
void emitLabelReposSig();
|
||||||
bool m_has_tooltip;
|
bool m_has_tooltip;
|
||||||
|
|
||||||
SizeHints m_size_hint;
|
SizeHints m_size_hint;
|
||||||
|
|
Loading…
Reference in a new issue