tools: don't apply config options on device removed

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2018-11-29 09:15:52 +10:00
parent c32bd79af5
commit 96a0e8ed66
2 changed files with 5 additions and 4 deletions

View file

@ -782,11 +782,13 @@ handle_and_print_events(struct libinput *li)
case LIBINPUT_EVENT_NONE:
abort();
case LIBINPUT_EVENT_DEVICE_ADDED:
case LIBINPUT_EVENT_DEVICE_REMOVED:
print_device_notify(ev);
tools_device_apply_config(libinput_event_get_device(ev),
&options);
break;
case LIBINPUT_EVENT_DEVICE_REMOVED:
print_device_notify(ev);
break;
case LIBINPUT_EVENT_KEYBOARD_KEY:
print_key_event(li, ev);
break;

View file

@ -820,6 +820,8 @@ handle_event_device_notify(struct libinput_event *ev)
if (libinput_event_get_type(ev) == LIBINPUT_EVENT_DEVICE_ADDED) {
type = "added";
register_evdev_device(w, dev);
tools_device_apply_config(libinput_event_get_device(ev),
&w->options);
} else {
type = "removed";
unregister_evdev_device(w, dev);
@ -830,9 +832,6 @@ handle_event_device_notify(struct libinput_event *ev)
libinput_device_get_name(dev),
type);
tools_device_apply_config(libinput_event_get_device(ev),
&w->options);
if (libinput_event_get_type(ev) == LIBINPUT_EVENT_DEVICE_ADDED) {
for (i = 0; i < ARRAY_LENGTH(w->devices); i++) {
if (w->devices[i] == NULL) {