From 2065214b71bb14dae10c9859ad08444fed9e70b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 8 May 2024 01:26:29 +0200 Subject: [PATCH] frame: Associate the frame to the window after reparenting Since we listen the X events in the same thread, and they are delivered through the main loop, there's not any need to set the frame details on windows before the reparent operation, because such action could fail. So move the code order, as preparation for handling the error. Part-of: --- src/x11/meta-x11-frame.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/x11/meta-x11-frame.c b/src/x11/meta-x11-frame.c index eefbbd28c..69d000eb3 100644 --- a/src/x11/meta-x11-frame.c +++ b/src/x11/meta-x11-frame.c @@ -123,6 +123,16 @@ meta_window_x11_set_frame_xwindow (MetaWindow *window, meta_x11_display_register_x_window (x11_display, &frame->xwindow, window); + meta_stack_tracker_record_remove (window->display->stack_tracker, + meta_window_x11_get_xwindow (window), + XNextRequest (x11_display->xdisplay)); + + XReparentWindow (x11_display->xdisplay, + meta_window_x11_get_xwindow (window), + frame->xwindow, + frame->child_x, + frame->child_y); + if (window->mapped) { window->mapped = FALSE; /* the reparent will unmap the window, @@ -133,19 +143,9 @@ meta_window_x11_set_frame_xwindow (MetaWindow *window, window->unmaps_pending += 1; } - meta_stack_tracker_record_remove (window->display->stack_tracker, - meta_window_x11_get_xwindow (window), - XNextRequest (x11_display->xdisplay)); - /* stick frame to the window */ priv->frame = g_steal_pointer (&frame); - XReparentWindow (x11_display->xdisplay, - meta_window_x11_get_xwindow (window), - priv->frame->xwindow, - priv->frame->child_x, - priv->frame->child_y); - window->reparents_pending += 1; /* FIXME handle this error */ mtk_x11_error_trap_pop (x11_display->xdisplay);