aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Ramsay <i.am@jimramsay.com>2009-05-26 20:45:05 (GMT)
committerJim Ramsay <i.am@jimramsay.com>2009-05-26 20:45:05 (GMT)
commit54b49c63a641fb742f014403c924ae8f81f73824 (patch)
treec2b8511c911d0375715f7f0cd2f8d1999790923a /src
parent04538cbaa1f74b3b7dd397fa515617d8691980d4 (diff)
parentc1dee4a4055f8f0dafadeca508ff5568e2d0ce08 (diff)
downloadfluxbox_pavel-54b49c63a641fb742f014403c924ae8f81f73824.zip
fluxbox_pavel-54b49c63a641fb742f014403c924ae8f81f73824.tar.bz2
Merge branch 'mousefocus'
Diffstat (limited to 'src')
-rw-r--r--src/FocusControl.cc25
-rw-r--r--src/FocusControl.hh10
-rw-r--r--src/Screen.cc3
-rw-r--r--src/Window.cc15
-rw-r--r--src/fluxbox.cc5
5 files changed, 55 insertions, 3 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc
index 78752bb..701373b 100644
--- a/src/FocusControl.cc
+++ b/src/FocusControl.cc
@@ -81,7 +81,8 @@ FocusControl::FocusControl(BScreen &screen):
81 m_focused_win_list(screen), m_creation_order_win_list(screen), 81 m_focused_win_list(screen), m_creation_order_win_list(screen),
82 m_cycling_list(0), 82 m_cycling_list(0),
83 m_was_iconic(false), 83 m_was_iconic(false),
84 m_cycling_last(0) { 84 m_cycling_last(0),
85 m_ignore_mouse_x(-1), m_ignore_mouse_y(-1) {
85 86
86 m_cycling_window = m_focused_list.clientList().end(); 87 m_cycling_window = m_focused_list.clientList().end();
87 88
@@ -400,6 +401,28 @@ void FocusControl::dirFocus(FluxboxWindow &win, FocusDir dir) {
400 401
401} 402}
402 403
404void FocusControl::ignoreAtPointer()
405{
406 int ignore_i;
407 unsigned int ignore_ui;
408 Window ignore_w;
409
410 XQueryPointer(m_screen.rootWindow().display(),
411 m_screen.rootWindow().window(), &ignore_w, &ignore_w,
412 &m_ignore_mouse_x, &m_ignore_mouse_y,
413 &ignore_i, &ignore_i, &ignore_ui);
414}
415
416void FocusControl::ignoreAt(int x, int y)
417{
418 m_ignore_mouse_x = x; m_ignore_mouse_y = y;
419}
420
421bool FocusControl::isIgnored(int x, int y)
422{
423 return x == m_ignore_mouse_x && y == m_ignore_mouse_y;
424}
425
403void FocusControl::removeClient(WinClient &client) { 426void FocusControl::removeClient(WinClient &client) {
404 if (client.screen().isShuttingdown()) 427 if (client.screen().isShuttingdown())
405 return; 428 return;
diff --git a/src/FocusControl.hh b/src/FocusControl.hh
index 4de4310..91681ab 100644
--- a/src/FocusControl.hh
+++ b/src/FocusControl.hh
@@ -93,6 +93,15 @@ public:
93 bool isMouseFocus() const { return focusModel() == MOUSEFOCUS; } 93 bool isMouseFocus() const { return focusModel() == MOUSEFOCUS; }
94 /// @return true if tab focus mode is mouse tab focus 94 /// @return true if tab focus mode is mouse tab focus
95 bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; } 95 bool isMouseTabFocus() const { return tabFocusModel() == MOUSETABFOCUS; }
96
97 /// Set the "ignore" pointer location to the current pointer location
98 void ignoreAtPointer();
99 /// Set the "ignore" pointer location to the given coordinates
100 void ignoreAt(int x, int y);
101 /// @return true if events at the given X/Y coordinate should be ignored
102 /// (ie, they were previously cached via one of the ignoreAt calls)
103 bool isIgnored(int x, int y);
104
96 /// @return true if cycling is in progress 105 /// @return true if cycling is in progress
97 bool isCycling() const { return m_cycling_list != 0; } 106 bool isCycling() const { return m_cycling_list != 0; }
98 /// Appends a client to the front of the focus list 107 /// Appends a client to the front of the focus list
@@ -157,6 +166,7 @@ private:
157 const FocusableList *m_cycling_list; 166 const FocusableList *m_cycling_list;
158 Focusable *m_was_iconic; 167 Focusable *m_was_iconic;
159 WinClient *m_cycling_last; 168 WinClient *m_cycling_last;
169 int m_ignore_mouse_x, m_ignore_mouse_y;
160 170
161 static WinClient *s_focused_window; 171 static WinClient *s_focused_window;
162 static FluxboxWindow *s_focused_fbwindow; 172 static FluxboxWindow *s_focused_fbwindow;
diff --git a/src/Screen.cc b/src/Screen.cc
index 02351a5..1581571 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1098,6 +1098,9 @@ void BScreen::changeWorkspaceID(unsigned int id, bool revert) {
1098 id == m_current_workspace->workspaceID()) 1098 id == m_current_workspace->workspaceID())
1099 return; 1099 return;
1100 1100
1101 /* Ignore all EnterNotify events until the pointer actually moves */
1102 this->focusControl().ignoreAtPointer();
1103
1101 FbTk::App::instance()->sync(false); 1104 FbTk::App::instance()->sync(false);
1102 1105
1103 FluxboxWindow *focused = FocusControl::focusedFbWindow(); 1106 FluxboxWindow *focused = FocusControl::focusedFbWindow();
diff --git a/src/Window.cc b/src/Window.cc
index edc2b8e..b2bfcf7 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1213,6 +1213,9 @@ void FluxboxWindow::moveResize(int new_x, int new_y,
1213 if (!moving) { 1213 if (!moving) {
1214 m_last_resize_x = new_x; 1214 m_last_resize_x = new_x;
1215 m_last_resize_y = new_y; 1215 m_last_resize_y = new_y;
1216
1217 /* Ignore all EnterNotify events until the pointer actually moves */
1218 screen().focusControl().ignoreAtPointer();
1216 } 1219 }
1217 1220
1218} 1221}
@@ -1670,6 +1673,10 @@ void FluxboxWindow::lower() {
1670#ifdef DEBUG 1673#ifdef DEBUG
1671 cerr<<"FluxboxWindow("<<title()<<")::lower()"<<endl; 1674 cerr<<"FluxboxWindow("<<title()<<")::lower()"<<endl;
1672#endif // DEBUG 1675#endif // DEBUG
1676
1677 /* Ignore all EnterNotify events until the pointer actually moves */
1678 screen().focusControl().ignoreAtPointer();
1679
1673 // get root window 1680 // get root window
1674 WinClient *client = getRootTransientFor(m_client); 1681 WinClient *client = getRootTransientFor(m_client);
1675 1682
@@ -2684,13 +2691,17 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
2684 sa.enter = sa.leave = False; 2691 sa.enter = sa.leave = False;
2685 XCheckIfEvent(display, &dummy, queueScanner, (char *) &sa); 2692 XCheckIfEvent(display, &dummy, queueScanner, (char *) &sa);
2686 2693
2687 if ((!sa.leave || sa.inferior) && !screen().focusControl().isCycling() ) { 2694 if ((!sa.leave || sa.inferior) &&
2695 !screen().focusControl().isCycling() &&
2696 !screen().focusControl().isIgnored(ev.x_root, ev.y_root) ) {
2688 focus(); 2697 focus();
2689 } 2698 }
2690 } 2699 }
2691 } 2700 }
2692 2701
2693 if (screen().focusControl().isMouseTabFocus() && client && client != m_client) { 2702 if (screen().focusControl().isMouseTabFocus() &&
2703 client && client != m_client &&
2704 !screen().focusControl().isIgnored(ev.x_root, ev.y_root) ) {
2694 setCurrentClient(*client, isFocused()); 2705 setCurrentClient(*client, isFocused());
2695 } 2706 }
2696 2707
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 93768da..f44f8aa 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -899,6 +899,11 @@ void Fluxbox::handleUnmapNotify(XUnmapEvent &ue) {
899 899
900 BScreen *screen = searchScreen(ue.event); 900 BScreen *screen = searchScreen(ue.event);
901 901
902 if (screen) {
903 /* Ignore all EnterNotify events until the pointer actually moves */
904 screen->focusControl().ignoreAtPointer();
905 }
906
902 if (ue.event != ue.window && (!screen || !ue.send_event)) { 907 if (ue.event != ue.window && (!screen || !ue.send_event)) {
903 return; 908 return;
904 } 909 }