window/x11: Don't stop early when trying to find default focus window

When trying to find a default focus window, the code iterates through a
queue of candidates with a timeout between each candidate. If the window
the current timeout is waiting for gets destroyed, this process just
stops instead of trying the next window in the queue.

This issue was made more likely to be triggered with the previous change
to the closed-transient-no-input-parents-queued-default-focus-destroyed
test due to the introduction of a wait, which can introduce a
delay between the two destroy commands.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1325
This commit is contained in:
Sebastian Keller 2020-06-21 00:46:38 +02:00
parent c3d1320343
commit f5c8e0d96d

View File

@ -833,6 +833,18 @@ focus_candidates_maybe_take_and_focus_next (GQueue **focus_candidates_ptr,
meta_window_x11_maybe_focus_delayed (focus_window, focus_candidates, timestamp); meta_window_x11_maybe_focus_delayed (focus_window, focus_candidates, timestamp);
} }
static void
focus_window_delayed_unmanaged (gpointer user_data)
{
MetaWindowX11DelayedFocusData *data = user_data;
uint32_t timestamp = data->timestamp;
focus_candidates_maybe_take_and_focus_next (&data->pending_focus_candidates,
timestamp);
meta_window_x11_delayed_focus_data_free (data);
}
static gboolean static gboolean
focus_window_delayed_timeout (gpointer user_data) focus_window_delayed_timeout (gpointer user_data)
{ {
@ -868,7 +880,7 @@ meta_window_x11_maybe_focus_delayed (MetaWindow *window,
data->unmanaged_id = data->unmanaged_id =
g_signal_connect_swapped (window, "unmanaged", g_signal_connect_swapped (window, "unmanaged",
G_CALLBACK (meta_window_x11_delayed_focus_data_free), G_CALLBACK (focus_window_delayed_unmanaged),
data); data);
data->focused_changed_id = data->focused_changed_id =