Bug 1712680 [Wayland] Clear wl_surface input region on map and allocate event, r=jhorak

Differential Revision: https://phabricator.services.mozilla.com/D115861
This commit is contained in:
stransky 2021-05-25 10:22:16 +00:00
parent 42c1875739
commit 34b5df654e

View File

@ -116,6 +116,16 @@ static void moz_container_wayland_invalidate(MozContainer* container) {
gdk_window_invalidate_rect(window, &rect, true);
}
// Route input to parent wl_surface owned by Gtk+ so we get input
// events from Gtk+.
static void moz_container_clear_input_region(MozContainer* container) {
struct wl_compositor* compositor = WaylandDisplayGet()->GetCompositor();
MozContainerWayland* wl_container = &container->wl_container;
wl_region* region = wl_compositor_create_region(compositor);
wl_surface_set_input_region(wl_container->surface, region);
wl_region_destroy(region);
}
static void moz_container_wayland_move_locked(MozContainer* container, int dx,
int dy) {
LOGWAYLAND(
@ -310,6 +320,7 @@ static gboolean moz_container_wayland_map_event(GtkWidget* widget,
moz_container_wayland_set_scale_factor_locked(MOZ_CONTAINER(widget));
moz_container_wayland_set_opaque_region_locked(MOZ_CONTAINER(widget));
moz_container_clear_input_region(MOZ_CONTAINER(widget));
moz_container_wayland_invalidate(MOZ_CONTAINER(widget));
return FALSE;
}
@ -375,6 +386,7 @@ void moz_container_wayland_size_allocate(GtkWidget* widget,
moz_container_wayland_set_scale_factor_locked(container);
moz_container_wayland_set_opaque_region_locked(container);
moz_container_wayland_move_locked(container, allocation->x, allocation->y);
moz_container_clear_input_region(container);
moz_container_wayland_invalidate(MOZ_CONTAINER(widget));
container->wl_container.before_first_size_alloc = false;
}
@ -503,12 +515,6 @@ static bool moz_container_wayland_surface_create_locked(
LOGWAYLAND((" guessing subsurface position %d %d\n", dx, dy));
}
// Route input to parent wl_surface owned by Gtk+ so we get input
// events from Gtk+.
wl_region* region = wl_compositor_create_region(compositor);
wl_surface_set_input_region(wl_container->surface, region);
wl_region_destroy(region);
// If there's pending frame callback it's for wrong parent surface,
// so delete it.
if (wl_container->frame_callback_handler) {
@ -536,7 +542,6 @@ struct wl_surface* moz_container_wayland_surface_lock(MozContainer* container) {
LOGWAYLAND(("%s [%p] surface %p ready_to_draw %d\n", __FUNCTION__,
(void*)container, (void*)container->wl_container.surface,
container->wl_container.ready_to_draw));
if (!container->wl_container.surface ||
!container->wl_container.ready_to_draw) {
return nullptr;