diff options
author | markt <markt> | 2006-07-23 09:51:54 (GMT) |
---|---|---|
committer | markt <markt> | 2006-07-23 09:51:54 (GMT) |
commit | be2f40a10d9c11a56c0c53307be5557a127027e9 (patch) | |
tree | 0cd5067c32dc42dbcbb59ad32d7d2a08f44cdf6f | |
parent | b0b28c4bbb20ffcf56b445caca112d8866c9c788 (diff) | |
download | fluxbox_lack-be2f40a10d9c11a56c0c53307be5557a127027e9.zip fluxbox_lack-be2f40a10d9c11a56c0c53307be5557a127027e9.tar.bz2 |
use a timer to make sure focus always reverts if possible
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/FbTk/FbWindow.hh | 2 | ||||
-rw-r--r-- | src/WinClient.cc | 6 | ||||
-rw-r--r-- | src/WinClient.hh | 4 | ||||
-rw-r--r-- | src/Window.cc | 2 | ||||
-rw-r--r-- | src/fluxbox.cc | 26 | ||||
-rw-r--r-- | src/fluxbox.hh | 5 |
7 files changed, 29 insertions, 19 deletions
@@ -1,5 +1,8 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 1.0rc3: | 2 | Changes for 1.0rc3: |
3 | *06/07/23: | ||
4 | * Use a timer to make sure focus always reverts if possible (Mark) | ||
5 | fluxbox.cc/hh and reverse patch from 06/07/20 | ||
3 | *06/07/22: | 6 | *06/07/22: |
4 | * Ewmh compliance updates: (Mark) | 7 | * Ewmh compliance updates: (Mark) |
5 | - implemented _NET_WM_MOVERESIZE_CANCEL (new in version 1.4.draft-1) | 8 | - implemented _NET_WM_MOVERESIZE_CANCEL (new in version 1.4.draft-1) |
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh index 0226121..c5494b0 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 | virtual void setInputFocus(int revert_to, int time); | 140 | 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 daf3d42..73b5d45 100644 --- a/src/WinClient.cc +++ b/src/WinClient.cc | |||
@@ -66,7 +66,6 @@ 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), | ||
70 | m_win_gravity(0), | 69 | m_win_gravity(0), |
71 | m_title(""), m_icon_title(""), | 70 | m_title(""), m_icon_title(""), |
72 | m_class_name(""), m_instance_name(""), | 71 | m_class_name(""), m_instance_name(""), |
@@ -189,11 +188,6 @@ bool WinClient::sendFocus() { | |||
189 | return true; | 188 | return true; |
190 | } | 189 | } |
191 | 190 | ||
192 | void WinClient::setInputFocus(int revert_to, int time) { | ||
193 | FbTk::FbWindow::setInputFocus(revert_to, time); | ||
194 | m_waiting_focus = true; | ||
195 | } | ||
196 | |||
197 | void WinClient::sendClose(bool forceful) { | 191 | void WinClient::sendClose(bool forceful) { |
198 | if (forceful || !send_close_message) | 192 | if (forceful || !send_close_message) |
199 | XKillClient(display(), window()); | 193 | XKillClient(display(), window()); |
diff --git a/src/WinClient.hh b/src/WinClient.hh index 4808807..3a9d792 100644 --- a/src/WinClient.hh +++ b/src/WinClient.hh | |||
@@ -53,9 +53,6 @@ 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(); } | ||
59 | void sendClose(bool forceful = false); | 56 | void sendClose(bool forceful = false); |
60 | // not aware of anything that makes this false at present | 57 | // not aware of anything that makes this false at present |
61 | inline bool isClosable() const { return true; } | 58 | inline bool isClosable() const { return true; } |
@@ -200,7 +197,6 @@ private: | |||
200 | // or indicates that we are modal if don't have any transients | 197 | // or indicates that we are modal if don't have any transients |
201 | int m_modal; | 198 | int m_modal; |
202 | bool send_focus_message, send_close_message; | 199 | bool send_focus_message, send_close_message; |
203 | bool m_waiting_focus; | ||
204 | 200 | ||
205 | int m_win_gravity; | 201 | int m_win_gravity; |
206 | 202 | ||
diff --git a/src/Window.cc b/src/Window.cc index 265d948..f2b57f2 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->receivedFocus(); | 2115 | m_client->focusSig().notify(); |
2116 | } | 2116 | } |
2117 | } | 2117 | } |
2118 | 2118 | ||
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index b5b5ddb..abe43d2 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -221,6 +221,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
221 | m_masked(0), | 221 | m_masked(0), |
222 | m_rc_file(rcfilename ? rcfilename : ""), | 222 | m_rc_file(rcfilename ? rcfilename : ""), |
223 | m_argv(argv), m_argc(argc), | 223 | m_argv(argv), m_argc(argc), |
224 | m_revert_screen(0), | ||
224 | m_starting(true), | 225 | m_starting(true), |
225 | m_restarting(false), | 226 | m_restarting(false), |
226 | m_shutdown(false), | 227 | m_shutdown(false), |
@@ -273,6 +274,13 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
273 | m_reconfig_timer.setTimeout(to); | 274 | m_reconfig_timer.setTimeout(to); |
274 | m_reconfig_timer.setCommand(reconfig_cmd); | 275 | m_reconfig_timer.setCommand(reconfig_cmd); |
275 | m_reconfig_timer.fireOnce(true); | 276 | m_reconfig_timer.fireOnce(true); |
277 | |||
278 | // set a timer to revert focus on FocusOut, in case no FocusIn arrives | ||
279 | FbTk::RefCount<FbTk::Command> revert_cmd(new FbTk::SimpleCommand<Fluxbox>(*this, &Fluxbox::revert_focus)); | ||
280 | m_revert_timer.setCommand(revert_cmd); | ||
281 | m_revert_timer.setTimeout(to); | ||
282 | m_revert_timer.fireOnce(true); | ||
283 | |||
276 | // XSynchronize(disp, True); | 284 | // XSynchronize(disp, True); |
277 | 285 | ||
278 | s_singleton = this; | 286 | s_singleton = this; |
@@ -681,9 +689,6 @@ void Fluxbox::handleEvent(XEvent * const e) { | |||
681 | break; // found the screen, no more search | 689 | break; // found the screen, no more search |
682 | } | 690 | } |
683 | } | 691 | } |
684 | |||
685 | if (screen != 0) | ||
686 | FocusControl::revertFocus(*screen); | ||
687 | } | 692 | } |
688 | 693 | ||
689 | // try FbTk::EventHandler first | 694 | // try FbTk::EventHandler first |
@@ -877,9 +882,12 @@ void Fluxbox::handleEvent(XEvent * const e) { | |||
877 | #endif // DEBUG | 882 | #endif // DEBUG |
878 | } else if (winclient && winclient == FocusControl::focusedWindow() && | 883 | } else if (winclient && winclient == FocusControl::focusedWindow() && |
879 | (winclient->fbwindow() == 0 | 884 | (winclient->fbwindow() == 0 |
880 | || !winclient->fbwindow()->isMoving())) | 885 | || !winclient->fbwindow()->isMoving())) { |
881 | // we don't unfocus a moving window | 886 | // we don't unfocus a moving window |
882 | FocusControl::setFocusedWindow(0); | 887 | FocusControl::setFocusedWindow(0); |
888 | m_revert_screen = &winclient->screen(); | ||
889 | m_revert_timer.start(); | ||
890 | } | ||
883 | } | 891 | } |
884 | break; | 892 | break; |
885 | case ClientMessage: | 893 | case ClientMessage: |
@@ -1300,8 +1308,9 @@ void Fluxbox::update(FbTk::Subject *changedsub) { | |||
1300 | FocusControl::unfocusWindow(client); | 1308 | FocusControl::unfocusWindow(client); |
1301 | // make sure nothing else uses this window before focus reverts | 1309 | // make sure nothing else uses this window before focus reverts |
1302 | FocusControl::setFocusedWindow(0); | 1310 | FocusControl::setFocusedWindow(0); |
1303 | } else if (!FocusControl::focusedWindow() && client.isWaitingFocus()) | 1311 | m_revert_screen = &screen; |
1304 | FocusControl::revertFocus(screen); | 1312 | m_revert_timer.start(); |
1313 | } | ||
1305 | } | 1314 | } |
1306 | } | 1315 | } |
1307 | 1316 | ||
@@ -1776,6 +1785,11 @@ void Fluxbox::timed_reconfigure() { | |||
1776 | m_reconfigure_wait = m_reread_menu_wait = false; | 1785 | m_reconfigure_wait = m_reread_menu_wait = false; |
1777 | } | 1786 | } |
1778 | 1787 | ||
1788 | void Fluxbox::revert_focus() { | ||
1789 | if (m_revert_screen && !FocusControl::focusedWindow()) | ||
1790 | FocusControl::revertFocus(*m_revert_screen); | ||
1791 | } | ||
1792 | |||
1779 | bool Fluxbox::validateClient(const WinClient *client) const { | 1793 | bool Fluxbox::validateClient(const WinClient *client) const { |
1780 | WinClientMap::const_iterator it = | 1794 | WinClientMap::const_iterator it = |
1781 | find_if(m_window_search.begin(), | 1795 | find_if(m_window_search.begin(), |
diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 7fa5f5d..e7bc18d 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh | |||
@@ -185,6 +185,7 @@ public: | |||
185 | void attachSignals(WinClient &winclient); | 185 | void attachSignals(WinClient &winclient); |
186 | 186 | ||
187 | void timed_reconfigure(); | 187 | void timed_reconfigure(); |
188 | void revert_focus(); | ||
188 | 189 | ||
189 | bool isStartup() const { return m_starting; } | 190 | bool isStartup() const { return m_starting; } |
190 | bool isRestarting() const { return m_restarting; } | 191 | bool isRestarting() const { return m_restarting; } |
@@ -289,7 +290,9 @@ private: | |||
289 | 290 | ||
290 | XEvent m_last_event; | 291 | XEvent m_last_event; |
291 | 292 | ||
292 | FbTk::Timer m_reconfig_timer; ///< when we execute reconfig command we must wait at least to next event round | 293 | ///< when we execute reconfig command we must wait until next event round |
294 | FbTk::Timer m_reconfig_timer, m_revert_timer; | ||
295 | BScreen *m_revert_screen; | ||
293 | 296 | ||
294 | std::auto_ptr<Keys> m_key; | 297 | std::auto_ptr<Keys> m_key; |
295 | 298 | ||