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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-08-01 06:40:59 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-08-01 06:51:44 +0300
commit7065022f7aa23ba13d2999e1e40162a8f480af0e (patch)
treea1b73860f22cf6824d366ff52d3ca5b0b32a64e7 /intern/ghost
parenta3ce64be5a828cbf8896be18b9c1060d5520bce8 (diff)
Fix T48901: Blender ignores xinput cursor matrix
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp22
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp21
2 files changed, 41 insertions, 2 deletions
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 6f349543eed..727bc9a01fb 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -61,6 +61,11 @@
#include <X11/XF86keysym.h>
#endif
+/* for XIWarpPointer */
+#ifdef WITH_X11_XINPUT
+# include <X11/extensions/XInput2.h>
+#endif
+
/* For timing */
#include <sys/time.h>
#include <unistd.h>
@@ -1469,7 +1474,22 @@ setCursorPosition(
int relx = x - cx;
int rely = y - cy;
- XWarpPointer(m_display, None, None, 0, 0, 0, 0, relx, rely);
+#ifdef WITH_X11_XINPUT
+ if ((m_xinput_version.present) &&
+ (m_xinput_version.major_version >= 2))
+ {
+ /* Needed to account for XInput "Coordinate Transformation Matrix", see T48901 */
+ int device_id;
+ if (XIGetClientPointer(m_display, None, &device_id) != False) {
+ XIWarpPointer(m_display, device_id, None, None, 0, 0, 0, 0, relx, rely);
+ }
+ }
+ else
+#endif
+ {
+ XWarpPointer(m_display, None, None, 0, 0, 0, 0, relx, rely);
+ }
+
XSync(m_display, 0); /* Sync to process all requests */
return GHOST_kSuccess;
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index fd002cec80c..ec2b65e67d0 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -51,6 +51,11 @@
# include "GHOST_ContextGLX.h"
#endif
+/* for XIWarpPointer */
+#ifdef WITH_X11_XINPUT
+# include <X11/extensions/XInput2.h>
+#endif
+
#if defined(__sun__) || defined(__sun) || defined(__sparc) || defined(__sparc__) || defined(_AIX)
# include <strings.h>
#endif
@@ -1520,7 +1525,21 @@ setWindowCursorGrab(
/* use to generate a mouse move event, otherwise the last event
* blender gets can be outside the screen causing menus not to show
* properly unless the user moves the mouse */
- XWarpPointer(m_display, None, None, 0, 0, 0, 0, 0, 0);
+
+#ifdef WITH_X11_XINPUT
+ if ((m_system->m_xinput_version.present) &&
+ (m_system->m_xinput_version.major_version >= 2))
+ {
+ int device_id;
+ if (XIGetClientPointer(m_display, None, &device_id) != False) {
+ XIWarpPointer(m_display, device_id, None, None, 0, 0, 0, 0, 0, 0);
+ }
+ }
+ else
+#endif
+ {
+ XWarpPointer(m_display, None, None, 0, 0, 0, 0, 0, 0);
+ }
}
/* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */