Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorrecht Van Lommel <brecht@blender.org>2022-09-26 23:56:14 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-09-26 23:59:35 +0300
commit84ddb8b3cc9989c2d5569bf2fa381a585f99d20f (patch)
treee41c117b0551d888abead3d09bacaabaab66379c /intern
parent57ea827bfb28eb697b74dbc606facbc133e10fab (diff)
UI: add preference to disable touchpad multitouch gestures
Available on Windows and macOS, where such gestures are supported. For Windows, disabling this option restores touchpad behavior to match Blender 3.2. Ref T97925 Differential Revision: https://developer.blender.org/D16005
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/GHOST_C-api.h7
-rw-r--r--intern/ghost/GHOST_ISystem.h6
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp6
-rw-r--r--intern/ghost/intern/GHOST_System.cpp6
-rw-r--r--intern/ghost/intern/GHOST_System.h9
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm2
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp4
7 files changed, 38 insertions, 2 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 399ee67a8fa..9da7d314052 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -741,6 +741,13 @@ extern unsigned int GHOST_GetContextDefaultOpenGLFramebuffer(GHOST_ContextHandle
extern unsigned int GHOST_GetDefaultOpenGLFramebuffer(GHOST_WindowHandle windowhandle);
/**
+ * Use multitouch gestures if supported.
+ * \param systemhandle: The handle to the system.
+ * \param use: Enable or disable.
+ */
+extern void GHOST_SetMultitouchGestures(GHOST_SystemHandle systemhandle, const bool use);
+
+/**
* Set which tablet API to use. Only affects Windows, other platforms have a single API.
* \param systemhandle: The handle to the system.
* \param api: Enum indicating which API to use.
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index d9be1454cea..da6233456c3 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -421,6 +421,12 @@ class GHOST_ISystem {
virtual GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &isDown) const = 0;
/**
+ * Enable multitouch gestures if supported.
+ * \param use: Enable or disable.
+ */
+ virtual void setMultitouchGestures(const bool use) = 0;
+
+ /**
* Set which tablet API to use. Only affects Windows, other platforms have a single API.
* \param api: Enum indicating which API to use.
*/
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 1ec7d2f926c..1dc23a68cea 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -743,6 +743,12 @@ GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle)
return window->invalidate();
}
+void GHOST_SetMultitouchGestures(GHOST_SystemHandle systemhandle, const bool use)
+{
+ GHOST_ISystem *system = GHOST_ISystem::getSystem();
+ return system->setMultitouchGestures(use);
+}
+
void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI api)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index 714565568dc..94d021fd822 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -30,6 +30,7 @@ GHOST_System::GHOST_System()
#ifdef WITH_INPUT_NDOF
m_ndofManager(0),
#endif
+ m_multitouchGestures(true),
m_tabletAPI(GHOST_kTabletAutomatic),
m_is_debug_enabled(false)
{
@@ -305,6 +306,11 @@ GHOST_TSuccess GHOST_System::getButtonState(GHOST_TButton mask, bool &isDown) co
return success;
}
+void GHOST_System::setMultitouchGestures(const bool use)
+{
+ m_multitouchGestures = use;
+}
+
void GHOST_System::setTabletAPI(GHOST_TTabletAPI api)
{
m_tabletAPI = api;
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 83f8cb254ce..7a22e2aa259 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -240,6 +240,12 @@ class GHOST_System : public GHOST_ISystem {
GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &isDown) const;
/**
+ * Enable multitouch gestures if supported.
+ * \param use: Enable or disable.
+ */
+ void setMultitouchGestures(const bool use);
+
+ /**
* Set which tablet API to use. Only affects Windows, other platforms have a single API.
* \param api: Enum indicating which API to use.
*/
@@ -402,6 +408,9 @@ class GHOST_System : public GHOST_ISystem {
/** Settings of the display before the display went full-screen. */
GHOST_DisplaySetting m_preFullScreenSetting;
+ /* Use multitouch gestures? */
+ bool m_multitouchGestures;
+
/** Which tablet API to use. */
GHOST_TTabletAPI m_tabletAPI;
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index fe5992343ab..bfa90114e4c 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1681,7 +1681,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
/* we assume phases are only set for gestures from trackpad or magic
* mouse events. note that using tablet at the same time may not work
* since this is a static variable */
- if (phase == NSEventPhaseBegan)
+ if (phase == NSEventPhaseBegan && m_multitouchGestures)
m_multiTouchScroll = true;
else if (phase == NSEventPhaseEnded)
m_multiTouchScroll = false;
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 0efe40de176..667198241f0 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -2093,7 +2093,9 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, uint msg, WPARAM wParam,
/* The DM_POINTERHITTEST message is sent to a window, when pointer input is first
* detected, in order to determine the most probable input target for Direct
* Manipulation. */
- window->onPointerHitTest(wParam);
+ if (system->m_multitouchGestures) {
+ window->onPointerHitTest(wParam);
+ }
break;
}
}