Revision: 23310
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23310
Author:   campbellbarton
Date:     2009-09-17 18:17:32 +0200 (Thu, 17 Sep 2009)

Log Message:
-----------
backport Nicholas Bishop's 2.5 commit from r22581, stylus fails on ubuntu 9.10 
without this.

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

Modified: branches/blender2.4/intern/ghost/intern/GHOST_WindowX11.cpp
===================================================================
--- branches/blender2.4/intern/ghost/intern/GHOST_WindowX11.cpp 2009-09-17 
15:35:25 UTC (rev 23309)
+++ branches/blender2.4/intern/ghost/intern/GHOST_WindowX11.cpp 2009-09-17 
16:17:32 UTC (rev 23310)
@@ -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 @@
                        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 @@
                                                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 @@
        GHOST_TInt32& outX,
        GHOST_TInt32& outY
 ) const {
-       // not sure about this one!
+       // This is correct!
 
        int ax,ay;
        Window temp;


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to