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:
Thomas Lübking 2016-11-20 08:43:26 +01:00
parent e480255a79
commit 3d7b466e7a
5 changed files with 15 additions and 2 deletions

View file

@ -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<FbTk::Command<void> > ets(new FbTk::SimpleCommand<IconButton>(*this, &IconButton::clientTitleChanged));
m_title_update_timer.setCommand(ets);

View file

@ -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:

View file

@ -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<FbTk::Command<void> > ers(new FbTk::SimpleCommand<IconbarTool>(*this, &IconbarTool::emitResizeSig));
m_resizeSig_timer.setCommand(ers);

View file

@ -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<FbTk::Command<void> > elrs(new FbTk::SimpleCommand<FluxboxWindow>(*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();
}

View file

@ -576,6 +576,8 @@ private:
WinClient *m_client; ///< current client
typedef std::map<WinClient *, IconButton *> Client2ButtonMap;
Client2ButtonMap m_labelbuttons;
FbTk::Timer m_reposLabels_timer;
void emitLabelReposSig();
bool m_has_tooltip;
SizeHints m_size_hint;