Skip to content

Commit

Permalink
tools: don't apply config options on device removed
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  • Loading branch information
whot committed Dec 19, 2018
1 parent c32bd79 commit 96a0e8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 3 additions & 1 deletion tools/libinput-debug-events.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions tools/libinput-debug-gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit 96a0e8e

Please sign in to comment.