Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-10-19 06:07:36 +0300
committerCampbell Barton <campbell@blender.org>2022-10-19 06:07:36 +0300
commite4c5a46c1294eefd7464395bca9551b9ca866aea (patch)
tree837f6be87ae4e500cfe9a1d83f94037b9e641fa8 /intern
parentc9f13788639790aba02acb3376dc505043dae175 (diff)
Cleanup: remove NDOF_BUTTON_NONE from the range of usable buttons
This is used to represent unknown state, so there is no need to be able to store it's pressed state.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_NDOFManager.cpp8
-rw-r--r--intern/ghost/intern/GHOST_NDOFManager.h6
2 files changed, 7 insertions, 7 deletions
diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp
index 882443ae839..9e9b9f14c43 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManager.cpp
@@ -29,8 +29,7 @@ static const char *ndof_progress_string[] = {
/* Printable values for #NDOF_ButtonT enum (keep aligned) */
static const char *ndof_button_names[] = {
- "NDOF_BUTTON_NONE",
- /* Real button values. */
+ /* Exclude `NDOF_BUTTON_NONE` (-1). */
"NDOF_BUTTON_MENU",
"NDOF_BUTTON_FIT",
"NDOF_BUTTON_TOP",
@@ -68,6 +67,7 @@ static const char *ndof_button_names[] = {
"NDOF_BUTTON_V1",
"NDOF_BUTTON_V2",
"NDOF_BUTTON_V3",
+ /* Keyboard emulation. */
"NDOF_BUTTON_ESC",
"NDOF_BUTTON_ENTER",
"NDOF_BUTTON_DELETE",
@@ -270,7 +270,7 @@ bool GHOST_NDOFManager::setDevice(ushort vendor_id, ushort product_id)
}
case 0xC62B: {
device_type_ = NDOF_SpaceMousePro;
- hid_map_button_num_ = 27; /* Actually has 15 buttons, but HID codes range from 0 to 26. */
+ hid_map_button_num_ = 27; /* 15 physical buttons, but HID codes range from 0 to 26. */
hid_map_button_mask_ = 0x07C0F137;
hid_map_ = ndof_HID_map_Modern3Dx;
break;
@@ -312,7 +312,7 @@ bool GHOST_NDOFManager::setDevice(ushort vendor_id, ushort product_id)
case 0xC632: /* Wireless. */
{
device_type_ = NDOF_SpaceMouseProWireless;
- hid_map_button_num_ = 27; /* Actually has 15 buttons, but HID codes range from 0 to 26. */
+ hid_map_button_num_ = 27; /* 15 physical buttons, but HID codes range from 0 to 26. */
hid_map_button_mask_ = 0x07C0F137;
hid_map_ = ndof_HID_map_Modern3Dx;
break;
diff --git a/intern/ghost/intern/GHOST_NDOFManager.h b/intern/ghost/intern/GHOST_NDOFManager.h
index 6dadeee1fcc..2d5bba14aa4 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.h
+++ b/intern/ghost/intern/GHOST_NDOFManager.h
@@ -29,8 +29,8 @@ typedef enum {
/* NDOF device button event types */
typedef enum {
- /* Used internally, never sent. */
- NDOF_BUTTON_NONE = 0,
+ /* Used internally, never sent or used as an index. */
+ NDOF_BUTTON_NONE = -1,
/* These two are available from any 3Dconnexion device. */
NDOF_BUTTON_MENU,
NDOF_BUTTON_FIT,
@@ -162,7 +162,7 @@ class GHOST_NDOFManager {
int rotation_[3];
int button_depressed_; /* Bit field. */
- uint64_t motion_time_; /* In milliseconds. */
+ uint64_t motion_time_; /* In milliseconds. */
uint64_t motion_time_prev_; /* Time of most recent motion event sent. */
GHOST_TProgress motion_state_;