x11: Separate X11 focus handling into MetaX11Display method
Updating the MetaWindow focus and the X Window focus is interrelated but independent. Call one after the other in the places we handle window focus changes. https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
This commit is contained in:

committed by
Jonas Ådahl

parent
2f217109aa
commit
1d77641f0b
@ -140,14 +140,6 @@ struct _MetaDisplay
|
||||
*/
|
||||
guint allow_terminal_deactivation : 1;
|
||||
|
||||
/* If true, server->focus_serial refers to us changing the focus; in
|
||||
* this case, we can ignore focus events that have exactly focus_serial,
|
||||
* since we take care to make another request immediately afterwards.
|
||||
* But if focus is being changed by another client, we have to accept
|
||||
* multiple events with the same serial.
|
||||
*/
|
||||
guint focused_by_us : 1;
|
||||
|
||||
/*< private-ish >*/
|
||||
GHashTable *stamps;
|
||||
GHashTable *wayland_windows;
|
||||
@ -371,10 +363,7 @@ gboolean meta_display_modifiers_accelerator_activate (MetaDisplay *display);
|
||||
|
||||
void meta_display_sync_wayland_input_focus (MetaDisplay *display);
|
||||
void meta_display_update_focus_window (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
Window xwindow,
|
||||
gulong serial,
|
||||
gboolean focused_by_us);
|
||||
MetaWindow *window);
|
||||
|
||||
void meta_display_sanity_check_timestamps (MetaDisplay *display,
|
||||
guint32 timestamp);
|
||||
|
@ -1238,16 +1238,9 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display)
|
||||
|
||||
void
|
||||
meta_display_update_focus_window (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
Window xwindow,
|
||||
gulong serial,
|
||||
gboolean focused_by_us)
|
||||
MetaWindow *window)
|
||||
{
|
||||
display->x11_display->focus_serial = serial;
|
||||
display->focused_by_us = focused_by_us;
|
||||
|
||||
if (display->x11_display->focus_xwindow == xwindow &&
|
||||
display->focus_window == window)
|
||||
if (display->focus_window == window)
|
||||
return;
|
||||
|
||||
if (display->focus_window)
|
||||
@ -1264,28 +1257,25 @@ meta_display_update_focus_window (MetaDisplay *display,
|
||||
*/
|
||||
previous = display->focus_window;
|
||||
display->focus_window = NULL;
|
||||
display->x11_display->focus_xwindow = None;
|
||||
|
||||
meta_window_set_focused_internal (previous, FALSE);
|
||||
}
|
||||
|
||||
display->focus_window = window;
|
||||
display->x11_display->focus_xwindow = xwindow;
|
||||
|
||||
if (display->focus_window)
|
||||
{
|
||||
meta_topic (META_DEBUG_FOCUS, "* Focus --> %s with serial %lu\n",
|
||||
display->focus_window->desc, serial);
|
||||
meta_topic (META_DEBUG_FOCUS, "* Focus --> %s\n",
|
||||
display->focus_window->desc);
|
||||
meta_window_set_focused_internal (display->focus_window, TRUE);
|
||||
}
|
||||
else
|
||||
meta_topic (META_DEBUG_FOCUS, "* Focus --> NULL with serial %lu\n", serial);
|
||||
meta_topic (META_DEBUG_FOCUS, "* Focus --> NULL\n");
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
meta_display_sync_wayland_input_focus (display);
|
||||
|
||||
g_object_notify (G_OBJECT (display), "focus-window");
|
||||
meta_x11_display_update_active_window_hint (display->x11_display);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
Reference in New Issue
Block a user