evdev: plug a potential memleak
[platform/upstream/libinput.git] / src / evdev.c
1 /*
2  * Copyright © 2010 Intel Corporation
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and
5  * its documentation for any purpose is hereby granted without fee, provided
6  * that the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation, and that the name of the copyright holders not be used in
9  * advertising or publicity pertaining to distribution of the software
10  * without specific, written prior permission.  The copyright holders make
11  * no representations about the suitability of this software for any
12  * purpose.  It is provided "as is" without express or implied warranty.
13  *
14  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
15  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
16  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
17  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
18  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
19  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  */
22
23 #include "config.h"
24
25 #include <stdlib.h>
26 #include <string.h>
27 #include <linux/input.h>
28 #include <unistd.h>
29 #include <fcntl.h>
30 #include <mtdev.h>
31
32 #include "compositor.h"
33 #include "evdev.h"
34
35 #define DEFAULT_AXIS_STEP_DISTANCE wl_fixed_from_int(10)
36
37 void
38 evdev_led_update(struct evdev_device *device, enum weston_led leds)
39 {
40         static const struct {
41                 enum weston_led weston;
42                 int evdev;
43         } map[] = {
44                 { LED_NUM_LOCK, LED_NUML },
45                 { LED_CAPS_LOCK, LED_CAPSL },
46                 { LED_SCROLL_LOCK, LED_SCROLLL },
47         };
48         struct input_event ev[ARRAY_LENGTH(map)];
49         unsigned int i;
50
51         if (!device->caps & EVDEV_KEYBOARD)
52                 return;
53
54         memset(ev, 0, sizeof(ev));
55         for (i = 0; i < ARRAY_LENGTH(map); i++) {
56                 ev[i].type = EV_LED;
57                 ev[i].code = map[i].evdev;
58                 ev[i].value = !!(leds & map[i].weston);
59         }
60
61         i = write(device->fd, ev, sizeof ev);
62         (void)i; /* no, we really don't care about the return value */
63 }
64
65 static inline void
66 evdev_process_key(struct evdev_device *device, struct input_event *e, int time)
67 {
68         /* ignore kernel key repeat */
69         if (e->value == 2)
70                 return;
71
72         switch (e->code) {
73         case BTN_LEFT:
74         case BTN_RIGHT:
75         case BTN_MIDDLE:
76         case BTN_SIDE:
77         case BTN_EXTRA:
78         case BTN_FORWARD:
79         case BTN_BACK:
80         case BTN_TASK:
81                 notify_button(device->seat,
82                               time, e->code,
83                               e->value ? WL_POINTER_BUTTON_STATE_PRESSED :
84                                          WL_POINTER_BUTTON_STATE_RELEASED);
85                 break;
86
87         case BTN_TOUCH:
88                 if (e->value == 0 && !device->is_mt)
89                         notify_touch(device->seat, time, device->mt.slot, 0, 0,
90                                      WL_TOUCH_UP);
91                 break;
92         default:
93                 notify_key(device->seat,
94                            time, e->code,
95                            e->value ? WL_KEYBOARD_KEY_STATE_PRESSED :
96                                       WL_KEYBOARD_KEY_STATE_RELEASED,
97                            STATE_UPDATE_AUTOMATIC);
98                 break;
99         }
100 }
101
102 static void
103 evdev_process_touch(struct evdev_device *device, struct input_event *e)
104 {
105         const int screen_width = device->output->current->width;
106         const int screen_height = device->output->current->height;
107
108         switch (e->code) {
109         case ABS_MT_SLOT:
110                 device->mt.slot = e->value;
111                 break;
112         case ABS_MT_TRACKING_ID:
113                 if (e->value >= 0)
114                         device->pending_events |= EVDEV_ABSOLUTE_MT_DOWN;
115                 else
116                         device->pending_events |= EVDEV_ABSOLUTE_MT_UP;
117                 break;
118         case ABS_MT_POSITION_X:
119                 device->mt.x[device->mt.slot] =
120                         (e->value - device->abs.min_x) * screen_width /
121                         (device->abs.max_x - device->abs.min_x);
122                 device->pending_events |= EVDEV_ABSOLUTE_MT_MOTION;
123                 break;
124         case ABS_MT_POSITION_Y:
125                 device->mt.y[device->mt.slot] =
126                         (e->value - device->abs.min_y) * screen_height /
127                         (device->abs.max_y - device->abs.min_y);
128                 device->pending_events |= EVDEV_ABSOLUTE_MT_MOTION;
129                 break;
130         }
131 }
132
133 static inline void
134 evdev_process_absolute_motion(struct evdev_device *device,
135                               struct input_event *e)
136 {
137         const int screen_width = device->output->current->width;
138         const int screen_height = device->output->current->height;
139
140         switch (e->code) {
141         case ABS_X:
142                 device->abs.x =
143                         (e->value - device->abs.min_x) * screen_width /
144                         (device->abs.max_x - device->abs.min_x);
145                 device->pending_events |= EVDEV_ABSOLUTE_MOTION;
146                 break;
147         case ABS_Y:
148                 device->abs.y =
149                         (e->value - device->abs.min_y) * screen_height /
150                         (device->abs.max_y - device->abs.min_y);
151                 device->pending_events |= EVDEV_ABSOLUTE_MOTION;
152                 break;
153         }
154 }
155
156 static inline void
157 evdev_process_relative(struct evdev_device *device,
158                        struct input_event *e, uint32_t time)
159 {
160         switch (e->code) {
161         case REL_X:
162                 device->rel.dx += wl_fixed_from_int(e->value);
163                 device->pending_events |= EVDEV_RELATIVE_MOTION;
164                 break;
165         case REL_Y:
166                 device->rel.dy += wl_fixed_from_int(e->value);
167                 device->pending_events |= EVDEV_RELATIVE_MOTION;
168                 break;
169         case REL_WHEEL:
170                 switch (e->value) {
171                 case -1:
172                         /* Scroll down */
173                 case 1:
174                         /* Scroll up */
175                         notify_axis(device->seat,
176                                     time,
177                                     WL_POINTER_AXIS_VERTICAL_SCROLL,
178                                     -1 * e->value * DEFAULT_AXIS_STEP_DISTANCE);
179                         break;
180                 default:
181                         break;
182                 }
183                 break;
184         case REL_HWHEEL:
185                 switch (e->value) {
186                 case -1:
187                         /* Scroll left */
188                 case 1:
189                         /* Scroll right */
190                         notify_axis(device->seat,
191                                     time,
192                                     WL_POINTER_AXIS_HORIZONTAL_SCROLL,
193                                     e->value * DEFAULT_AXIS_STEP_DISTANCE);
194                         break;
195                 default:
196                         break;
197
198                 }
199         }
200 }
201
202 static inline void
203 evdev_process_absolute(struct evdev_device *device, struct input_event *e)
204 {
205         if (device->is_mt) {
206                 evdev_process_touch(device, e);
207         } else {
208                 evdev_process_absolute_motion(device, e);
209         }
210 }
211
212 static int
213 is_motion_event(struct input_event *e)
214 {
215         switch (e->type) {
216         case EV_REL:
217                 switch (e->code) {
218                 case REL_X:
219                 case REL_Y:
220                         return 1;
221                 }
222                 break;
223         case EV_ABS:
224                 switch (e->code) {
225                 case ABS_X:
226                 case ABS_Y:
227                 case ABS_MT_POSITION_X:
228                 case ABS_MT_POSITION_Y:
229                         return 1;
230                 }
231         }
232
233         return 0;
234 }
235
236 static void
237 transform_absolute(struct evdev_device *device)
238 {
239         int32_t x, y;
240
241         if (!device->abs.apply_calibration)
242                 return;
243
244         x = device->abs.x * device->abs.calibration[0] +
245                 device->abs.y * device->abs.calibration[1] +
246                 device->abs.calibration[2];
247
248         y = device->abs.x * device->abs.calibration[3] +
249                 device->abs.y * device->abs.calibration[4] +
250                 device->abs.calibration[5];
251
252         device->abs.x = x;
253         device->abs.y = y;
254 }
255
256 static void
257 evdev_flush_motion(struct evdev_device *device, uint32_t time)
258 {
259         struct weston_seat *master = device->seat;
260         wl_fixed_t x, y;
261         int slot;
262
263         if (!(device->pending_events & EVDEV_SYN))
264                 return;
265
266         slot = device->mt.slot;
267         device->pending_events &= ~EVDEV_SYN;
268         if (device->pending_events & EVDEV_RELATIVE_MOTION) {
269                 notify_motion(master, time, device->rel.dx, device->rel.dy);
270                 device->pending_events &= ~EVDEV_RELATIVE_MOTION;
271                 device->rel.dx = 0;
272                 device->rel.dy = 0;
273         }
274         if (device->pending_events & EVDEV_ABSOLUTE_MT_DOWN) {
275                 weston_output_transform_coordinate(device->output,
276                                                    device->mt.x[slot],
277                                                    device->mt.y[slot],
278                                                    &x, &y);
279                 notify_touch(master, time,
280                              device->mt.slot, x, y, WL_TOUCH_DOWN);
281                 device->pending_events &= ~EVDEV_ABSOLUTE_MT_DOWN;
282                 device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION;
283         }
284         if (device->pending_events & EVDEV_ABSOLUTE_MT_MOTION) {
285                 weston_output_transform_coordinate(device->output,
286                                                    device->mt.x[slot],
287                                                    device->mt.y[slot],
288                                                    &x, &y);
289                 notify_touch(master, time,
290                              device->mt.slot, x, y, WL_TOUCH_MOTION);
291                 device->pending_events &= ~EVDEV_ABSOLUTE_MT_DOWN;
292                 device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION;
293         }
294         if (device->pending_events & EVDEV_ABSOLUTE_MT_UP) {
295                 notify_touch(master, time, device->mt.slot, 0, 0,
296                              WL_TOUCH_UP);
297                 device->pending_events &= ~EVDEV_ABSOLUTE_MT_UP;
298         }
299         if (device->pending_events & EVDEV_ABSOLUTE_MOTION) {
300                 transform_absolute(device);
301                 weston_output_transform_coordinate(device->output,
302                                                    device->abs.x,
303                                                    device->abs.y, &x, &y);
304
305                 if (device->caps & EVDEV_TOUCH) {
306                         if (master->num_tp == 0)
307                                 notify_touch(master, time, 0,
308                                              x, y, WL_TOUCH_DOWN);
309                         else
310                                 notify_touch(master, time, 0,
311                                              x, y, WL_TOUCH_MOTION);
312                 } else
313                         notify_motion_absolute(master, time, x, y);
314                 device->pending_events &= ~EVDEV_ABSOLUTE_MOTION;
315         }
316 }
317
318 static void
319 fallback_process(struct evdev_dispatch *dispatch,
320                  struct evdev_device *device,
321                  struct input_event *event,
322                  uint32_t time)
323 {
324         switch (event->type) {
325         case EV_REL:
326                 evdev_process_relative(device, event, time);
327                 break;
328         case EV_ABS:
329                 evdev_process_absolute(device, event);
330                 break;
331         case EV_KEY:
332                 evdev_process_key(device, event, time);
333                 break;
334         case EV_SYN:
335                 device->pending_events |= EVDEV_SYN;
336                 break;
337         }
338 }
339
340 static void
341 fallback_destroy(struct evdev_dispatch *dispatch)
342 {
343         free(dispatch);
344 }
345
346 struct evdev_dispatch_interface fallback_interface = {
347         fallback_process,
348         fallback_destroy
349 };
350
351 static struct evdev_dispatch *
352 fallback_dispatch_create(void)
353 {
354         struct evdev_dispatch *dispatch = malloc(sizeof *dispatch);
355         if (dispatch == NULL)
356                 return NULL;
357
358         dispatch->interface = &fallback_interface;
359
360         return dispatch;
361 }
362
363 static void
364 evdev_process_events(struct evdev_device *device,
365                      struct input_event *ev, int count)
366 {
367         struct evdev_dispatch *dispatch = device->dispatch;
368         struct input_event *e, *end;
369         uint32_t time = 0;
370
371         device->pending_events = 0;
372
373         e = ev;
374         end = e + count;
375         for (e = ev; e < end; e++) {
376                 time = e->time.tv_sec * 1000 + e->time.tv_usec / 1000;
377
378                 /* we try to minimize the amount of notifications to be
379                  * forwarded to the compositor, so we accumulate motion
380                  * events and send as a bunch */
381                 if (!is_motion_event(e))
382                         evdev_flush_motion(device, time);
383
384                 dispatch->interface->process(dispatch, device, e, time);
385         }
386
387         evdev_flush_motion(device, time);
388 }
389
390 static int
391 evdev_device_data(int fd, uint32_t mask, void *data)
392 {
393         struct weston_compositor *ec;
394         struct evdev_device *device = data;
395         struct input_event ev[32];
396         int len;
397
398         ec = device->seat->compositor;
399         if (!ec->focus)
400                 return 1;
401
402         /* If the compositor is repainting, this function is called only once
403          * per frame and we have to process all the events available on the
404          * fd, otherwise there will be input lag. */
405         do {
406                 if (device->mtdev)
407                         len = mtdev_get(device->mtdev, fd, ev,
408                                         ARRAY_LENGTH(ev)) *
409                                 sizeof (struct input_event);
410                 else
411                         len = read(fd, &ev, sizeof ev);
412
413                 if (len < 0 || len % sizeof ev[0] != 0) {
414                         /* FIXME: call evdev_device_destroy when errno is ENODEV. */
415                         return 1;
416                 }
417
418                 evdev_process_events(device, ev, len / sizeof ev[0]);
419
420         } while (len > 0);
421
422         return 1;
423 }
424
425 static int
426 evdev_handle_device(struct evdev_device *device)
427 {
428         struct input_absinfo absinfo;
429         unsigned long ev_bits[NBITS(EV_MAX)];
430         unsigned long abs_bits[NBITS(ABS_MAX)];
431         unsigned long rel_bits[NBITS(REL_MAX)];
432         unsigned long key_bits[NBITS(KEY_MAX)];
433         int has_key, has_abs;
434         unsigned int i;
435
436         has_key = 0;
437         has_abs = 0;
438         device->caps = 0;
439
440         ioctl(device->fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits);
441         if (TEST_BIT(ev_bits, EV_ABS)) {
442                 has_abs = 1;
443
444                 ioctl(device->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)),
445                       abs_bits);
446                 if (TEST_BIT(abs_bits, ABS_X)) {
447                         ioctl(device->fd, EVIOCGABS(ABS_X), &absinfo);
448                         device->abs.min_x = absinfo.minimum;
449                         device->abs.max_x = absinfo.maximum;
450                         device->caps |= EVDEV_MOTION_ABS;
451                 }
452                 if (TEST_BIT(abs_bits, ABS_Y)) {
453                         ioctl(device->fd, EVIOCGABS(ABS_Y), &absinfo);
454                         device->abs.min_y = absinfo.minimum;
455                         device->abs.max_y = absinfo.maximum;
456                         device->caps |= EVDEV_MOTION_ABS;
457                 }
458                 /* We only handle the slotted Protocol B in weston.
459                    Devices with ABS_MT_POSITION_* but not ABS_MT_SLOT
460                    require mtdev for conversion. */
461                 if (TEST_BIT(abs_bits, ABS_MT_POSITION_X) &&
462                     TEST_BIT(abs_bits, ABS_MT_POSITION_Y)) {
463                         ioctl(device->fd, EVIOCGABS(ABS_MT_POSITION_X),
464                               &absinfo);
465                         device->abs.min_x = absinfo.minimum;
466                         device->abs.max_x = absinfo.maximum;
467                         ioctl(device->fd, EVIOCGABS(ABS_MT_POSITION_Y),
468                               &absinfo);
469                         device->abs.min_y = absinfo.minimum;
470                         device->abs.max_y = absinfo.maximum;
471                         device->is_mt = 1;
472                         device->caps |= EVDEV_TOUCH;
473
474                         if (!TEST_BIT(abs_bits, ABS_MT_SLOT)) {
475                                 device->mtdev = mtdev_new_open(device->fd);
476                                 if (!device->mtdev) {
477                                         weston_log("mtdev required but failed to open for %s\n",
478                                                    device->devnode);
479                                         return 0;
480                                 }
481                                 device->mt.slot = device->mtdev->caps.slot.value;
482                         } else {
483                                 ioctl(device->fd, EVIOCGABS(ABS_MT_SLOT),
484                                       &absinfo);
485                                 device->mt.slot = absinfo.value;
486                         }
487                 }
488         }
489         if (TEST_BIT(ev_bits, EV_REL)) {
490                 ioctl(device->fd, EVIOCGBIT(EV_REL, sizeof(rel_bits)),
491                       rel_bits);
492                 if (TEST_BIT(rel_bits, REL_X) || TEST_BIT(rel_bits, REL_Y))
493                         device->caps |= EVDEV_MOTION_REL;
494         }
495         if (TEST_BIT(ev_bits, EV_KEY)) {
496                 has_key = 1;
497                 ioctl(device->fd, EVIOCGBIT(EV_KEY, sizeof(key_bits)),
498                       key_bits);
499                 if (TEST_BIT(key_bits, BTN_TOOL_FINGER) &&
500                     !TEST_BIT(key_bits, BTN_TOOL_PEN) &&
501                     has_abs)
502                         device->dispatch = evdev_touchpad_create(device);
503                 for (i = KEY_ESC; i < KEY_MAX; i++) {
504                         if (i >= BTN_MISC && i < KEY_OK)
505                                 continue;
506                         if (TEST_BIT(key_bits, i)) {
507                                 device->caps |= EVDEV_KEYBOARD;
508                                 break;
509                         }
510                 }
511                 for (i = BTN_MISC; i < KEY_OK; i++) {
512                         if (TEST_BIT(key_bits, i)) {
513                                 device->caps |= EVDEV_BUTTON;
514                                 break;
515                         }
516                 }
517                 if (TEST_BIT(key_bits, BTN_TOUCH)) {
518                         device->caps |= EVDEV_TOUCH;
519                 }
520
521         }
522         if (TEST_BIT(ev_bits, EV_LED)) {
523                 device->caps |= EVDEV_KEYBOARD;
524         }
525
526         /* This rule tries to catch accelerometer devices and opt out. We may
527          * want to adjust the protocol later adding a proper event for dealing
528          * with accelerometers and implement here accordingly */
529         if (has_abs && !has_key && !device->is_mt) {
530                 weston_log("input device %s, %s "
531                            "ignored: unsupported device type\n",
532                            device->devname, device->devnode);
533                 return 0;
534         }
535
536         return 1;
537 }
538
539 static int
540 evdev_configure_device(struct evdev_device *device)
541 {
542         if ((device->caps &
543              (EVDEV_MOTION_ABS | EVDEV_MOTION_REL | EVDEV_BUTTON))) {
544                 weston_seat_init_pointer(device->seat);
545                 weston_log("input device %s, %s is a pointer caps =%s%s%s\n",
546                            device->devname, device->devnode,
547                            device->caps & EVDEV_MOTION_ABS ? " absolute-motion" : "",
548                            device->caps & EVDEV_MOTION_REL ? " relative-motion": "",
549                            device->caps & EVDEV_BUTTON ? " button" : "");
550         }
551         if ((device->caps & EVDEV_KEYBOARD)) {
552                 if (weston_seat_init_keyboard(device->seat, NULL) < 0)
553                         return -1;
554                 weston_log("input device %s, %s is a keyboard\n",
555                            device->devname, device->devnode);
556         }
557         if ((device->caps & EVDEV_TOUCH)) {
558                 weston_seat_init_touch(device->seat);
559                 weston_log("input device %s, %s is a touch device\n",
560                            device->devname, device->devnode);
561         }
562
563         return 0;
564 }
565
566 struct evdev_device *
567 evdev_device_create(struct weston_seat *seat, const char *path, int device_fd)
568 {
569         struct evdev_device *device;
570         struct weston_compositor *ec;
571         char devname[256] = "unknown";
572
573         device = zalloc(sizeof *device);
574         if (device == NULL)
575                 return NULL;
576
577         ec = seat->compositor;
578         device->output =
579                 container_of(ec->output_list.next, struct weston_output, link);
580
581         device->seat = seat;
582         device->is_mt = 0;
583         device->mtdev = NULL;
584         device->devnode = strdup(path);
585         device->mt.slot = -1;
586         device->rel.dx = 0;
587         device->rel.dy = 0;
588         device->dispatch = NULL;
589         device->fd = device_fd;
590
591         ioctl(device->fd, EVIOCGNAME(sizeof(devname)), devname);
592         devname[sizeof(devname) - 1] = '\0';
593         device->devname = strdup(devname);
594
595         if (!evdev_handle_device(device)) {
596                 if (device->dispatch)
597                         device->dispatch->interface->destroy(dispatch);
598                 if (device->mtdev)
599                         mtdev_close_delete(device->mtdev);
600                 free(device->devnode);
601                 free(device->devname);
602                 free(device);
603                 return EVDEV_UNHANDLED_DEVICE;
604         }
605
606         if (evdev_configure_device(device) == -1)
607                 goto err1;
608
609         /* If the dispatch was not set up use the fallback. */
610         if (device->dispatch == NULL)
611                 device->dispatch = fallback_dispatch_create();
612         if (device->dispatch == NULL)
613                 goto err1;
614
615         device->source = wl_event_loop_add_fd(ec->input_loop, device->fd,
616                                               WL_EVENT_READABLE,
617                                               evdev_device_data, device);
618         if (device->source == NULL)
619                 goto err2;
620
621         return device;
622
623 err2:
624         device->dispatch->interface->destroy(device->dispatch);
625 err1:
626         if (device->mtdev)
627                 mtdev_close_delete(device->mtdev);
628         free(device->devname);
629         free(device->devnode);
630         free(device);
631         return NULL;
632 }
633
634 void
635 evdev_device_destroy(struct evdev_device *device)
636 {
637         struct evdev_dispatch *dispatch;
638
639         dispatch = device->dispatch;
640         if (dispatch)
641                 dispatch->interface->destroy(dispatch);
642
643         wl_event_source_remove(device->source);
644         wl_list_remove(&device->link);
645         if (device->mtdev)
646                 mtdev_close_delete(device->mtdev);
647         close(device->fd);
648         free(device->devname);
649         free(device->devnode);
650         free(device);
651 }
652
653 void
654 evdev_notify_keyboard_focus(struct weston_seat *seat,
655                             struct wl_list *evdev_devices)
656 {
657         struct evdev_device *device;
658         struct wl_array keys;
659         unsigned int i, set;
660         char evdev_keys[(KEY_CNT + 7) / 8];
661         char all_keys[(KEY_CNT + 7) / 8];
662         uint32_t *k;
663         int ret;
664
665         if (!seat->keyboard)
666                 return;
667
668         memset(all_keys, 0, sizeof all_keys);
669         wl_list_for_each(device, evdev_devices, link) {
670                 memset(evdev_keys, 0, sizeof evdev_keys);
671                 ret = ioctl(device->fd,
672                             EVIOCGKEY(sizeof evdev_keys), evdev_keys);
673                 if (ret < 0) {
674                         weston_log("failed to get keys for device %s\n",
675                                 device->devnode);
676                         continue;
677                 }
678                 for (i = 0; i < ARRAY_LENGTH(evdev_keys); i++)
679                         all_keys[i] |= evdev_keys[i];
680         }
681
682         wl_array_init(&keys);
683         for (i = 0; i < KEY_CNT; i++) {
684                 set = all_keys[i >> 3] & (1 << (i & 7));
685                 if (set) {
686                         k = wl_array_add(&keys, sizeof *k);
687                         *k = i;
688                 }
689         }
690
691         notify_keyboard_focus_in(seat, &keys, STATE_UPDATE_AUTOMATIC);
692
693         wl_array_release(&keys);
694 }