From cffe7e95667b92af5539c69147556169dd224781 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Wed, 15 Sep 2004 16:53:20 +0000 Subject: [PATCH] Focus the no_focus_window if no suitable window is in the mru list (should 2004-09-15 Elijah Newren Focus the no_focus_window if no suitable window is in the mru list (should fix the almost contrived extra issue found in #147475) * doc/how-to-get-focus-right.txt: We no longer need to lie about only focusing panels upon explicit request. * src/workspace.c: (meta_workspace_focus_top_window): removed this function--it was more code than needed and was unreliable anyway, (meta_workspace_focus_mru_window): if a suitable window isn't in the mru list, focus the no_focus_window instead of calling focus_top_window. --- ChangeLog | 14 +++++++++++ doc/how-to-get-focus-right.txt | 5 +--- src/workspace.c | 43 ++++------------------------------ 3 files changed, 20 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a15c1c23..8394d8ca1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2004-09-15 Elijah Newren + + Focus the no_focus_window if no suitable window is in the mru list + (should fix the almost contrived extra issue found in #147475) + + * doc/how-to-get-focus-right.txt: We no longer need to lie about + only focusing panels upon explicit request. + + * src/workspace.c: (meta_workspace_focus_top_window): removed this + function--it was more code than needed and was unreliable anyway, + (meta_workspace_focus_mru_window): if a suitable window isn't in + the mru list, focus the no_focus_window instead of calling + focus_top_window. + 2004-09-15 Elijah Newren Prevent focus inconsistencies by only providing one focus method diff --git a/doc/how-to-get-focus-right.txt b/doc/how-to-get-focus-right.txt index dbf1d9efa..2f5da047d 100644 --- a/doc/how-to-get-focus-right.txt +++ b/doc/how-to-get-focus-right.txt @@ -78,10 +78,7 @@ without using the mouse, for example, by grabs). Finally, windows of type WM_DOCK or WM_DESKTOP (e.g. the desktop and the panel) present a special case. For all focus modes, we only focus these windows if the user clicks on them or uses Ctrl-Alt-Tab to -navigate to them. (Well, erm, actually they can be focused in click -and sloppy focus modes if no other window besides these are found, but -there shouldn't be any difference in behavior between doing this and -focusing the designated "no_focus_window") +navigate to them. diff --git a/src/workspace.c b/src/workspace.c index 912a41bd2..728c333fb 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -31,8 +31,6 @@ void meta_workspace_queue_calc_showing (MetaWorkspace *workspace); static void set_active_space_hint (MetaScreen *screen); static void meta_workspace_focus_mru_window (MetaWorkspace *workspace, MetaWindow *not_this_one); -static void meta_workspace_focus_top_window (MetaWorkspace *workspace, - MetaWindow *not_this_one); static void maybe_add_to_list (MetaScreen *screen, MetaWindow *window, gpointer data) @@ -867,41 +865,10 @@ meta_workspace_focus_mru_window (MetaWorkspace *workspace, } else { - meta_topic (META_DEBUG_FOCUS, "No MRU window to focus found\n"); - meta_workspace_focus_top_window (workspace, not_this_one); - } -} - -/* Focus top window on workspace */ -void -meta_workspace_focus_top_window (MetaWorkspace *workspace, - MetaWindow *not_this_one) -{ - MetaWindow *window; - - if (not_this_one) - meta_topic (META_DEBUG_FOCUS, - "Focusing top window excluding %s\n", not_this_one->desc); - - window = meta_stack_get_default_focus_window (workspace->screen->stack, - workspace, - not_this_one); - - /* FIXME I'm a loser on the CurrentTime front */ - if (window) - { - meta_topic (META_DEBUG_FOCUS, - "Focusing top window %s\n", window->desc); - - meta_window_focus (window, - meta_display_get_current_time (workspace->screen->display)); - - /* Also raise the window if in click-to-focus */ - if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK) - meta_window_raise (window); - } - else - { - meta_topic (META_DEBUG_FOCUS, "No top window to focus found\n"); + meta_topic (META_DEBUG_FOCUS, "No MRU window to focus found; focusing no_focus_window.\n"); + XSetInputFocus (workspace->screen->display->xdisplay, + workspace->screen->display->no_focus_window, + RevertToPointerRoot, + meta_display_get_current_time (workspace->screen->display)); } }