x11: Use the currently focused X window for _NET_ACTIVE_WINDOW

MetaDisplay and MetaX11Display focus windows are slightly decoupled,
we cannot rely here on the MetaDisplay focus to be updated yet. We
however know the X Window that got focused, so lookup the corresponding
MetaWindow (and client X window) from it.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/751
This commit is contained in:
Carlos Garnacho 2019-09-05 12:59:08 +02:00 committed by Georges Basile Stavracas Neto
parent ecec9a7eaa
commit 31df06d94e

View File

@ -1828,12 +1828,15 @@ meta_x11_display_increment_event_serial (MetaX11Display *x11_display)
void void
meta_x11_display_update_active_window_hint (MetaX11Display *x11_display) meta_x11_display_update_active_window_hint (MetaX11Display *x11_display)
{ {
MetaWindow *focus_window = x11_display->display->focus_window; MetaWindow *focus_window;
gulong data[1]; gulong data[1];
if (x11_display->display->closing) if (x11_display->display->closing)
return; /* Leave old value for a replacement */ return; /* Leave old value for a replacement */
focus_window = meta_x11_display_lookup_x_window (x11_display,
x11_display->focus_xwindow);
if (focus_window) if (focus_window)
data[0] = focus_window->xwindow; data[0] = focus_window->xwindow;
else else