x11/display: Keep track of stage input region

It makes more sense for Mutter to track that instead of gnome-shell
allowing gnome-shell to no longer have an ifdefed struct field

Context:
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3362#note_2151381

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
This commit is contained in:
Bilal Elmoussaoui
2024-06-27 09:36:06 +02:00
parent fd9957b81a
commit b6fb8d87f4
4 changed files with 20 additions and 25 deletions

View File

@ -178,11 +178,11 @@ meta_x11_display_dispose (GObject *object)
g_clear_object (&x11_display->frames_client);
}
if (x11_display->empty_region != None)
if (x11_display->stage_input_region != None)
{
XFixesDestroyRegion (x11_display->xdisplay,
x11_display->empty_region);
x11_display->empty_region = None;
x11_display->stage_input_region);
x11_display->stage_input_region = None;
}
meta_x11_startup_notification_release (x11_display);
@ -2421,9 +2421,13 @@ prefs_changed_callback (MetaPreference pref,
}
}
/**
* meta_x11_display_set_stage_input_region: (skip)
*/
void
meta_x11_display_set_stage_input_region (MetaX11Display *x11_display,
XserverRegion region)
XRectangle *rects,
int n_rects)
{
Display *xdisplay = x11_display->xdisplay;
MetaBackend *backend = backend_from_x11_display (x11_display);
@ -2432,25 +2436,17 @@ meta_x11_display_set_stage_input_region (MetaX11Display *x11_display,
g_return_if_fail (!meta_is_wayland_compositor ());
if (x11_display->stage_input_region)
XFixesDestroyRegion (xdisplay, x11_display->stage_input_region);
x11_display->stage_input_region = XFixesCreateRegion (xdisplay, rects, n_rects);
stage_xwindow = meta_x11_get_stage_window (stage);
XFixesSetWindowShapeRegion (xdisplay, stage_xwindow,
ShapeInput, 0, 0, region);
ShapeInput, 0, 0, x11_display->stage_input_region);
XFixesSetWindowShapeRegion (xdisplay,
x11_display->composite_overlay_window,
ShapeInput, 0, 0, region);
}
void
meta_x11_display_clear_stage_input_region (MetaX11Display *x11_display)
{
if (x11_display->empty_region == None)
{
x11_display->empty_region = XFixesCreateRegion (x11_display->xdisplay,
NULL, 0);
}
meta_x11_display_set_stage_input_region (x11_display,
x11_display->empty_region);
ShapeInput, 0, 0, x11_display->stage_input_region);
}
/**