waylandsink: Simplify input region handling

We only need to unset the input region for the area surface when
we don't have our own toplevel surface. By default, the input region
covers the whole surface, thus no need to change it on resize.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1446>
This commit is contained in:
Robert Mader 2021-12-13 14:31:06 +01:00 committed by GStreamer Marge Bot
parent 1e2bc68171
commit b03c7edfcf

View file

@ -222,11 +222,7 @@ gst_wl_window_new_internal (GstWlDisplay * display, GMutex * render_lock)
window->video_surface);
}
/* do not accept input */
region = wl_compositor_create_region (display->compositor);
wl_surface_set_input_region (window->area_surface, region);
wl_region_destroy (region);
/* never accept input events on the video surface */
region = wl_compositor_create_region (display->compositor);
wl_surface_set_input_region (window->video_surface, region);
wl_region_destroy (region);
@ -345,8 +341,14 @@ gst_wl_window_new_in_surface (GstWlDisplay * display,
struct wl_surface * parent, GMutex * render_lock)
{
GstWlWindow *window;
struct wl_region *region;
window = gst_wl_window_new_internal (display, render_lock);
/* do not accept input events on the area surface when embedded */
region = wl_compositor_create_region (display->compositor);
wl_surface_set_input_region (window->area_surface, region);
wl_region_destroy (region);
/* embed in parent */
window->area_subsurface =
wl_subcompositor_get_subsurface (display->subcompositor,
@ -412,16 +414,6 @@ gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit)
wl_surface_commit (window->video_surface_wrapper);
}
if (gst_wl_window_is_toplevel (window)) {
struct wl_region *region;
region = wl_compositor_create_region (window->display->compositor);
wl_region_add (region, 0, 0, window->render_rectangle.w,
window->render_rectangle.h);
wl_surface_set_input_region (window->area_surface, region);
wl_region_destroy (region);
}
/* this is saved for use in wl_surface_damage */
window->video_rectangle = res;
}