mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
core: Prepare MetaStackTracker for X11 display being closed
If the display is closed prematurely, go through all windows that look X11-y and remove them for future calculations. This is not strictly needed as Xwayland should shut down orderly (thus no client windows be there), but doesn't hurt to prepare in advance for the cases where it might not be the case. https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
This commit is contained in:
parent
9109fa0eb8
commit
ca51cd8488
@ -508,6 +508,42 @@ query_xserver_stack (MetaDisplay *display,
|
|||||||
XFree (children);
|
XFree (children);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
drop_x11_windows (MetaDisplay *display,
|
||||||
|
MetaStackTracker *tracker)
|
||||||
|
{
|
||||||
|
GArray *new_stack;
|
||||||
|
GList *l;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
tracker->xserver_serial = 0;
|
||||||
|
|
||||||
|
new_stack = g_array_new (FALSE, FALSE, sizeof (guint64));
|
||||||
|
|
||||||
|
for (i = 0; i < tracker->verified_stack->len; i++)
|
||||||
|
{
|
||||||
|
guint64 window = g_array_index (tracker->verified_stack, guint64, i);
|
||||||
|
|
||||||
|
if (!META_STACK_ID_IS_X11 (window))
|
||||||
|
g_array_append_val (new_stack, window);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_array_unref (tracker->verified_stack);
|
||||||
|
tracker->verified_stack = new_stack;
|
||||||
|
l = tracker->unverified_predictions->head;
|
||||||
|
|
||||||
|
while (l)
|
||||||
|
{
|
||||||
|
MetaStackOp *op = l->data;
|
||||||
|
GList *next = l->next;
|
||||||
|
|
||||||
|
if (META_STACK_ID_IS_X11 (op->any.window))
|
||||||
|
g_queue_remove (tracker->unverified_predictions, op);
|
||||||
|
|
||||||
|
l = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MetaStackTracker *
|
MetaStackTracker *
|
||||||
meta_stack_tracker_new (MetaDisplay *display)
|
meta_stack_tracker_new (MetaDisplay *display)
|
||||||
{
|
{
|
||||||
@ -523,6 +559,10 @@ meta_stack_tracker_new (MetaDisplay *display)
|
|||||||
"x11-display-opened",
|
"x11-display-opened",
|
||||||
G_CALLBACK (query_xserver_stack),
|
G_CALLBACK (query_xserver_stack),
|
||||||
tracker);
|
tracker);
|
||||||
|
g_signal_connect (display,
|
||||||
|
"x11-display-closing",
|
||||||
|
G_CALLBACK (drop_x11_windows),
|
||||||
|
tracker);
|
||||||
|
|
||||||
meta_stack_tracker_dump (tracker);
|
meta_stack_tracker_dump (tracker);
|
||||||
|
|
||||||
@ -546,6 +586,9 @@ meta_stack_tracker_free (MetaStackTracker *tracker)
|
|||||||
g_signal_handlers_disconnect_by_func (tracker->display,
|
g_signal_handlers_disconnect_by_func (tracker->display,
|
||||||
(gpointer)query_xserver_stack,
|
(gpointer)query_xserver_stack,
|
||||||
tracker);
|
tracker);
|
||||||
|
g_signal_handlers_disconnect_by_func (tracker->display,
|
||||||
|
drop_x11_windows,
|
||||||
|
tracker);
|
||||||
|
|
||||||
g_free (tracker);
|
g_free (tracker);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user