mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
wayland/pointer: Check pointer presence at set focus call site
Make the caller of focus setting check whether there is a pointer to update the focus state of. It makes it more obvious what to expect, as the call would be a no-op in when no pointer is present. Grabbing is still allowed without the presence of a pointer because it is used by popups even on touch-only systems. https://bugzilla.gnome.org/show_bug.cgi?id=771646
This commit is contained in:
parent
d3cff9a962
commit
d5d5084151
@ -416,11 +416,13 @@ default_grab_focus (MetaWaylandPointerGrab *grab,
|
|||||||
MetaWaylandSurface *surface)
|
MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
MetaWaylandPointer *pointer = grab->pointer;
|
MetaWaylandPointer *pointer = grab->pointer;
|
||||||
|
MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (pointer);
|
||||||
|
|
||||||
if (pointer->button_count > 0)
|
if (pointer->button_count > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_wayland_pointer_set_focus (pointer, surface);
|
if (meta_wayland_seat_has_pointer (seat))
|
||||||
|
meta_wayland_pointer_set_focus (pointer, surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -794,10 +796,6 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
|
|||||||
MetaWaylandSurface *surface)
|
MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (pointer);
|
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (pointer);
|
||||||
MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (pointer);
|
|
||||||
|
|
||||||
if (!meta_wayland_seat_has_pointer (seat))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (pointer->focus_surface == surface)
|
if (pointer->focus_surface == surface)
|
||||||
return;
|
return;
|
||||||
|
@ -101,6 +101,16 @@ popup_grab_focus (MetaWaylandPointerGrab *grab,
|
|||||||
MetaWaylandSurface *surface)
|
MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
MetaWaylandPopupGrab *popup_grab = (MetaWaylandPopupGrab*)grab;
|
MetaWaylandPopupGrab *popup_grab = (MetaWaylandPopupGrab*)grab;
|
||||||
|
MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (grab->pointer);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We rely on having a pointer grab even when the seat doesn't have
|
||||||
|
* the pointer capability. In this case, we shouldn't update any pointer focus
|
||||||
|
* since there is no such thing when the seat doesn't have the pointer
|
||||||
|
* capability.
|
||||||
|
*/
|
||||||
|
if (!meta_wayland_seat_has_pointer (seat))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Popup grabs are in owner-events mode (ie, events for the same client
|
/* Popup grabs are in owner-events mode (ie, events for the same client
|
||||||
are reported as normal) */
|
are reported as normal) */
|
||||||
|
Loading…
Reference in New Issue
Block a user