aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Ramsay <jim.ramsay@motorola.com>2010-05-28 19:50:15 (GMT)
committerJim Ramsay <jim.ramsay@motorola.com>2010-05-28 19:50:15 (GMT)
commit37a24132b5cd444fca025259f05618eec52935b2 (patch)
treeb6f64add5a665666996857a02150ebe3cac082a7
parentcdbaf5c04d07e8310c661e12e354724a619e5911 (diff)
downloadfluxbox-37a24132b5cd444fca025259f05618eec52935b2.zip
fluxbox-37a24132b5cd444fca025259f05618eec52935b2.tar.bz2
Implement StrictMouseFocus
As noted in the previous commit, StrictMouseFocus now works as advertised: Focus follows mouse on every EnterNotify event (except when the "ClientMenu" closes or during alt+tab window cycling)
-rw-r--r--src/ClientMenu.cc7
-rw-r--r--src/FocusControl.cc19
-rw-r--r--src/FocusControl.hh10
3 files changed, 28 insertions, 8 deletions
diff --git a/src/ClientMenu.cc b/src/ClientMenu.cc
index 02df7e4..67ec374 100644
--- a/src/ClientMenu.cc
+++ b/src/ClientMenu.cc
@@ -25,6 +25,7 @@
25#include "Screen.hh" 25#include "Screen.hh"
26#include "Window.hh" 26#include "Window.hh"
27#include "WindowCmd.hh" 27#include "WindowCmd.hh"
28#include "FocusControl.hh"
28#include <X11/keysym.h> 29#include <X11/keysym.h>
29 30
30#include "FbTk/MenuItem.hh" 31#include "FbTk/MenuItem.hh"
@@ -56,8 +57,12 @@ public:
56 57
57 m_client.focus(); 58 m_client.focus();
58 fbwin->raise(); 59 fbwin->raise();
59 if ((mods & ControlMask) == 0) 60 if ((mods & ControlMask) == 0) {
61 // Ignore any focus changes due to this menu closing
62 // (even in StrictMouseFocus mode)
63 m_client.screen().focusControl().ignoreAtPointer(true);
60 parent->hide(); 64 parent->hide();
65 }
61 } 66 }
62 67
63 const std::string &label() const { return m_client.title(); } 68 const std::string &label() const { return m_client.title(); }
diff --git a/src/FocusControl.cc b/src/FocusControl.cc
index eeacc3b..63ca773 100644
--- a/src/FocusControl.cc
+++ b/src/FocusControl.cc
@@ -401,21 +401,30 @@ void FocusControl::dirFocus(FluxboxWindow &win, FocusDir dir) {
401 401
402} 402}
403 403
404void FocusControl::ignoreAtPointer() 404void FocusControl::ignoreAtPointer(bool force)
405{ 405{
406 int ignore_i; 406 int ignore_i, ignore_x, ignore_y;
407 unsigned int ignore_ui; 407 unsigned int ignore_ui;
408 Window ignore_w; 408 Window ignore_w;
409 409
410 XQueryPointer(m_screen.rootWindow().display(), 410 XQueryPointer(m_screen.rootWindow().display(),
411 m_screen.rootWindow().window(), &ignore_w, &ignore_w, 411 m_screen.rootWindow().window(), &ignore_w, &ignore_w,
412 &m_ignore_mouse_x, &m_ignore_mouse_y, 412 &ignore_x, &ignore_y,
413 &ignore_i, &ignore_i, &ignore_ui); 413 &ignore_i, &ignore_i, &ignore_ui);
414
415 this->ignoreAt(ignore_x, ignore_y, force);
416}
417
418void FocusControl::ignoreAt(int x, int y, bool force)
419{
420 if (force || this->focusModel() == MOUSEFOCUS) {
421 m_ignore_mouse_x = x; m_ignore_mouse_y = y;
422 }
414} 423}
415 424
416void FocusControl::ignoreAt(int x, int y) 425void FocusControl::ignoreCancel()
417{ 426{
418 m_ignore_mouse_x = x; m_ignore_mouse_y = y; 427 m_ignore_mouse_x = m_ignore_mouse_y = -1;
419} 428}
420 429
421bool FocusControl::isIgnored(int x, int y) 430bool FocusControl::isIgnored(int x, int y)
diff --git a/src/FocusControl.hh b/src/FocusControl.hh
index 72eec11..c265253 100644
--- a/src/FocusControl.hh
+++ b/src/FocusControl.hh
@@ -96,9 +96,15 @@ public:
96 bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; } 96 bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; }
97 97
98 /// Set the "ignore" pointer location to the current pointer location 98 /// Set the "ignore" pointer location to the current pointer location
99 void ignoreAtPointer(); 99 /// @param force If true, ignore even in StrictMouseFocus mode
100 void ignoreAtPointer(bool force = false);
100 /// Set the "ignore" pointer location to the given coordinates 101 /// Set the "ignore" pointer location to the given coordinates
101 void ignoreAt(int x, int y); 102 /// @param x Current X position of the pointer
103 /// @param y Current Y position of the pointer
104 /// @param force If true, ignore even in StrictMouseFocus mode
105 void ignoreAt(int x, int y, bool force = false);
106 /// unset the "ignore" pointer location
107 void ignoreCancel();
102 /// @return true if events at the given X/Y coordinate should be ignored 108 /// @return true if events at the given X/Y coordinate should be ignored
103 /// (ie, they were previously cached via one of the ignoreAt calls) 109 /// (ie, they were previously cached via one of the ignoreAt calls)
104 bool isIgnored(int x, int y); 110 bool isIgnored(int x, int y);