Bläddra i källkod

Modified handling of raw mouse IDs

Josh Yelon 18 år sedan
förälder
incheckning
cc60fad2a5

+ 11 - 1
panda/src/glxdisplay/glxGraphicsWindow.cxx

@@ -1063,7 +1063,17 @@ open_raw_mice()
 	  "Opening raw mice: ioctl failed on " << fn << "\n";
 	  "Opening raw mice: ioctl failed on " << fn << "\n";
       } else {
       } else {
 	if (test_bit(EV_REL, evtypes) || test_bit(EV_ABS, evtypes)) {
 	if (test_bit(EV_REL, evtypes) || test_bit(EV_ABS, evtypes)) {
-	  string full_id = ((string)name) + " " + uniq;
+          for (char *p=name; *p; p++) {
+            if (((*p<'a')||(*p>'z')) && ((*p<'A')||(*p>'Z')) && ((*p<'0')||(*p>'9'))) {
+              *p = '_';
+            }
+          }
+          for (char *p=uniq; *p; p++) {
+            if (((*p<'a')||(*p>'z')) && ((*p<'A')||(*p>'Z')) && ((*p<'0')||(*p>'9'))) {
+              *p = '_';
+            }
+          }
+	  string full_id = ((string)name) + "." + uniq;
 	  MouseDeviceInfo inf;
 	  MouseDeviceInfo inf;
 	  inf._fd = fd;
 	  inf._fd = fd;
 	  inf._input_device_index = _input_devices.size();
 	  inf._input_device_index = _input_devices.size();

+ 8 - 1
panda/src/windisplay/winGraphicsWindow.cxx

@@ -537,7 +537,14 @@ initialize_input_devices() {
           if (strncmp(psName,"\\??\\",4)==0) psName += 4;
           if (strncmp(psName,"\\??\\",4)==0) psName += 4;
           char *pound1 = strchr(psName,'#');
           char *pound1 = strchr(psName,'#');
           char *pound2 = pound1 ? strchr(pound1+1,'#') : 0;
           char *pound2 = pound1 ? strchr(pound1+1,'#') : 0;
-          if (pound2) *pound2 = 0;
+          char *pound3 = pound2 ? strchr(pound2+1,'#') : 0;
+          if (pound3) *pound3 = 0;
+          for (char *p = psName; *p; p++) {
+            if (((*p<'a')||(*p>'z')) && ((*p<'A')||(*p>'Z')) && ((*p<'0')||(*p>'9'))) {
+              *p = '_';
+            }
+          }
+          if (pound2) *pound2 = '.';
           _input_device_handle[_input_devices.size()] = pRawInputDeviceList[i].hDevice;
           _input_device_handle[_input_devices.size()] = pRawInputDeviceList[i].hDevice;
           GraphicsWindowInputDevice device = GraphicsWindowInputDevice::pointer_only(psName);
           GraphicsWindowInputDevice device = GraphicsWindowInputDevice::pointer_only(psName);
           device.set_pointer_in_window(0,0);
           device.set_pointer_in_window(0,0);