diff options
author | Jim Ramsay <jim.ramsay@motorola.com> | 2010-05-28 17:22:13 (GMT) |
---|---|---|
committer | Jim Ramsay <jim.ramsay@motorola.com> | 2010-05-28 19:10:28 (GMT) |
commit | cdbaf5c04d07e8310c661e12e354724a619e5911 (patch) | |
tree | 5e39e64b2caa4ff79cce2749ba1331574b06673b /src | |
parent | 769130f51a8f670ba46dac50d7602f6b936c9dc1 (diff) | |
download | fluxbox-cdbaf5c04d07e8310c661e12e354724a619e5911.zip fluxbox-cdbaf5c04d07e8310c661e12e354724a619e5911.tar.bz2 |
Add new focus model: StrictMouseFocus
This is not actually implemented yet, but from now on, "MouseFocus" means:
Focus follows mouse only when you are moving the mouse, any EnterNotify events
caused by non-mouse operations (window closing, keycommands, changing
desktops) will *not* shift focus
And once fully-implemented, "StrictMouseFocus" will mean:
Focus follows mouse on every EnterNotify event (except when the "ClientMenu"
closes or during alt+tab window cycling)
Diffstat (limited to 'src')
-rw-r--r-- | src/FocusControl.cc | 5 | ||||
-rw-r--r-- | src/FocusControl.hh | 7 | ||||
-rw-r--r-- | src/Screen.cc | 7 |
3 files changed, 15 insertions, 4 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc index 3ba9dc6..eeacc3b 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc | |||
@@ -489,6 +489,7 @@ void FocusControl::revertFocus(BScreen &screen) { | |||
489 | else { | 489 | else { |
490 | switch (screen.focusControl().focusModel()) { | 490 | switch (screen.focusControl().focusModel()) { |
491 | case FocusControl::MOUSEFOCUS: | 491 | case FocusControl::MOUSEFOCUS: |
492 | case FocusControl::STRICTMOUSEFOCUS: | ||
492 | XSetInputFocus(screen.rootWindow().display(), | 493 | XSetInputFocus(screen.rootWindow().display(), |
493 | PointerRoot, None, CurrentTime); | 494 | PointerRoot, None, CurrentTime); |
494 | break; | 495 | break; |
@@ -593,6 +594,8 @@ std::string FbTk::Resource<FocusControl::FocusModel>::getString() const { | |||
593 | switch (m_value) { | 594 | switch (m_value) { |
594 | case FocusControl::MOUSEFOCUS: | 595 | case FocusControl::MOUSEFOCUS: |
595 | return string("MouseFocus"); | 596 | return string("MouseFocus"); |
597 | case FocusControl::STRICTMOUSEFOCUS: | ||
598 | return string("StrictMouseFocus"); | ||
596 | case FocusControl::CLICKFOCUS: | 599 | case FocusControl::CLICKFOCUS: |
597 | return string("ClickFocus"); | 600 | return string("ClickFocus"); |
598 | } | 601 | } |
@@ -605,6 +608,8 @@ void FbTk::Resource<FocusControl::FocusModel>:: | |||
605 | setFromString(char const *strval) { | 608 | setFromString(char const *strval) { |
606 | if (strcasecmp(strval, "MouseFocus") == 0) | 609 | if (strcasecmp(strval, "MouseFocus") == 0) |
607 | m_value = FocusControl::MOUSEFOCUS; | 610 | m_value = FocusControl::MOUSEFOCUS; |
611 | else if (strcasecmp(strval, "StrictMouseFocus") == 0) | ||
612 | m_value = FocusControl::STRICTMOUSEFOCUS; | ||
608 | else if (strcasecmp(strval, "ClickToFocus") == 0) | 613 | else if (strcasecmp(strval, "ClickToFocus") == 0) |
609 | m_value = FocusControl::CLICKFOCUS; | 614 | m_value = FocusControl::CLICKFOCUS; |
610 | else | 615 | else |
diff --git a/src/FocusControl.hh b/src/FocusControl.hh index 91681ab..72eec11 100644 --- a/src/FocusControl.hh +++ b/src/FocusControl.hh | |||
@@ -42,8 +42,9 @@ public: | |||
42 | typedef std::list<Focusable *> Focusables; | 42 | typedef std::list<Focusable *> Focusables; |
43 | /// main focus model | 43 | /// main focus model |
44 | enum FocusModel { | 44 | enum FocusModel { |
45 | MOUSEFOCUS = 0, ///< focus follows mouse | 45 | MOUSEFOCUS = 0, ///< focus follows mouse, but only when the mouse is moving |
46 | CLICKFOCUS ///< focus on click | 46 | CLICKFOCUS, ///< focus on click |
47 | STRICTMOUSEFOCUS ///< focus always follows mouse, even when stationary | ||
47 | }; | 48 | }; |
48 | /// focus model for tabs | 49 | /// focus model for tabs |
49 | enum TabFocusModel { | 50 | enum TabFocusModel { |
@@ -90,7 +91,7 @@ public: | |||
90 | */ | 91 | */ |
91 | void dirFocus(FluxboxWindow &win, FocusDir dir); | 92 | void dirFocus(FluxboxWindow &win, FocusDir dir); |
92 | /// @return true if focus mode is mouse focus | 93 | /// @return true if focus mode is mouse focus |
93 | bool isMouseFocus() const { return focusModel() == MOUSEFOCUS; } | 94 | bool isMouseFocus() const { return focusModel() != CLICKFOCUS; } |
94 | /// @return true if tab focus mode is mouse tab focus | 95 | /// @return true if tab focus mode is mouse tab focus |
95 | bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; } | 96 | bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; } |
96 | 97 | ||
diff --git a/src/Screen.cc b/src/Screen.cc index b712b81..44649c0 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -1555,8 +1555,13 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { | |||
1555 | "Click To Focus", "Click to focus", | 1555 | "Click To Focus", "Click to focus", |
1556 | FocusControl::CLICKFOCUS); | 1556 | FocusControl::CLICKFOCUS); |
1557 | _FOCUSITEM(Configmenu, MouseFocus, | 1557 | _FOCUSITEM(Configmenu, MouseFocus, |
1558 | "Mouse Focus", "Mouse Focus", | 1558 | "Mouse Focus (Keyboard Friendly)", |
1559 | "Mouse Focus (Keyboard Friendly)", | ||
1559 | FocusControl::MOUSEFOCUS); | 1560 | FocusControl::MOUSEFOCUS); |
1561 | _FOCUSITEM(Configmenu, StrictMouseFocus, | ||
1562 | "Mouse Focus (Strict)", | ||
1563 | "Mouse Focus (Strict)", | ||
1564 | FocusControl::STRICTMOUSEFOCUS); | ||
1560 | #undef _FOCUSITEM | 1565 | #undef _FOCUSITEM |
1561 | 1566 | ||
1562 | focus_menu->insert(new FbTk::MenuSeparator()); | 1567 | focus_menu->insert(new FbTk::MenuSeparator()); |