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



commit d2cdbd433d5a7218e1083b12e6914feecf242715
Author: Jonas Ådahl <jadahl gmail com>
Date:   Mon Sep 12 23:12:40 2016 +0800

    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(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index 165b765..ec1c0bb 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 33b8975..1b3cd8a 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 */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]