Jelajahi Sumber

Switch to UPPER_CASE convention for enum classes as per PEP-8

Old names are still kept around for compatibility reasons, but deprecated - fortunately there are not that many cases of enum classes yet
rdb 2 tahun lalu
induk
melakukan
c34f2bbc64

+ 1 - 1
panda/src/device/clientDevice.cxx

@@ -24,7 +24,7 @@ TypeHandle ClientDevice::_type_handle;
 ClientDevice::
 ClientDevice(ClientBase *client, TypeHandle device_type,
              const std::string &device_name) :
-  InputDevice(device_name, DeviceClass::unknown),
+  InputDevice(device_name, DeviceClass::UNKNOWN),
   _client(client),
   _device_type(device_type)
 {

+ 1 - 1
panda/src/device/clientTrackerDevice.I

@@ -18,5 +18,5 @@ INLINE ClientTrackerDevice::
 ClientTrackerDevice(ClientBase *client, const std::string &device_name):
   ClientDevice(client, get_class_type(), device_name)
 {
-  enable_feature(Feature::tracker);
+  enable_feature(Feature::TRACKER);
 }

+ 96 - 96
panda/src/device/evdevInputDevice.cxx

@@ -80,41 +80,41 @@ static const struct DeviceMapping {
   int quirks;
 } mapping_presets[] = {
   // NVIDIA Shield Controller
-  {0x0955, 0x7214, InputDevice::DeviceClass::gamepad, QB_rstick_from_z},
+  {0x0955, 0x7214, InputDevice::DeviceClass::GAMEPAD, QB_rstick_from_z},
   // T.Flight Hotas X
-  {0x044f, 0xb108, InputDevice::DeviceClass::flight_stick, QB_centered_throttle | QB_reversed_throttle | QB_rudder_from_throttle},
+  {0x044f, 0xb108, InputDevice::DeviceClass::FLIGHT_STICK, QB_centered_throttle | QB_reversed_throttle | QB_rudder_from_throttle},
   // Xbox 360 Wireless Controller
-  {0x045e, 0x0719, InputDevice::DeviceClass::gamepad, QB_connect_if_nonzero},
+  {0x045e, 0x0719, InputDevice::DeviceClass::GAMEPAD, QB_connect_if_nonzero},
   // Steam Controller (wired)
-  {0x28de, 0x1102, InputDevice::DeviceClass::unknown, QB_steam_controller},
+  {0x28de, 0x1102, InputDevice::DeviceClass::UNKNOWN, QB_steam_controller},
   // Steam Controller (wireless)
-  {0x28de, 0x1142, InputDevice::DeviceClass::unknown, QB_steam_controller},
+  {0x28de, 0x1142, InputDevice::DeviceClass::UNKNOWN, QB_steam_controller},
   // Jess Tech Colour Rumble Pad
-  {0x0f30, 0x0111, InputDevice::DeviceClass::gamepad, QB_rstick_from_z | QB_right_axes_swapped},
+  {0x0f30, 0x0111, InputDevice::DeviceClass::GAMEPAD, QB_rstick_from_z | QB_right_axes_swapped},
   // Trust GXT 24
-  {0x0079, 0x0006, InputDevice::DeviceClass::gamepad, QB_no_analog_triggers | QB_alt_button_mapping},
+  {0x0079, 0x0006, InputDevice::DeviceClass::GAMEPAD, QB_no_analog_triggers | QB_alt_button_mapping},
   // 8bitdo N30 Pro Controller
-  {0x2dc8, 0x9001, InputDevice::DeviceClass::gamepad, QB_rstick_from_z},
+  {0x2dc8, 0x9001, InputDevice::DeviceClass::GAMEPAD, QB_rstick_from_z},
   // Generic gamepad
-  {0x0810, 0x0001, InputDevice::DeviceClass::gamepad, QB_no_analog_triggers | QB_alt_button_mapping | QB_rstick_from_z | QB_right_axes_swapped},
+  {0x0810, 0x0001, InputDevice::DeviceClass::GAMEPAD, QB_no_analog_triggers | QB_alt_button_mapping | QB_rstick_from_z | QB_right_axes_swapped},
   // Generic gamepad without sticks
-  {0x0810, 0xe501, InputDevice::DeviceClass::gamepad, QB_no_analog_triggers | QB_alt_button_mapping},
+  {0x0810, 0xe501, InputDevice::DeviceClass::GAMEPAD, QB_no_analog_triggers | QB_alt_button_mapping},
   // 3Dconnexion Space Traveller 3D Mouse
-  {0x046d, 0xc623, InputDevice::DeviceClass::spatial_mouse, 0},
+  {0x046d, 0xc623, InputDevice::DeviceClass::SPATIAL_MOUSE, 0},
   // 3Dconnexion Space Pilot 3D Mouse
-  {0x046d, 0xc625, InputDevice::DeviceClass::spatial_mouse, 0},
+  {0x046d, 0xc625, InputDevice::DeviceClass::SPATIAL_MOUSE, 0},
   // 3Dconnexion Space Navigator 3D Mouse
-  {0x046d, 0xc626, InputDevice::DeviceClass::spatial_mouse, 0},
+  {0x046d, 0xc626, InputDevice::DeviceClass::SPATIAL_MOUSE, 0},
   // 3Dconnexion Space Explorer 3D Mouse
-  {0x046d, 0xc627, InputDevice::DeviceClass::spatial_mouse, 0},
+  {0x046d, 0xc627, InputDevice::DeviceClass::SPATIAL_MOUSE, 0},
   // 3Dconnexion Space Navigator for Notebooks
-  {0x046d, 0xc628, InputDevice::DeviceClass::spatial_mouse, 0},
+  {0x046d, 0xc628, InputDevice::DeviceClass::SPATIAL_MOUSE, 0},
   // 3Dconnexion SpacePilot Pro 3D Mouse
-  {0x046d, 0xc629, InputDevice::DeviceClass::spatial_mouse, 0},
+  {0x046d, 0xc629, InputDevice::DeviceClass::SPATIAL_MOUSE, 0},
   // 3Dconnexion Space Mouse Pro
-  {0x046d, 0xc62b, InputDevice::DeviceClass::spatial_mouse, 0},
+  {0x046d, 0xc62b, InputDevice::DeviceClass::SPATIAL_MOUSE, 0},
   // FrSky Simulator
-  {0x0483, 0x5720, InputDevice::DeviceClass::flight_stick, 0},
+  {0x0483, 0x5720, InputDevice::DeviceClass::FLIGHT_STICK, 0},
   {0},
 };
 
@@ -322,7 +322,7 @@ init_device() {
     has_keys = true;
 
     if (test_bit(KEY_A, keys) && test_bit(KEY_Z, keys)) {
-      enable_feature(Feature::keyboard);
+      enable_feature(Feature::KEYBOARD);
     }
   }
 
@@ -364,7 +364,7 @@ init_device() {
   // The Steam Controller reports as multiple devices, one of which a gamepad.
   if (quirks & QB_steam_controller) {
     if (test_bit(BTN_GAMEPAD, keys)) {
-      _device_class = DeviceClass::gamepad;
+      _device_class = DeviceClass::GAMEPAD;
 
       // If we have a virtual gamepad on the system, then careful: if Steam is
       // running, it may disable its own gamepad in favour of the virtual
@@ -380,41 +380,41 @@ init_device() {
   _quirks = quirks;
 
   // Try to detect which type of device we have here
-  if (_device_class == DeviceClass::unknown) {
-    int device_scores[(size_t)DeviceClass::digitizer + 1] = {0};
+  if (_device_class == DeviceClass::UNKNOWN) {
+    int device_scores[(size_t)DeviceClass::DIGITIZER + 1] = {0};
 
     // Test for specific keys
     if (test_bit(BTN_GAMEPAD, keys) && test_bit(ABS_X, axes) && test_bit(ABS_RX, axes)) {
-      device_scores[(size_t)DeviceClass::gamepad] += 5;
-      device_scores[(size_t)DeviceClass::steering_wheel] += 5;
-      device_scores[(size_t)DeviceClass::flight_stick] += 5;
+      device_scores[(size_t)DeviceClass::GAMEPAD] += 5;
+      device_scores[(size_t)DeviceClass::STEERING_WHEEL] += 5;
+      device_scores[(size_t)DeviceClass::FLIGHT_STICK] += 5;
     }
 
     if (test_bit(ABS_WHEEL, axes) && test_bit(ABS_GAS, axes) && test_bit(ABS_BRAKE, axes)) {
-      device_scores[(size_t)DeviceClass::steering_wheel] += 10;
+      device_scores[(size_t)DeviceClass::STEERING_WHEEL] += 10;
     }
     if (test_bit(BTN_GEAR_DOWN, keys) && test_bit(BTN_GEAR_UP, keys)) {
-      device_scores[(size_t)DeviceClass::steering_wheel] += 10;
+      device_scores[(size_t)DeviceClass::STEERING_WHEEL] += 10;
     }
     if (test_bit(BTN_JOYSTICK, keys) && test_bit(ABS_X, axes)) {
-      device_scores[(size_t)DeviceClass::flight_stick] += 10;
+      device_scores[(size_t)DeviceClass::FLIGHT_STICK] += 10;
     }
     if (test_bit(BTN_MOUSE, keys) && test_bit(EV_REL, evtypes)) {
-      device_scores[(size_t)DeviceClass::mouse] += 20;
+      device_scores[(size_t)DeviceClass::MOUSE] += 20;
     }
     if (test_bit(BTN_DIGI, keys) && test_bit(EV_ABS, evtypes)) {
-      device_scores[(size_t)DeviceClass::digitizer] += 20;
+      device_scores[(size_t)DeviceClass::DIGITIZER] += 20;
     }
     uint8_t unknown_keys[] = {KEY_POWER};
     for (int i = 0; i < 1; i++) {
       if (test_bit(unknown_keys[i], keys)) {
         if (unknown_keys[i] == KEY_POWER) {
         }
-        device_scores[(size_t)DeviceClass::unknown] += 20;
+        device_scores[(size_t)DeviceClass::UNKNOWN] += 20;
       }
     }
-    if (_features & (unsigned int)Feature::keyboard) {
-      device_scores[(size_t)DeviceClass::keyboard] += 20;
+    if (_features & (unsigned int)Feature::KEYBOARD) {
+      device_scores[(size_t)DeviceClass::KEYBOARD] += 20;
     }
 
     // Test for specific name tags
@@ -423,28 +423,28 @@ init_device() {
       lowercase_name[x] = tolower(lowercase_name[x]);
     }
     if (lowercase_name.find("gamepad") != string::npos) {
-      device_scores[(size_t)DeviceClass::gamepad] += 10;
+      device_scores[(size_t)DeviceClass::GAMEPAD] += 10;
     }
     if (lowercase_name.find("wheel") != string::npos) {
-      device_scores[(size_t)DeviceClass::steering_wheel] += 10;
+      device_scores[(size_t)DeviceClass::STEERING_WHEEL] += 10;
     }
     if (lowercase_name.find("mouse") != string::npos || lowercase_name.find("touchpad") != string::npos) {
-      device_scores[(size_t)DeviceClass::mouse] += 10;
+      device_scores[(size_t)DeviceClass::MOUSE] += 10;
     }
     if (lowercase_name.find("keyboard") != string::npos) {
-      device_scores[(size_t)DeviceClass::keyboard] += 10;
+      device_scores[(size_t)DeviceClass::KEYBOARD] += 10;
     }
     // List of lowercase names that occur in unknown devices
     string unknown_names[] = {"video bus", "power button", "sleep button"};
     for(int i = 0; i < 3; i++) {
       if (lowercase_name.find(unknown_names[i]) != string::npos) {
-        device_scores[(size_t)DeviceClass::unknown] += 20;
+        device_scores[(size_t)DeviceClass::UNKNOWN] += 20;
       }
     }
 
     // Check which device type got the most points
     int highest_score = 0;
-    for (size_t i = 0; i <= (size_t)DeviceClass::digitizer; i++) {
+    for (size_t i = 0; i <= (size_t)DeviceClass::DIGITIZER; i++) {
       if (device_scores[i] > highest_score) {
         highest_score = device_scores[i];
         _device_class = (DeviceClass)i;
@@ -499,113 +499,113 @@ init_device() {
 
     for (int i = 0; i < num_bits; ++i) {
       if (test_bit(i, axes)) {
-        Axis axis = Axis::none;
+        Axis axis = Axis::NONE;
         switch (i) {
         case ABS_X:
-          if (_device_class == DeviceClass::gamepad) {
-            axis = InputDevice::Axis::left_x;
-          } else if (_device_class == DeviceClass::flight_stick) {
-            axis = InputDevice::Axis::roll;
+          if (_device_class == DeviceClass::GAMEPAD) {
+            axis = Axis::LEFT_X;
+          } else if (_device_class == DeviceClass::FLIGHT_STICK) {
+            axis = Axis::ROLL;
           } else {
-            axis = InputDevice::Axis::x;
+            axis = Axis::X;
           }
           break;
         case ABS_Y:
-          if (_device_class == DeviceClass::gamepad) {
-            axis = InputDevice::Axis::left_y;
-          } else if (_device_class == DeviceClass::flight_stick) {
-            axis = InputDevice::Axis::pitch;
+          if (_device_class == DeviceClass::GAMEPAD) {
+            axis = Axis::LEFT_Y;
+          } else if (_device_class == DeviceClass::FLIGHT_STICK) {
+            axis = Axis::PITCH;
           } else {
-            axis = InputDevice::Axis::y;
+            axis = Axis::Y;
           }
           break;
         case ABS_Z:
           if (quirks & QB_rstick_from_z) {
             if (quirks & QB_right_axes_swapped) {
-              axis = InputDevice::Axis::right_y;
+              axis = Axis::RIGHT_Y;
             } else {
-              axis = InputDevice::Axis::right_x;
+              axis = Axis::RIGHT_X;
             }
-          } else if (_device_class == DeviceClass::gamepad) {
+          } else if (_device_class == DeviceClass::GAMEPAD) {
             if ((quirks & QB_no_analog_triggers) == 0) {
-              axis = InputDevice::Axis::left_trigger;
+              axis = Axis::LEFT_TRIGGER;
               have_analog_triggers = true;
             }
-          } else if (_device_class == DeviceClass::spatial_mouse) {
-            axis = InputDevice::Axis::z;
+          } else if (_device_class == DeviceClass::SPATIAL_MOUSE) {
+            axis = Axis::Z;
           } else {
-            axis = InputDevice::Axis::throttle;
+            axis = Axis::THROTTLE;
           }
           break;
         case ABS_RX:
-          if (_device_class == DeviceClass::spatial_mouse) {
-            axis = InputDevice::Axis::pitch;
+          if (_device_class == DeviceClass::SPATIAL_MOUSE) {
+            axis = Axis::PITCH;
           } else if ((quirks & QB_rstick_from_z) == 0) {
-            axis = InputDevice::Axis::right_x;
+            axis = Axis::RIGHT_X;
           }
           break;
         case ABS_RY:
-          if (_device_class == DeviceClass::spatial_mouse) {
-            axis = InputDevice::Axis::roll;
+          if (_device_class == DeviceClass::SPATIAL_MOUSE) {
+            axis = Axis::ROLL;
           } else if ((quirks & QB_rstick_from_z) == 0) {
-            axis = InputDevice::Axis::right_y;
+            axis = Axis::RIGHT_Y;
           }
           break;
         case ABS_RZ:
           if (quirks & QB_rstick_from_z) {
             if (quirks & QB_right_axes_swapped) {
-              axis = InputDevice::Axis::right_x;
+              axis = Axis::RIGHT_X;
             } else {
-              axis = InputDevice::Axis::right_y;
+              axis = Axis::RIGHT_Y;
             }
-          } else if (_device_class == DeviceClass::gamepad) {
+          } else if (_device_class == DeviceClass::GAMEPAD) {
             if ((quirks & QB_no_analog_triggers) == 0) {
-              axis = InputDevice::Axis::right_trigger;
+              axis = Axis::RIGHT_TRIGGER;
               have_analog_triggers = true;
             } else {
               // Special weird case for Trust GXT 24
-              axis = InputDevice::Axis::right_y;
+              axis = Axis::RIGHT_Y;
             }
           } else {
-            axis = InputDevice::Axis::yaw;
+            axis = Axis::YAW;
           }
           break;
         case ABS_THROTTLE:
           if (quirks & QB_rudder_from_throttle) {
-            axis = InputDevice::Axis::rudder;
+            axis = Axis::RUDDER;
           } else {
-            axis = InputDevice::Axis::throttle;
+            axis = Axis::THROTTLE;
           }
           break;
         case ABS_RUDDER:
-          axis = InputDevice::Axis::rudder;
+          axis = Axis::RUDDER;
           break;
         case ABS_WHEEL:
-          axis = InputDevice::Axis::wheel;
+          axis = Axis::WHEEL;
           break;
         case ABS_GAS:
-          if (_device_class == DeviceClass::gamepad) {
+          if (_device_class == DeviceClass::GAMEPAD) {
             if ((quirks & QB_no_analog_triggers) == 0) {
-              axis = InputDevice::Axis::right_trigger;
+              axis = Axis::RIGHT_TRIGGER;
               have_analog_triggers = true;
             }
           } else {
-            axis = InputDevice::Axis::accelerator;
+            axis = Axis::ACCELERATOR;
           }
           break;
         case ABS_BRAKE:
-          if (_device_class == DeviceClass::gamepad) {
-            axis = InputDevice::Axis::left_trigger;
+          if (_device_class == DeviceClass::GAMEPAD) {
+            axis = Axis::LEFT_TRIGGER;
             have_analog_triggers = true;
           } else {
-            axis = InputDevice::Axis::brake;
+            axis = Axis::BRAKE;
           }
           break;
         case ABS_HAT0X:
           if (emulate_dpad) {
             _dpad_x_axis = i;
             _dpad_left_button = (int)_buttons.size();
-            if (_device_class == DeviceClass::gamepad) {
+            if (_device_class == DeviceClass::GAMEPAD) {
               _buttons.push_back(ButtonState(GamepadButton::dpad_left()));
               _buttons.push_back(ButtonState(GamepadButton::dpad_right()));
             } else {
@@ -620,7 +620,7 @@ init_device() {
           if (emulate_dpad) {
             _dpad_y_axis = i;
             _dpad_up_button = (int)_buttons.size();
-            if (_device_class == DeviceClass::gamepad) {
+            if (_device_class == DeviceClass::GAMEPAD) {
               _buttons.push_back(ButtonState(GamepadButton::dpad_up()));
               _buttons.push_back(ButtonState(GamepadButton::dpad_down()));
             } else {
@@ -633,18 +633,18 @@ init_device() {
           break;
         case ABS_HAT2X:
           if (quirks & QB_steam_controller) {
-            axis = InputDevice::Axis::right_trigger;
+            axis = Axis::RIGHT_TRIGGER;
             have_analog_triggers = true;
           }
           break;
         case ABS_HAT2Y:
           if (quirks & QB_steam_controller) {
-            axis = InputDevice::Axis::left_trigger;
+            axis = Axis::LEFT_TRIGGER;
             have_analog_triggers = true;
           }
           break;
         case ABS_PRESSURE:
-          axis = InputDevice::Axis::pressure;
+          axis = Axis::PRESSURE;
           break;
         }
 
@@ -655,13 +655,13 @@ init_device() {
           // We'd like to reverse the Y axis to match the XInput behavior.
           // Also reverse the yaw axis to match right-hand coordinate system.
           // Also T.Flight Hotas X throttle is reversed and can go backwards.
-          if (axis == Axis::yaw || axis == Axis::rudder || axis == Axis::left_y || axis == Axis::right_y ||
-              (axis == Axis::throttle && (quirks & QB_reversed_throttle) != 0) ||
-              (_device_class == DeviceClass::spatial_mouse && (axis == Axis::y || axis == Axis::z || axis == Axis::roll)) ||
-              (_device_class == DeviceClass::digitizer && axis == Axis::y)) {
+          if (axis == Axis::YAW || axis == Axis::RUDDER || axis == Axis::LEFT_Y || axis == Axis::RIGHT_Y ||
+              (axis == Axis::THROTTLE && (quirks & QB_reversed_throttle) != 0) ||
+              (_device_class == DeviceClass::SPATIAL_MOUSE && (axis == Axis::Y || axis == Axis::Z || axis == Axis::ROLL)) ||
+              (_device_class == DeviceClass::DIGITIZER && axis == Axis::Y)) {
             std::swap(absinfo.maximum, absinfo.minimum);
           }
-          if (axis == Axis::throttle && (quirks & QB_centered_throttle) != 0) {
+          if (axis == Axis::THROTTLE && (quirks & QB_centered_throttle) != 0) {
             index = add_axis(axis, absinfo.minimum, absinfo.maximum, true);
           } else {
             index = add_axis(axis, absinfo.minimum, absinfo.maximum);
@@ -678,8 +678,8 @@ init_device() {
   }
 
   if (test_bit(EV_REL, evtypes)) {
-    enable_feature(Feature::pointer);
-    add_pointer(PointerType::unknown, 0);
+    enable_feature(Feature::POINTER);
+    add_pointer(PointerType::UNKNOWN, 0);
   }
 
   if (test_bit(EV_FF, evtypes)) {
@@ -688,7 +688,7 @@ init_device() {
 
     if (test_bit(FF_RUMBLE, effects)) {
       if (_can_write) {
-        enable_feature(Feature::vibration);
+        enable_feature(Feature::VIBRATION);
       } else {
         // Let the user know what he's missing out on.
         device_cat.warning()
@@ -701,8 +701,8 @@ init_device() {
   if (_ltrigger_code >= 0 && _rtrigger_code >= 0 && !have_analog_triggers) {
     // Emulate analog triggers.
     _ltrigger_axis = (int)_axes.size();
-    add_axis(Axis::left_trigger, 0, 1, false);
-    add_axis(Axis::right_trigger, 0, 1, false);
+    add_axis(Axis::LEFT_TRIGGER, 0, 1, false);
+    add_axis(Axis::RIGHT_TRIGGER, 0, 1, false);
   } else {
     _ltrigger_code = -1;
     _rtrigger_code = -1;
@@ -1033,7 +1033,7 @@ map_button(int code, DeviceClass device_class, int quirks) {
       // BTN_THUMB and BTN_THUMB2 detect touching the touchpads.
       return ButtonHandle::none();
 
-    } else if (device_class == DeviceClass::gamepad &&
+    } else if (device_class == DeviceClass::GAMEPAD &&
                (quirks & QB_alt_button_mapping) != 0) {
       static const ButtonHandle mapping[] = {
         GamepadButton::face_y(),
@@ -1053,7 +1053,7 @@ map_button(int code, DeviceClass device_class, int quirks) {
         return mapping[code & 0xf];
       }
 
-    } else if (device_class == DeviceClass::gamepad) {
+    } else if (device_class == DeviceClass::GAMEPAD) {
       // Based on "Jess Tech Colour Rumble Pad"
       static const ButtonHandle mapping[] = {
         GamepadButton::face_x(),

+ 1 - 1
panda/src/device/evdevInputDevice.h

@@ -70,7 +70,7 @@ private:
 
 public:
   static ButtonHandle map_button(int code,
-                                 DeviceClass device_class = DeviceClass::unknown,
+                                 DeviceClass device_class = DeviceClass::UNKNOWN,
                                  int quirks = 0);
 
 public:

+ 6 - 6
panda/src/device/inputDevice.I

@@ -105,7 +105,7 @@ has_feature(Feature feature) const {
  */
 INLINE bool InputDevice::
 has_pointer() const {
-  return has_feature(Feature::pointer);
+  return has_feature(Feature::POINTER);
 }
 
 /**
@@ -113,7 +113,7 @@ has_pointer() const {
  */
 INLINE bool InputDevice::
 has_keyboard() const {
-  return has_feature(Feature::keyboard);
+  return has_feature(Feature::KEYBOARD);
 }
 
 /**
@@ -122,7 +122,7 @@ has_keyboard() const {
  */
 INLINE bool InputDevice::
 has_tracker() const {
-  return has_feature(Feature::tracker);
+  return has_feature(Feature::TRACKER);
 }
 
 /**
@@ -131,7 +131,7 @@ has_tracker() const {
  */
 INLINE bool InputDevice::
 has_vibration() const {
-  return has_feature(Feature::vibration);
+  return has_feature(Feature::VIBRATION);
 }
 
 /**
@@ -140,7 +140,7 @@ has_vibration() const {
  */
 INLINE bool InputDevice::
 has_battery() const {
-  return has_feature(Feature::battery);
+  return has_feature(Feature::BATTERY);
 }
 
 /**
@@ -270,7 +270,7 @@ get_num_axes() const {
 
 /**
  * Associates the indicated Axis with the axis of the indicated index
- * number.  Pass Axis::none to turn off any association.
+ * number.  Pass Axis::NONE to turn off any association.
  *
  * It is not necessary to call this if you simply want to query the state of
  * the various axes by index number.

+ 53 - 53
panda/src/device/inputDevice.cxx

@@ -134,18 +134,18 @@ add_axis(Axis axis, int minimum, int maximum, bool centered) {
 int InputDevice::
 add_axis(Axis axis, int minimum, int maximum) {
   bool centered = (minimum < 0)
-    || axis == Axis::x
-    || axis == Axis::y
-    || axis == Axis::z
-    || axis == Axis::yaw
-    || axis == Axis::pitch
-    || axis == Axis::roll
-    || axis == Axis::left_x
-    || axis == Axis::left_y
-    || axis == Axis::right_x
-    || axis == Axis::right_y
-    || axis == Axis::wheel
-    || axis == Axis::rudder;
+    || axis == Axis::X
+    || axis == Axis::Y
+    || axis == Axis::Z
+    || axis == Axis::YAW
+    || axis == Axis::PITCH
+    || axis == Axis::ROLL
+    || axis == Axis::LEFT_X
+    || axis == Axis::LEFT_Y
+    || axis == Axis::RIGHT_X
+    || axis == Axis::RIGHT_Y
+    || axis == Axis::WHEEL
+    || axis == Axis::RUDDER;
   return add_axis(axis, minimum, maximum, centered);
 }
 
@@ -321,7 +321,7 @@ set_axis_value(int index, double value) {
     device_cat.spam()
       << "Changed axis " << index;
 
-    if (_axes[index].axis != Axis::none) {
+    if (_axes[index].axis != Axis::NONE) {
       device_cat.spam(false) << " (" << _axes[index].axis << ")";
     }
 
@@ -350,7 +350,7 @@ axis_changed(int index, int state) {
     device_cat.spam()
       << "Changed axis " << index;
 
-    if (_axes[index].axis != Axis::none) {
+    if (_axes[index].axis != Axis::NONE) {
       device_cat.spam(false) << " (" << _axes[index].axis << ")";
     }
 
@@ -388,7 +388,7 @@ output(std::ostream &out) const {
 
   out << "connected)";
 
-  if (_device_class != DeviceClass::unknown) {
+  if (_device_class != DeviceClass::UNKNOWN) {
     out << ", " << _device_class;
   }
 
@@ -404,19 +404,19 @@ output(std::ostream &out) const {
         << (_axes.size() != 1 ? 'e' : 'i') << 's';
   }
 
-  if (_features & (1 << (unsigned int)Feature::pointer)) {
+  if (_features & (1 << (unsigned int)Feature::POINTER)) {
     out << ", pointer";
   }
-  if (_features & (1 << (unsigned int)Feature::keyboard)) {
+  if (_features & (1 << (unsigned int)Feature::KEYBOARD)) {
     out << ", keyboard";
   }
-  if (_features & (1 << (unsigned int)Feature::tracker)) {
+  if (_features & (1 << (unsigned int)Feature::TRACKER)) {
     out << ", tracker";
   }
-  if (_features & (1 << (unsigned int)Feature::vibration)) {
+  if (_features & (1 << (unsigned int)Feature::VIBRATION)) {
     out << ", vibration";
   }
-  if (_features & (1 << (unsigned int)Feature::battery)) {
+  if (_features & (1 << (unsigned int)Feature::BATTERY)) {
     out << ", battery";
 
     if (_battery_data.level > 0 && _battery_data.max_level > 0) {
@@ -546,40 +546,40 @@ do_poll() {
 std::string InputDevice::
 format_device_class(DeviceClass dc) {
   switch (dc) {
-  case InputDevice::DeviceClass::unknown:
+  case InputDevice::DeviceClass::UNKNOWN:
     return "unknown";
 
-  case InputDevice::DeviceClass::virtual_device:
-    return "virtual_device";
+  case InputDevice::DeviceClass::VIRTUAL:
+    return "virtual";
 
-  case InputDevice::DeviceClass::keyboard:
+  case InputDevice::DeviceClass::KEYBOARD:
     return "keyboard";
 
-  case InputDevice::DeviceClass::mouse:
+  case InputDevice::DeviceClass::MOUSE:
     return "mouse";
 
-  case InputDevice::DeviceClass::touch:
+  case InputDevice::DeviceClass::TOUCH:
     return "touch";
 
-  case InputDevice::DeviceClass::gamepad:
+  case InputDevice::DeviceClass::GAMEPAD:
     return "gamepad";
 
-  case InputDevice::DeviceClass::flight_stick:
+  case InputDevice::DeviceClass::FLIGHT_STICK:
     return "flight_stick";
 
-  case InputDevice::DeviceClass::steering_wheel:
+  case InputDevice::DeviceClass::STEERING_WHEEL:
     return "steering_wheel";
 
-  case InputDevice::DeviceClass::dance_pad:
+  case InputDevice::DeviceClass::DANCE_PAD:
     return "dance_pad";
 
-  case InputDevice::DeviceClass::hmd:
+  case InputDevice::DeviceClass::HMD:
     return "hmd";
 
-  case InputDevice::DeviceClass::spatial_mouse:
+  case InputDevice::DeviceClass::SPATIAL_MOUSE:
     return "spatial_mouse";
 
-  case InputDevice::DeviceClass::digitizer:
+  case InputDevice::DeviceClass::DIGITIZER:
     return "digitizer";
   }
   return "**invalid**";
@@ -591,64 +591,64 @@ format_device_class(DeviceClass dc) {
 std::string InputDevice::
 format_axis(Axis axis) {
   switch (axis) {
-  case InputDevice::Axis::none:
+  case Axis::NONE:
     return "none";
 
-  case InputDevice::Axis::x:
+  case Axis::X:
     return "x";
 
-  case InputDevice::Axis::y:
+  case Axis::Y:
     return "y";
 
-  case InputDevice::Axis::z:
+  case Axis::Z:
     return "z";
 
-  case InputDevice::Axis::yaw:
+  case Axis::YAW:
     return "yaw";
 
-  case InputDevice::Axis::pitch:
+  case Axis::PITCH:
     return "pitch";
 
-  case InputDevice::Axis::roll:
+  case Axis::ROLL:
     return "roll";
 
-  case InputDevice::Axis::left_x:
+  case Axis::LEFT_X:
     return "left_x";
 
-  case InputDevice::Axis::left_y:
+  case Axis::LEFT_Y:
     return "left_y";
 
-  case InputDevice::Axis::left_trigger:
+  case Axis::LEFT_TRIGGER:
     return "left_trigger";
 
-  case InputDevice::Axis::right_x:
+  case Axis::RIGHT_X:
     return "right_x";
 
-  case InputDevice::Axis::right_y:
+  case Axis::RIGHT_Y:
     return "right_y";
 
-  case InputDevice::Axis::right_trigger:
+  case Axis::RIGHT_TRIGGER:
     return "right_trigger";
 
-  //case InputDevice::Axis::trigger:
+  //case Axis::TRIGGER:
   //  return "trigger";
 
-  case InputDevice::Axis::throttle:
+  case Axis::THROTTLE:
     return "throttle";
 
-  case InputDevice::Axis::rudder:
+  case Axis::RUDDER:
     return "rudder";
 
-  case InputDevice::Axis::wheel:
+  case Axis::WHEEL:
     return "wheel";
 
-  case InputDevice::Axis::accelerator:
+  case Axis::ACCELERATOR:
     return "accelerator";
 
-  case InputDevice::Axis::brake:
+  case Axis::BRAKE:
     return "brake";
 
-  case InputDevice::Axis::pressure:
+  case Axis::PRESSURE:
     return "pressure";
   }
   return "**invalid**";

+ 80 - 38
panda/src/device/inputDevice.h

@@ -56,84 +56,126 @@ PUBLISHED:
   // type of input device.
   enum class DeviceClass {
     // It is not known what type of device this is.
-    unknown,
+    UNKNOWN,
 
     // This means that the device doesn't correspond to a physical
     // device, but rather to a dynamic source of input events.
-    virtual_device,
+    VIRTUAL,
 
     // A physical, alphabetical keyboard.
-    keyboard,
+    KEYBOARD,
 
-    mouse,
-    touch,
+    MOUSE,
+    TOUCH,
 
     // A gamepad with action buttons, a D-pad, and thumbsticks.
-    gamepad,
+    GAMEPAD,
 
-    flight_stick,
-    steering_wheel,
-    dance_pad,
+    FLIGHT_STICK,
+    STEERING_WHEEL,
+    DANCE_PAD,
 
     // Head-mounted display.
-    hmd,
+    HMD,
 
     // 3D mouse, such as produced by 3Dconnexion.
-    spatial_mouse,
+    SPATIAL_MOUSE,
 
     // A graphics tablet with stylus/pen.
-    digitizer,
+    DIGITIZER,
+
+    // Deprecated aliases.
+    unknown = UNKNOWN,
+    virtual_device = VIRTUAL,
+    keyboard = KEYBOARD,
+    mouse = MOUSE,
+    touch = TOUCH,
+    gamepad = GAMEPAD,
+    flight_stick = FLIGHT_STICK,
+    steering_wheel = STEERING_WHEEL,
+    dance_pad = DANCE_PAD,
+    hmd = HMD,
+    spatial_mouse = SPATIAL_MOUSE,
+    digitizer = DIGITIZER,
   };
 
   enum class Feature {
     // The device provides absolute screen coordinates.
-    pointer,
+    POINTER,
 
     // The device has an interface for providing text input.
-    keyboard,
+    KEYBOARD,
 
     // The device has a motion tracker, such as an HMD.
-    tracker,
+    TRACKER,
 
     // The device can produce force feedback.
-    vibration,
+    VIBRATION,
 
     // The device provides information about battery life.
-    battery,
+    BATTERY,
+
+    // Deprecated aliases.
+    pointer = POINTER,
+    keyboard = KEYBOARD,
+    tracker = TRACKER,
+    vibration = VIBRATION,
+    battery = BATTERY,
   };
 
   enum class Axis {
-    none,
+    NONE,
 
     // Generic translational axes
-    x,
-    y,
-    z,
+    X,
+    Y,
+    Z,
 
     // Generic rotational axes, used by joysticks and 3D mice
-    yaw,
-    pitch,
-    roll,
+    YAW,
+    PITCH,
+    ROLL,
 
     // Gamepad
-    left_x,
-    left_y,
-    left_trigger,
-    right_x,
-    right_y,
-    right_trigger,
+    LEFT_X,
+    LEFT_Y,
+    LEFT_TRIGGER,
+    RIGHT_X,
+    RIGHT_Y,
+    RIGHT_TRIGGER,
 
     // Flight stick specific
-    throttle,
-    rudder, // When available separately from yaw
+    THROTTLE,
+    RUDDER, // When available separately from yaw
 
     // Steering wheel / pedals
-    wheel,
-    accelerator,
-    brake,
+    WHEEL,
+    ACCELERATOR,
+    BRAKE,
 
     // Pen pressure
-    pressure,
+    PRESSURE,
+
+    // Deprecated aliases
+    none = NONE,
+    x = X,
+    y = Y,
+    z = Z,
+    yaw = YAW,
+    pitch = PITCH,
+    roll = ROLL,
+    left_x = LEFT_X,
+    left_y = LEFT_Y,
+    left_trigger = LEFT_TRIGGER,
+    right_x = RIGHT_X,
+    right_y = RIGHT_Y,
+    right_trigger = RIGHT_TRIGGER,
+    throttle = THROTTLE,
+    rudder = RUDDER,
+    wheel = WHEEL,
+    accelerator = ACCELERATOR,
+    brake = BRAKE,
+    pressure = PRESSURE,
   };
 
   enum State {
@@ -168,7 +210,7 @@ PUBLISHED:
   PUBLISHED:
     operator bool() { return known && value != 0.0; }
 
-    Axis axis = Axis::none;
+    Axis axis = Axis::NONE;
     double value = 0.0;
     bool known = false;
 
@@ -319,7 +361,7 @@ protected:
   std::string _name;
   std::string _serial_number;
   std::string _manufacturer;
-  DeviceClass _device_class = DeviceClass::unknown;
+  DeviceClass _device_class = DeviceClass::UNKNOWN;
   unsigned int _features = 0;
   int _event_sequence = 0;
   unsigned short _vendor_id = 0;

+ 63 - 56
panda/src/device/ioKitInputDevice.cxx

@@ -80,19 +80,25 @@ IOKitInputDevice(IOHIDDeviceRef device) :
   }
 
   if (IOHIDDeviceConformsTo(device, kHIDPage_GenericDesktop, kHIDUsage_GD_Mouse)) {
-    _device_class = DeviceClass::mouse;
-  } else if (IOHIDDeviceConformsTo(device, kHIDPage_GenericDesktop, kHIDUsage_GD_Keyboard)) {
-    _device_class = DeviceClass::keyboard;
-  } else if (IOHIDDeviceConformsTo(device, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad)) {
-    _device_class = DeviceClass::gamepad;
-  } else if (IOHIDDeviceConformsTo(device, kHIDPage_Simulation, kHIDUsage_Sim_FlightStick)) {
-    _device_class = DeviceClass::flight_stick;
-  } else if (IOHIDDeviceConformsTo(device, kHIDPage_Simulation, kHIDUsage_GD_Joystick)) {
-    _device_class = DeviceClass::flight_stick;
-  } else if (_vendor_id == 0x044f && _product_id == 0xb108) {
+    _device_class = DeviceClass::MOUSE;
+  }
+  else if (IOHIDDeviceConformsTo(device, kHIDPage_GenericDesktop, kHIDUsage_GD_Keyboard)) {
+    _device_class = DeviceClass::KEYBOARD;
+  }
+  else if (IOHIDDeviceConformsTo(device, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad)) {
+    _device_class = DeviceClass::GAMEPAD;
+  }
+  else if (IOHIDDeviceConformsTo(device, kHIDPage_Simulation, kHIDUsage_Sim_FlightStick)) {
+    _device_class = DeviceClass::FLIGHT_STICK;
+  }
+  else if (IOHIDDeviceConformsTo(device, kHIDPage_Simulation, kHIDUsage_GD_Joystick)) {
+    _device_class = DeviceClass::FLIGHT_STICK;
+  }
+  else if (_vendor_id == 0x044f && _product_id == 0xb108) {
     // T.Flight Hotas X
-    _device_class = DeviceClass::flight_stick;
-  } else if (_vendor_id == 0x046d &&
+    _device_class = DeviceClass::FLIGHT_STICK;
+  }
+  else if (_vendor_id == 0x046d &&
       (_product_id == 0xc623 ||
        _product_id == 0xc625 ||
        _product_id == 0xc626 ||
@@ -101,9 +107,10 @@ IOKitInputDevice(IOHIDDeviceRef device) :
        _product_id == 0xc629 ||
        _product_id == 0xc62b)) {
     // 3Dconnexion SpaceNavigator and friends.
-    _device_class = DeviceClass::spatial_mouse;
-  } else if (_name == "usb gamepad") {
-    _device_class = DeviceClass::gamepad;
+    _device_class = DeviceClass::SPATIAL_MOUSE;
+  }
+  else if (_name == "usb gamepad") {
+    _device_class = DeviceClass::GAMEPAD;
   }
 
   CFArrayRef elements = IOHIDDeviceCopyMatchingElements(device, nullptr, 0);
@@ -125,8 +132,8 @@ IOKitInputDevice(IOHIDDeviceRef device) :
   }
 
   if (_pointer_x != nullptr && _pointer_y != nullptr) {
-    enable_feature(Feature::pointer);
-    add_pointer(PointerType::unknown, 0);
+    enable_feature(Feature::POINTER);
+    add_pointer(PointerType::UNKNOWN, 0);
   }
 
   _is_connected = true;
@@ -145,7 +152,7 @@ IOKitInputDevice::
 void IOKitInputDevice::
 parse_element(IOHIDElementRef element) {
   ButtonHandle handle = ButtonHandle::none();
-  Axis axis = Axis::none;
+  Axis axis = Axis::NONE;
   uint32_t page = IOHIDElementGetUsagePage(element);
   uint32_t usage = IOHIDElementGetUsage(element);
 
@@ -155,61 +162,61 @@ parse_element(IOHIDElementRef element) {
     case kHIDPage_GenericDesktop:
       switch (usage) {
       case kHIDUsage_GD_X:
-        if (_device_class == DeviceClass::gamepad) {
-          axis = Axis::left_x;
-        } else if (_device_class == DeviceClass::flight_stick) {
-          axis = Axis::roll;
-        } else if (_device_class == DeviceClass::mouse) {
+        if (_device_class == DeviceClass::GAMEPAD) {
+          axis = Axis::LEFT_X;
+        } else if (_device_class == DeviceClass::FLIGHT_STICK) {
+          axis = Axis::ROLL;
+        } else if (_device_class == DeviceClass::MOUSE) {
           _pointer_x = element;
           return;
         } else {
-          axis = Axis::x;
+          axis = Axis::X;
         }
         break;
       case kHIDUsage_GD_Y:
-        if (_device_class == DeviceClass::gamepad) {
-          axis = Axis::left_y;
-        } else if (_device_class == DeviceClass::flight_stick) {
-          axis = Axis::pitch;
-        } else if (_device_class == DeviceClass::mouse) {
+        if (_device_class == DeviceClass::GAMEPAD) {
+          axis = Axis::LEFT_Y;
+        } else if (_device_class == DeviceClass::FLIGHT_STICK) {
+          axis = Axis::PITCH;
+        } else if (_device_class == DeviceClass::MOUSE) {
           _pointer_y = element;
           return;
         } else {
-          axis = Axis::y;
+          axis = Axis::Y;
         }
         break;
       case kHIDUsage_GD_Z:
-        if (_device_class == DeviceClass::gamepad) {
-          axis = Axis::left_trigger;
-        } else if (_device_class == DeviceClass::flight_stick) {
-          axis = Axis::throttle;
+        if (_device_class == DeviceClass::GAMEPAD) {
+          axis = Axis::LEFT_TRIGGER;
+        } else if (_device_class == DeviceClass::FLIGHT_STICK) {
+          axis = Axis::THROTTLE;
         } else {
-          axis = Axis::z;
+          axis = Axis::Z;
         }
         break;
       case kHIDUsage_GD_Rx:
-        if (_device_class == DeviceClass::gamepad) {
-          axis = Axis::right_x;
+        if (_device_class == DeviceClass::GAMEPAD) {
+          axis = Axis::RIGHT_X;
         } else {
-          axis = Axis::pitch;
+          axis = Axis::PITCH;
         }
         break;
       case kHIDUsage_GD_Ry:
-        if (_device_class == DeviceClass::gamepad) {
-          axis = Axis::right_y;
+        if (_device_class == DeviceClass::GAMEPAD) {
+          axis = Axis::RIGHT_Y;
         } else {
-          axis = Axis::roll;
+          axis = Axis::ROLL;
         }
         break;
       case kHIDUsage_GD_Rz:
-        if (_device_class == DeviceClass::gamepad) {
-          axis = Axis::right_trigger;
+        if (_device_class == DeviceClass::GAMEPAD) {
+          axis = Axis::RIGHT_TRIGGER;
         } else {
-          axis = Axis::yaw;
+          axis = Axis::YAW;
         }
         break;
       case kHIDUsage_GD_Slider:
-        axis = Axis::rudder;
+        axis = Axis::RUDDER;
         break;
       case kHIDUsage_GD_Dial:
         break;
@@ -241,28 +248,28 @@ parse_element(IOHIDElementRef element) {
     case kHIDPage_Simulation:
       switch (usage) {
       case kHIDUsage_Sim_Rudder:
-        axis = Axis::rudder;
+        axis = Axis::RUDDER;
         break;
       case kHIDUsage_Sim_Throttle:
-        axis = Axis::throttle;
+        axis = Axis::THROTTLE;
         break;
       case kHIDUsage_Sim_Accelerator:
-        axis = Axis::accelerator;
+        axis = Axis::ACCELERATOR;
         break;
       case kHIDUsage_Sim_Brake:
-        axis = Axis::brake;
+        axis = Axis::BRAKE;
         break;
       }
       break;
     }
-    if (axis != Axis::none) {
+    if (axis != Axis::NONE) {
       int min = IOHIDElementGetLogicalMin(element);
       int max = IOHIDElementGetLogicalMax(element);
-      if (_vendor_id == 0x044f && _product_id == 0xb108 && axis == Axis::throttle) {
+      if (_vendor_id == 0x044f && _product_id == 0xb108 && axis == Axis::THROTTLE) {
         // T.Flight Hotas X throttle is reversed and can go backwards.
         add_axis(axis, max, min, true);
-      } else if (axis == Axis::yaw || axis == Axis::rudder || axis == Axis::left_y || axis == Axis::right_y ||
-                 (_device_class == DeviceClass::spatial_mouse && (axis == Axis::y || axis == Axis::z || axis == Axis::roll))) {
+      } else if (axis == Axis::YAW || axis == Axis::RUDDER || axis == Axis::LEFT_Y || axis == Axis::RIGHT_Y ||
+                 (_device_class == DeviceClass::SPATIAL_MOUSE && (axis == Axis::Y || axis == Axis::Z || axis == Axis::ROLL))) {
         // We'd like to reverse the Y axis to match the XInput behavior.
         // We also reverse yaw to obey the right-hand rule.
         add_axis(axis, max, min);
@@ -600,7 +607,7 @@ parse_element(IOHIDElementRef element) {
       break;
 
     case kHIDPage_Button:
-      if (_device_class == DeviceClass::gamepad) {
+      if (_device_class == DeviceClass::GAMEPAD) {
         if (_vendor_id == 0x0810 && _product_id == 0xe501) {
           // SNES-style USB gamepad
           static const ButtonHandle gamepad_buttons[] = {
@@ -644,11 +651,11 @@ parse_element(IOHIDElementRef element) {
             handle = gamepad_buttons[usage];
           }
         }
-      } else if (_device_class == DeviceClass::flight_stick) {
+      } else if (_device_class == DeviceClass::FLIGHT_STICK) {
         if (usage > 0) {
           handle = GamepadButton::joystick(usage - 1);
         }
-      } else if (_device_class == DeviceClass::mouse) {
+      } else if (_device_class == DeviceClass::MOUSE) {
         // In Panda, wheel and right button are flipped around...
         int button = (usage == 2 || usage == 3) ? (4 - usage) : (usage - 1);
         handle = MouseButton::button(button);

+ 39 - 39
panda/src/device/linuxJoystickDevice.cxx

@@ -136,9 +136,9 @@ open_device() {
             << " button " << (int)i << ": 0x" << std::hex << btnmap[i] << "\n";
         }
       } else if (handle == GamepadButton::face_a()) {
-        _device_class = DeviceClass::gamepad;
+        _device_class = DeviceClass::GAMEPAD;
       } else if (handle == GamepadButton::trigger()) {
-        _device_class = DeviceClass::flight_stick;
+        _device_class = DeviceClass::FLIGHT_STICK;
       } else if (handle == GamepadButton::dpad_left()) {
         emulate_dpad = false;
       } else if (handle == GamepadButton::ltrigger()) {
@@ -155,71 +155,71 @@ open_device() {
     ioctl(_fd, JSIOCGAXMAP, axmap);
 
     for (uint8_t i = 0; i < num_axes; ++i) {
-      Axis axis = Axis::none;
+      Axis axis = Axis::NONE;
 
       switch (axmap[i]) {
       case ABS_X:
-        if (_device_class == DeviceClass::gamepad) {
-          axis = InputDevice::Axis::left_x;
-        } else if (_device_class == DeviceClass::flight_stick) {
-          axis = InputDevice::Axis::roll;
+        if (_device_class == DeviceClass::GAMEPAD) {
+          axis = Axis::LEFT_X;
+        } else if (_device_class == DeviceClass::FLIGHT_STICK) {
+          axis = Axis::ROLL;
         } else {
-          axis = InputDevice::Axis::x;
+          axis = Axis::X;
         }
         break;
 
       case ABS_Y:
-        if (_device_class == DeviceClass::gamepad) {
-          axis = InputDevice::Axis::left_y;
-        } else if (_device_class == DeviceClass::flight_stick) {
-          axis = InputDevice::Axis::pitch;
+        if (_device_class == DeviceClass::GAMEPAD) {
+          axis = Axis::LEFT_Y;
+        } else if (_device_class == DeviceClass::FLIGHT_STICK) {
+          axis = Axis::PITCH;
         } else {
-          axis = InputDevice::Axis::y;
+          axis = Axis::Y;
         }
         break;
 
       case ABS_Z:
-        if (_device_class == DeviceClass::gamepad) {
-          axis = Axis::left_trigger;
+        if (_device_class == DeviceClass::GAMEPAD) {
+          axis = Axis::LEFT_TRIGGER;
         } else {
-          //axis = Axis::trigger;
+          //axis = Axis::TRIGGER;
         }
         break;
 
       case ABS_RX:
-        axis = Axis::right_x;
+        axis = Axis::RIGHT_X;
         break;
 
       case ABS_RY:
-        axis = Axis::right_y;
+        axis = Axis::RIGHT_Y;
         break;
 
       case ABS_RZ:
-        if (_device_class == DeviceClass::gamepad) {
-          axis = InputDevice::Axis::right_trigger;
+        if (_device_class == DeviceClass::GAMEPAD) {
+          axis = Axis::RIGHT_TRIGGER;
         } else {
-          axis = InputDevice::Axis::yaw;
+          axis = Axis::YAW;
         }
         break;
 
       case ABS_THROTTLE:
-        axis = InputDevice::Axis::throttle;
+        axis = Axis::THROTTLE;
         break;
 
       case ABS_RUDDER:
-        axis = InputDevice::Axis::rudder;
+        axis = Axis::RUDDER;
         break;
 
       case ABS_WHEEL:
-        axis = InputDevice::Axis::wheel;
+        axis = Axis::WHEEL;
         break;
 
       case ABS_GAS:
-        axis = InputDevice::Axis::accelerator;
+        axis = Axis::ACCELERATOR;
         break;
 
       case ABS_BRAKE:
-        axis = InputDevice::Axis::brake;
+        axis = Axis::BRAKE;
         break;
 
       case ABS_HAT0X:
@@ -227,7 +227,7 @@ open_device() {
           // Emulate D-Pad or hat switch.
           _dpad_x_axis = i;
           _dpad_left_button = (int)_buttons.size();
-          if (_device_class == DeviceClass::gamepad) {
+          if (_device_class == DeviceClass::GAMEPAD) {
             add_button(GamepadButton::dpad_left());
             add_button(GamepadButton::dpad_right());
           } else {
@@ -236,7 +236,7 @@ open_device() {
           }
           _buttons[_dpad_left_button]._state = S_up;
           _buttons[_dpad_left_button+1]._state = S_up;
-          axis = Axis::none;
+          axis = Axis::NONE;
         }
         break;
 
@@ -245,7 +245,7 @@ open_device() {
           // Emulate D-Pad.
           _dpad_y_axis = i;
           _dpad_up_button = (int)_buttons.size();
-          if (_device_class == DeviceClass::gamepad) {
+          if (_device_class == DeviceClass::GAMEPAD) {
             add_button(GamepadButton::dpad_up());
             add_button(GamepadButton::dpad_down());
           } else {
@@ -254,19 +254,19 @@ open_device() {
           }
           _buttons[_dpad_up_button]._state = S_up;
           _buttons[_dpad_up_button+1]._state = S_up;
-          axis = Axis::none;
+          axis = Axis::NONE;
         }
         break;
 
       case ABS_HAT2X:
-        if (_device_class == DeviceClass::gamepad) {
-          axis = InputDevice::Axis::right_trigger;
+        if (_device_class == DeviceClass::GAMEPAD) {
+          axis = Axis::RIGHT_TRIGGER;
         }
         break;
 
       case ABS_HAT2Y:
-        if (_device_class == DeviceClass::gamepad) {
-          axis = InputDevice::Axis::left_trigger;
+        if (_device_class == DeviceClass::GAMEPAD) {
+          axis = Axis::LEFT_TRIGGER;
         }
         break;
 
@@ -275,17 +275,17 @@ open_device() {
           device_cat.debug() << "Unmapped /dev/input/js" << _index
             << " axis " << (int)i << ": 0x" << std::hex << (int)axmap[i] << "\n";
         }
-        axis = Axis::none;
+        axis = Axis::NONE;
         break;
       }
       _axes[i].axis = axis;
 
-      if (axis == Axis::left_trigger || axis == Axis::right_trigger) {
+      if (axis == Axis::LEFT_TRIGGER || axis == Axis::RIGHT_TRIGGER) {
         // We'd like to use 0.0 to indicate the resting position.
         _axes[i]._scale = 1.0 / 65534.0;
         _axes[i]._bias = 0.5;
         have_analog_triggers = true;
-      } else if (axis == Axis::left_y || axis == Axis::right_y || axis == Axis::y) {
+      } else if (axis == Axis::LEFT_Y || axis == Axis::RIGHT_Y || axis == Axis::Y) {
         _axes[i]._scale = 1.0 / -32767.0;
         _axes[i]._bias = 0.0;
       } else {
@@ -298,8 +298,8 @@ open_device() {
   if (_ltrigger_button >= 0 && _rtrigger_button >= 0 && !have_analog_triggers) {
     // Emulate analog triggers.
     _ltrigger_axis = (int)_axes.size();
-    add_axis(Axis::left_trigger, 0, 1, false);
-    add_axis(Axis::right_trigger, 0, 1, false);
+    add_axis(Axis::LEFT_TRIGGER, 0, 1, false);
+    add_axis(Axis::RIGHT_TRIGGER, 0, 1, false);
   } else {
     _ltrigger_button = -1;
     _rtrigger_button = -1;

+ 60 - 60
panda/src/device/winRawInputDevice.cxx

@@ -50,43 +50,43 @@ static const struct DeviceMapping {
 } mapping_presets[] = {
   // SNES-style USB gamepad, or cheap unbranded USB gamepad with no sticks
   // ABXY are mapped based on their position, not based on their label.
-  {0x0810, 0xe501, InputDevice::DeviceClass::gamepad, QB_no_analog_triggers,
+  {0x0810, 0xe501, InputDevice::DeviceClass::GAMEPAD, QB_no_analog_triggers,
     {"face_y", "face_b", "face_a", "face_x", "lshoulder", "rshoulder", "ltrigger", "rtrigger", "back", "start"}
   },
   // Unbranded generic cheap USB gamepad
-  {0x0810, 0x0001, InputDevice::DeviceClass::gamepad, QB_rstick_from_z | QB_no_analog_triggers | QB_right_axes_swapped,
+  {0x0810, 0x0001, InputDevice::DeviceClass::GAMEPAD, QB_rstick_from_z | QB_no_analog_triggers | QB_right_axes_swapped,
     {"face_y", "face_b", "face_a", "face_x", "lshoulder", "rshoulder", "ltrigger", "rtrigger", "back", "start", "lstick", "rstick"}
   },
   // Trust GXT 24 / SPEED Link SL-6535-SBK-01
-  {0x0079, 0x0006, InputDevice::DeviceClass::gamepad, QB_rstick_from_z | QB_no_analog_triggers,
+  {0x0079, 0x0006, InputDevice::DeviceClass::GAMEPAD, QB_rstick_from_z | QB_no_analog_triggers,
     {"face_y", "face_b", "face_a", "face_x", "lshoulder", "rshoulder", "ltrigger", "rtrigger", "back", "start", "lstick", "rstick"}
   },
   // T.Flight Hotas X
-  {0x044f, 0xb108, InputDevice::DeviceClass::flight_stick, QB_centered_throttle | QB_reversed_throttle,
+  {0x044f, 0xb108, InputDevice::DeviceClass::FLIGHT_STICK, QB_centered_throttle | QB_reversed_throttle,
     {0}
   },
   // NVIDIA Shield Controller
-  {0x0955, 0x7214, InputDevice::DeviceClass::gamepad, 0,
+  {0x0955, 0x7214, InputDevice::DeviceClass::GAMEPAD, 0,
     {"face_a", "face_b", 0, "face_x", "face_y", "rshoulder", "lshoulder", "rshoulder", 0, 0, 0, "start", 0, "lstick", "rstick", 0}
   },
   // Dualshock (PS4)
-  {0x054c, 0x05c4, InputDevice::DeviceClass::gamepad, QB_rstick_from_z,
+  {0x054c, 0x05c4, InputDevice::DeviceClass::GAMEPAD, QB_rstick_from_z,
     {"face_x", "face_a", "face_b", "face_y", "lshoulder", "rshoulder", 0, 0, "back", "start", "lstick", "rstick", "guide", 0}
   },
   // Dualshock 2nd Gen (PS4 Slim)
-  {0x054c, 0x09cc, InputDevice::DeviceClass::gamepad, QB_rstick_from_z,
+  {0x054c, 0x09cc, InputDevice::DeviceClass::GAMEPAD, QB_rstick_from_z,
     {"face_x", "face_a", "face_b", "face_y", "lshoulder", "rshoulder", 0, 0, "back", "start", "lstick", "rstick", "guide", 0}
   },
   // Dualshock 2nd Gen (PS4 wireless adapter)
-  {0x054c, 0x0ba0, InputDevice::DeviceClass::gamepad, QB_rstick_from_z,
+  {0x054c, 0x0ba0, InputDevice::DeviceClass::GAMEPAD, QB_rstick_from_z,
     {"face_x", "face_a", "face_b", "face_y", "lshoulder", "rshoulder", 0, 0, "back", "start", "lstick", "rstick", "guide", 0}
   },
   // PS2 controller connected through a USB adapter
-  {0x2563, 0x0523, InputDevice::DeviceClass::gamepad, QB_rstick_from_z | QB_no_analog_triggers,
+  {0x2563, 0x0523, InputDevice::DeviceClass::GAMEPAD, QB_rstick_from_z | QB_no_analog_triggers,
     {"face_y", "face_b", "face_a", "face_x", "lshoulder", "rshoulder", "ltrigger", "rtrigger", "back", "start", "lstick", "rstick"}
   },
   // FrSky Simulator
-  {0x0483, 0x5720, InputDevice::DeviceClass::flight_stick, 0,
+  {0x0483, 0x5720, InputDevice::DeviceClass::FLIGHT_STICK, 0,
     {0}
   },
   {0},
@@ -183,11 +183,11 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
 
   switch (info.dwType) {
   case RIM_TYPEMOUSE:
-    _device_class = DeviceClass::mouse;
+    _device_class = DeviceClass::MOUSE;
     break;
 
   case RIM_TYPEKEYBOARD:
-    _device_class = DeviceClass::keyboard;
+    _device_class = DeviceClass::KEYBOARD;
     break;
 
   case RIM_TYPEHID:
@@ -197,32 +197,32 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
     // Gamepads
     if (info.hid.usUsagePage == HID_USAGE_PAGE_GENERIC &&
         info.hid.usUsage == HID_USAGE_GENERIC_GAMEPAD) {
-      _device_class = DeviceClass::gamepad;
+      _device_class = DeviceClass::GAMEPAD;
 
     // Various game controllers, incl. flight sticks and some gamepads
     } else if (info.hid.usUsagePage == HID_USAGE_PAGE_GENERIC &&
                info.hid.usUsage == HID_USAGE_GENERIC_JOYSTICK) {
-      _device_class = DeviceClass::flight_stick;
+      _device_class = DeviceClass::FLIGHT_STICK;
 
       if (_name == "usb gamepad") {
         // Well, it claims to be a gamepad...
-        _device_class = DeviceClass::gamepad;
+        _device_class = DeviceClass::GAMEPAD;
       }
 
     // Mice
     } else if (info.hid.usUsagePage == HID_USAGE_PAGE_GENERIC &&
                info.hid.usUsage == HID_USAGE_GENERIC_MOUSE) {
-      _device_class = DeviceClass::mouse;
+      _device_class = DeviceClass::MOUSE;
 
     // Keyboards
     } else if (info.hid.usUsagePage == HID_USAGE_PAGE_GENERIC &&
                info.hid.usUsage == HID_USAGE_GENERIC_KEYBOARD) {
-      _device_class = DeviceClass::keyboard;
+      _device_class = DeviceClass::KEYBOARD;
 
     // Digitizers
     } else if (info.hid.usUsagePage == HID_USAGE_PAGE_DIGITIZER &&
                info.hid.usUsage == 1) {
-      _device_class = DeviceClass::digitizer;
+      _device_class = DeviceClass::DIGITIZER;
 
     // 3Dconnexion SpaceNavigator and friends.
     } else if (_vendor_id == 0x046d &&
@@ -233,7 +233,7 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
          _product_id == 0xc628 ||
          _product_id == 0xc629 ||
          _product_id == 0xc62b)) {
-      _device_class = DeviceClass::spatial_mouse;
+      _device_class = DeviceClass::SPATIAL_MOUSE;
     }
     break;
 
@@ -241,8 +241,8 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
     return false;
   }
 
-  if (_device_class == DeviceClass::gamepad ||
-      _device_class == DeviceClass::flight_stick) {
+  if (_device_class == DeviceClass::GAMEPAD ||
+      _device_class == DeviceClass::FLIGHT_STICK) {
     // Do we have a built-in mapping?
     const DeviceMapping *mapping = mapping_presets;
     while (mapping->vendor != 0) {
@@ -354,17 +354,17 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
       ButtonHandle handle = ButtonHandle::none();
       switch (cap.UsagePage) {
       case HID_USAGE_PAGE_BUTTON:
-        if (_device_class == DeviceClass::gamepad) {
+        if (_device_class == DeviceClass::GAMEPAD) {
           if (usage > 0 && usage - 1 < _countof(default_gamepad_mapping)) {
             if (gamepad_buttons[usage - 1] != nullptr) {
               handle = registry->find_button(gamepad_buttons[usage - 1]);
             }
           }
-        } else if (_device_class == DeviceClass::flight_stick) {
+        } else if (_device_class == DeviceClass::FLIGHT_STICK) {
           if (usage > 0) {
             handle = GamepadButton::joystick(usage - 1);
           }
-        } else if (_device_class == DeviceClass::mouse) {
+        } else if (_device_class == DeviceClass::MOUSE) {
           // In Panda, wheel and right button are flipped around...
           int button = (usage == 2 || usage == 3) ? (4 - usage) : (usage - 1);
           handle = MouseButton::button(button);
@@ -434,44 +434,44 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
         is_signed = false;
       }
 
-      Axis axis = Axis::none;
+      Axis axis = Axis::NONE;
       switch (cap.UsagePage) {
       case HID_USAGE_PAGE_GENERIC:
         switch (usage) {
           case HID_USAGE_GENERIC_X:
-          if (_device_class == DeviceClass::gamepad) {
-            axis = Axis::left_x;
-          } else if (_device_class == DeviceClass::flight_stick) {
-            axis = Axis::roll;
+          if (_device_class == DeviceClass::GAMEPAD) {
+            axis = Axis::LEFT_X;
+          } else if (_device_class == DeviceClass::FLIGHT_STICK) {
+            axis = Axis::ROLL;
           } else {
-            axis = Axis::x;
+            axis = Axis::X;
           }
           break;
         case HID_USAGE_GENERIC_Y:
-          if (_device_class == DeviceClass::gamepad) {
-            axis = Axis::left_y;
+          if (_device_class == DeviceClass::GAMEPAD) {
+            axis = Axis::LEFT_Y;
             swap(cap.LogicalMin, cap.LogicalMax);
-          } else if (_device_class == DeviceClass::flight_stick) {
-            axis = Axis::pitch;
+          } else if (_device_class == DeviceClass::FLIGHT_STICK) {
+            axis = Axis::PITCH;
           } else {
-            axis = Axis::y;
+            axis = Axis::Y;
             swap(cap.LogicalMin, cap.LogicalMax);
           }
           break;
         case HID_USAGE_GENERIC_Z:
-          if (_device_class == DeviceClass::gamepad) {
+          if (_device_class == DeviceClass::GAMEPAD) {
             if (quirks & QB_rstick_from_z) {
               if (quirks & QB_right_axes_swapped) {
-                axis = InputDevice::Axis::right_y;
+                axis = InputDevice::Axis::RIGHT_Y;
                 swap(cap.LogicalMin, cap.LogicalMax);
               } else {
-                axis = InputDevice::Axis::right_x;
+                axis = InputDevice::Axis::RIGHT_X;
               }
             } else if ((quirks & QB_no_analog_triggers) == 0) {
-              axis = Axis::left_trigger;
+              axis = Axis::LEFT_TRIGGER;
             }
-          } else if (_device_class == DeviceClass::flight_stick) {
-            axis = Axis::throttle;
+          } else if (_device_class == DeviceClass::FLIGHT_STICK) {
+            axis = Axis::THROTTLE;
             if ((quirks & QB_reversed_throttle) != 0) {
               std::swap(cap.LogicalMin, cap.LogicalMax);
             }
@@ -479,63 +479,63 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
               is_signed = false;
             }
           } else {
-            axis = Axis::z;
+            axis = Axis::Z;
             swap(cap.LogicalMin, cap.LogicalMax);
           }
           break;
         case HID_USAGE_GENERIC_RX:
-          if (_device_class == DeviceClass::gamepad) {
+          if (_device_class == DeviceClass::GAMEPAD) {
             if (quirks & QB_rstick_from_z) {
               if ((quirks & QB_no_analog_triggers) == 0) {
-                axis = Axis::left_trigger;
+                axis = Axis::LEFT_TRIGGER;
               }
             } else {
-              axis = Axis::right_x;
+              axis = Axis::RIGHT_X;
             }
           } else {
-            axis = Axis::pitch;
+            axis = Axis::PITCH;
           }
           break;
         case HID_USAGE_GENERIC_RY:
-          if (_device_class == DeviceClass::gamepad) {
+          if (_device_class == DeviceClass::GAMEPAD) {
             if (quirks & QB_rstick_from_z) {
               if ((quirks & QB_no_analog_triggers) == 0) {
-                axis = Axis::right_trigger;
+                axis = Axis::RIGHT_TRIGGER;
               }
             } else {
-              axis = Axis::right_y;
+              axis = Axis::RIGHT_Y;
               swap(cap.LogicalMin, cap.LogicalMax);
             }
           } else {
-            axis = Axis::roll;
+            axis = Axis::ROLL;
             swap(cap.LogicalMin, cap.LogicalMax);
           }
           break;
         case HID_USAGE_GENERIC_RZ:
-          if (_device_class == DeviceClass::gamepad) {
+          if (_device_class == DeviceClass::GAMEPAD) {
             if (quirks & QB_rstick_from_z) {
               if (quirks & QB_right_axes_swapped) {
-                axis = InputDevice::Axis::right_x;
+                axis = InputDevice::Axis::RIGHT_X;
               } else {
-                axis = InputDevice::Axis::right_y;
+                axis = InputDevice::Axis::RIGHT_Y;
                 swap(cap.LogicalMin, cap.LogicalMax);
               }
             } else if ((quirks & QB_no_analog_triggers) == 0) {
-              axis = Axis::right_trigger;
+              axis = Axis::RIGHT_TRIGGER;
             }
           } else {
             // Flip to match Panda's convention for heading.
-            axis = Axis::yaw;
+            axis = Axis::YAW;
             swap(cap.LogicalMin, cap.LogicalMax);
           }
           break;
         case HID_USAGE_GENERIC_SLIDER:
           // Flip to match Panda's convention for heading.
-          axis = Axis::rudder;
+          axis = Axis::RUDDER;
           swap(cap.LogicalMin, cap.LogicalMax);
           break;
         case HID_USAGE_GENERIC_WHEEL:
-          axis = Axis::wheel;
+          axis = Axis::WHEEL;
           break;
         case HID_USAGE_GENERIC_HATSWITCH:
           // This is handled specially.
@@ -548,7 +548,7 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
       case HID_USAGE_PAGE_DIGITIZER:
         switch (usage) {
         case 0x30:
-          axis = Axis::pressure;
+          axis = Axis::PRESSURE;
           break;
         }
         break;
@@ -559,7 +559,7 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
       // have a weird extra Z axis with DataIndex 2 that should be ignored.
       for (size_t i = 0; i < _axes.size(); ++i) {
         if (_axes[i].axis == axis) {
-          axis = Axis::none;
+          axis = Axis::NONE;
           break;
         }
       }
@@ -589,7 +589,7 @@ on_arrival(HANDLE handle, const RID_DEVICE_INFO &info, std::string name) {
   // Do we need to emulate a hat switch or directional pad?
   if (_hat_data_index != -1) {
     _hat_left_button = (int)_buttons.size();
-    if (_device_class == DeviceClass::gamepad) {
+    if (_device_class == DeviceClass::GAMEPAD) {
       _buttons.push_back(ButtonState(GamepadButton::dpad_left()));
       _buttons.push_back(ButtonState(GamepadButton::dpad_right()));
       _buttons.push_back(ButtonState(GamepadButton::dpad_down()));

+ 30 - 30
panda/src/device/xInputDevice.cxx

@@ -335,43 +335,43 @@ init_device(const XINPUT_CAPABILITIES_EX &caps, const XINPUT_STATE &state) {
   switch (caps.SubType) {
   default:
   case XINPUT_DEVSUBTYPE_GAMEPAD:
-    _device_class = DeviceClass::gamepad;
-    _axes[0].axis = Axis::left_trigger;
-    _axes[1].axis = Axis::right_trigger;
-    _axes[2].axis = Axis::left_x;
-    _axes[3].axis = Axis::left_y;
-    _axes[4].axis = Axis::right_x;
-    _axes[5].axis = Axis::right_y;
+    _device_class = DeviceClass::GAMEPAD;
+    _axes[0].axis = Axis::LEFT_TRIGGER;
+    _axes[1].axis = Axis::RIGHT_TRIGGER;
+    _axes[2].axis = Axis::LEFT_X;
+    _axes[3].axis = Axis::LEFT_Y;
+    _axes[4].axis = Axis::RIGHT_X;
+    _axes[5].axis = Axis::RIGHT_Y;
     break;
 
   case XINPUT_DEVSUBTYPE_WHEEL:
-    _device_class = DeviceClass::steering_wheel;
-    _axes[0].axis = Axis::brake;
-    _axes[1].axis = Axis::accelerator;
-    _axes[2].axis = Axis::wheel;
-    _axes[3].axis = Axis::none;
-    _axes[4].axis = Axis::none;
-    _axes[5].axis = Axis::none;
+    _device_class = DeviceClass::STEERING_WHEEL;
+    _axes[0].axis = Axis::BRAKE;
+    _axes[1].axis = Axis::ACCELERATOR;
+    _axes[2].axis = Axis::WHEEL;
+    _axes[3].axis = Axis::NONE;
+    _axes[4].axis = Axis::NONE;
+    _axes[5].axis = Axis::NONE;
     break;
 
   case XINPUT_DEVSUBTYPE_FLIGHT_STICK:
-    _device_class = DeviceClass::flight_stick;
-    _axes[0].axis = Axis::yaw;
-    _axes[1].axis = Axis::throttle;
-    _axes[2].axis = Axis::roll;
-    _axes[3].axis = Axis::pitch;
-    _axes[4].axis = Axis::none;
-    _axes[5].axis = Axis::none;
+    _device_class = DeviceClass::FLIGHT_STICK;
+    _axes[0].axis = Axis::YAW;
+    _axes[1].axis = Axis::THROTTLE;
+    _axes[2].axis = Axis::ROLL;
+    _axes[3].axis = Axis::PITCH;
+    _axes[4].axis = Axis::NONE;
+    _axes[5].axis = Axis::NONE;
     break;
 
   case XINPUT_DEVSUBTYPE_DANCE_PAD:
-    _device_class = DeviceClass::dance_pad;
-    _axes[0].axis = Axis::none;
-    _axes[1].axis = Axis::none;
-    _axes[2].axis = Axis::none;
-    _axes[3].axis = Axis::none;
-    _axes[4].axis = Axis::none;
-    _axes[5].axis = Axis::none;
+    _device_class = DeviceClass::DANCE_PAD;
+    _axes[0].axis = Axis::NONE;
+    _axes[1].axis = Axis::NONE;
+    _axes[2].axis = Axis::NONE;
+    _axes[3].axis = Axis::NONE;
+    _axes[4].axis = Axis::NONE;
+    _axes[5].axis = Axis::NONE;
     break;
   }
 
@@ -414,7 +414,7 @@ init_device(const XINPUT_CAPABILITIES_EX &caps, const XINPUT_STATE &state) {
 
   if (caps.Vibration.wLeftMotorSpeed != 0 ||
       caps.Vibration.wRightMotorSpeed != 0) {
-    enable_feature(Feature::vibration);
+    enable_feature(Feature::VIBRATION);
   }
 
   if (get_battery_information != nullptr) {
@@ -423,7 +423,7 @@ init_device(const XINPUT_CAPABILITIES_EX &caps, const XINPUT_STATE &state) {
       if (batt.BatteryType != BATTERY_TYPE_DISCONNECTED &&
           batt.BatteryType != BATTERY_TYPE_WIRED) {
         // This device has a battery.  Report the battery level.
-        enable_feature(Feature::battery);
+        enable_feature(Feature::BATTERY);
         _battery_data.level = batt.BatteryLevel;
         _battery_data.max_level = BATTERY_LEVEL_FULL;
       }

+ 5 - 5
panda/src/display/graphicsWindowInputDevice.cxx

@@ -30,14 +30,14 @@ using std::string;
  */
 GraphicsWindowInputDevice::
 GraphicsWindowInputDevice(GraphicsWindow *host, const string &name, bool pointer, bool keyboard) :
-  InputDevice(name, DeviceClass::virtual_device)
+  InputDevice(name, DeviceClass::VIRTUAL)
 {
   if (pointer) {
-    enable_feature(Feature::pointer);
-    add_pointer(PointerType::mouse, 0);
+    enable_feature(Feature::POINTER);
+    add_pointer(PointerType::MOUSE, 0);
   }
   if (keyboard) {
-    enable_feature(Feature::keyboard);
+    enable_feature(Feature::KEYBOARD);
   }
 }
 
@@ -167,7 +167,7 @@ set_pointer_in_window(double x, double y, double time) {
   LightMutexHolder holder(_lock);
   PointerData data = _pointers[0];
   data._id = 0;
-  data._type = PointerType::mouse;
+  data._type = PointerType::MOUSE;
   data._xpos = x;
   data._ypos = y;
   data._in_window = true;

+ 1 - 1
panda/src/event/pointerEvent.h

@@ -39,7 +39,7 @@ public:
 public:
   bool _in_window = false;
   int _id = 0;
-  PointerType _type = PointerType::unknown;
+  PointerType _type = PointerType::UNKNOWN;
   double _xpos = 0.0;
   double _ypos = 0.0;
   double _dx = 0.0;

+ 13 - 6
panda/src/putil/pointerData.h

@@ -23,11 +23,18 @@ BEGIN_PUBLISH
  * Contains the types of pointer device.
  */
 enum class PointerType {
-  unknown,
-  mouse,
-  finger,
-  stylus,
-  eraser,
+  UNKNOWN,
+  MOUSE,
+  FINGER,
+  STYLUS,
+  ERASER,
+
+  // deprecated aliases
+  unknown = UNKNOWN,
+  mouse = MOUSE,
+  finger = FINGER,
+  stylus = STYLUS,
+  eraser = ERASER,
 };
 END_PUBLISH
 
@@ -61,7 +68,7 @@ public:
   double _xpos = 0.0;
   double _ypos = 0.0;
   double _pressure = 0.0;
-  PointerType _type = PointerType::unknown;
+  PointerType _type = PointerType::UNKNOWN;
   int _id = 0;
 };