};
static void
-hw_set_key_down(struct evdev_device *device, int code, int pressed)
+hw_set_key_down(struct evdev_dispatch *dispatch, int code, int pressed)
{
- long_set_bit_state(device->hw_key_mask, code, pressed);
+ long_set_bit_state(dispatch->hw_key_mask, code, pressed);
}
static bool
-hw_is_key_down(struct evdev_device *device, int code)
+hw_is_key_down(struct evdev_dispatch *dispatch, int code)
{
- return long_bit_is_set(device->hw_key_mask, code);
+ return long_bit_is_set(dispatch->hw_key_mask, code);
}
static int
return key_count;
}
-void
-evdev_keyboard_notify_key(struct evdev_device *device,
+static void
+evdev_keyboard_notify_key(struct evdev_dispatch *dispatch,
+ struct evdev_device *device,
uint64_t time,
int key,
enum libinput_key_state state)
}
static inline void
-evdev_process_key(struct evdev_device *device,
+evdev_process_key(struct evdev_dispatch *dispatch,
+ struct evdev_device *device,
struct input_event *e, uint64_t time)
{
enum evdev_key_type type;
break;
case EVDEV_KEY_TYPE_KEY:
case EVDEV_KEY_TYPE_BUTTON:
- if (!hw_is_key_down(device, e->code))
+ if (!hw_is_key_down(dispatch, e->code))
return;
}
}
- hw_set_key_down(device, e->code, e->value);
+ hw_set_key_down(dispatch, e->code, e->value);
switch (type) {
case EVDEV_KEY_TYPE_NONE:
break;
case EVDEV_KEY_TYPE_KEY:
evdev_keyboard_notify_key(
+ dispatch,
device,
time,
e->code,
}
static inline bool
-evdev_any_button_down(struct evdev_device *device)
+evdev_any_button_down(struct evdev_dispatch *dispatch,
+ struct evdev_device *device)
{
unsigned int button;
for (button = BTN_LEFT; button < BTN_JOYSTICK; button++) {
if (libevdev_has_event_code(device->evdev, EV_KEY, button) &&
- hw_is_key_down(device, button))
+ hw_is_key_down(dispatch, button))
return true;
}
return false;
evdev_process_absolute(device, event, time);
break;
case EV_KEY:
- evdev_process_key(device, event, time);
+ evdev_process_key(dispatch, device, event, time);
break;
case EV_SYN:
need_frame = evdev_need_touch_frame(device);
}
static void
-release_pressed_keys(struct evdev_device *device)
+release_pressed_keys(struct evdev_dispatch *dispatch,
+ struct evdev_device *device)
{
struct libinput *libinput = evdev_libinput_context(device);
uint64_t time;
break;
case EVDEV_KEY_TYPE_KEY:
evdev_keyboard_notify_key(
+ dispatch,
device,
time,
code,
fallback_suspend(struct evdev_dispatch *dispatch,
struct evdev_device *device)
{
- release_pressed_keys(device);
+ release_pressed_keys(dispatch, device);
+ memset(dispatch->hw_key_mask, 0, sizeof(dispatch->hw_key_mask));
}
static void
static void
evdev_change_to_left_handed(struct evdev_device *device)
{
+ struct evdev_dispatch *dispatch = device->dispatch;
+
if (device->left_handed.want_enabled == device->left_handed.enabled)
return;
- if (evdev_any_button_down(device))
+ if (evdev_any_button_down(dispatch, device))
return;
device->left_handed.enabled = device->left_handed.want_enabled;
static void
evdev_change_scroll_method(struct evdev_device *device)
{
+ struct evdev_dispatch *dispatch = device->dispatch;
+
if (device->scroll.want_method == device->scroll.method &&
device->scroll.want_button == device->scroll.button)
return;
- if (evdev_any_button_down(device))
+ if (evdev_any_button_down(dispatch, device))
return;
device->scroll.method = device->scroll.want_method;
return -ENOMEM;
}
- memset(device->hw_key_mask, 0, sizeof(device->hw_key_mask));
-
evdev_notify_resumed_device(device);
return 0;