MetaWaylandPointerConstraint: Disable if 'appears-focused' is false
Disable a constraint if the associated MetaWindow's 'appears-focused' state changed to false. https://bugzilla.gnome.org/show_bug.cgi?id=762661
This commit is contained in:
@@ -100,7 +100,7 @@ meta_wayland_pointer_constraint_maybe_enable_for_window (MetaWindow *window);
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
meta_wayland_pointer_constraint_maybe_remove_for_seat (MetaWaylandSeat *seat,
|
meta_wayland_pointer_constraint_maybe_remove_for_seat (MetaWaylandSeat *seat,
|
||||||
MetaWindow *focus_window);
|
MetaWindow *window);
|
||||||
|
|
||||||
static MetaWaylandSurfacePointerConstraintsData *
|
static MetaWaylandSurfacePointerConstraintsData *
|
||||||
get_surface_constraints_data (MetaWaylandSurface *surface)
|
get_surface_constraints_data (MetaWaylandSurface *surface)
|
||||||
@@ -402,31 +402,36 @@ meta_wayland_pointer_constraint_remove (MetaWaylandPointerConstraint *constraint
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_pointer_constraint_maybe_remove_for_seat (MetaWaylandSeat *seat,
|
meta_wayland_pointer_constraint_maybe_remove_for_seat (MetaWaylandSeat *seat,
|
||||||
MetaWindow *focus_window)
|
MetaWindow *window)
|
||||||
{
|
{
|
||||||
MetaWaylandPointer *pointer = &seat->pointer;
|
MetaWaylandPointer *pointer = &seat->pointer;
|
||||||
|
MetaWaylandPointerConstraint *constraint;
|
||||||
|
|
||||||
if ((pointer->grab->interface == &confined_pointer_grab_interface ||
|
if ((pointer->grab->interface != &confined_pointer_grab_interface &&
|
||||||
pointer->grab->interface == &locked_pointer_grab_interface) &&
|
pointer->grab->interface != &locked_pointer_grab_interface))
|
||||||
pointer->focus_surface &&
|
return;
|
||||||
pointer->focus_surface->window != focus_window)
|
|
||||||
|
constraint = wl_container_of (pointer->grab, constraint, grab);
|
||||||
|
|
||||||
|
if (constraint->surface != window->surface)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (meta_window_appears_focused (window) &&
|
||||||
|
pointer->focus_surface == window->surface)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (constraint->lifetime)
|
||||||
{
|
{
|
||||||
MetaWaylandPointerConstraint *constraint =
|
case ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT:
|
||||||
wl_container_of (pointer->grab, constraint, grab);
|
meta_wayland_pointer_constraint_remove (constraint);
|
||||||
|
break;
|
||||||
|
|
||||||
switch (constraint->lifetime)
|
case ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT:
|
||||||
{
|
meta_wayland_pointer_constraint_disable (constraint);
|
||||||
case ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT:
|
break;
|
||||||
meta_wayland_pointer_constraint_remove (constraint);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT:
|
default:
|
||||||
meta_wayland_pointer_constraint_disable (constraint);
|
g_assert_not_reached ();
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user