[Bf-blender-cvs] [6a9a2b5133b] master: Windows: use Wintab by default if it's available and a device is detected.

Brecht Van Lommel noreply at git.blender.org
Wed Apr 3 20:03:42 CEST 2019


Commit: 6a9a2b5133bae2682d20a68d5b3eb925b3f5b6ff
Author: Brecht Van Lommel
Date:   Wed Apr 3 17:09:54 2019 +0200
Branches: master
https://developer.blender.org/rB6a9a2b5133bae2682d20a68d5b3eb925b3f5b6ff

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.

===================================================================

M	intern/ghost/intern/GHOST_System.cpp
M	intern/ghost/intern/GHOST_System.h
M	intern/ghost/intern/GHOST_WindowWin32.cpp
M	intern/ghost/intern/GHOST_WindowWin32.h

===================================================================

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();



More information about the Bf-blender-cvs mailing list