| 29 | } |
| 30 | |
| 31 | struct kiwmi_pointer * |
| 32 | pointer_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 | |
| 60 | void |
| 61 | pointer_destroy(struct kiwmi_pointer *pointer) |