diff options
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_System.cpp | 4 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_System.h | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.cpp | 26 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.h | 2 |
4 files changed, 26 insertions, 12 deletions
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp index 80ef3a6fdc2..27fb08ad014 100644 --- a/intern/ghost/intern/GHOST_System.cpp +++ b/intern/ghost/intern/GHOST_System.cpp @@ -291,9 +291,9 @@ void GHOST_System::setTabletAPI(GHOST_TTabletAPI api) m_tabletAPI = api; } -bool GHOST_System::useTabletAPI(GHOST_TTabletAPI api) const +GHOST_TTabletAPI GHOST_System::getTabletAPI(void) { - return (m_tabletAPI == GHOST_kTabletAutomatic || m_tabletAPI == api); + return m_tabletAPI; } #ifdef WITH_INPUT_NDOF diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h index bd8a1d4a23e..b9b7fc5658a 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -242,11 +242,7 @@ public: * \param api Enum indicating which API to use. */ void setTabletAPI(GHOST_TTabletAPI api); - - /** - * Test if given tablet API should be used by event handling. - */ - bool useTabletAPI(GHOST_TTabletAPI api) const; + GHOST_TTabletAPI getTabletAPI(void); #ifdef WITH_INPUT_NDOF /*************************************************************************************** diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 5849d620b23..b119a32e002 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -880,7 +880,7 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCursorShape(GHOST_TStandardCursor cur void GHOST_WindowWin32::processWin32PointerEvent(WPARAM wParam) { - if (!m_system->useTabletAPI(GHOST_kTabletNative)) { + if (!useTabletAPI(GHOST_kTabletNative)) { return; // Other tablet API specified by user } @@ -930,7 +930,7 @@ void GHOST_WindowWin32::processWin32PointerEvent(WPARAM wParam) void GHOST_WindowWin32::processWin32TabletActivateEvent(WORD state) { - if (!m_system->useTabletAPI(GHOST_kTabletWintab)) { + if (!useTabletAPI(GHOST_kTabletWintab)) { return; } @@ -943,9 +943,25 @@ void GHOST_WindowWin32::processWin32TabletActivateEvent(WORD state) } } +bool GHOST_WindowWin32::useTabletAPI(GHOST_TTabletAPI api) const +{ + if (m_system->getTabletAPI() == api) { + return true; + } + else if (m_system->getTabletAPI() == GHOST_kTabletAutomatic) { + if (m_wintab.tablet) + return api == GHOST_kTabletWintab; + else + return api == GHOST_kTabletNative; + } + else { + return false; + } +} + void GHOST_WindowWin32::processWin32TabletInitEvent() { - if (!m_system->useTabletAPI(GHOST_kTabletWintab)) { + if (!useTabletAPI(GHOST_kTabletWintab)) { return; } @@ -979,7 +995,7 @@ void GHOST_WindowWin32::processWin32TabletInitEvent() void GHOST_WindowWin32::processWin32TabletEvent(WPARAM wParam, LPARAM lParam) { - if (!m_system->useTabletAPI(GHOST_kTabletWintab)) { + if (!useTabletAPI(GHOST_kTabletWintab)) { return; } @@ -1048,7 +1064,7 @@ void GHOST_WindowWin32::processWin32TabletEvent(WPARAM wParam, LPARAM lParam) void GHOST_WindowWin32::bringTabletContextToFront() { - if (!m_system->useTabletAPI(GHOST_kTabletWintab)) { + if (!useTabletAPI(GHOST_kTabletWintab)) { return; } diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h index 716e2f0618c..41874579f73 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.h +++ b/intern/ghost/intern/GHOST_WindowWin32.h @@ -316,6 +316,8 @@ public: return &m_tabletData; } + bool useTabletAPI(GHOST_TTabletAPI api) const; + void processWin32PointerEvent(WPARAM wParam); void processWin32TabletActivateEvent(WORD state); void processWin32TabletInitEvent(); |