fix: configure error device when createdevice
This commit is contained in:
22
src/mango.c
22
src/mango.c
@@ -2780,22 +2780,24 @@ void configure_pointer(struct libinput_device *device) {
|
||||
}
|
||||
|
||||
void createpointer(struct wlr_pointer *pointer) {
|
||||
struct libinput_device *device =
|
||||
wlr_libinput_get_device_handle(&pointer->base);
|
||||
|
||||
if (device && wlr_input_device_is_libinput(&pointer->base)) {
|
||||
struct libinput_device *device = NULL;
|
||||
|
||||
if (wlr_input_device_is_libinput(&pointer->base) &&
|
||||
(device = wlr_libinput_get_device_handle(&pointer->base))) {
|
||||
|
||||
configure_pointer(device);
|
||||
}
|
||||
|
||||
InputDevice *input_dev = calloc(1, sizeof(InputDevice));
|
||||
input_dev->wlr_device = &pointer->base;
|
||||
input_dev->libinput_device = device;
|
||||
|
||||
input_dev->destroy_listener.notify = destroyinputdevice;
|
||||
wl_signal_add(&pointer->base.events.destroy, &input_dev->destroy_listener);
|
||||
wl_signal_add(&pointer->base.events.destroy,
|
||||
&input_dev->destroy_listener);
|
||||
|
||||
wl_list_insert(&inputdevices, &input_dev->link);
|
||||
|
||||
}
|
||||
wlr_cursor_attach_input_device(cursor, &pointer->base);
|
||||
}
|
||||
|
||||
@@ -2820,8 +2822,11 @@ void switch_toggle(struct wl_listener *listener, void *data) {
|
||||
}
|
||||
|
||||
void createswitch(struct wlr_switch *switch_device) {
|
||||
struct libinput_device *device =
|
||||
wlr_libinput_get_device_handle(&switch_device->base);
|
||||
|
||||
struct libinput_device *device = NULL;
|
||||
|
||||
if (wlr_input_device_is_libinput(&switch_device->base) &&
|
||||
(device = wlr_libinput_get_device_handle(&switch_device->base))) {
|
||||
|
||||
InputDevice *input_dev = calloc(1, sizeof(InputDevice));
|
||||
input_dev->wlr_device = &switch_device->base;
|
||||
@@ -2847,6 +2852,7 @@ void createswitch(struct wlr_switch *switch_device) {
|
||||
// 添加到全局列表
|
||||
wl_list_insert(&inputdevices, &input_dev->link);
|
||||
}
|
||||
}
|
||||
|
||||
void createpointerconstraint(struct wl_listener *listener, void *data) {
|
||||
PointerConstraint *pointer_constraint =
|
||||
|
||||
Reference in New Issue
Block a user