[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22581] branches/blender2.5/blender/intern /ghost/intern/GHOST_WindowX11.cpp: 2.5/Ghost:

Nicholas Bishop nicholasbishop at gmail.com
Mon Aug 17 21:54:29 CEST 2009


Revision: 22581
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22581
Author:   nicholasbishop
Date:     2009-08-17 21:54:29 +0200 (Mon, 17 Aug 2009)

Log Message:
-----------
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.

Modified Paths:
--------------
    branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowX11.cpp

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowX11.cpp
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowX11.cpp	2009-08-17 19:13:03 UTC (rev 22580)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowX11.cpp	2009-08-17 19:54:29 UTC (rev 22581)
@@ -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 @@
 			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 @@
  						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;





More information about the Bf-blender-cvs mailing list