From fe8ff8729299a4fd4371394d3ca9102ece22fefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sat, 13 Aug 2016 10:48:22 +0200 Subject: add autoraising to toolbar and slit --- doc/asciidoc/fluxbox.txt | 20 ++++++++++++++++++++ nls/fluxbox-nls.hh | 1 + src/Slit.cc | 11 +++++++++++ src/Slit.hh | 2 +- src/Toolbar.cc | 12 ++++++++++++ src/Toolbar.hh | 2 +- 6 files changed, 46 insertions(+), 2 deletions(-) diff --git a/doc/asciidoc/fluxbox.txt b/doc/asciidoc/fluxbox.txt index 87bd554..3556f5a 100644 --- a/doc/asciidoc/fluxbox.txt +++ b/doc/asciidoc/fluxbox.txt @@ -604,6 +604,11 @@ All changes take effect immediately. Here are the settings: remaining edge of the toolbar. See the *session.autoRaiseDelay* resource for the delay time. +*Auto raise*::: + If this is enabled the toolbar will elevate after a defined time when the + mouse pointer enters the it. It will fall back when the cursor leaves the + toolbar. See the *session.autoRaiseDelay* resource for the delay time. + *Toolbar width percentage*::: Sets the width of the toolbar in a percentage of your total screen size. Use the left mouse button to decrease and the right mouse-button to increase the @@ -796,6 +801,11 @@ All changes take effect immediately. Here are the settings: remaining edge of the slit. See the *session.autoRaiseDelay* resource for the delay time. +*Auto raise*::: + If this is enabled the slit will elevate after a defined time when the + mouse pointer enters the it. It will fall back when the cursor leaves the + slit. See the *session.autoRaiseDelay* resource for the delay time. + *Maximize Over*::: Enabling this option will allow windows to maximizing over the slit. With this switched off they will only expand to the edge of the slit. This @@ -886,6 +896,16 @@ used actively by the user, or they remain visible at all times. + Default: *False* +*session.screen0.{slit|toolbar}.autoRaise*: 'boolean':: +If enabled, the respective item will elevate to the AboveDock layer when entered +and fall back to its regular layer when left. +Notice that this does *not* implicitly alter the items regular layer or the +workspace padding, ie. if the item is already set to AboveDock this does nothing +and if a mximized window completely covers the item you won't be able to enter, +thus elevate it. ++ +Default: *False* + *session.screen0.{slit|toolbar}.layer*: 'layer':: With these two resources, you can set the layer you want the toolbar and the slit to appear on. Please read the LAYER section for more information. diff --git a/nls/fluxbox-nls.hh b/nls/fluxbox-nls.hh index caba12e..82f10d1 100644 --- a/nls/fluxbox-nls.hh +++ b/nls/fluxbox-nls.hh @@ -54,6 +54,7 @@ enum { CommonVisible = 18, CommonBackgroundWarning = 19, CommonDefaultWindowMenuFile = 20, + CommonAutoRaise = 21, ConfigmenuSet = 4, ConfigmenuAntiAlias = 1, diff --git a/src/Slit.cc b/src/Slit.cc index d03f61b..b628d18 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -235,6 +235,8 @@ Slit::Slit(BScreen &scr, FbTk::Layer &layer, const char *filename) scr.name() + ".slit.acceptKdeDockapps", scr.altName() + ".Slit.AcceptKdeDockapps"), m_rc_auto_hide(scr.resourceManager().lock(), false, scr.name() + ".slit.autoHide", scr.altName() + ".Slit.AutoHide"), + m_rc_auto_raise(scr.resourceManager().lock(), false, + scr.name() + ".slit.autoRaise", scr.altName() + ".Slit.AutoRaise"), // TODO: this resource name must change m_rc_maximize_over(scr.resourceManager(), false, scr.name() + ".slit.maxOver", scr.altName() + ".Slit.MaxOver"), @@ -957,6 +959,9 @@ void Slit::buttonPressEvent(XButtonEvent &be) { void Slit::enterNotifyEvent(XCrossingEvent &) { + if (m_rc_auto_raise) + m_layeritem->moveToLayer(ResourceLayer::ABOVE_DOCK); + if (! doAutoHide()) return; @@ -971,6 +976,9 @@ void Slit::enterNotifyEvent(XCrossingEvent &) { void Slit::leaveNotifyEvent(XCrossingEvent &ev) { + if (m_rc_auto_raise) + m_layeritem->moveToLayer(m_rc_layernum->getNum()); + if (! doAutoHide()) return; @@ -1207,6 +1215,9 @@ void Slit::setupMenu() { m_slitmenu.insertItem(new FbTk::BoolMenuItem(_FB_XTEXT(Common, AutoHide, "Auto hide", "This thing automatically hides when not close by"), m_rc_auto_hide, save_and_reconfigure_slit)); + m_slitmenu.insertItem(new FbTk::BoolMenuItem(_FB_XTEXT(Common, AutoRaise, "Auto raise", "This thing automatically raises when entered"), + m_rc_auto_raise, + save_and_reconfigure_slit)); m_slitmenu.insertItem(new FbTk::BoolMenuItem(_FB_XTEXT(Common, MaximizeOver,"Maximize Over", "Maximize over this thing when maximizing"), m_rc_maximize_over, diff --git a/src/Slit.hh b/src/Slit.hh index cffc087..0b476b5 100644 --- a/src/Slit.hh +++ b/src/Slit.hh @@ -182,7 +182,7 @@ private: static unsigned int s_eventmask; Strut *m_strut; - FbTk::Resource m_rc_kde_dockapp, m_rc_auto_hide, m_rc_maximize_over; + FbTk::Resource m_rc_kde_dockapp, m_rc_auto_hide, m_rc_auto_raise, m_rc_maximize_over; FbTk::Resource m_rc_placement; FbTk::Resource m_rc_alpha, m_rc_on_head; FbTk::Resource m_rc_layernum; diff --git a/src/Toolbar.cc b/src/Toolbar.cc index cb52066..23a8244 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -194,6 +194,8 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::Layer &layer, size_t width): // lock rcmanager here m_rc_auto_hide(scrn.resourceManager().lock(), false, scrn.name() + ".toolbar.autoHide", scrn.altName() + ".Toolbar.AutoHide"), + m_rc_auto_raise(scrn.resourceManager().lock(), false, + scrn.name() + ".toolbar.autoRaise", scrn.altName() + ".Toolbar.AutoRaise"), m_rc_maximize_over(scrn.resourceManager(), false, scrn.name() + ".toolbar.maxOver", scrn.altName() + ".Toolbar.MaxOver"), m_rc_visible(scrn.resourceManager(), true, scrn.name() + ".toolbar.visible", scrn.altName() + ".Toolbar.Visible"), @@ -522,6 +524,9 @@ void Toolbar::buttonPressEvent(XButtonEvent &be) { } void Toolbar::enterNotifyEvent(XCrossingEvent &ce) { + if (m_rc_auto_raise) + m_layeritem.moveToLayer(ResourceLayer::ABOVE_DOCK); + Fluxbox::instance()->keys()->doAction(ce.type, ce.state, 0, Keys::ON_TOOLBAR); @@ -552,6 +557,9 @@ void Toolbar::leaveNotifyEvent(XCrossingEvent &event) { return; } + if (m_rc_auto_raise) + m_layeritem.moveToLayer(m_rc_layernum->getNum()); + Fluxbox::instance()->keys()->doAction(event.type, event.state, 0, Keys::ON_TOOLBAR); @@ -762,6 +770,10 @@ void Toolbar::setupMenus(bool skip_new_placement) { "Auto hide", "Toggle auto hide of toolbar"), m_rc_auto_hide, reconfig_toolbar_and_save_resource)); + menu().insertItem(new FbTk::BoolMenuItem(_FB_XTEXT(Common, AutoRaise, + "Auto raise", "Toggle auto raise of toolbar"), + m_rc_auto_raise, + reconfig_toolbar_and_save_resource)); MenuItem *toolbar_menuitem = new FbTk::IntMenuItem(_FB_XTEXT(Toolbar, WidthPercent, diff --git a/src/Toolbar.hh b/src/Toolbar.hh index a1631bd..47569f6 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh @@ -185,7 +185,7 @@ private: Strut *m_strut; ///< created and destroyed by BScreen // resources - FbTk::Resource m_rc_auto_hide, m_rc_maximize_over, m_rc_visible; + FbTk::Resource m_rc_auto_hide, m_rc_auto_raise, m_rc_maximize_over, m_rc_visible; FbTk::Resource m_rc_width_percent; FbTk::Resource m_rc_alpha; FbTk::Resource m_rc_layernum; -- cgit v0.11.2