window: Move input_region to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
This commit is contained in:
parent
606197de46
commit
5e8e7df5bd
5 changed files with 18 additions and 13 deletions
|
@ -955,9 +955,11 @@ update_input_region (MetaWindowActorX11 *actor_x11)
|
|||
meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11));
|
||||
MetaSurfaceActor *surface =
|
||||
meta_window_actor_get_surface (META_WINDOW_ACTOR (actor_x11));
|
||||
MetaWindowX11Private *priv =
|
||||
meta_window_x11_get_private (META_WINDOW_X11 (window));
|
||||
g_autoptr (MtkRegion) region = NULL;
|
||||
|
||||
if (window->shape_region && window->input_region)
|
||||
if (window->shape_region && priv->input_region)
|
||||
{
|
||||
MtkRectangle client_area;
|
||||
g_autoptr (MtkRegion) frames_input = NULL;
|
||||
|
@ -965,11 +967,11 @@ update_input_region (MetaWindowActorX11 *actor_x11)
|
|||
|
||||
get_client_area_rect (actor_x11, &client_area);
|
||||
|
||||
frames_input = mtk_region_copy (window->input_region);
|
||||
frames_input = mtk_region_copy (priv->input_region);
|
||||
mtk_region_subtract_rectangle (frames_input, &client_area);
|
||||
|
||||
client_input = mtk_region_copy (actor_x11->shape_region);
|
||||
mtk_region_intersect (client_input, window->input_region);
|
||||
mtk_region_intersect (client_input, priv->input_region);
|
||||
|
||||
mtk_region_union (frames_input, client_input);
|
||||
|
||||
|
@ -984,8 +986,8 @@ update_input_region (MetaWindowActorX11 *actor_x11)
|
|||
region = mtk_region_copy (window->shape_region);
|
||||
mtk_region_translate (region, client_area.x, client_area.y);
|
||||
}
|
||||
else if (window->input_region)
|
||||
region = mtk_region_ref (window->input_region);
|
||||
else if (priv->input_region)
|
||||
region = mtk_region_ref (priv->input_region);
|
||||
else
|
||||
region = NULL;
|
||||
|
||||
|
|
|
@ -243,9 +243,6 @@ struct _MetaWindow
|
|||
* the server-side client window. */
|
||||
MtkRegion *shape_region;
|
||||
|
||||
/* the input shape region for picking */
|
||||
MtkRegion *input_region;
|
||||
|
||||
/* _NET_WM_WINDOW_OPACITY rescaled to 0xFF */
|
||||
guint8 opacity;
|
||||
|
||||
|
|
|
@ -315,7 +315,6 @@ meta_window_finalize (GObject *object)
|
|||
|
||||
g_clear_pointer (&window->frame_bounds, mtk_region_unref);
|
||||
g_clear_pointer (&window->shape_region, mtk_region_unref);
|
||||
g_clear_pointer (&window->input_region, mtk_region_unref);
|
||||
|
||||
if (window->transient_for)
|
||||
g_object_unref (window->transient_for);
|
||||
|
|
|
@ -72,6 +72,9 @@ struct _MetaWindowX11Private
|
|||
/* if non-NULL, the opaque region _NET_WM_OPAQUE_REGION */
|
||||
MtkRegion *opaque_region;
|
||||
|
||||
/* the input shape region for picking */
|
||||
MtkRegion *input_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->input_region, mtk_region_unref);
|
||||
g_clear_pointer (&priv->opaque_region, mtk_region_unref);
|
||||
g_clear_pointer (&priv->wm_client_machine, g_free);
|
||||
g_clear_pointer (&priv->sm_client_id, g_free);
|
||||
|
@ -2364,13 +2365,16 @@ static void
|
|||
meta_window_set_input_region (MetaWindow *window,
|
||||
MtkRegion *region)
|
||||
{
|
||||
if (mtk_region_equal (window->input_region, region))
|
||||
MetaWindowX11Private *priv =
|
||||
meta_window_x11_get_private (META_WINDOW_X11 (window));
|
||||
|
||||
if (mtk_region_equal (priv->input_region, region))
|
||||
return;
|
||||
|
||||
g_clear_pointer (&window->input_region, mtk_region_unref);
|
||||
g_clear_pointer (&priv->input_region, mtk_region_unref);
|
||||
|
||||
if (region != NULL)
|
||||
window->input_region = mtk_region_ref (region);
|
||||
priv->input_region = mtk_region_ref (region);
|
||||
|
||||
meta_compositor_window_shape_changed (window->display->compositor, window);
|
||||
}
|
||||
|
@ -2409,7 +2413,7 @@ meta_window_x11_update_input_region (MetaWindow *window)
|
|||
{
|
||||
if (!window->frame)
|
||||
{
|
||||
if (window->input_region)
|
||||
if (priv->input_region)
|
||||
meta_window_set_input_region (window, NULL);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue