[mutter/wip/carlosg/stack-tracking-fixes: 1/2] core: Move Stack to StackTracker synchronization to display.c
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/stack-tracking-fixes: 1/2] core: Move Stack to StackTracker synchronization to display.c
- Date: Fri, 16 Aug 2019 08:53:14 +0000 (UTC)
commit 405b40f5bce8cde51386bb954e760e91af2aceb6
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Aug 16 00:24:31 2019 +0200
core: Move Stack to StackTracker synchronization to display.c
We indirectly were relying on the MetaX11Stack for this. We strictly
need the _NET_CLIENT_LIST* property updates there, so move our own
internal synchronization to common code.
Fixes stacking changes of windows while there's no MetaX11Display.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/730
src/core/display.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++
src/x11/meta-x11-stack.c | 59 ---------------------------------
2 files changed, 85 insertions(+), 59 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 3d1e33429..5dba0b0f3 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -667,6 +667,88 @@ meta_display_shutdown_x11 (MetaDisplay *display)
g_clear_object (&display->x11_display);
}
+static void
+on_stack_changed_cb (MetaStack *stack,
+ MetaDisplay *display)
+{
+ GArray *all_root_children_stacked;
+ GList *tmp;
+ GArray *hidden_stack_ids;
+ uint64_t guard_window_id;
+ GList *sorted;
+
+ meta_topic (META_DEBUG_STACK, "Syncing window stack to server\n");
+
+ all_root_children_stacked = g_array_new (FALSE, FALSE, sizeof (guint64));
+ hidden_stack_ids = g_array_new (FALSE, FALSE, sizeof (guint64));
+
+ meta_topic (META_DEBUG_STACK, "Bottom to top: ");
+ meta_push_no_msg_prefix ();
+
+ sorted = meta_stack_list_windows (stack, NULL);
+
+ for (tmp = sorted; tmp; tmp = tmp->next)
+ {
+ MetaWindow *w = tmp->data;
+ guint64 top_level_window;
+ guint64 stack_id;
+
+ if (w->unmanaging)
+ continue;
+
+ meta_topic (META_DEBUG_STACK, "%u:%d - %s ",
+ w->layer, w->stack_position, w->desc);
+
+ if (w->frame)
+ top_level_window = w->frame->xwindow;
+ else
+ top_level_window = w->xwindow;
+
+ if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
+ stack_id = top_level_window;
+ else
+ stack_id = w->stamp;
+
+ /* We don't restack hidden windows along with the rest, though they are
+ * reflected in the _NET hints. Hidden windows all get pushed below
+ * the screens fullscreen guard_window. */
+ if (w->hidden)
+ {
+ g_array_append_val (hidden_stack_ids, stack_id);
+ continue;
+ }
+
+ g_array_append_val (all_root_children_stacked, stack_id);
+ }
+
+ meta_topic (META_DEBUG_STACK, "\n");
+ meta_pop_no_msg_prefix ();
+
+ if (display->x11_display)
+ {
+ /* The screen guard window sits above all hidden windows and acts as
+ * a barrier to input reaching these windows. */
+ guard_window_id = display->x11_display->guard_window;
+ g_array_append_val (hidden_stack_ids, guard_window_id);
+ }
+
+ /* Sync to server */
+
+ meta_topic (META_DEBUG_STACK, "Restacking %u windows\n",
+ all_root_children_stacked->len);
+
+ meta_stack_tracker_restack_managed (display->stack_tracker,
+ (guint64 *)all_root_children_stacked->data,
+ all_root_children_stacked->len);
+ meta_stack_tracker_restack_at_bottom (display->stack_tracker,
+ (guint64 *)hidden_stack_ids->data,
+ hidden_stack_ids->len);
+
+ g_array_free (hidden_stack_ids, TRUE);
+ g_array_free (all_root_children_stacked, TRUE);
+ g_list_free (sorted);
+}
+
/**
* meta_display_open:
*
@@ -754,6 +836,9 @@ meta_display_open (void)
display->stack = meta_stack_new (display);
display->stack_tracker = meta_stack_tracker_new (display);
+ g_signal_connect (display->stack, "changed",
+ G_CALLBACK (on_stack_changed_cb), display);
+
display->workspace_manager = meta_workspace_manager_new (display);
display->startup_notification = meta_startup_notification_new (display);
diff --git a/src/x11/meta-x11-stack.c b/src/x11/meta-x11-stack.c
index fa08fc4c5..ca611f2d4 100644
--- a/src/x11/meta-x11-stack.c
+++ b/src/x11/meta-x11-stack.c
@@ -232,9 +232,7 @@ x11_stack_sync_to_xserver (MetaX11Stack *x11_stack)
MetaX11Display *x11_display = x11_stack->x11_display;
MetaStack *stack = x11_display->display->stack;
GArray *x11_stacked;
- GArray *all_root_children_stacked; /* wayland OR x11 */
GList *tmp;
- GArray *hidden_stack_ids;
uint64_t guard_window_id;
GList *sorted;
@@ -244,71 +242,16 @@ x11_stack_sync_to_xserver (MetaX11Stack *x11_stack)
*/
x11_stacked = g_array_new (FALSE, FALSE, sizeof (Window));
- all_root_children_stacked = g_array_new (FALSE, FALSE, sizeof (guint64));
- hidden_stack_ids = g_array_new (FALSE, FALSE, sizeof (guint64));
-
- meta_topic (META_DEBUG_STACK, "Bottom to top: ");
- meta_push_no_msg_prefix ();
-
sorted = meta_stack_list_windows (stack, NULL);
for (tmp = sorted; tmp; tmp = tmp->next)
{
MetaWindow *w = tmp->data;
- guint64 top_level_window;
- guint64 stack_id;
-
- if (w->unmanaging)
- continue;
-
- meta_topic (META_DEBUG_STACK, "%u:%d - %s ",
- w->layer, w->stack_position, w->desc);
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
g_array_append_val (x11_stacked, w->xwindow);
-
- if (w->frame)
- top_level_window = w->frame->xwindow;
- else
- top_level_window = w->xwindow;
-
- if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
- stack_id = top_level_window;
- else
- stack_id = w->stamp;
-
- /* We don't restack hidden windows along with the rest, though they are
- * reflected in the _NET hints. Hidden windows all get pushed below
- * the screens fullscreen guard_window. */
- if (w->hidden)
- {
- g_array_append_val (hidden_stack_ids, stack_id);
- continue;
- }
-
- g_array_append_val (all_root_children_stacked, stack_id);
}
- meta_topic (META_DEBUG_STACK, "\n");
- meta_pop_no_msg_prefix ();
-
- /* The screen guard window sits above all hidden windows and acts as
- * a barrier to input reaching these windows. */
- guard_window_id = x11_stack->x11_display->guard_window;
- g_array_append_val (hidden_stack_ids, guard_window_id);
-
- /* Sync to server */
-
- meta_topic (META_DEBUG_STACK, "Restacking %u windows\n",
- all_root_children_stacked->len);
-
- meta_stack_tracker_restack_managed (x11_display->display->stack_tracker,
- (guint64 *)all_root_children_stacked->data,
- all_root_children_stacked->len);
- meta_stack_tracker_restack_at_bottom (x11_display->display->stack_tracker,
- (guint64 *)hidden_stack_ids->data,
- hidden_stack_ids->len);
-
/* Sync _NET_CLIENT_LIST and _NET_CLIENT_LIST_STACKING */
XChangeProperty (x11_stack->x11_display->xdisplay,
@@ -327,8 +270,6 @@ x11_stack_sync_to_xserver (MetaX11Stack *x11_stack)
x11_stacked->len);
g_array_free (x11_stacked, TRUE);
- g_array_free (hidden_stack_ids, TRUE);
- g_array_free (all_root_children_stacked, TRUE);
g_list_free (sorted);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]