Using device name instead of ID for touchpad
* UDEV registers touch pad (e.g., Synaptic) with different IDs on reboots. Instead of hard-coding product/device IDs in config.h, use a string that appears in device name to identify it
This commit is contained in:
38
dwl.c
38
dwl.c
@@ -1051,18 +1051,20 @@ createpointer(struct wlr_pointer *pointer)
|
||||
libinput_device_config_click_set_method (device, click_method);
|
||||
|
||||
if (libinput_device_config_send_events_get_modes(device)) {
|
||||
if ((cfg_disable_touch_pad)
|
||||
&& ((libinput_device_get_id_vendor(device) == touch_device_vendor_id)
|
||||
&& (libinput_device_get_id_product(device) == touch_device_product_id))) {
|
||||
libinput_device_config_send_events_set_mode(device, LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
|
||||
touch_input_device = device;
|
||||
fprintf(stderr,"DWL::createpointer - Disable set to %d events for device %s (%d:%d) == %d:%d\n",
|
||||
cfg_disable_touch_pad,
|
||||
libinput_device_get_name(touch_input_device),
|
||||
libinput_device_get_id_vendor(touch_input_device),
|
||||
libinput_device_get_id_product(touch_input_device), touch_device_vendor_id, touch_device_product_id);
|
||||
} else {
|
||||
libinput_device_config_send_events_set_mode(device, send_events_mode);
|
||||
const char *dev_name = libinput_device_get_name(device);
|
||||
if (strstr(dev_name, cfg_touchpad_device_str)) {
|
||||
fprintf(stderr,"DWL::createpointer - %s device %s (%d:%d). Disable=%d\n",
|
||||
cfg_touchpad_device_str,
|
||||
libinput_device_get_name(device),
|
||||
libinput_device_get_id_vendor(device),
|
||||
libinput_device_get_id_product(device),
|
||||
cfg_disable_touchpad);
|
||||
touch_input_device = device; // Capture touchpad device
|
||||
if (cfg_disable_touchpad) {
|
||||
libinput_device_config_send_events_set_mode(device, LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
|
||||
} else {
|
||||
libinput_device_config_send_events_set_mode(device, send_events_mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2857,18 +2859,18 @@ tile(Monitor *m)
|
||||
|
||||
void
|
||||
toggle_touch_input_device(const Arg *arg) {
|
||||
if (cfg_disable_touch_pad) {
|
||||
if (cfg_disable_touchpad) {
|
||||
libinput_device_config_send_events_set_mode(touch_input_device, send_events_mode);
|
||||
cfg_disable_touch_pad = 0;
|
||||
cfg_disable_touchpad = 0;
|
||||
} else {
|
||||
libinput_device_config_send_events_set_mode(touch_input_device, LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
|
||||
cfg_disable_touch_pad = 1;
|
||||
cfg_disable_touchpad = 1;
|
||||
}
|
||||
fprintf(stderr,"DWL::toggle_touch_input_device - Disable set to %d events for device %s (%d:%d) == %d:%d\n",
|
||||
cfg_disable_touch_pad,
|
||||
fprintf(stderr,"DWL::toggle_touch_input_device - Disable set to %d events for device %s (%d:%d)\n",
|
||||
cfg_disable_touchpad,
|
||||
libinput_device_get_name(touch_input_device),
|
||||
libinput_device_get_id_vendor(touch_input_device),
|
||||
libinput_device_get_id_product(touch_input_device), touch_device_vendor_id, touch_device_product_id);
|
||||
libinput_device_get_id_product(touch_input_device));
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user