Modified handling of raw mouse IDs

This commit is contained in:
Josh Yelon 2007-04-04 18:20:42 +00:00
parent cd85248a06
commit cc60fad2a5
2 changed files with 19 additions and 2 deletions

View File

@ -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();

View File

@ -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);