Windows: use Wintab by default if it's available and a device is detected.

Previously Automatic tablet API mode would handle both Windows Ink and
Wintab events. This is unpredictable and causes problems with the fix
coming in the next commit.

Instead assume that in most cases where Windows Ink is desired there
will be no Wintab. If that's not the case, it can be adjusted under
Preferences > Input > Tablet.
This commit is contained in:
Brecht Van Lommel 2019-04-03 17:09:54 +02:00
parent aa0bb47576
commit 6a9a2b5133
4 changed files with 26 additions and 12 deletions

View File

@ -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

View File

@ -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
/***************************************************************************************

View File

@ -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;
}

View File

@ -316,6 +316,8 @@ public:
return &m_tabletData;
}
bool useTabletAPI(GHOST_TTabletAPI api) const;
void processWin32PointerEvent(WPARAM wParam);
void processWin32TabletActivateEvent(WORD state);
void processWin32TabletInitEvent();