diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-09-17 20:17:32 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-09-17 20:17:32 +0400 |
commit | 77446c59e991d25493148c7ea56199025248922c (patch) | |
tree | 57fc1101680d16c427b32ad70e38f2ba2bb73e7a /intern | |
parent | 064569c52eeeabaaef617c44e13df11026f37a2d (diff) |
backport Nicholas Bishop's 2.5 commit from r22581, stylus fails on ubuntu 9.10 without this.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowX11.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 5a1f3bf1e21..0457cbcaecb 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -42,6 +42,9 @@ #include <cstring> #include <cstdio> +#include <algorithm> +#include <string> + // For obscure full screen mode stuuf // lifted verbatim from blut. @@ -441,7 +444,20 @@ void GHOST_WindowX11::initXInputDevices() old_handler = XSetErrorHandler(ApplicationErrorHandler) ; for(int i=0; i<device_count; ++i) { - if(!strcasecmp(device_info[i].name, "stylus")) { + std::string type = ""; + + if(device_info[i].type) { + const char *orig = XGetAtomName(m_display, device_info[i].type); + // Make a copy so we can convert to lower case + if(orig) { + type = orig; + XFree((void*)orig); + std::transform(type.begin(), type.end(), type.begin(), ::tolower); + } + } + + + if(type.find("stylus") != std::string::npos) { m_xtablet.StylusID= device_info[i].id; m_xtablet.StylusDevice = XOpenDevice(m_display, m_xtablet.StylusID); @@ -466,7 +482,7 @@ void GHOST_WindowX11::initXInputDevices() m_xtablet.StylusID= 0; } } - if(!strcasecmp(device_info[i].name, "eraser")) { + if(type.find("eraser") != std::string::npos) { m_xtablet.EraserID= device_info[i].id; m_xtablet.EraserDevice = XOpenDevice(m_display, m_xtablet.EraserID); if (m_xtablet.EraserDevice == NULL) m_xtablet.EraserID= 0; @@ -622,7 +638,7 @@ screenToClient( GHOST_TInt32& outX, GHOST_TInt32& outY ) const { - // not sure about this one! + // This is correct! int ax,ay; Window temp; |