From c69d5afb64b3ce90190cd5e0515020afb48a8b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Tue, 13 Sep 2016 21:06:40 +0200 Subject: show tooltips for tabs on the run (yes sucks, sorry) fixes a bug where windows were not activated on hovering the tab (for focus-follows-mouse policies) REQUEST: 95 The iconbar already shows tooltips and I doubt the claim that (untabbed) titlebars are "often" too short for the window title. --- src/IconButton.hh | 2 +- src/Window.cc | 16 ++++++++++++---- src/Window.hh | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/IconButton.hh b/src/IconButton.hh index d3cb3d8..4bb57e7 100644 --- a/src/IconButton.hh +++ b/src/IconButton.hh @@ -66,6 +66,7 @@ public: bool setOrientation(FbTk::Orientation orient); virtual unsigned int preferredWidth() const; + void showTooltip(); const FbTk::Signal<> &titleChanged() { return m_title_changed; } @@ -74,7 +75,6 @@ protected: private: void reconfigAndClear(); void setupWindow(); - void showTooltip(); /// Refresh all pixmaps and windows /// @param setup Wether to setup window again. diff --git a/src/Window.cc b/src/Window.cc index 5eaf0d5..1e32bd5 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -2774,10 +2774,13 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) { Fluxbox::instance()->keys()->doAction(ev.type, ev.state, 0, Keys::ON_WINDOW, m_client); - WinClient *client = 0; - if (screen().focusControl().isMouseTabFocus()) { - // determine if we're in a label button (tab) - client = winClientOfLabelButtonWindow(ev.window); + // determine if we're in a label button (tab) + WinClient *client = winClientOfLabelButtonWindow(ev.window); + if (client) { + if (IconButton *tab = m_labelbuttons[client]) { + m_has_tooltip = true; + tab->showTooltip(); + } } if (ev.window == frame().window() || @@ -2818,6 +2821,11 @@ void FluxboxWindow::leaveNotifyEvent(XCrossingEvent &ev) { return; } + if (m_has_tooltip) { + m_has_tooltip = false; + screen().hideTooltip(); + } + // still inside? if (ev.x_root > frame().x() && ev.y_root > frame().y() && ev.x_root <= (int)(frame().x() + frame().width()) && diff --git a/src/Window.hh b/src/Window.hh index b6e56b2..0cfe73a 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -576,6 +576,7 @@ private: WinClient *m_client; ///< current client typedef std::map Client2ButtonMap; Client2ButtonMap m_labelbuttons; + bool m_has_tooltip; SizeHints m_size_hint; struct { -- cgit v0.11.2