From 070a216aa88ed56d391db8b73e7e9356e90742bb Mon Sep 17 00:00:00 2001 From: simonb Date: Wed, 7 Sep 2005 16:46:17 +0000 Subject: Add titlebar scrolling options (thanks Krzysiek Pawlik ) New init options added: session.screenN.windowScrollAction: Shade|NextTab - set the action that happens when scrolling on the titlebar session.screenN.windowScrollReverse: true|false - reverse the action direction --- ChangeLog | 8 ++++++++ src/Screen.cc | 5 ++++- src/Screen.hh | 5 +++++ src/Window.cc | 30 ++++++++++++++++++++++++++++++ src/Window.hh | 4 ++++ 5 files changed, 51 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cc90829..76cd349 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ (Format: Year/Month/Day) Changes for 0.9.14: +*05/09/08: + * Add titlebar scrolling options (thanks Krzysiek Pawlik ) + New init options: + session.screenN.windowScrollAction: Shade|NextTab + - set the action that happens when scrolling on the titlebar + session.screenN.windowScrollReverse: true|false + - reverse the action direction + Screen.hh/cc Window.hh/cc *05/09/04: * Added Feature Request #1084510 (Mathias) When Mod1 + LeftMouse are clicked on a Window and the mouse is not diff --git a/src/Screen.cc b/src/Screen.cc index 6d30cef..4433000 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -202,7 +202,10 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm, gc_cap_style(rm, FbTk::GContext::CAPNOTLAST, scrname+".overlay.capStyle", - altscrname+".overlay.CapStyle") { + altscrname+".overlay.CapStyle"), + scroll_action(rm, "", scrname+".windowScrollAction", altscrname+".WindowScrollAction"), + scroll_reverse(rm, false, scrname+".windowScrollReverse", altscrname+".WindowScrollReverse") { + } diff --git a/src/Screen.hh b/src/Screen.hh index 3316fab..bac0f29 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -141,6 +141,9 @@ public: inline FollowModel getFollowModel() const { return *resource.follow_model; } + inline const std::string &getScrollAction() const { return *resource.scroll_action; } + inline const bool getScrollReverse() const { return *resource.scroll_reverse; } + inline Slit *slit() { return m_slit.get(); } inline const Slit *slit() const { return m_slit.get(); } @@ -465,6 +468,8 @@ private: FbTk::Resource gc_line_style; FbTk::Resource gc_join_style; FbTk::Resource gc_cap_style; + FbTk::Resource scroll_action; + FbTk::Resource scroll_reverse; } resource; diff --git a/src/Window.cc b/src/Window.cc index 93fbea7..12f40fb 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -1788,6 +1788,19 @@ void FluxboxWindow::shade() { } +void FluxboxWindow::shadeOn() { + + if (!shaded) + shade(); + +} + +void FluxboxWindow::shadeOff() { + + if (shaded) + shade(); + +} void FluxboxWindow::stick() { @@ -3752,6 +3765,10 @@ void FluxboxWindow::setupWindow() { CommandRef maximize_horiz_cmd(new WindowCmd(*this, &FluxboxWindow::maximizeHorizontal)); CommandRef close_cmd(new WindowCmd(*this, &FluxboxWindow::close)); CommandRef shade_cmd(new WindowCmd(*this, &FluxboxWindow::shade)); + CommandRef shade_on_cmd(new WindowCmd(*this, &FluxboxWindow::shadeOn)); + CommandRef shade_off_cmd(new WindowCmd(*this, &FluxboxWindow::shadeOff)); + CommandRef next_tab_cmd(new WindowCmd(*this, &FluxboxWindow::nextClient)); + CommandRef prev_tab_cmd(new WindowCmd(*this, &FluxboxWindow::prevClient)); CommandRef raise_cmd(new WindowCmd(*this, &FluxboxWindow::raise)); CommandRef lower_cmd(new WindowCmd(*this, &FluxboxWindow::lower)); CommandRef raise_and_focus_cmd(new WindowCmd(*this, &FluxboxWindow::raiseAndFocus)); @@ -3837,6 +3854,19 @@ void FluxboxWindow::setupWindow() { frame().setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1 frame().setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3 frame().setOnClickTitlebar(lower_cmd, 2); // on release with button 2 + + int reverse = 0; + if (screen().getScrollReverse()) + reverse = 1; + + if (StringUtil::strcasestr(screen().getScrollAction(), std::string("shade")) == 0) { + frame().setOnClickTitlebar(shade_on_cmd, 5 - reverse); // shade on mouse roll + frame().setOnClickTitlebar(shade_off_cmd, 4 + reverse); // unshade if rolled oposite direction + } else if (StringUtil::strcasestr(screen().getScrollAction(), std::string("nexttab")) == 0) { + frame().setOnClickTitlebar(next_tab_cmd, 5 - reverse); // next tab + frame().setOnClickTitlebar(prev_tab_cmd, 4 + reverse); // previous tab + } + frame().setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval()); // end setup frame diff --git a/src/Window.hh b/src/Window.hh index b4fcdfb..176f623 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -208,6 +208,10 @@ public: void maximizeFull(); /// toggles shade void shade(); + /// shades window + void shadeOn(); + /// unshades window + void shadeOff(); /// toggles sticky void stick(); void raise(); -- cgit v0.11.2