mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
Focus correct window after minimizing via the tasklist (fixes #128200; see
2004-09-15 Elijah Newren <newren@math.utah.edu> Focus correct window after minimizing via the tasklist (fixes #128200; see also #107681) * src/display.h (struct _MetaDisplay): track the previously_focused_window * src/display.c (meta_display_open): initialize previously_focused_window * src/window.c (meta_window_free): clear the previously_focused_window if it's being freed, (meta_window_client_message): if we get a request to minimize the previously_focused_window and the focus_window is a dock or the desktop, focus the default window, (meta_window_notify_focus): update the previously_focused_window
This commit is contained in:
parent
c188ae0954
commit
4b9fe2cae7
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
||||
2004-09-15 Elijah Newren <newren@math.utah.edu>
|
||||
|
||||
Focus correct window after minimizing via the tasklist (fixes
|
||||
#128200; see also #107681)
|
||||
|
||||
* src/display.h (struct _MetaDisplay): track the
|
||||
previously_focused_window
|
||||
|
||||
* src/display.c (meta_display_open): initialize
|
||||
previously_focused_window
|
||||
|
||||
* src/window.c (meta_window_free): clear the
|
||||
previously_focused_window if it's being freed,
|
||||
(meta_window_client_message): if we get a request to minimize the
|
||||
previously_focused_window and the focus_window is a dock or the
|
||||
desktop, focus the default window, (meta_window_notify_focus):
|
||||
update the previously_focused_window
|
||||
|
||||
2004-09-13 Rob Adams <readams@readams.net>
|
||||
|
||||
* configure.in: post-release increment
|
||||
|
@ -329,6 +329,7 @@ meta_display_open (const char *name)
|
||||
display->pending_pings = NULL;
|
||||
display->autoraise_timeout_id = 0;
|
||||
display->focus_window = NULL;
|
||||
display->previously_focused_window = NULL;
|
||||
display->expected_focus_window = NULL;
|
||||
|
||||
#ifdef HAVE_XSYNC
|
||||
|
@ -188,6 +188,10 @@ struct _MetaDisplay
|
||||
*/
|
||||
MetaWindow *focus_window;
|
||||
|
||||
/* Window that was the actual window from focus events before focus_window
|
||||
*/
|
||||
MetaWindow *previously_focused_window;
|
||||
|
||||
/* window we are expecting a FocusIn event for
|
||||
*/
|
||||
MetaWindow *expected_focus_window;
|
||||
|
28
src/window.c
28
src/window.c
@ -967,6 +967,8 @@ meta_window_free (MetaWindow *window)
|
||||
|
||||
if (window->display->focus_window == window)
|
||||
window->display->focus_window = NULL;
|
||||
if (window->display->previously_focused_window == window)
|
||||
window->display->previously_focused_window = NULL;
|
||||
|
||||
meta_window_unqueue_calc_showing (window);
|
||||
meta_window_unqueue_move_resize (window);
|
||||
@ -4022,7 +4024,29 @@ meta_window_client_message (MetaWindow *window,
|
||||
event->xclient.data.l[0]);
|
||||
if (event->xclient.data.l[0] == IconicState &&
|
||||
window->has_minimize_func)
|
||||
meta_window_minimize (window);
|
||||
{
|
||||
meta_window_minimize (window);
|
||||
|
||||
/* If the window being minimized was the one with focus,
|
||||
* then we should focus a new window. We often receive this
|
||||
* wm_change_state message when a user has clicked on the
|
||||
* tasklist on the panel; in those cases, the current
|
||||
* focus_window is the panel, but the previous focus_window
|
||||
* will have been this one. This is a special case where we
|
||||
* need to manually handle focusing a new window because
|
||||
* meta_window_minimize will get it wrong.
|
||||
*/
|
||||
if (window->display->focus_window &&
|
||||
(window->display->focus_window->type == META_WINDOW_DOCK ||
|
||||
window->display->focus_window->type == META_WINDOW_DESKTOP) &&
|
||||
window->display->previously_focused_window == window)
|
||||
{
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Focusing default window because of minimization of former focus window %s, which was due to a wm_change_state client message\n",
|
||||
window->desc);
|
||||
meta_workspace_focus_default_window (window->screen->active_workspace, window);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -4397,6 +4421,8 @@ meta_window_notify_focus (MetaWindow *window,
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"* Focus --> NULL (was %s)\n", window->desc);
|
||||
|
||||
window->display->previously_focused_window =
|
||||
window->display->focus_window;
|
||||
window->display->focus_window = NULL;
|
||||
window->has_focus = FALSE;
|
||||
if (window->frame)
|
||||
|
Loading…
Reference in New Issue
Block a user