types/wlr_switch: add base wlr_input_device

wlr_switch owns its wlr_input_device. It will be initialized when the
switch is initialized, and finished when the switch is destroyed.
This commit is contained in:
Simon Zeni 2022-01-31 10:53:58 -05:00 committed by Kirill Primak
parent d5480efc7a
commit 0f3b38365d
4 changed files with 15 additions and 4 deletions

View file

@ -16,8 +16,11 @@ struct wlr_switch *create_libinput_switch(
wlr_log(WLR_ERROR, "Unable to allocate wlr_switch");
return NULL;
}
wlr_switch_init(wlr_switch, NULL);
wlr_log(WLR_DEBUG, "Created switch for device %s", libinput_device_get_name(libinput_dev));
const char *name = libinput_device_get_name(libinput_dev);
wlr_switch_init(wlr_switch, NULL, name);
wlr_log(WLR_DEBUG, "Created switch for device %s", name);
wlr_switch->base.vendor = libinput_device_get_id_vendor(libinput_dev);
wlr_switch->base.product = libinput_device_get_id_product(libinput_dev);
return wlr_switch;
}