x11: Update focus on the X11 display before the MetaDisplay

The meta_display_update_focus_window() call has indirect dependencies
on the X11 focus window, in order to determine the correct focus window
on the Wayland side (i.e. may turn out NULL with certain X windows).

In order to have the right x11_display->focus_xwindow there, we should
perform first the focus update on the X11 display.

Fixes focusing of Java applications, as those don't seem to go through
_NET_ACTIVE_WINDOW.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/819
This commit is contained in:
Carlos Garnacho 2019-09-27 13:06:34 +02:00 committed by Jonas Ådahl
parent acfd03da30
commit 8fd55fef85

View File

@ -808,12 +808,12 @@ handle_window_focus_event (MetaX11Display *x11_display,
(!x11_display->focused_by_us &&
x11_display->server_focus_serial == x11_display->focus_serial))
{
meta_display_update_focus_window (display, focus_window);
meta_x11_display_update_focus_window (x11_display,
focus_window ?
focus_window->xwindow : None,
x11_display->server_focus_serial,
FALSE);
meta_display_update_focus_window (display, focus_window);
return TRUE;
}
else
@ -1807,13 +1807,13 @@ meta_x11_display_handle_xevent (MetaX11Display *x11_display,
{
meta_topic (META_DEBUG_FOCUS, "Earlier attempt to focus %s failed\n",
display->focus_window->desc);
meta_display_update_focus_window (display,
meta_x11_display_lookup_x_window (x11_display,
x11_display->server_focus_window));
meta_x11_display_update_focus_window (x11_display,
x11_display->server_focus_window,
x11_display->server_focus_serial,
FALSE);
meta_display_update_focus_window (display,
meta_x11_display_lookup_x_window (x11_display,
x11_display->server_focus_window));
}
if (event->xany.window == x11_display->xroot)