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
This commit is contained in:
simonb 2005-09-07 16:46:17 +00:00
parent cfb26be269
commit 070a216aa8
5 changed files with 51 additions and 1 deletions

View file

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

View file

@ -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") {
}

View file

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

View file

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

View file

@ -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();