Add titlebar scrolling options (thanks Krzysiek Pawlik <krzysiek.pawlik__AT__people.pl>) 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
simonb simonb
5 files changed,
51 insertions(+),
1 deletions(-)
M
ChangeLog
→
ChangeLog
@@ -1,5 +1,13 @@
(Format: Year/Month/Day) Changes for 0.9.14: +*05/09/08: + * Add titlebar scrolling options (thanks Krzysiek Pawlik <krzysiek.pawlik__AT__people.pl>) + 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
M
src/Screen.cc
→
src/Screen.cc
@@ -202,7 +202,10 @@ altscrname+".Overlay.JoinStyle"),
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") { + }
M
src/Screen.hh
→
src/Screen.hh
@@ -141,6 +141,9 @@ TabFocusModel getTabFocusModel() const { return *resource.tabfocus_model; }
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 @@ FbTk::Resource<int> gc_line_width;
FbTk::Resource<FbTk::GContext::LineStyle> gc_line_style; FbTk::Resource<FbTk::GContext::JoinStyle> gc_join_style; FbTk::Resource<FbTk::GContext::CapStyle> gc_cap_style; + FbTk::Resource<std::string> scroll_action; + FbTk::Resource<bool> scroll_reverse; } resource;
M
src/Window.cc
→
src/Window.cc
@@ -1788,6 +1788,19 @@ }
} +void FluxboxWindow::shadeOn() { + + if (!shaded) + shade(); + +} + +void FluxboxWindow::shadeOff() { + + if (shaded) + shade(); + +} void FluxboxWindow::stick() {@@ -3752,6 +3765,10 @@ CommandRef maximize_vert_cmd(new WindowCmd(*this, &FluxboxWindow::maximizeVertical));
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 @@ frame().setOnClickTitlebar(raise_and_focus_cmd, 1, false, true); // on press with button 1
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
M
src/Window.hh
→
src/Window.hh
@@ -208,6 +208,10 @@ /// maximizes the window fully
void maximizeFull(); /// toggles shade void shade(); + /// shades window + void shadeOn(); + /// unshades window + void shadeOff(); /// toggles sticky void stick(); void raise();