wayland/pointer: Check for subsurfaces when grabbing

Previously, the function only returned `TRUE` if the given surface was
equal to the given pointer's focused surface. This changes the behaviour
to also return `TRUE` if any of the given surface's subsurfaces are
equal to the pointer's focused surface.

https://bugzilla.gnome.org/show_bug.cgi?id=781811
This commit is contained in:
mitchmindtree 2017-06-02 14:41:56 +10:00 committed by Jonas Ådahl
parent 0f7c3f3678
commit e22c75377b

View File

@ -1162,13 +1162,33 @@ meta_wayland_pointer_create_new_resource (MetaWaylandPointer *pointer,
} }
} }
static gboolean
pointer_can_grab_surface (MetaWaylandPointer *pointer,
MetaWaylandSurface *surface)
{
GList *l;
if (pointer->focus_surface == surface)
return TRUE;
for (l = surface->subsurfaces; l; l = l->next)
{
MetaWaylandSurface *subsurface = l->data;
if (pointer_can_grab_surface (pointer, subsurface))
return TRUE;
}
return FALSE;
}
gboolean gboolean
meta_wayland_pointer_can_grab_surface (MetaWaylandPointer *pointer, meta_wayland_pointer_can_grab_surface (MetaWaylandPointer *pointer,
MetaWaylandSurface *surface, MetaWaylandSurface *surface,
uint32_t serial) uint32_t serial)
{ {
return (pointer->grab_serial == serial && return (pointer->grab_serial == serial &&
pointer->focus_surface == surface); pointer_can_grab_surface (pointer, surface));
} }
gboolean gboolean