[mutter/wip/carlosg/xwayland-on-demand: 149/155] core: Prepare MetaStackTracker for X11 display being closed
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/xwayland-on-demand: 149/155] core: Prepare MetaStackTracker for X11 display being closed
- Date: Fri, 24 May 2019 19:56:15 +0000 (UTC)
commit fafb432b46dc85128a15cdf43dfd180f179aec6e
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri May 24 20:04:09 2019 +0200
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.
src/core/stack-tracker.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
---
diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c
index ee8bf011f..8010e0e8a 100644
--- a/src/core/stack-tracker.c
+++ b/src/core/stack-tracker.c
@@ -508,6 +508,44 @@ query_xserver_stack (MetaDisplay *display,
XFree (children);
}
+static void
+drop_x11_windows (MetaDisplay *display,
+ MetaStackTracker *tracker)
+{
+ GArray *new_stack;
+ GList *l = NULL;
+ 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;
+
+ if (tracker->unverified_predictions)
+ 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 *
meta_stack_tracker_new (MetaDisplay *display)
{
@@ -523,6 +561,10 @@ meta_stack_tracker_new (MetaDisplay *display)
"x11-display-opened",
G_CALLBACK (query_xserver_stack),
tracker);
+ g_signal_connect (display,
+ "x11-display-closing",
+ G_CALLBACK (drop_x11_windows),
+ tracker);
meta_stack_tracker_dump (tracker);
@@ -546,6 +588,9 @@ meta_stack_tracker_free (MetaStackTracker *tracker)
g_signal_handlers_disconnect_by_func (tracker->display,
(gpointer)query_xserver_stack,
tracker);
+ g_signal_handlers_disconnect_by_func (tracker->display,
+ drop_x11_windows,
+ tracker);
g_free (tracker);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]