diff options
author | Campbell Barton <campbell@blender.org> | 2022-06-27 13:31:28 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-06-27 13:36:40 +0300 |
commit | a61792968363bbd443f03186e77fef77ddbf88a7 (patch) | |
tree | 7ae168d0e89f03d5dbed24cb12be0c3033ad651f /intern/ghost | |
parent | 3cf6516e7b917bd81d7147b57baafe2495c759f4 (diff) |
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.
Diffstat (limited to 'intern/ghost')
21 files changed, 45 insertions, 45 deletions
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 : public GHOST_ISystem { * \param isDown: The state of a modifier key (true == pressed). * \return Indication of success. */ - GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const; + GHOST_TSuccess getModifierKeyState(GHOST_TModifierKey mask, bool &isDown) const; /** * Returns the state of a mouse button (outside the message queue). @@ -229,7 +229,7 @@ class GHOST_System : public GHOST_ISystem { * \param isDown: Button state. * \return Indication of success. */ - GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool &isDown) const; + GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &isDown) const; /** * Set which tablet API to use. Only affects Windows, other platforms have a single API. diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp index 36c912d8821..a29bfd9489d 100644 --- a/intern/ghost/intern/GHOST_SystemSDL.cpp +++ b/intern/ghost/intern/GHOST_SystemSDL.cpp @@ -410,7 +410,7 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event) case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONDOWN: { SDL_MouseButtonEvent &sdl_sub_evt = sdl_event->button; - GHOST_TButtonMask gbmask = GHOST_kButtonMaskLeft; + GHOST_TButton gbmask = GHOST_kButtonMaskLeft; GHOST_TEventType type = (sdl_sub_evt.state == SDL_PRESSED) ? GHOST_kEventButtonDown : GHOST_kEventButtonUp; diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index b212b6fc52c..b7e0b17d97a 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -1312,7 +1312,7 @@ static void pointer_handle_button(void *data, break; } - GHOST_TButtonMask ebutton = GHOST_kButtonMaskLeft; + GHOST_TButton ebutton = GHOST_kButtonMaskLeft; switch (button) { case BTN_LEFT: ebutton = GHOST_kButtonMaskLeft; @@ -1480,7 +1480,7 @@ static void tablet_tool_handle_down(void *data, { tablet_tool_input_t *tool_input = static_cast<tablet_tool_input_t *>(data); input_t *input = tool_input->input; - const GHOST_TButtonMask ebutton = GHOST_kButtonMaskLeft; + const GHOST_TButton ebutton = GHOST_kButtonMaskLeft; const GHOST_TEventType etype = GHOST_kEventButtonDown; input->data_source_serial = serial; @@ -1498,7 +1498,7 @@ static void tablet_tool_handle_up(void *data, struct zwp_tablet_tool_v2 * /*zwp_ { tablet_tool_input_t *tool_input = static_cast<tablet_tool_input_t *>(data); input_t *input = tool_input->input; - const GHOST_TButtonMask ebutton = GHOST_kButtonMaskLeft; + const GHOST_TButton ebutton = GHOST_kButtonMaskLeft; const GHOST_TEventType etype = GHOST_kEventButtonUp; input->tablet.buttons.set(ebutton, false); @@ -1614,7 +1614,7 @@ static void tablet_tool_handle_button(void *data, break; } - GHOST_TButtonMask ebutton = GHOST_kButtonMaskLeft; + GHOST_TButton ebutton = GHOST_kButtonMaskLeft; switch (button) { case BTN_STYLUS: ebutton = GHOST_kButtonMaskRight; @@ -2507,7 +2507,7 @@ GHOST_TSuccess GHOST_SystemWayland::getModifierKeys(GHOST_ModifierKeys &keys) co keys.set(GHOST_kModifierKeyOS, val); val = xkb_state_mod_name_is_active(d->inputs[0]->xkb_state, XKB_MOD_NAME_NUM, mods_all) == 1; - keys.set(GHOST_kModifierKeyNumMasks, val); + keys.set(GHOST_kModifierKeyNum, val); return GHOST_kSuccess; } diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 28c86db53e2..1365c281ab4 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -580,7 +580,7 @@ GHOST_TKey GHOST_SystemWin32::hardKey(RAWINPUT const &raw, // extra handling of modifier keys: don't send repeats out from GHOST if (key >= GHOST_kKeyLeftShift && key <= GHOST_kKeyRightAlt) { bool changed = false; - GHOST_TModifierKeyMask modifier; + GHOST_TModifierKey modifier; switch (key) { case GHOST_kKeyLeftShift: { changed = (modifiers.get(GHOST_kModifierKeyLeftShift) != *r_keyDown); @@ -864,7 +864,7 @@ GHOST_TKey GHOST_SystemWin32::convertKey(short vKey, short scanCode, short exten GHOST_EventButton *GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type, GHOST_WindowWin32 *window, - GHOST_TButtonMask mask) + GHOST_TButton mask) { GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem(); diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index 689b78b0317..b40f5e3fd75 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -310,7 +310,7 @@ class GHOST_SystemWin32 : public GHOST_System { */ static GHOST_EventButton *processButtonEvent(GHOST_TEventType type, GHOST_WindowWin32 *window, - GHOST_TButtonMask mask); + GHOST_TButton mask); /** * Creates tablet events from Wintab events. diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index bed9cd6c784..0023ff639f4 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -1231,7 +1231,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe) case ButtonPress: case ButtonRelease: { XButtonEvent &xbe = xe->xbutton; - GHOST_TButtonMask gbmask = GHOST_kButtonMaskLeft; + GHOST_TButton gbmask = GHOST_kButtonMaskLeft; GHOST_TEventType type = (xbe.type == ButtonPress) ? GHOST_kEventButtonDown : GHOST_kEventButtonUp; diff --git a/intern/ghost/intern/GHOST_Window.cpp b/intern/ghost/intern/GHOST_Window.cpp index 3f093840d0c..be5d593c401 100644 --- a/intern/ghost/intern/GHOST_Window.cpp +++ b/intern/ghost/intern/GHOST_Window.cpp @@ -177,7 +177,7 @@ void GHOST_Window::getCursorGrabState(GHOST_TGrabCursorMode &mode, bounds.m_r = -1; bounds.m_t = -1; bounds.m_b = -1; - wrap_axis = GHOST_kGrabAxisNone; + wrap_axis = GHOST_kAxisNone; } use_software_cursor = (m_cursorGrab != GHOST_kGrabDisable) ? getCursorGrabUseSoftwareDisplay() : false; diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h index c958a89ac48..88731597caa 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.h +++ b/intern/ghost/intern/GHOST_WindowWin32.h @@ -34,7 +34,7 @@ typedef BOOL(API *GHOST_WIN32_AdjustWindowRectExForDpi)( struct GHOST_PointerInfoWin32 { int32_t pointerId; int32_t isPrimary; - GHOST_TButtonMask buttonMask; + GHOST_TButton buttonMask; POINT pixelLocation; uint64_t time; GHOST_TabletData tabletData; diff --git a/intern/ghost/intern/GHOST_Wintab.cpp b/intern/ghost/intern/GHOST_Wintab.cpp index b136acbe098..c75a39bb34b 100644 --- a/intern/ghost/intern/GHOST_Wintab.cpp +++ b/intern/ghost/intern/GHOST_Wintab.cpp @@ -373,7 +373,7 @@ void GHOST_Wintab::getInput(std::vector<GHOST_WintabInfoWin32> &outWintabInfo) /* Iterate over button flag indices until all flags are clear. */ for (WORD buttonIndex = 0; buttonsChanged; buttonIndex++, buttonsChanged >>= 1) { if (buttonsChanged & 1) { - GHOST_TButtonMask button = mapWintabToGhostButton(pkt.pkCursor, buttonIndex); + GHOST_TButton button = mapWintabToGhostButton(pkt.pkCursor, buttonIndex); if (button != GHOST_kButtonMaskNone) { /* If this is not the first button found, push info for the prior Wintab button. */ @@ -397,7 +397,7 @@ void GHOST_Wintab::getInput(std::vector<GHOST_WintabInfoWin32> &outWintabInfo) } } -GHOST_TButtonMask GHOST_Wintab::mapWintabToGhostButton(UINT cursor, WORD physicalButton) +GHOST_TButton GHOST_Wintab::mapWintabToGhostButton(UINT cursor, WORD physicalButton) { const WORD numButtons = 32; BYTE logicalButtons[numButtons] = {0}; diff --git a/intern/ghost/intern/GHOST_Wintab.h b/intern/ghost/intern/GHOST_Wintab.h index 80eacf1f3fa..565aeb6ca02 100644 --- a/intern/ghost/intern/GHOST_Wintab.h +++ b/intern/ghost/intern/GHOST_Wintab.h @@ -54,7 +54,7 @@ struct GHOST_WintabInfoWin32 { int32_t x = 0; int32_t y = 0; GHOST_TEventType type = GHOST_kEventCursorMove; - GHOST_TButtonMask button = GHOST_kButtonMaskNone; + GHOST_TButton button = GHOST_kButtonMaskNone; uint64_t time = 0; GHOST_TabletData tabletData = GHOST_TABLET_DATA_NONE; }; @@ -243,7 +243,7 @@ class GHOST_Wintab { * \param physicalButton: The physical button ID to inspect. * \return The system mapped button. */ - GHOST_TButtonMask mapWintabToGhostButton(UINT cursor, WORD physicalButton); + GHOST_TButton mapWintabToGhostButton(UINT cursor, WORD physicalButton); /** * Applies common modifications to Wintab context. |