[Bf-blender-cvs] [e63594a] master: Fix again tablets with linux!

Bastien Montagne noreply at git.blender.org
Fri Feb 13 11:05:21 CET 2015


Commit: e63594a6e5d5e00f397bafa75dc234f1a1733a7a
Author: Bastien Montagne
Date:   Fri Feb 13 10:52:30 2015 +0100
Branches: master
https://developer.blender.org/rBe63594a6e5d5e00f397bafa75dc234f1a1733a7a

Fix again tablets with linux!

Yes, for me tablets (both wacom and no-name) were again broken - curse X11!
So now, we want ButtonPress, Button1Motion does not work anymore...

Anyway, this patch makes things much cleaner, storing each event type
in its own variable!

Patch by cedricp (Cédric PAILLE) from T43367, thanks a bunch!

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

M	intern/ghost/intern/GHOST_SystemX11.cpp
M	intern/ghost/intern/GHOST_SystemX11.h
M	intern/ghost/intern/GHOST_WindowX11.cpp

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

diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index d4693e9..e819928 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -1181,7 +1181,11 @@ GHOST_SystemX11::processEvent(XEvent *xe)
 		default:
 		{
 #ifdef WITH_X11_XINPUT
-			if (xe->type == m_xtablet.MotionEvent) {
+			if (xe->type == m_xtablet.MotionEvent ||
+			    xe->type == m_xtablet.MotionEventEraser ||
+			    xe->type == m_xtablet.PressEvent ||
+			    xe->type == m_xtablet.PressEventEraser)
+			{
 				XDeviceMotionEvent *data = (XDeviceMotionEvent *)xe;
 				const unsigned char axis_first = data->first_axis;
 				const unsigned char axes_end = axis_first + data->axes_count;  /* after the last */
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index bc35b6c..378f07d 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -286,6 +286,12 @@ public:
 		int MotionEvent;
 		int ProxInEvent;
 		int ProxOutEvent;
+		int PressEvent;
+
+		int MotionEventEraser;
+		int ProxInEventEraser;
+		int ProxOutEventEraser;
+		int PressEventEraser;
 
 		int PressureLevels;
 		int XtiltLevels, YtiltLevels;
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 5e2a881..4e61926 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -570,18 +570,18 @@ void GHOST_WindowX11::initXInputDevices()
 	if (version && (version != (XExtensionVersion *)NoSuchExtension)) {
 		if (version->present) {
 			GHOST_SystemX11::GHOST_TabletX11 &xtablet = m_system->GetXTablet();
-			XEventClass xevents[10], ev;
+			XEventClass xevents[8], ev;
 			int dcount = 0;
 
 			/* With modern XInput (xlib 1.6.2 at least and/or evdev 2.9.0) and some 'no-name' tablets
-			 * like 'UC-LOGIC Tablet WP5540U', we also need to 'select' Button1 for motion event,
+			 * like 'UC-LOGIC Tablet WP5540U', we also need to 'select' ButtonPress for motion event,
 			 * otherwise we do not get any tablet motion event once pen is pressed... See T43367.
 			 */
 
 			if (xtablet.StylusDevice) {
 				DeviceMotionNotify(xtablet.StylusDevice, xtablet.MotionEvent, ev);
 				if (ev) xevents[dcount++] = ev;
-				DeviceButton1Motion(xtablet.StylusDevice, xtablet.MotionEvent, ev);
+				DeviceButtonPress(xtablet.StylusDevice, xtablet.PressEvent, ev);
 				if (ev) xevents[dcount++] = ev;
 				ProximityIn(xtablet.StylusDevice, xtablet.ProxInEvent, ev);
 				if (ev) xevents[dcount++] = ev;
@@ -589,13 +589,13 @@ void GHOST_WindowX11::initXInputDevices()
 				if (ev) xevents[dcount++] = ev;
 			}
 			if (xtablet.EraserDevice) {
-				DeviceMotionNotify(xtablet.EraserDevice, xtablet.MotionEvent, ev);
+				DeviceMotionNotify(xtablet.EraserDevice, xtablet.MotionEventEraser, ev);
 				if (ev) xevents[dcount++] = ev;
-				DeviceButton1Motion(xtablet.EraserDevice, xtablet.MotionEvent, ev);
+				DeviceButtonPress(xtablet.EraserDevice, xtablet.PressEventEraser, ev);
 				if (ev) xevents[dcount++] = ev;
-				ProximityIn(xtablet.EraserDevice, xtablet.ProxInEvent, ev);
+				ProximityIn(xtablet.EraserDevice, xtablet.ProxInEventEraser, ev);
 				if (ev) xevents[dcount++] = ev;
-				ProximityOut(xtablet.EraserDevice, xtablet.ProxOutEvent, ev);
+				ProximityOut(xtablet.EraserDevice, xtablet.ProxOutEventEraser, ev);
 				if (ev) xevents[dcount++] = ev;
 			}




More information about the Bf-blender-cvs mailing list