116 lines
4.1 KiB
Diff
116 lines
4.1 KiB
Diff
From ab21ff48316e82543d2854f4c024a400ea1c374c Mon Sep 17 00:00:00 2001
|
|
From: Olivier Fourdan <ofourdan@redhat.com>
|
|
Date: Mon, 21 Oct 2024 10:24:09 +0200
|
|
Subject: [PATCH 10/10] window-x11: Emit the configure signal
|
|
|
|
Emit the configure signal for X11 windows as soon as they get created.
|
|
|
|
The configuration values then get applied as initial values.
|
|
|
|
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4076>
|
|
(cherry picked from commit ad9a192455ed2502153bbb5b7960bafb2ed1fbb5)
|
|
---
|
|
src/x11/events.c | 4 ++++
|
|
src/x11/window-x11.c | 48 ++++++++++++++++++++++++++++++++++++++++++++
|
|
src/x11/window-x11.h | 2 ++
|
|
3 files changed, 54 insertions(+)
|
|
|
|
diff --git a/src/x11/events.c b/src/x11/events.c
|
|
index 05d04a8c1a..c72d00c3a7 100644
|
|
--- a/src/x11/events.c
|
|
+++ b/src/x11/events.c
|
|
@@ -1450,6 +1450,8 @@ handle_other_xevent (MetaX11Display *x11_display,
|
|
{
|
|
window = meta_window_x11_new (display, event->xmap.window,
|
|
FALSE, META_COMP_EFFECT_CREATE);
|
|
+ if (window)
|
|
+ meta_window_x11_configure (window);
|
|
}
|
|
else if (window && window->restore_focus_on_map &&
|
|
window->reparents_pending == 0)
|
|
@@ -1506,6 +1508,8 @@ handle_other_xevent (MetaX11Display *x11_display,
|
|
|
|
window = meta_window_x11_new (display, event->xmaprequest.window,
|
|
FALSE, META_COMP_EFFECT_CREATE);
|
|
+ if (window)
|
|
+ meta_window_x11_configure (window);
|
|
}
|
|
else
|
|
{
|
|
diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c
|
|
index d02ca97486..8ac7f147b3 100644
|
|
--- a/src/x11/window-x11.c
|
|
+++ b/src/x11/window-x11.c
|
|
@@ -38,6 +38,7 @@
|
|
#include "compositor/compositor-private.h"
|
|
#include "compositor/meta-window-actor-private.h"
|
|
#include "core/boxes-private.h"
|
|
+#include "core/meta-window-config-private.h"
|
|
#include "core/meta-workspace-manager-private.h"
|
|
#include "core/window-private.h"
|
|
#include "core/workspace-private.h"
|
|
@@ -4935,3 +4936,50 @@ meta_window_x11_shutdown_group (MetaWindow *window)
|
|
{
|
|
remove_window_from_group (window);
|
|
}
|
|
+
|
|
+void
|
|
+meta_window_x11_configure (MetaWindow *window)
|
|
+{
|
|
+ MtkRectangle prev_rect;
|
|
+ MtkRectangle new_rect;
|
|
+ MetaMoveResizeFlags flags;
|
|
+ gboolean is_fullscreen;
|
|
+ g_autoptr (MetaWindowConfig) window_config = NULL;
|
|
+
|
|
+ window_config = meta_window_new_window_config (window);
|
|
+ prev_rect = meta_window_config_get_rect (window->config);
|
|
+ meta_window_config_set_rect (window_config, prev_rect);
|
|
+ is_fullscreen = meta_window_is_fullscreen (window);
|
|
+ meta_window_config_set_is_fullscreen (window_config, is_fullscreen);
|
|
+
|
|
+ meta_window_emit_configure (window, window_config);
|
|
+ new_rect = meta_window_config_get_rect (window_config);
|
|
+
|
|
+ meta_topic (META_DEBUG_GEOMETRY,
|
|
+ "Window %s pre-configured at (%i,%i) [%ix%i]",
|
|
+ window->desc, new_rect.x, new_rect.y, new_rect.width, new_rect.height);
|
|
+
|
|
+ if (!mtk_rectangle_equal (&prev_rect, &new_rect))
|
|
+ {
|
|
+ window->placed = TRUE;
|
|
+
|
|
+ /* Update the size hints to match the new pre-configuration */
|
|
+ window->size_hints.x = new_rect.x;
|
|
+ window->size_hints.y = new_rect.y;
|
|
+ window->size_hints.width = new_rect.width;
|
|
+ window->size_hints.height = new_rect.height;
|
|
+
|
|
+ flags = (META_MOVE_RESIZE_MOVE_ACTION |
|
|
+ META_MOVE_RESIZE_RESIZE_ACTION |
|
|
+ META_MOVE_RESIZE_CONSTRAIN);
|
|
+
|
|
+ meta_window_move_resize_internal (window,
|
|
+ flags,
|
|
+ META_PLACE_FLAG_NONE,
|
|
+ window->size_hints.win_gravity,
|
|
+ new_rect);
|
|
+ }
|
|
+
|
|
+ if (meta_window_config_get_is_fullscreen (window_config))
|
|
+ meta_window_make_fullscreen (window);
|
|
+}
|
|
diff --git a/src/x11/window-x11.h b/src/x11/window-x11.h
|
|
index 5fd8517b4c..c92b28b1a0 100644
|
|
--- a/src/x11/window-x11.h
|
|
+++ b/src/x11/window-x11.h
|
|
@@ -116,3 +116,5 @@ gboolean meta_window_x11_has_alpha_channel (MetaWindow *window);
|
|
|
|
META_EXPORT
|
|
Window meta_window_x11_get_xwindow (MetaWindow *window);
|
|
+
|
|
+void meta_window_x11_configure (MetaWindow *window);
|
|
--
|
|
2.49.0
|
|
|