aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Ramsay <jim.ramsay@motorola.com>2010-05-28 17:22:13 (GMT)
committerJim Ramsay <jim.ramsay@motorola.com>2010-05-28 19:10:28 (GMT)
commitcdbaf5c04d07e8310c661e12e354724a619e5911 (patch)
tree5e39e64b2caa4ff79cce2749ba1331574b06673b
parent769130f51a8f670ba46dac50d7602f6b936c9dc1 (diff)
downloadfluxbox_paul-cdbaf5c04d07e8310c661e12e354724a619e5911.zip
fluxbox_paul-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)
-rw-r--r--doc/asciidoc/fluxbox.txt6
-rw-r--r--doc/fluxbox.1.in10
-rw-r--r--nls/fluxbox-nls.hh1
-rw-r--r--src/FocusControl.cc5
-rw-r--r--src/FocusControl.hh7
-rw-r--r--src/Screen.cc7
6 files changed, 25 insertions, 11 deletions
diff --git a/doc/asciidoc/fluxbox.txt b/doc/asciidoc/fluxbox.txt
index a324336..22d07ac 100644
--- a/doc/asciidoc/fluxbox.txt
+++ b/doc/asciidoc/fluxbox.txt
@@ -1001,10 +1001,12 @@ This specifies the width of external tabs in pixels.
1001+ 1001+
1002Default: *64* 1002Default: *64*
1003 1003
1004*session.screen0.focusModel*: *ClickToFocus|MouseFocus*:: 1004*session.screen0.focusModel*: *ClickToFocus|MouseFocus|StrictMouseFocus*::
1005This controls how windows gain focus via the mouse. With `ClickToFocus', 1005This controls how windows gain focus via the mouse. With `ClickToFocus',
1006the user must click on the window. With `MouseFocus', windows gain focus 1006the user must click on the window. With `MouseFocus', windows gain focus
1007whenever the mouse moves over them. 1007whenever the mouse moves over them, but only when the mouse is moving. With
1008`StrictMouseFocus', windows gain focus whenever the mouse enters any exposed
1009area, even if this is due to layer changes, window movement, changing desktops, closing windows, etc.
1008+ 1010+
1009Default: *ClickToFocus* 1011Default: *ClickToFocus*
1010 1012
diff --git a/doc/fluxbox.1.in b/doc/fluxbox.1.in
index 7e36b8c..c65545f 100644
--- a/doc/fluxbox.1.in
+++ b/doc/fluxbox.1.in
@@ -1,13 +1,13 @@
1'\" t 1'\" t
2.\" Title: fluxbox 2.\" Title: fluxbox
3.\" Author: [see the "AUTHORS" section] 3.\" Author: [see the "AUTHORS" section]
4.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/> 4.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
5.\" Date: 01/14/2010 5.\" Date: 05/28/2010
6.\" Manual: Fluxbox Manual 6.\" Manual: Fluxbox Manual
7.\" Source: fluxbox.txt 7.\" Source: fluxbox.txt
8.\" Language: English 8.\" Language: English
9.\" 9.\"
10.TH "FLUXBOX" "1" "01/14/2010" "fluxbox\&.txt" "Fluxbox Manual" 10.TH "FLUXBOX" "1" "05/28/2010" "fluxbox\&.txt" "Fluxbox Manual"
11.\" ----------------------------------------------------------------- 11.\" -----------------------------------------------------------------
12.\" * set default formatting 12.\" * set default formatting
13.\" ----------------------------------------------------------------- 13.\" -----------------------------------------------------------------
@@ -1693,9 +1693,9 @@ Default:
1693\fB64\fR 1693\fB64\fR
1694.RE 1694.RE
1695.PP 1695.PP
1696\fBsession\&.screen0\&.focusModel\fR: \fBClickToFocus|MouseFocus\fR 1696\fBsession\&.screen0\&.focusModel\fR: \fBClickToFocus|MouseFocus|StrictMouseFocus\fR
1697.RS 4 1697.RS 4
1698This controls how windows gain focus via the mouse\&. With \(oqClickToFocus\(cq, the user must click on the window\&. With \(oqMouseFocus\(cq, windows gain focus whenever the mouse moves over them\&. 1698This controls how windows gain focus via the mouse\&. With \(oqClickToFocus\(cq, the user must click on the window\&. With \(oqMouseFocus\(cq, windows gain focus whenever the mouse moves over them, but only when the mouse is moving\&. With \(oqStrictMouseFocus\(cq, windows gain focus whenever the mouse enters any exposed area, even if this is due to layer changes, window movement, changing desktops, closing windows, etc\&.
1699.sp 1699.sp
1700Default: 1700Default:
1701\fBClickToFocus\fR 1701\fBClickToFocus\fR
diff --git a/nls/fluxbox-nls.hh b/nls/fluxbox-nls.hh
index 7e461ca..7ddc978 100644
--- a/nls/fluxbox-nls.hh
+++ b/nls/fluxbox-nls.hh
@@ -84,6 +84,7 @@ enum {
84 ConfigmenuMaxIgnoreInc = 27, 84 ConfigmenuMaxIgnoreInc = 27,
85 ConfigmenuMaxDisableMove = 28, 85 ConfigmenuMaxDisableMove = 28,
86 ConfigmenuMaxDisableResize = 29, 86 ConfigmenuMaxDisableResize = 29,
87 ConfigmenuStrictMouseFocus = 30,
87 88
88 EwmhSet = 5, 89 EwmhSet = 5,
89 EwmhOutOfMemoryClientList = 1, 90 EwmhOutOfMemoryClientList = 1,
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>::
605setFromString(char const *strval) { 608setFromString(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());