Procházet zdrojové kódy

input: add missing has_vibration() method to InputDevice

rdb před 8 roky
rodič
revize
58623b09bd
2 změnil soubory, kde provedl 11 přidání a 0 odebrání
  1. 10 0
      panda/src/device/inputDevice.I
  2. 1 0
      panda/src/device/inputDevice.h

+ 10 - 0
panda/src/device/inputDevice.I

@@ -118,6 +118,16 @@ has_tracker() const {
   return ((_flags & IDF_has_tracker) != 0);
 }
 
+/**
+ * Returns true if the device has vibration motors that can be controlled by
+ * calling set_vibration().
+ */
+INLINE bool InputDevice::
+has_vibration() const {
+  LightMutexHolder holder(_lock);
+  return ((_flags & IDF_has_vibration) != 0);
+}
+
 /**
  * Returns true if the device may be able to provide information about its
  * battery life.

+ 1 - 0
panda/src/device/inputDevice.h

@@ -149,6 +149,7 @@ PUBLISHED:
   INLINE bool has_pointer() const;
   INLINE bool has_keyboard() const;
   INLINE bool has_tracker() const;
+  INLINE bool has_vibration() const;
   INLINE bool has_battery() const;
 
   INLINE PointerData get_pointer() const;