From b03c7edfcfba6585d4ef236118ae4f49afb1bedf Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Mon, 13 Dec 2021 14:31:06 +0100 Subject: [PATCH] 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: --- subprojects/gst-plugins-bad/ext/wayland/wlwindow.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/wayland/wlwindow.c b/subprojects/gst-plugins-bad/ext/wayland/wlwindow.c index 961acd1..49a0447 100644 --- a/subprojects/gst-plugins-bad/ext/wayland/wlwindow.c +++ b/subprojects/gst-plugins-bad/ext/wayland/wlwindow.c @@ -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; } -- 2.7.4