[Bf-blender-cvs] [c444bc6] experimental-build: Attempt to fix T48204...
Bastien Montagne
noreply at git.blender.org
Fri May 6 18:16:59 CEST 2016
Commit: c444bc670e428f1315c5804efef94f76bb12d6d0
Author: Bastien Montagne
Date: Fri May 6 18:14:46 2016 +0200
Branches: experimental-build
https://developer.blender.org/rBc444bc670e428f1315c5804efef94f76bb12d6d0
Attempt to fix T48204...
===================================================================
M intern/ghost/GHOST_Types.h
M intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 29508a8..dc11d16 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -91,6 +91,7 @@ typedef enum {
typedef struct GHOST_TabletData {
GHOST_TTabletMode Active; /* 0=None, 1=Stylus, 2=Eraser */
+ int x_root, y_root; /* Coordinates in root window. */
float Pressure; /* range 0.0 (not touching) to 1.0 (full pressure) */
float Xtilt; /* range 0.0 (upright) to 1.0 (tilted fully against the tablet surface) */
float Ytilt; /* as above */
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 0c87ee1..8aa2cb4 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -705,12 +705,16 @@ GHOST_SystemX11::processEvent(XEvent *xe)
XMotionEvent &xme = xe->xmotion;
#ifdef WITH_X11_XINPUT
- bool is_tablet = window->GetTabletData()->Active != GHOST_kTabletModeNone;
+ const bool is_tablet = window->GetTabletData()->Active != GHOST_kTabletModeNone;
#else
- bool is_tablet = false;
+ const bool is_tablet = false;
#endif
- if (is_tablet == false && window->getCursorGrabModeIsWarp()) {
+ if (is_tablet == true) {
+ /* Do Nothing (c)
+ * See T48204 and comment in tablet handling code (default case below). */
+ }
+ if (window->getCursorGrabModeIsWarp()) {
GHOST_TInt32 x_new = xme.x_root;
GHOST_TInt32 y_new = xme.y_root;
GHOST_TInt32 x_accum, y_accum;
@@ -1241,6 +1245,31 @@ GHOST_SystemX11::processEvent(XEvent *xe)
#define AXIS_VALUE_GET(axis, val) ((axis_first <= axis && axes_end > axis) && ((void)(val = data->axis_data[axis]), true))
+ if (axis_first < 2) {
+ /* There are some movement.
+ * Note: maybe we could use X/Y valuator values themselves, but it's not that interesting
+ * for us here, and converting them to root coordinates is not trivial.
+ * However, we suffer again here from some drivers (generic evdev...) which only output a subset
+ * of whole data - specifically, it may give Y value without X value (the reverse is not possible),
+ * and looks like even x_root of main motion event gets corrupted in this case!
+ * So we do as with pressure etc. - cache locations 'root' data. */
+ if (AXIS_VALUE_GET(0, axis_value)) {
+ window->GetTabletData()->x_root = data->x_root;
+ }
+ if (AXIS_VALUE_GET(1, axis_value)) {
+ window->GetTabletData()->y_root = data->y_root;
+ }
+
+ g_event = new
+ GHOST_EventCursor(
+ getMilliSeconds(),
+ GHOST_kEventCursorMove,
+ window,
+ window->GetTabletData()->x_root,
+ window->GetTabletData()->y_root
+ );
+ }
+
if (AXIS_VALUE_GET(2, axis_value)) {
window->GetTabletData()->Pressure = axis_value / ((float)m_xtablet.PressureLevels);
}
More information about the Bf-blender-cvs
mailing list