MCPcopy Create free account
hub / github.com/buffet/kiwmi / pointer_create

Function pointer_create

kiwmi/input/pointer.c:31–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31struct kiwmi_pointer *
32pointer_create(struct kiwmi_server *server, struct wlr_input_device *device)
33{
34 wlr_cursor_attach_input_device(server->input.cursor->cursor, device);
35
36 struct kiwmi_pointer *pointer = malloc(sizeof(*pointer));
37 if (!pointer) {
38 return NULL;
39 }
40
41 pointer->device = device;
42
43 pointer->device_destroy.notify = pointer_destroy_notify;
44 wl_signal_add(&device->events.destroy, &pointer->device_destroy);
45
46 if (device->output_name) {
47 struct kiwmi_output *output;
48 wl_list_for_each (output, &server->desktop.outputs, link) {
49 if (strcmp(device->output_name, output->wlr_output->name) == 0) {
50 wlr_cursor_map_input_to_output(
51 server->input.cursor->cursor, device, output->wlr_output);
52 break;
53 }
54 }
55 }
56
57 return pointer;
58}
59
60void
61pointer_destroy(struct kiwmi_pointer *pointer)

Callers 1

new_pointerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected