diff options
author | Matt Ebb <matt@mke3.net> | 2006-08-03 20:10:16 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2006-08-03 20:10:16 +0400 |
commit | 8899116fc2033abbe85d4d97d9dae97b92092b94 (patch) | |
tree | 4dc6e829b5d5745a7282265e943f88a85f195a48 /intern | |
parent | 8dbefad45100a08ce2c94d07830abb1b1c075199 (diff) |
* Added tablet tilt data collection for X11
Diffstat (limited to 'intern')
-rwxr-xr-x | intern/ghost/intern/GHOST_SystemX11.cpp | 7 | ||||
-rwxr-xr-x | intern/ghost/intern/GHOST_WindowX11.cpp | 5 | ||||
-rwxr-xr-x | intern/ghost/intern/GHOST_WindowX11.h | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 68bdd1a09a3..9b5c2d12149 100755 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -511,6 +511,11 @@ processEvent( if(xe->type == window->GetXTablet().MotionEvent) { XDeviceMotionEvent* data = (XDeviceMotionEvent*)xe; window->GetXTablet().CommonData.Pressure= data->axis_data[2]/((float)window->GetXTablet().PressureLevels); + + /* the (short) cast and the &0xffff is bizarre and unexplained anywhere, + * but I got garbage data without it. Found it in the xidump.c source --matt */ + window->GetXTablet().CommonData.Xtilt= (short)(data->axis_data[3]&0xffff)/((float)window->GetXTablet().XtiltLevels); + window->GetXTablet().CommonData.Ytilt= (short)(data->axis_data[4]&0xffff)/((float)window->GetXTablet().YtiltLevels); } else if(xe->type == window->GetXTablet().ProxInEvent) { XProximityNotifyEvent* data = (XProximityNotifyEvent*)xe; @@ -868,5 +873,3 @@ convertXKey( } #undef GXMAP - - diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 87798b02ff4..4db2764f0e5 100755 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -230,6 +230,11 @@ void GHOST_WindowX11::initXInputDevices() if(ici->c_class==ValuatorClass) { XValuatorInfo* xvi = (XValuatorInfo*)ici; m_xtablet.PressureLevels = xvi->axes[2].max_value; + + /* this is assuming that the tablet has the same tilt resolution in both + * positive and negative directions. It would be rather weird if it didn't.. */ + m_xtablet.XtiltLevels = xvi->axes[3].max_value; + m_xtablet.YtiltLevels = xvi->axes[4].max_value; break; } diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h index 863644da095..0de4f65acd1 100755 --- a/intern/ghost/intern/GHOST_WindowX11.h +++ b/intern/ghost/intern/GHOST_WindowX11.h @@ -205,6 +205,7 @@ public: int ProxOutEvent; int PressureLevels; + int XtiltLevels, YtiltLevels; }; XTablet& GetXTablet() @@ -331,4 +332,3 @@ private : #endif // _GHOST_WINDOWX11_H_ - |