[Bf-blender-cvs] [a6179296836] master: Cleanup: rename misleading/inconsistent GHOST types
Campbell Barton
noreply at git.blender.org
Mon Jun 27 12:37:10 CEST 2022
Commit: a61792968363bbd443f03186e77fef77ddbf88a7
Author: Campbell Barton
Date: Mon Jun 27 20:31:28 2022 +1000
Branches: master
https://developer.blender.org/rBa61792968363bbd443f03186e77fef77ddbf88a7
Cleanup: rename misleading/inconsistent GHOST types
Remove mask suffix from:
- GHOST_TButtonMask
- GHOST_TModifierKeyMask
.. neither are used as bit-masks.
Remove 'Grab' from:
- GHOST_kGrabAxisNone
- GHOST_kGrabAxisY
.. matching the existing GHOST_TAxisFlag & GHOST_kAxisX.
===================================================================
M intern/ghost/GHOST_C-api.h
M intern/ghost/GHOST_ISystem.h
M intern/ghost/GHOST_Rect.h
M intern/ghost/GHOST_Types.h
M intern/ghost/intern/GHOST_Buttons.cpp
M intern/ghost/intern/GHOST_Buttons.h
M intern/ghost/intern/GHOST_C-api.cpp
M intern/ghost/intern/GHOST_EventButton.h
M intern/ghost/intern/GHOST_ModifierKeys.cpp
M intern/ghost/intern/GHOST_ModifierKeys.h
M intern/ghost/intern/GHOST_System.cpp
M intern/ghost/intern/GHOST_System.h
M intern/ghost/intern/GHOST_SystemSDL.cpp
M intern/ghost/intern/GHOST_SystemWayland.cpp
M intern/ghost/intern/GHOST_SystemWin32.cpp
M intern/ghost/intern/GHOST_SystemWin32.h
M intern/ghost/intern/GHOST_SystemX11.cpp
M intern/ghost/intern/GHOST_Window.cpp
M intern/ghost/intern/GHOST_WindowWin32.h
M intern/ghost/intern/GHOST_Wintab.cpp
M intern/ghost/intern/GHOST_Wintab.h
M source/blender/windowmanager/intern/wm_cursors.c
M source/blender/windowmanager/intern/wm_draw.c
M source/blender/windowmanager/intern/wm_window.c
===================================================================
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 5ace0fcc9d2..0f05e501d17 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -439,7 +439,7 @@ extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
- GHOST_TModifierKeyMask mask,
+ GHOST_TModifierKey mask,
bool *r_is_down);
/**
@@ -450,7 +450,7 @@ extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
- GHOST_TButtonMask mask,
+ GHOST_TButton mask,
bool *r_is_down);
#ifdef WITH_INPUT_NDOF
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index d946d2d882a..d7485975906 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -391,7 +391,7 @@ class GHOST_ISystem {
* \param isDown: The state of a modifier key (true == pressed).
* \return Indication of success.
*/
- virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const = 0;
+ virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKey mask, bool &isDown) const = 0;
/**
* Returns the state of a mouse button (outside the message queue).
@@ -399,7 +399,7 @@ class GHOST_ISystem {
* \param isDown: Button state.
* \return Indication of success.
*/
- virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool &isDown) const = 0;
+ virtual GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &isDown) const = 0;
/**
* Set which tablet API to use. Only affects Windows, other platforms have a single API.
diff --git a/intern/ghost/GHOST_Rect.h b/intern/ghost/GHOST_Rect.h
index 1cbc75fe60b..15fa546fb07 100644
--- a/intern/ghost/GHOST_Rect.h
+++ b/intern/ghost/GHOST_Rect.h
@@ -244,7 +244,7 @@ inline void GHOST_Rect::wrapPoint(int32_t &x, int32_t &y, int32_t ofs, GHOST_TAx
x -= w - (ofs * 2);
}
}
- if (axis & GHOST_kGrabAxisY) {
+ if (axis & GHOST_kAxisY) {
while (y - ofs < m_t) {
y += h - (ofs * 2);
}
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 76e6525ebfe..2fc84349eb9 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -123,8 +123,8 @@ typedef enum {
GHOST_kModifierKeyLeftControl,
GHOST_kModifierKeyRightControl,
GHOST_kModifierKeyOS,
- GHOST_kModifierKeyNumMasks
-} GHOST_TModifierKeyMask;
+ GHOST_kModifierKeyNum
+} GHOST_TModifierKey;
typedef enum {
GHOST_kWindowStateNormal = 0,
@@ -163,8 +163,8 @@ typedef enum {
/* Trackballs and programmable buttons. */
GHOST_kButtonMaskButton6,
GHOST_kButtonMaskButton7,
- GHOST_kButtonNumMasks
-} GHOST_TButtonMask;
+ GHOST_kButtonNum
+} GHOST_TButton;
typedef enum {
GHOST_kEventUnknown = 0,
@@ -419,9 +419,9 @@ typedef enum {
typedef enum {
/** Axis that cursor grab will wrap. */
- GHOST_kGrabAxisNone = 0,
+ GHOST_kAxisNone = 0,
GHOST_kAxisX = (1 << 0),
- GHOST_kGrabAxisY = (1 << 1),
+ GHOST_kAxisY = (1 << 1),
} GHOST_TAxisFlag;
typedef void *GHOST_TEventDataPtr;
@@ -437,7 +437,7 @@ typedef struct {
typedef struct {
/** The mask of the mouse button. */
- GHOST_TButtonMask button;
+ GHOST_TButton button;
/** Associated tablet data. */
GHOST_TabletData tablet;
} GHOST_TEventButtonData;
diff --git a/intern/ghost/intern/GHOST_Buttons.cpp b/intern/ghost/intern/GHOST_Buttons.cpp
index 3367d256325..6382729c579 100644
--- a/intern/ghost/intern/GHOST_Buttons.cpp
+++ b/intern/ghost/intern/GHOST_Buttons.cpp
@@ -12,7 +12,7 @@ GHOST_Buttons::GHOST_Buttons()
clear();
}
-bool GHOST_Buttons::get(GHOST_TButtonMask mask) const
+bool GHOST_Buttons::get(GHOST_TButton mask) const
{
switch (mask) {
case GHOST_kButtonMaskLeft:
@@ -34,7 +34,7 @@ bool GHOST_Buttons::get(GHOST_TButtonMask mask) const
}
}
-void GHOST_Buttons::set(GHOST_TButtonMask mask, bool down)
+void GHOST_Buttons::set(GHOST_TButton mask, bool down)
{
switch (mask) {
case GHOST_kButtonMaskLeft:
diff --git a/intern/ghost/intern/GHOST_Buttons.h b/intern/ghost/intern/GHOST_Buttons.h
index 72cb17a3322..e42376b1c76 100644
--- a/intern/ghost/intern/GHOST_Buttons.h
+++ b/intern/ghost/intern/GHOST_Buttons.h
@@ -27,14 +27,14 @@ struct GHOST_Buttons {
* \param mask: Key button to return.
* \return The state of the button (pressed == true).
*/
- bool get(GHOST_TButtonMask mask) const;
+ bool get(GHOST_TButton mask) const;
/**
* Updates the state of a single button.
* \param mask: Button state to update.
* \param down: The new state of the button.
*/
- void set(GHOST_TButtonMask mask, bool down);
+ void set(GHOST_TButton mask, bool down);
/**
* Sets the state of all buttons to up.
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 2b5414cd47b..8c690767810 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -402,7 +402,7 @@ void GHOST_GetCursorGrabState(GHOST_WindowHandle windowhandle,
}
GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
- GHOST_TModifierKeyMask mask,
+ GHOST_TModifierKey mask,
bool *r_is_down)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
@@ -416,7 +416,7 @@ GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
}
GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
- GHOST_TButtonMask mask,
+ GHOST_TButton mask,
bool *r_is_down)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
diff --git a/intern/ghost/intern/GHOST_EventButton.h b/intern/ghost/intern/GHOST_EventButton.h
index d68e401ffc4..f42805e2c6b 100644
--- a/intern/ghost/intern/GHOST_EventButton.h
+++ b/intern/ghost/intern/GHOST_EventButton.h
@@ -27,7 +27,7 @@ class GHOST_EventButton : public GHOST_Event {
GHOST_EventButton(uint64_t time,
GHOST_TEventType type,
GHOST_IWindow *window,
- GHOST_TButtonMask button,
+ GHOST_TButton button,
const GHOST_TabletData &tablet)
: GHOST_Event(time, type, window), m_buttonEventData({button, tablet})
{
diff --git a/intern/ghost/intern/GHOST_ModifierKeys.cpp b/intern/ghost/intern/GHOST_ModifierKeys.cpp
index e6e433ba332..d31dc8f0770 100644
--- a/intern/ghost/intern/GHOST_ModifierKeys.cpp
+++ b/intern/ghost/intern/GHOST_ModifierKeys.cpp
@@ -20,7 +20,7 @@ GHOST_ModifierKeys::~GHOST_ModifierKeys()
{
}
-GHOST_TKey GHOST_ModifierKeys::getModifierKeyCode(GHOST_TModifierKeyMask mask)
+GHOST_TKey GHOST_ModifierKeys::getModifierKeyCode(GHOST_TModifierKey mask)
{
GHOST_TKey key;
switch (mask) {
@@ -53,7 +53,7 @@ GHOST_TKey GHOST_ModifierKeys::getModifierKeyCode(GHOST_TModifierKeyMask mask)
return key;
}
-bool GHOST_ModifierKeys::get(GHOST_TModifierKeyMask mask) const
+bool GHOST_ModifierKeys::get(GHOST_TModifierKey mask) const
{
switch (mask) {
case GHOST_kModifierKeyLeftShift:
@@ -75,7 +75,7 @@ bool GHOST_ModifierKeys::get(GHOST_TModifierKeyMask mask) const
}
}
-void GHOST_ModifierKeys::set(GHOST_TModifierKeyMask mask, bool down)
+void GHOST_ModifierKeys::set(GHOST_TModifierKey mask, bool down)
{
switch (mask) {
case GHOST_kModifierKeyLeftShift:
diff --git a/intern/ghost/intern/GHOST_ModifierKeys.h b/intern/ghost/intern/GHOST_ModifierKeys.h
index ca76ba6c704..ce1bf3df2ae 100644
--- a/intern/ghost/intern/GHOST_ModifierKeys.h
+++ b/intern/ghost/intern/GHOST_ModifierKeys.h
@@ -27,21 +27,21 @@ struct GHOST_ModifierKeys {
* \param mask: The mask of the modifier key.
* \return The modifier key's key code.
*/
- static GHOST_TKey getModifierKeyCode(GHOST_TModifierKeyMask mask);
+ static GHOST_TKey getModifierKeyCode(GHOST_TModifierKey mask);
/**
* Returns the state of a single modifier key.
* \param mask: Key state to return.
* \return The state of the key (pressed == true).
*/
- bool get(GHOST_TModifierKeyMask mask) const;
+ bool get(GHOST_TModifierKey mask) const;
/**
* Updates the state of a single modifier key.
* \param mask: Key state to update.
* \param down: The new state of the key.
*/
- void set(GHOST_TModifierKeyMask mask, bool down);
+ void set(GHOST_TModifierKey mask, bool down);
/**
* Sets the state of all modifier keys to up.
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index cc8d0915c5a..2f4ab9ee37c 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -260,7 +260,7 @@ GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent *event)
return success;
}
-GHOST_TSuccess GHOST_System::getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const
+GHOST_TSuccess GHOST_System::getModifierKeyState(GHOST_TModifierKey mask, bool &isDown) const
{
GHOST_ModifierKeys keys;
/* Get the state of all modifier keys. */
@@ -272,7 +272,7 @@ GHOST_TSuccess GHOST_System::getModifierKeyState(GHOST_TModifierKeyMask mask, bo
return success;
}
-GHOST_TSuccess GHOST_System::getButtonState(GHOST_TButtonMask mask, bool &isDown) const
+GHOST_TSuccess GHOST_System::getButtonState(GHOST_TButton mask, bool &isDown) const
{
GHOST_Buttons buttons;
/* Get the state of all mouse buttons. */
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index b60ce09f743..e4a49551222 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -221,7 +221,7 @@ class GHOST_System :
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list