diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-18 15:25:30 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-18 15:25:30 +0400 |
commit | 242a800d34deac554713bb8a77de181713b39bb9 (patch) | |
tree | 1c1132dd08424bceee393d2e447474a91dd419d1 /intern/ghost | |
parent | 9ba8f57d586a55352d4f5d922158187384248220 (diff) |
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.
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index de0cf641c2d..4bf4edaf092 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -422,6 +422,15 @@ processEvents( 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 @@ GHOST_SystemX11::processEvent(XEvent *xe) 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 @@ GHOST_SystemX11::processEvent(XEvent *xe) 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; |