MetaWaylandPointerConstraint: Require 'appears-focused' to enable

Instead of relying on the keyboard focus surface, use the
'appears-focused' state of the corresponding MetaWindow to determine if
a constraint should enable or not.

https://bugzilla.gnome.org/show_bug.cgi?id=762661
This commit is contained in:
Jonas Ådahl 2016-02-25 11:15:29 +08:00
parent b04747b174
commit 1c94d0e598

View File

@ -368,13 +368,18 @@ is_within_constraint_region (MetaWaylandPointerConstraint *constraint,
static void
meta_wayland_pointer_constraint_maybe_enable (MetaWaylandPointerConstraint *constraint)
{
MetaWaylandSeat *seat = constraint->seat;
wl_fixed_t sx, sy;
if (constraint->is_enabled)
return;
if (seat->keyboard.focus_surface != constraint->surface)
if (!constraint->surface->window)
{
g_warn_if_reached ();
return;
}
if (!meta_window_appears_focused (constraint->surface->window))
return;
meta_wayland_pointer_get_relative_coordinates (&constraint->seat->pointer,