diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c index 92a3c73ab..aeaf1cfbe 100644 --- a/src/compositor/meta-window-actor-x11.c +++ b/src/compositor/meta-window-actor-x11.c @@ -1090,11 +1090,20 @@ update_frame_bounds (MetaWindowActorX11 *actor_x11) { MetaWindow *window = meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11)); - MtkRegion *frame_bounds = meta_window_get_frame_bounds (window); + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11); + g_clear_pointer (&actor_x11->frame_bounds, mtk_region_unref); - if (frame_bounds) - actor_x11->frame_bounds = mtk_region_copy (frame_bounds); + if (!priv->frame_bounds) + { + MetaFrame *frame = meta_window_x11_get_frame (window); + if (frame) + priv->frame_bounds = meta_frame_get_frame_bounds (frame); + } + + if (priv->frame_bounds) + actor_x11->frame_bounds = mtk_region_copy (priv->frame_bounds); } static void diff --git a/src/core/window-private.h b/src/core/window-private.h index ef3fed811..082e54d28 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -278,9 +278,6 @@ struct _MetaWindow MetaLogicalMonitor *right; } fullscreen_monitors; - /* if non-NULL, the bounds of the window frame */ - MtkRegion *frame_bounds; - /* _NET_WM_WINDOW_OPACITY rescaled to 0xFF */ guint8 opacity; diff --git a/src/core/window.c b/src/core/window.c index b82c107f4..67dc56bd7 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -99,6 +99,10 @@ #include "wayland/meta-window-wayland.h" #endif +#ifdef HAVE_X11_CLIENT +#include "x11/window-x11-private.h" +#endif + #ifdef HAVE_XWAYLAND #include "wayland/meta-window-xwayland.h" #endif @@ -315,8 +319,6 @@ meta_window_finalize (GObject *object) { MetaWindow *window = META_WINDOW (object); - g_clear_pointer (&window->frame_bounds, mtk_region_unref); - if (window->transient_for) g_object_unref (window->transient_for); @@ -3992,8 +3994,16 @@ meta_window_move_resize_internal (MetaWindow *window, meta_window_update_monitor (window, update_monitor_flags); } - if ((result & META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED) && window->frame_bounds) - g_clear_pointer (&window->frame_bounds, mtk_region_unref); +#ifdef HAVE_X11_CLIENT + if (window->client_type == META_WINDOW_CLIENT_TYPE_X11) + { + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11); + + if ((result & META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED) && priv->frame_bounds) + g_clear_pointer (&priv->frame_bounds, mtk_region_unref); + } +#endif meta_window_foreach_transient (window, maybe_move_attached_window, NULL); @@ -6791,34 +6801,6 @@ meta_window_get_frame_type (MetaWindow *window) } } -/** - * meta_window_get_frame_bounds: - * @window: a #MetaWindow - * - * Gets a region representing the outer bounds of the window's frame. - * - * Return value: (transfer none) (nullable): a #MtkRegion - * holding the outer bounds of the window, or %NULL if the window - * doesn't have a frame. - */ -MtkRegion * -meta_window_get_frame_bounds (MetaWindow *window) -{ - if (!window->frame_bounds) - { -#ifdef HAVE_X11_CLIENT - MetaFrame *frame = meta_window_x11_get_frame (window); -#else - /* Only for now, as this method would be moved to a window-x11 in the upcoming commits */ - MetaFrame *frame = NULL; -#endif - if (frame) - window->frame_bounds = meta_frame_get_frame_bounds (frame); - } - - return window->frame_bounds; -} - /** * meta_window_is_attached_dialog: * @window: a #MetaWindow diff --git a/src/meta/window.h b/src/meta/window.h index c6e6a028b..63da5eac7 100644 --- a/src/meta/window.h +++ b/src/meta/window.h @@ -343,9 +343,6 @@ const char *meta_window_get_mutter_hints (MetaWindow *window); META_EXPORT MetaFrameType meta_window_get_frame_type (MetaWindow *window); -META_EXPORT -MtkRegion *meta_window_get_frame_bounds (MetaWindow *window); - META_EXPORT MetaWindow *meta_window_get_tile_match (MetaWindow *window); diff --git a/src/x11/meta-x11-frame.c b/src/x11/meta-x11-frame.c index 9b4449863..843230e0b 100644 --- a/src/x11/meta-x11-frame.c +++ b/src/x11/meta-x11-frame.c @@ -242,7 +242,7 @@ meta_window_destroy_frame (MetaWindow *window) meta_x11_display_unregister_x_window (x11_display, frame->xwindow); priv->frame = NULL; - g_clear_pointer (&window->frame_bounds, mtk_region_unref); + g_clear_pointer (&priv->frame_bounds, mtk_region_unref); g_clear_pointer (&frame->opaque_region, mtk_region_unref); /* Move keybindings to window instead of frame */ diff --git a/src/x11/window-x11-private.h b/src/x11/window-x11-private.h index ccc3182e1..3a7567ad0 100644 --- a/src/x11/window-x11-private.h +++ b/src/x11/window-x11-private.h @@ -102,6 +102,9 @@ struct _MetaWindowX11Private /* may be NULL! not all windows get decorated */ MetaFrame *frame; + /* if non-NULL, the bounds of the window frame */ + MtkRegion *frame_bounds; + gboolean has_custom_frame_extents; MetaSyncCounter sync_counter;