[Bf-blender-cvs] [19fba61d46a] blender2.7: Fix T55589: drawing strokes with Microsoft surface pen misses first part.

Christopher Peerman noreply at git.blender.org
Mon Jan 14 12:26:43 CET 2019


Commit: 19fba61d46a6e54d0a85a88f36bd150ec3df97b4
Author: Christopher Peerman
Date:   Mon Jan 14 12:15:59 2019 +0100
Branches: blender2.7
https://developer.blender.org/rB19fba61d46a6e54d0a85a88f36bd150ec3df97b4

Fix T55589: drawing strokes with Microsoft surface pen misses first part.

This disables touch gesture recognition in Blender, avoiding any initial delay
when drawing with grease pencil, texture paint, etc.

Differential Revision: https://developer.blender.org/D4203

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

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

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

diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 983fffc10e6..17dbc858e01 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -190,7 +190,24 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
 		    0);                         // pointer to window-creation data
 		free(title_16);
 	}
+
+	m_user32 = ::LoadLibrary("user32.dll");
+
 	if (m_hWnd) {
+		if (m_user32) {
+			// Touch enabled screens with pen support by default have gestures
+			// enabled, which results in a delay between the pointer down event
+			// and the first move when using the stylus. RegisterTouchWindow
+			// disables the new gesture architecture enabling the events to be
+			// sent immediately to the application rather than being absorbed by
+			// the gesture API.
+			GHOST_WIN32_RegisterTouchWindow pRegisterTouchWindow =
+				(GHOST_WIN32_RegisterTouchWindow)GetProcAddress(m_user32, "RegisterTouchWindow");
+			if (pRegisterTouchWindow) {
+				pRegisterTouchWindow(m_hWnd, 0);
+			}
+		}
+
 		// Register this window as a droptarget. Requires m_hWnd to be valid.
 		// Note that OleInitialize(0) has to be called prior to this. Done in GHOST_SystemWin32.
 		m_dropTarget = new GHOST_DropTargetWin32(this, m_system);
@@ -368,6 +385,11 @@ GHOST_WindowWin32::~GHOST_WindowWin32()
 		::DestroyWindow(m_hWnd);
 		m_hWnd = 0;
 	}
+
+	if (m_user32) {
+		FreeLibrary(m_user32);
+		m_user32 = NULL;
+	}
 }
 
 bool GHOST_WindowWin32::getValid() const
@@ -998,10 +1020,6 @@ void GHOST_WindowWin32::bringTabletContextToFront()
 
 GHOST_TUns16 GHOST_WindowWin32::getDPIHint()
 {
-	if (!m_user32) {
-		m_user32 = ::LoadLibrary("user32.dll");
-	}
-
 	if (m_user32) {
 		GHOST_WIN32_GetDpiForWindow fpGetDpiForWindow = (GHOST_WIN32_GetDpiForWindow) ::GetProcAddress(m_user32, "GetDpiForWindow");
 
diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h
index 8b0ba2f1934..9d6a1b667d6 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.h
+++ b/intern/ghost/intern/GHOST_WindowWin32.h
@@ -59,6 +59,9 @@ typedef BOOL (API * GHOST_WIN32_WTPacket)(HCTX, UINT, LPVOID);
 typedef BOOL (API * GHOST_WIN32_WTEnable)(HCTX, BOOL);
 typedef BOOL (API * GHOST_WIN32_WTOverlap)(HCTX, BOOL);
 
+// typedef to user32 functions to disable gestures on windows
+typedef BOOL(API * GHOST_WIN32_RegisterTouchWindow)(HWND hwnd, ULONG ulFlags);
+
 // typedefs for user32 functions to allow dynamic loading of Windows 10 DPI scaling functions
 typedef UINT(API * GHOST_WIN32_GetDpiForWindow)(HWND);
 #ifndef USER_DEFAULT_SCREEN_DPI



More information about the Bf-blender-cvs mailing list