libinput-device: Don't get initial key states

Initial key state is no pressed keys, and the libinput_device_get_keys
function was deprecated in libinput 0.6.0.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
dev
Jonas Ådahl 10 years ago committed by Pekka Paalanen
parent 3fbba493d5
commit c996f1d8bd
  1. 30
      src/libinput-device.c

@ -468,42 +468,12 @@ void
evdev_notify_keyboard_focus(struct weston_seat *seat, evdev_notify_keyboard_focus(struct weston_seat *seat,
struct wl_list *evdev_devices) struct wl_list *evdev_devices)
{ {
struct evdev_device *device;
struct wl_array keys; struct wl_array keys;
unsigned int i, set;
char evdev_keys[(KEY_CNT + 7) / 8];
char all_keys[(KEY_CNT + 7) / 8];
uint32_t *k;
int ret;
if (!seat->keyboard_device_count > 0) if (!seat->keyboard_device_count > 0)
return; return;
memset(all_keys, 0, sizeof all_keys);
wl_list_for_each(device, evdev_devices, link) {
memset(evdev_keys, 0, sizeof evdev_keys);
ret = libinput_device_get_keys(device->device,
evdev_keys,
sizeof evdev_keys);
if (ret < 0) {
weston_log("failed to get keys for device %s\n",
device->devnode);
continue;
}
for (i = 0; i < ARRAY_LENGTH(evdev_keys); i++)
all_keys[i] |= evdev_keys[i];
}
wl_array_init(&keys); wl_array_init(&keys);
for (i = 0; i < KEY_CNT; i++) {
set = all_keys[i >> 3] & (1 << (i & 7));
if (set) {
k = wl_array_add(&keys, sizeof *k);
*k = i;
}
}
notify_keyboard_focus_in(seat, &keys, STATE_UPDATE_AUTOMATIC); notify_keyboard_focus_in(seat, &keys, STATE_UPDATE_AUTOMATIC);
wl_array_release(&keys); wl_array_release(&keys);
} }

Loading…
Cancel
Save