|
|
@@ -156,6 +156,7 @@ void la_ScanWacomDevices(Display *display, int deviceid){
|
|
|
XIDeviceInfo *info, *dev;
|
|
|
int ndevices;
|
|
|
int i; char * word;
|
|
|
+ int LikelyPen=-1,LikelyEraser=-1;
|
|
|
|
|
|
int _event, _error;
|
|
|
if (!XQueryExtension(MAIN.dpy, "XInputExtension", &MAIN.xi_opcode, &_event, &_error)) {
|
|
|
@@ -171,11 +172,30 @@ void la_ScanWacomDevices(Display *display, int deviceid){
|
|
|
word = strtok (dev->name," ");
|
|
|
while (1) {
|
|
|
word = strtok (NULL, " "); if (!word) break;
|
|
|
- if (strcmp("stylus", word) == 0){ if(LA_G_STYLUS(dev)) MAIN.WacomDeviceStylus = dev->deviceid; }// wacom
|
|
|
- elif (strcmp("eraser", word) == 0){ if(LA_G_ERASER) MAIN.WacomDeviceEraser = dev->deviceid; }// wacom
|
|
|
+ if (strstr("stylus", word)){ if(LA_G_STYLUS(dev)) MAIN.WacomDeviceStylus = dev->deviceid; }// wacom
|
|
|
+ elif (strstr("eraser", word)){ if(LA_G_ERASER) MAIN.WacomDeviceEraser = dev->deviceid; }// wacom
|
|
|
elif (is_ipts && strcmp("pen", word) == 0){ if(LA_G_STYLUS(dev)) MAIN.WacomDeviceStylus = dev->deviceid; }// surface ipts
|
|
|
elif (is_ipts && strcmp("eraser", word) == 0){ if(LA_G_ERASER) MAIN.WacomDeviceEraser = dev->deviceid; }// surface ipts
|
|
|
- elif (strcmp("pen", word) == 0){ if(LA_G_STYLUS(dev)) MAIN.WacomDeviceStylus = dev->deviceid; }// generic pen
|
|
|
+ elif (strstr("pen", word)){ if(LA_G_STYLUS(dev)) MAIN.WacomDeviceStylus = dev->deviceid; }// generic pen
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!MAIN.WacomDeviceStylus){
|
|
|
+ for(i = 0; i < ndevices; i++) {
|
|
|
+ dev = &info[i]; strToLower(dev->name);
|
|
|
+ if (strstr(dev->name, "stylus")){ if(LA_G_STYLUS(dev)) MAIN.WacomDeviceStylus = dev->deviceid; } // xwayland reports "stylus:10" etc
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!MAIN.WacomDeviceStylus){
|
|
|
+ for(i = 0; i < ndevices; i++) { dev = &info[i];
|
|
|
+ if(la_DeviceProbablyHasPressure(dev)){ MAIN.WacomDeviceStylus=dev->deviceid; break; } // generic stylus with unknown name
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!MAIN.WacomDeviceEraser){
|
|
|
+ if (strstr(dev->name, "eraser")){ if(LA_G_ERASER) MAIN.WacomDeviceEraser = dev->deviceid; } // xwayland reports "eraser:10" etc
|
|
|
+ }
|
|
|
+ if(!MAIN.WacomDeviceEraser){
|
|
|
+ for(i = 0; i < ndevices; i++) { dev = &info[i]; if(MAIN.WacomDeviceStylus == dev->deviceid) continue;
|
|
|
+ if(la_DeviceProbablyHasPressure(dev)){ MAIN.WacomDeviceStylus=dev->deviceid; break; } // generic eraser with unknown name
|
|
|
}
|
|
|
}
|
|
|
if(MAIN.WacomDeviceStylus || MAIN.WacomDeviceEraser){
|