*/}}
瀏覽代碼

Better adaptation on surface pen identification

YimingWu 1 年之前
父節點
當前提交
b72ffb968c
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      la_kernel.c

+ 3 - 3
la_kernel.c

@@ -107,14 +107,14 @@ void la_ScanWacomDevices(Display *display, int deviceid){
     info = XIQueryDevice(display, deviceid, &ndevices);
     for(i = 0; i < ndevices; i++) {
         dev = &info[i];
-        printf("%s\n",dev->name);
+        int is_ipts=0; if(strstr(dev->name, "ipts")){ is_ipts=1; }
         word = strtok (dev->name," ");
         while (1) {
             word = strtok (NULL, " "); if (!word) break;
             if (strcmp("stylus", word) == 0) MAIN.WacomDeviceStylus = dev->deviceid; // wacom
             elif (strcmp("eraser", word) == 0) MAIN.WacomDeviceEraser = dev->deviceid; // wacom
-            elif (strcmp("Pen", word) == 0) MAIN.WacomDeviceStylus = dev->deviceid; // surface ipts
-            elif (strcmp("Eraser", word) == 0) MAIN.WacomDeviceEraser = dev->deviceid; // surface ipts
+            elif (is_ipts && strcmp("Pen", word) == 0) MAIN.WacomDeviceStylus = dev->deviceid; // surface ipts
+            elif (is_ipts && strcmp("Eraser", word) == 0) MAIN.WacomDeviceEraser = dev->deviceid; // surface ipts
         }
     }
     if(MAIN.WacomDeviceStylus || MAIN.WacomDeviceEraser){