aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkt <markt>2006-07-20 07:15:59 (GMT)
committermarkt <markt>2006-07-20 07:15:59 (GMT)
commitf9ade8947c08a7f1a4485b44da2403a55a3c04e1 (patch)
tree793620785e0cae212af273681529415b57a5c8cf
parentf4d1af12083863f1aa63c88e3eb55a9317758fc1 (diff)
downloadfluxbox-f9ade8947c08a7f1a4485b44da2403a55a3c04e1.zip
fluxbox-f9ade8947c08a7f1a4485b44da2403a55a3c04e1.tar.bz2
properly revert focus when two windows close at the same time
-rw-r--r--ChangeLog3
-rw-r--r--src/FbTk/FbWindow.hh2
-rw-r--r--src/WinClient.cc6
-rw-r--r--src/WinClient.hh4
-rw-r--r--src/Window.cc2
-rw-r--r--src/fluxbox.cc8
6 files changed, 19 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 195f5b0..1c362e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.0rc3: 2Changes for 1.0rc3:
3*06/07/20:
4 * Properly revert focus when two windows close simultaneously (Mark)
5 WinClient.cc/hh FbTk/FbWindow.hh fluxbox.cc Window.cc
3*06/07/19: 6*06/07/19:
4 * Preserve order of focused windows on restart (Mark) 7 * Preserve order of focused windows on restart (Mark)
5 Workspace.cc Screen.cc FocusControl.cc/hh 8 Workspace.cc Screen.cc FocusControl.cc/hh
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh
index c5494b0..0226121 100644
--- a/src/FbTk/FbWindow.hh
+++ b/src/FbTk/FbWindow.hh
@@ -137,7 +137,7 @@ public:
137 } 137 }
138 virtual void lower(); 138 virtual void lower();
139 virtual void raise(); 139 virtual void raise();
140 void setInputFocus(int revert_to, int time); 140 virtual void setInputFocus(int revert_to, int time);
141 /// defines a cursor for this window 141 /// defines a cursor for this window
142 void setCursor(Cursor cur); 142 void setCursor(Cursor cur);
143#ifdef NOT_USED 143#ifdef NOT_USED
diff --git a/src/WinClient.cc b/src/WinClient.cc
index 4e508fb..0eddac5 100644
--- a/src/WinClient.cc
+++ b/src/WinClient.cc
@@ -66,6 +66,7 @@ WinClient::WinClient(Window win, BScreen &screen, FluxboxWindow *fbwin):FbTk::Fb
66 m_modal(0), 66 m_modal(0),
67 send_focus_message(false), 67 send_focus_message(false),
68 send_close_message(false), 68 send_close_message(false),
69 m_waiting_focus(false),
69 m_win_gravity(0), 70 m_win_gravity(0),
70 m_title(""), m_icon_title(""), 71 m_title(""), m_icon_title(""),
71 m_class_name(""), m_instance_name(""), 72 m_class_name(""), m_instance_name(""),
@@ -188,6 +189,11 @@ bool WinClient::sendFocus() {
188 return true; 189 return true;
189} 190}
190 191
192void WinClient::setInputFocus(int revert_to, int time) {
193 FbTk::FbWindow::setInputFocus(revert_to, time);
194 m_waiting_focus = true;
195}
196
191void WinClient::sendClose(bool forceful) { 197void WinClient::sendClose(bool forceful) {
192 if (forceful || !send_close_message) 198 if (forceful || !send_close_message)
193 XKillClient(display(), window()); 199 XKillClient(display(), window());
diff --git a/src/WinClient.hh b/src/WinClient.hh
index 3a9d792..4808807 100644
--- a/src/WinClient.hh
+++ b/src/WinClient.hh
@@ -53,6 +53,9 @@ public:
53 bool sendFocus(); // returns whether we sent a message or not 53 bool sendFocus(); // returns whether we sent a message or not
54 // i.e. whether we assume the focus will get taken 54 // i.e. whether we assume the focus will get taken
55 bool acceptsFocus() const; // will this window accept focus (according to hints) 55 bool acceptsFocus() const; // will this window accept focus (according to hints)
56 void setInputFocus(int revert_to, int time);
57 inline bool isWaitingFocus() { return m_waiting_focus; }
58 void receivedFocus() { m_waiting_focus = false; m_focussig.notify(); }
56 void sendClose(bool forceful = false); 59 void sendClose(bool forceful = false);
57 // not aware of anything that makes this false at present 60 // not aware of anything that makes this false at present
58 inline bool isClosable() const { return true; } 61 inline bool isClosable() const { return true; }
@@ -197,6 +200,7 @@ private:
197 // or indicates that we are modal if don't have any transients 200 // or indicates that we are modal if don't have any transients
198 int m_modal; 201 int m_modal;
199 bool send_focus_message, send_close_message; 202 bool send_focus_message, send_close_message;
203 bool m_waiting_focus;
200 204
201 int m_win_gravity; 205 int m_win_gravity;
202 206
diff --git a/src/Window.cc b/src/Window.cc
index 2bb19a2..aa9a2b7 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2112,7 +2112,7 @@ void FluxboxWindow::setFocusFlag(bool focus) {
2112 if (was_focused != focus) { 2112 if (was_focused != focus) {
2113 m_focussig.notify(); 2113 m_focussig.notify();
2114 if (m_client) 2114 if (m_client)
2115 m_client->focusSig().notify(); 2115 m_client->receivedFocus();
2116 } 2116 }
2117} 2117}
2118 2118
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 9625465..99dfff6 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -1297,12 +1297,12 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
1297 1297
1298 // This is where we revert focus on window close 1298 // This is where we revert focus on window close
1299 // NOWHERE ELSE!!! 1299 // NOWHERE ELSE!!!
1300 if (FocusControl::focusedWindow() == &client) 1300 if (FocusControl::focusedWindow() == &client) {
1301 FocusControl::unfocusWindow(client); 1301 FocusControl::unfocusWindow(client);
1302 1302 // make sure nothing else uses this window before focus reverts
1303 // failed to revert focus?
1304 if (FocusControl::focusedWindow() == &client)
1305 FocusControl::setFocusedWindow(0); 1303 FocusControl::setFocusedWindow(0);
1304 } else if (!FocusControl::focusedWindow() && client.isWaitingFocus())
1305 FocusControl::revertFocus(screen);
1306 } 1306 }
1307} 1307}
1308 1308