wayland/seat: Add API to check whether a seat has a device class

Meant to replace explicitly checking whether a
MetaWaylandPointer/MetaWaylandKeyboard/MetaWaylandTouch has a seat or
not to determine whether they are supposed to be active or not.

https://bugzilla.gnome.org/show_bug.cgi?id=771305
This commit is contained in:
Jonas Ådahl 2016-09-12 23:12:40 +08:00
parent 5d3cacf8d2
commit d2cdbd433d
2 changed files with 24 additions and 0 deletions

View File

@ -445,3 +445,21 @@ meta_wayland_seat_can_popup (MetaWaylandSeat *seat,
meta_wayland_keyboard_can_popup (seat->keyboard, serial) ||
meta_wayland_touch_can_popup (seat->touch, serial));
}
gboolean
meta_wayland_seat_has_keyboard (MetaWaylandSeat *seat)
{
return (seat->capabilities & WL_SEAT_CAPABILITY_KEYBOARD) != 0;
}
gboolean
meta_wayland_seat_has_pointer (MetaWaylandSeat *seat)
{
return (seat->capabilities & WL_SEAT_CAPABILITY_POINTER) != 0;
}
gboolean
meta_wayland_seat_has_touch (MetaWaylandSeat *seat)
{
return (seat->capabilities & WL_SEAT_CAPABILITY_TOUCH) != 0;
}

View File

@ -69,4 +69,10 @@ gboolean meta_wayland_seat_get_grab_info (MetaWaylandSeat *seat,
gboolean meta_wayland_seat_can_popup (MetaWaylandSeat *seat,
uint32_t serial);
gboolean meta_wayland_seat_has_keyboard (MetaWaylandSeat *seat);
gboolean meta_wayland_seat_has_pointer (MetaWaylandSeat *seat);
gboolean meta_wayland_seat_has_touch (MetaWaylandSeat *seat);
#endif /* META_WAYLAND_SEAT_H */