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

@ -167,7 +167,7 @@ meta_compositor_x11_manage (MetaCompositor *compositor,
XReparentWindow (xdisplay, xwindow, compositor_x11->output, 0, 0); XReparentWindow (xdisplay, xwindow, compositor_x11->output, 0, 0);
meta_x11_display_clear_stage_input_region (display->x11_display); meta_x11_display_set_stage_input_region (display->x11_display, NULL, 0);
/* /*
* Make sure there isn't any left-over output shape on the overlay window by * Make sure there isn't any left-over output shape on the overlay window by

View File

@ -46,8 +46,9 @@ META_EXPORT
Window meta_x11_display_get_xroot (MetaX11Display *x11_display); Window meta_x11_display_get_xroot (MetaX11Display *x11_display);
META_EXPORT META_EXPORT
void meta_x11_display_set_stage_input_region (MetaX11Display *x11_display, void meta_x11_display_set_stage_input_region (MetaX11Display *x11_display,
XserverRegion region); XRectangle *rects,
int n_rects);
META_EXPORT META_EXPORT
unsigned int meta_x11_display_add_event_func (MetaX11Display *x11_display, unsigned int meta_x11_display_add_event_func (MetaX11Display *x11_display,

View File

@ -185,7 +185,7 @@ struct _MetaX11Display
MetaX11StartupNotification *startup_notification; MetaX11StartupNotification *startup_notification;
MetaX11Stack *x11_stack; MetaX11Stack *x11_stack;
XserverRegion empty_region; XserverRegion stage_input_region;
unsigned int reload_x11_cursor_later; unsigned int reload_x11_cursor_later;
}; };
@ -250,5 +250,3 @@ int meta_x11_display_get_damage_event_base (MetaX11Display *x11_display);
gboolean meta_x11_display_xwindow_is_a_no_focus_window (MetaX11Display *x11_display, gboolean meta_x11_display_xwindow_is_a_no_focus_window (MetaX11Display *x11_display,
Window xwindow); Window xwindow);
void meta_x11_display_clear_stage_input_region (MetaX11Display *x11_display);

View File

@ -178,11 +178,11 @@ meta_x11_display_dispose (GObject *object)
g_clear_object (&x11_display->frames_client); g_clear_object (&x11_display->frames_client);
} }
if (x11_display->empty_region != None) if (x11_display->stage_input_region != None)
{ {
XFixesDestroyRegion (x11_display->xdisplay, XFixesDestroyRegion (x11_display->xdisplay,
x11_display->empty_region); x11_display->stage_input_region);
x11_display->empty_region = None; x11_display->stage_input_region = None;
} }
meta_x11_startup_notification_release (x11_display); 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 void
meta_x11_display_set_stage_input_region (MetaX11Display *x11_display, meta_x11_display_set_stage_input_region (MetaX11Display *x11_display,
XserverRegion region) XRectangle *rects,
int n_rects)
{ {
Display *xdisplay = x11_display->xdisplay; Display *xdisplay = x11_display->xdisplay;
MetaBackend *backend = backend_from_x11_display (x11_display); 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 ()); 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); stage_xwindow = meta_x11_get_stage_window (stage);
XFixesSetWindowShapeRegion (xdisplay, stage_xwindow, XFixesSetWindowShapeRegion (xdisplay, stage_xwindow,
ShapeInput, 0, 0, region); ShapeInput, 0, 0, x11_display->stage_input_region);
XFixesSetWindowShapeRegion (xdisplay, XFixesSetWindowShapeRegion (xdisplay,
x11_display->composite_overlay_window, x11_display->composite_overlay_window,
ShapeInput, 0, 0, region); ShapeInput, 0, 0, x11_display->stage_input_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);
} }
/** /**