x11: Move focus sentinel to MetaX11Display

This focus sentinel is a mechanism to avoid some X11-specific race
conditions in focus-follows-pointer, using X11 mechanisms. Move it to
MetaX11Display altogether.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
This commit is contained in:
Carlos Garnacho
2018-12-30 12:58:31 +01:00
committed by Jonas Ådahl
parent 439afb3f19
commit 0200f4fcd9
6 changed files with 48 additions and 46 deletions

View File

@@ -1939,9 +1939,10 @@ idle_calc_showing (gpointer data)
while (tmp != NULL)
{
MetaWindow *window = tmp->data;
MetaDisplay *display = window->display;
if (!window->display->mouse_mode)
meta_display_increment_focus_sentinel (window->display);
if (display->x11_display && !display->mouse_mode)
meta_x11_display_increment_focus_sentinel (display->x11_display);
tmp = tmp->next;
}
@@ -2411,6 +2412,7 @@ meta_window_show (MetaWindow *window)
gboolean needs_stacking_adjustment;
MetaWindow *focus_window;
gboolean notify_demands_attention = FALSE;
MetaDisplay *display = window->display;
meta_topic (META_DEBUG_WINDOW_STATE,
"Showing window %s, shaded: %d iconic: %d placed: %d\n",
@@ -2577,7 +2579,7 @@ meta_window_show (MetaWindow *window)
meta_window_focus (window, timestamp);
}
else
else if (display->x11_display)
{
/* Prevent EnterNotify events in sloppy/mouse focus from
* erroneously focusing the window that had been denied
@@ -2585,7 +2587,7 @@ meta_window_show (MetaWindow *window)
* ideas for a better way to accomplish the same thing, but
* they're more involved so do it this way for now.
*/
meta_display_increment_focus_sentinel (window->display);
meta_x11_display_increment_focus_sentinel (display->x11_display);
}
}