[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43489] trunk/blender/intern/ghost/intern/ GHOST_SystemX11.cpp: Fix #25581: No pressure sensitivity in sculpt mode

Sergey Sharybin sergey.vfx at gmail.com
Wed Jan 18 12:25:34 CET 2012


Revision: 43489
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43489
Author:   nazgul
Date:     2012-01-18 11:25:30 +0000 (Wed, 18 Jan 2012)
Log Message:
-----------
Fix #25581: No pressure sensitivity in sculpt mode

Tablet mode (stylus/eraser) wasn't properly set when pen was already hovering over
tablet surface when opening blender (i.e. in cases when blender was opened using
stylus tap).

Issue resolved by setting tablet mode when handling tablet's motion event too.

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp	2012-01-18 11:10:02 UTC (rev 43488)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp	2012-01-18 11:25:30 UTC (rev 43489)
@@ -422,6 +422,15 @@
 	return anyProcessed;
 }
 
+/* set currently using tablet mode (stylus or eraser) depending on device ID */
+static void setTabletMode(GHOST_WindowX11 * window, XID deviceid)
+{
+	if(deviceid == window->GetXTablet().StylusID)
+		window->GetXTablet().CommonData.Active= GHOST_kTabletModeStylus;
+	else if(deviceid == window->GetXTablet().EraserID)
+		window->GetXTablet().CommonData.Active= GHOST_kTabletModeEraser;
+}
+
 	void
 GHOST_SystemX11::processEvent(XEvent *xe)
 {
@@ -824,6 +833,12 @@
 			if(xe->type == window->GetXTablet().MotionEvent) 
 			{
 				XDeviceMotionEvent* data = (XDeviceMotionEvent*)xe;
+
+				/* stroke might begin without leading ProxyIn event,
+				 * this happens when window is opened when stylus is already hovering
+				 * around tablet surface */
+				setTabletMode(window, data->deviceid);
+
 				window->GetXTablet().CommonData.Pressure= 
 					data->axis_data[2]/((float)window->GetXTablet().PressureLevels);
 			
@@ -837,10 +852,8 @@
 			else if(xe->type == window->GetXTablet().ProxInEvent) 
 			{
 				XProximityNotifyEvent* data = (XProximityNotifyEvent*)xe;
-				if(data->deviceid == window->GetXTablet().StylusID)
-					window->GetXTablet().CommonData.Active= GHOST_kTabletModeStylus;
-				else if(data->deviceid == window->GetXTablet().EraserID)
-					window->GetXTablet().CommonData.Active= GHOST_kTabletModeEraser;
+
+				setTabletMode(window, data->deviceid);
 			}
 			else if(xe->type == window->GetXTablet().ProxOutEvent)
 				window->GetXTablet().CommonData.Active= GHOST_kTabletModeNone;



More information about the Bf-blender-cvs mailing list