Author: Nicholas Rishel 2021-02-23 10:17:13 Committer: Nicholas Rishel 2021-02-23 10:47:50 Parent: b88e2ad0c1bcb40c65504f7c64ec65e7cb444804 (Revert Automatic Tablet API dynamic fallback.) Branch: 292to291 Follows: v2.83 Precedes: Remaining differences between 2.92 and 2.91, comment cleanup removed. ------------------ intern/ghost/intern/GHOST_SystemWin32.cpp ------------------ index 85eeec8aa0d..d5b2773933d 100644 @@ -564,13 +564,13 @@ GHOST_TSuccess GHOST_SystemWin32::getButtons(GHOST_Buttons &buttons) const */ bool swapped = ::GetSystemMetrics(SM_SWAPBUTTON) == TRUE; >>>>>>> This is a dead function, its only used by getButtonState which is called in an unused Ghost_C-api function. - bool down = HIBYTE(::GetAsyncKeyState(VK_LBUTTON)) != 0; + bool down = HIBYTE(::GetKeyState(VK_LBUTTON)) != 0; buttons.set(swapped ? GHOST_kButtonMaskRight : GHOST_kButtonMaskLeft, down); - down = HIBYTE(::GetAsyncKeyState(VK_MBUTTON)) != 0; + down = HIBYTE(::GetKeyState(VK_MBUTTON)) != 0; buttons.set(GHOST_kButtonMaskMiddle, down); - down = HIBYTE(::GetAsyncKeyState(VK_RBUTTON)) != 0; + down = HIBYTE(::GetKeyState(VK_RBUTTON)) != 0; <<<<<<< buttons.set(swapped ? GHOST_kButtonMaskLeft : GHOST_kButtonMaskRight, down); return GHOST_kSuccess; } @@ -941,22 +941,27 @@ GHOST_EventButton *GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type, window->updateMouseCapture(MouseReleased); } >>>>>> This is a bugfix for Windows Ink + if (window->m_tabletInRange) { + if (window->useTabletAPI(GHOST_kTabletNative)) { + // Win32 Pointer processing handles input while in-range and in-contact events. + return NULL; + } + } + <<<<<<< return new GHOST_EventButton( system->getMilliSeconds(), type, window, mask, window->getTabletData()); } >>>>>>>>>> rename, and trivial reordering of initialization after check if we're going to run -void GHOST_SystemWin32::processPointerEvent( +void GHOST_SystemWin32::processPointerEvents( UINT type, GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam, bool &eventHandled) { - /* Pointer events might fire when changing windows for a device which is set to use Wintab, even - * when when Wintab is left enabled but set to the bottom of Wintab overlap order. */ + std::vector pointerInfo; + GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem(); + if (!window->useTabletAPI(GHOST_kTabletNative)) { return; } - GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem(); - std::vector pointerInfo; - <<<<<<<<<< if (window->getPointerInfo(pointerInfo, wParam, lParam) != GHOST_kSuccess) { return; } @@ -1013,6 +1018,11 @@ void GHOST_SystemWin32::processPointerEvent( break; case WM_POINTERLEAVE: window->m_tabletInRange = false; >>>>>>>>>>> Bugfix for Windows Ink + system->pushEvent(new GHOST_EventButton(pointerInfo[0].time, + GHOST_kEventCursorMove, + window, + pointerInfo[0].buttonMask, + pointerInfo[0].tabletData)); <<<<<<<<<<< break; default: break; @@ -1474,7 +1484,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_POINTERUPDATE: case WM_POINTERUP: case WM_POINTERLEAVE: >>>>>>>>> function rename - processPointerEvent(msg, window, wParam, lParam, eventHandled); + processPointerEvents(msg, window, wParam, lParam, eventHandled); <<<<<<<<<< break; //////////////////////////////////////////////////////////////////////// // Mouse events, processed ------------------- intern/ghost/intern/GHOST_SystemWin32.h ------------------- index 51c0c984710..a8505934582 100644 @@ -308,6 +308,13 @@ class GHOST_SystemWin32 : public GHOST_System { GHOST_WindowWin32 *window, GHOST_TButtonMask mask); >>>>>>>> Unused function, was unused in 2.91 + /** + * Creates tablet events from Wintab events. + * \param type The type of pointer event + * \param window The window receiving the event (the active window). + */ + static GHOST_TSuccess processWintabEvents(GHOST_TEventType type, GHOST_WindowWin32 *window); + <<<<<<<< /** * Creates tablet events from pointer events. * \param type: The type of pointer event. @@ -316,7 +323,7 @@ class GHOST_SystemWin32 : public GHOST_System { * \param lParam: The lParam from the wndproc. * \param eventhandled: True if the method handled the event. */ >>>>>>>> function rename - static void processPointerEvent( + static void processPointerEvents( UINT type, GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam, bool &eventhandled); <<<<<<<< /** ------------------ intern/ghost/intern/GHOST_WindowWin32.cpp ------------------ index 8696a146c98..18a48c9169e 100644 @@ -814,6 +814,11 @@ void GHOST_WindowWin32::updateMouseCapture(GHOST_MouseCaptureEventWin32 event) } } >>>>>>>>> unsued function, unused in 2.91 +bool GHOST_WindowWin32::getMousePressed() const +{ + return m_nPressedButtons; +} + <<<<<<<<< HCURSOR GHOST_WindowWin32::getStandardCursor(GHOST_TStandardCursor shape) const { // Convert GHOST cursor to Windows OEM cursor @@ -1099,6 +1104,16 @@ GHOST_TSuccess GHOST_WindowWin32::getPointerInfo( return GHOST_kSuccess; } >>>>>>>>>>>>>>>> unused function, unused in 2.91 +void GHOST_WindowWin32::setTabletData(GHOST_TabletData *pTabletData) +{ + if (pTabletData) { + m_tabletData = *pTabletData; + } + else { + m_tabletData = GHOST_TABLET_DATA_NONE; + } +} + <<<<<<<<<<<<<<<< void GHOST_WindowWin32::processWin32TabletActivateEvent(WORD state) { if (!useTabletAPI(GHOST_kTabletWintab)) { ------------------- intern/ghost/intern/GHOST_WindowWin32.h ------------------- index 18897a246b2..5c99c5960fe 100644 @@ -429,10 +429,7 @@ class GHOST_WindowWin32 : public GHOST_Window { return m_tabletData; } >>>>>> unused function, unused in 2.91 - /** - * Query whether given tablet API should be used. - * \param api: Tablet API to test. - */ + void setTabletData(GHOST_TabletData *tabletData); <<<<<<<<<< bool useTabletAPI(GHOST_TTabletAPI api) const; /** @@ -463,7 +460,12 @@ class GHOST_WindowWin32 : public GHOST_Window { GHOST_TUns16 getDPIHint() override; >>>>>>>>>>> unused function, unused in 2.91 - /** Whether a tablet stylus is being tracked. */ + /** + * Get whether there are currently any mouse buttons pressed + * \return True if there are any currently pressed mouse buttons + */ + bool getMousePressed() const; + <<<<<<<<<<<<<< bool m_tabletInRange; /** if the window currently resizing */