From d2cdbd433d5a7218e1083b12e6914feecf242715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 12 Sep 2016 23:12:40 +0800 Subject: [PATCH] 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 --- src/wayland/meta-wayland-seat.c | 18 ++++++++++++++++++ src/wayland/meta-wayland-seat.h | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c index 165b7656b..ec1c0bb60 100644 --- a/src/wayland/meta-wayland-seat.c +++ b/src/wayland/meta-wayland-seat.c @@ -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; +} diff --git a/src/wayland/meta-wayland-seat.h b/src/wayland/meta-wayland-seat.h index 33b8975c5..1b3cd8acd 100644 --- a/src/wayland/meta-wayland-seat.h +++ b/src/wayland/meta-wayland-seat.h @@ -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 */