window: Move shape_region to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
This commit is contained in:
parent
5e8e7df5bd
commit
41cc85c857
@ -915,19 +915,20 @@ update_shape_region (MetaWindowActorX11 *actor_x11)
|
||||
{
|
||||
MetaWindow *window =
|
||||
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_private (META_WINDOW_X11 (window));
|
||||
MtkRegion *region = NULL;
|
||||
MtkRectangle client_area;
|
||||
|
||||
get_client_area_rect (actor_x11, &client_area);
|
||||
|
||||
if (window->frame && window->shape_region)
|
||||
if (window->frame && priv->shape_region)
|
||||
{
|
||||
region = mtk_region_copy (window->shape_region);
|
||||
region = mtk_region_copy (priv->shape_region);
|
||||
mtk_region_translate (region, client_area.x, client_area.y);
|
||||
}
|
||||
else if (window->shape_region != NULL)
|
||||
else if (priv->shape_region != NULL)
|
||||
{
|
||||
region = mtk_region_ref (window->shape_region);
|
||||
region = mtk_region_ref (priv->shape_region);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -937,7 +938,7 @@ update_shape_region (MetaWindowActorX11 *actor_x11)
|
||||
region = mtk_region_create_rectangle (&client_area);
|
||||
}
|
||||
|
||||
if (window->shape_region || window->frame)
|
||||
if (priv->shape_region || window->frame)
|
||||
build_and_scan_frame_mask (actor_x11, region);
|
||||
|
||||
g_clear_pointer (&actor_x11->shape_region, mtk_region_unref);
|
||||
@ -959,7 +960,7 @@ update_input_region (MetaWindowActorX11 *actor_x11)
|
||||
meta_window_x11_get_private (META_WINDOW_X11 (window));
|
||||
g_autoptr (MtkRegion) region = NULL;
|
||||
|
||||
if (window->shape_region && priv->input_region)
|
||||
if (priv->shape_region && priv->input_region)
|
||||
{
|
||||
MtkRectangle client_area;
|
||||
g_autoptr (MtkRegion) frames_input = NULL;
|
||||
@ -977,13 +978,13 @@ update_input_region (MetaWindowActorX11 *actor_x11)
|
||||
|
||||
region = g_steal_pointer (&frames_input);
|
||||
}
|
||||
else if (window->shape_region)
|
||||
else if (priv->shape_region)
|
||||
{
|
||||
MtkRectangle client_area;
|
||||
|
||||
meta_window_get_client_area_rect (window, &client_area);
|
||||
|
||||
region = mtk_region_copy (window->shape_region);
|
||||
region = mtk_region_copy (priv->shape_region);
|
||||
mtk_region_translate (region, client_area.x, client_area.y);
|
||||
}
|
||||
else if (priv->input_region)
|
||||
|
@ -239,10 +239,6 @@ struct _MetaWindow
|
||||
/* if non-NULL, the bounds of the window frame */
|
||||
MtkRegion *frame_bounds;
|
||||
|
||||
/* if non-NULL, the bounding shape region of the window. Relative to
|
||||
* the server-side client window. */
|
||||
MtkRegion *shape_region;
|
||||
|
||||
/* _NET_WM_WINDOW_OPACITY rescaled to 0xFF */
|
||||
guint8 opacity;
|
||||
|
||||
|
@ -314,7 +314,6 @@ meta_window_finalize (GObject *object)
|
||||
MetaWindow *window = META_WINDOW (object);
|
||||
|
||||
g_clear_pointer (&window->frame_bounds, mtk_region_unref);
|
||||
g_clear_pointer (&window->shape_region, mtk_region_unref);
|
||||
|
||||
if (window->transient_for)
|
||||
g_object_unref (window->transient_for);
|
||||
|
@ -75,6 +75,10 @@ struct _MetaWindowX11Private
|
||||
/* the input shape region for picking */
|
||||
MtkRegion *input_region;
|
||||
|
||||
/* if non-NULL, the bounding shape region of the window. Relative to
|
||||
* the server-side client window. */
|
||||
MtkRegion *shape_region;
|
||||
|
||||
Pixmap wm_hints_pixmap;
|
||||
Pixmap wm_hints_mask;
|
||||
|
||||
|
@ -2149,6 +2149,7 @@ meta_window_x11_finalize (GObject *object)
|
||||
MetaWindowX11 *win = META_WINDOW_X11 (object);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (win);
|
||||
|
||||
g_clear_pointer (&priv->shape_region, mtk_region_unref);
|
||||
g_clear_pointer (&priv->input_region, mtk_region_unref);
|
||||
g_clear_pointer (&priv->opaque_region, mtk_region_unref);
|
||||
g_clear_pointer (&priv->wm_client_machine, g_free);
|
||||
@ -2507,13 +2508,16 @@ static void
|
||||
meta_window_set_shape_region (MetaWindow *window,
|
||||
MtkRegion *region)
|
||||
{
|
||||
if (mtk_region_equal (window->shape_region, region))
|
||||
MetaWindowX11Private *priv =
|
||||
meta_window_x11_get_instance_private (META_WINDOW_X11 (window));
|
||||
|
||||
if (mtk_region_equal (priv->shape_region, region))
|
||||
return;
|
||||
|
||||
g_clear_pointer (&window->shape_region, mtk_region_unref);
|
||||
g_clear_pointer (&priv->shape_region, mtk_region_unref);
|
||||
|
||||
if (region != NULL)
|
||||
window->shape_region = mtk_region_ref (region);
|
||||
priv->shape_region = mtk_region_ref (region);
|
||||
|
||||
meta_compositor_window_shape_changed (window->display->compositor, window);
|
||||
}
|
||||
@ -4322,6 +4326,8 @@ gboolean
|
||||
meta_window_x11_can_unredirect (MetaWindowX11 *window_x11)
|
||||
{
|
||||
MetaWindow *window = META_WINDOW (window_x11);
|
||||
MetaWindowX11Private *priv =
|
||||
meta_window_x11_get_instance_private (window_x11);
|
||||
|
||||
if (has_requested_dont_bypass_compositor (window_x11))
|
||||
return FALSE;
|
||||
@ -4329,7 +4335,7 @@ meta_window_x11_can_unredirect (MetaWindowX11 *window_x11)
|
||||
if (window->opacity != 0xFF)
|
||||
return FALSE;
|
||||
|
||||
if (window->shape_region != NULL)
|
||||
if (priv->shape_region != NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!window->monitor)
|
||||
|
Loading…
Reference in New Issue
Block a user