mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
libinput backend: fill in handle_device_removed
And fix input_remove_notify accordingly
This commit is contained in:
parent
65a8999242
commit
be3a0ad065
2 changed files with 17 additions and 5 deletions
|
@ -111,8 +111,21 @@ static void handle_device_added(struct wlr_backend_state *state,
|
||||||
|
|
||||||
static void handle_device_removed(struct wlr_backend_state *state,
|
static void handle_device_removed(struct wlr_backend_state *state,
|
||||||
struct libinput_device *device) {
|
struct libinput_device *device) {
|
||||||
wlr_log(L_DEBUG, "libinput device removed");
|
list_t *devices = libinput_device_get_user_data(device);
|
||||||
// TODO
|
for (size_t i = 0; i < devices->length; i++) {
|
||||||
|
struct wlr_input_device *wlr_device = devices->items[i];
|
||||||
|
wlr_log(L_DEBUG, "Removing %s [%d:%d]", wlr_device->name,
|
||||||
|
wlr_device->vendor, wlr_device->product);
|
||||||
|
wl_signal_emit(&state->backend->events.input_remove, wlr_device);
|
||||||
|
wlr_input_device_destroy(wlr_device);
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < state->devices->length; i++) {
|
||||||
|
if (state->devices->items[i] == devices) {
|
||||||
|
list_del(state->devices, i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list_free(devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_libinput_event(struct wlr_backend_state *state,
|
void wlr_libinput_event(struct wlr_backend_state *state,
|
||||||
|
|
|
@ -384,14 +384,13 @@ static void tablet_pad_remove(struct wlr_input_device *device, struct compositor
|
||||||
if (!pstate) {
|
if (!pstate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO probably missing more actions
|
wl_list_remove(&pstate->button.link);
|
||||||
free(pstate);
|
free(pstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO missing something that calls this on teardown
|
|
||||||
static void input_remove_notify(struct wl_listener *listener, void *data) {
|
static void input_remove_notify(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_input_device *device = data;
|
struct wlr_input_device *device = data;
|
||||||
struct compositor_state *state = wl_container_of(listener, state, input_add);
|
struct compositor_state *state = wl_container_of(listener, state, input_remove);
|
||||||
switch (device->type) {
|
switch (device->type) {
|
||||||
case WLR_INPUT_DEVICE_KEYBOARD:
|
case WLR_INPUT_DEVICE_KEYBOARD:
|
||||||
keyboard_remove(device, state);
|
keyboard_remove(device, state);
|
||||||
|
|
Loading…
Reference in a new issue