aboutsummaryrefslogtreecommitdiff
path: root/src/fluxbox.cc
diff options
context:
space:
mode:
authormarkt <markt>2006-07-23 09:51:54 (GMT)
committermarkt <markt>2006-07-23 09:51:54 (GMT)
commitbe2f40a10d9c11a56c0c53307be5557a127027e9 (patch)
tree0cd5067c32dc42dbcbb59ad32d7d2a08f44cdf6f /src/fluxbox.cc
parentb0b28c4bbb20ffcf56b445caca112d8866c9c788 (diff)
downloadfluxbox-be2f40a10d9c11a56c0c53307be5557a127027e9.zip
fluxbox-be2f40a10d9c11a56c0c53307be5557a127027e9.tar.bz2
use a timer to make sure focus always reverts if possible
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r--src/fluxbox.cc26
1 files changed, 20 insertions, 6 deletions
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
1788void Fluxbox::revert_focus() {
1789 if (m_revert_screen && !FocusControl::focusedWindow())
1790 FocusControl::revertFocus(*m_revert_screen);
1791}
1792
1779bool Fluxbox::validateClient(const WinClient *client) const { 1793bool 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(),