From cc60fad2a596c03dac5f1aa9c01a56a9ef60c351 Mon Sep 17 00:00:00 2001 From: Josh Yelon Date: Wed, 4 Apr 2007 18:20:42 +0000 Subject: [PATCH] Modified handling of raw mouse IDs --- panda/src/glxdisplay/glxGraphicsWindow.cxx | 12 +++++++++++- panda/src/windisplay/winGraphicsWindow.cxx | 9 ++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/panda/src/glxdisplay/glxGraphicsWindow.cxx b/panda/src/glxdisplay/glxGraphicsWindow.cxx index b2403aae10..408f82ee44 100644 --- a/panda/src/glxdisplay/glxGraphicsWindow.cxx +++ b/panda/src/glxdisplay/glxGraphicsWindow.cxx @@ -1063,7 +1063,17 @@ open_raw_mice() "Opening raw mice: ioctl failed on " << fn << "\n"; } else { 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; inf._fd = fd; inf._input_device_index = _input_devices.size(); diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index 2a0b29147c..064748ec23 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -537,7 +537,14 @@ initialize_input_devices() { if (strncmp(psName,"\\??\\",4)==0) psName += 4; char *pound1 = strchr(psName,'#'); 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; GraphicsWindowInputDevice device = GraphicsWindowInputDevice::pointer_only(psName); device.set_pointer_in_window(0,0);