From 1e957a168808f0357509300e879c0a7e97b49a24 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 13 May 2007 07:09:34 +0000 Subject: some changes to focus handling. most interesting is the change in focus_fallback, which means that it won't call xsetinput focus in some cases, potentially reducing flicker and stuff. also potentially producing bugs? heh. the screen.c focus fallback code doesn't seem to need special cases anymore, which is really good, if that is really the case. move the focus_tried stuff out of event.c into focus.c, where it seems to belong. --- openbox/screen.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'openbox/screen.c') diff --git a/openbox/screen.c b/openbox/screen.c index 3819a3b1..73cc4f14 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -494,7 +494,7 @@ void screen_set_desktop(guint num, gboolean dofocus) do this before hiding the windows so if helper windows are coming with us, they don't get hidden */ - if (dofocus && (c = focus_fallback_target(TRUE, focus_client))) { + if (dofocus && (c = focus_fallback(TRUE))) { /* only do the flicker reducing stuff ahead of time if we are going to call xsetinputfocus on the window ourselves. otherwise there is no guarantee the window will actually take focus.. */ @@ -506,7 +506,6 @@ void screen_set_desktop(guint num, gboolean dofocus) server FocusIn event */ frame_adjust_focus(c->frame, TRUE); } - client_focus(c); } /* hide windows from bottom to top */ @@ -939,7 +938,7 @@ void screen_show_desktop(gboolean show, ObClient *show_only) } if (show) { - /* focus desktop */ + /* focus the desktop */ for (it = focus_order; it; it = g_list_next(it)) { ObClient *c = it->data; if (c->type == OB_CLIENT_TYPE_DESKTOP && @@ -951,10 +950,16 @@ void screen_show_desktop(gboolean show, ObClient *show_only) else if (!show_only) { ObClient *c; - /* use NULL for the "old" argument because the desktop was focused - and we don't want to fallback to the desktop by default */ - if ((c = focus_fallback_target(TRUE, NULL))) - client_focus(c); + if ((c = focus_fallback(TRUE))) { + /* only do the flicker reducing stuff ahead of time if we are going + to call xsetinputfocus on the window ourselves. otherwise there + is no guarantee the window will actually take focus.. */ + if (c->can_focus) { + /* reduce flicker by hiliting now rather than waiting for the + server FocusIn event */ + frame_adjust_focus(c->frame, TRUE); + } + } } show = !!show; /* make it boolean */ -- cgit v1.2.3