diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-08-17 23:54:29 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2009-08-17 23:54:29 +0400 |
commit | 912c48442cf661bbc06ef37dd38f52a86eb7d036 (patch) | |
tree | fd240e64db073bd07b67983db8d81cfe19df234f /intern | |
parent | 55b6230464a140c62ec4cea4e11a4a05c8910d13 (diff) |
2.5/Ghost:
* Hopefully fixed X tablet support. The name string was not a reliable way of finding tablet anymore, so now we get the type string and search it for 'stylus' and 'eraser'. Still not very robust, but without UI I don't see how to do better.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowX11.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index f9774b6df70..88ae8afd0ce 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. @@ -428,7 +431,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); @@ -453,7 +469,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; |