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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3732>
This commit is contained in:
Marco Trevisan (Treviño) 2024-05-08 01:26:29 +02:00 committed by Marge Bot
parent 4eb76b565f
commit 2065214b71

View File

@ -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);