mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01:00
backend/libinput: use struct initializers for events
This is more readable and consistent with the rest of wlroots.
This commit is contained in:
parent
e1c6801b65
commit
2d9659d765
6 changed files with 98 additions and 100 deletions
|
@ -36,13 +36,12 @@ void handle_keyboard_key(struct libinput_event *event,
|
||||||
struct wlr_keyboard *kb) {
|
struct wlr_keyboard *kb) {
|
||||||
struct libinput_event_keyboard *kbevent =
|
struct libinput_event_keyboard *kbevent =
|
||||||
libinput_event_get_keyboard_event(event);
|
libinput_event_get_keyboard_event(event);
|
||||||
struct wlr_keyboard_key_event wlr_event = { 0 };
|
struct wlr_keyboard_key_event wlr_event = {
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_keyboard_get_time_usec(kbevent)),
|
||||||
usec_to_msec(libinput_event_keyboard_get_time_usec(kbevent));
|
.keycode = libinput_event_keyboard_get_key(kbevent),
|
||||||
wlr_event.keycode = libinput_event_keyboard_get_key(kbevent);
|
.update_state = true,
|
||||||
enum libinput_key_state state =
|
};
|
||||||
libinput_event_keyboard_get_key_state(kbevent);
|
switch (libinput_event_keyboard_get_key_state(kbevent)) {
|
||||||
switch (state) {
|
|
||||||
case LIBINPUT_KEY_STATE_RELEASED:
|
case LIBINPUT_KEY_STATE_RELEASED:
|
||||||
wlr_event.state = WL_KEYBOARD_KEY_STATE_RELEASED;
|
wlr_event.state = WL_KEYBOARD_KEY_STATE_RELEASED;
|
||||||
break;
|
break;
|
||||||
|
@ -50,6 +49,5 @@ void handle_keyboard_key(struct libinput_event *event,
|
||||||
wlr_event.state = WL_KEYBOARD_KEY_STATE_PRESSED;
|
wlr_event.state = WL_KEYBOARD_KEY_STATE_PRESSED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
wlr_event.update_state = true;
|
|
||||||
wlr_keyboard_notify_key(kb, &wlr_event);
|
wlr_keyboard_notify_key(kb, &wlr_event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,14 +28,14 @@ void handle_pointer_motion(struct libinput_event *event,
|
||||||
struct wlr_pointer *pointer) {
|
struct wlr_pointer *pointer) {
|
||||||
struct libinput_event_pointer *pevent =
|
struct libinput_event_pointer *pevent =
|
||||||
libinput_event_get_pointer_event(event);
|
libinput_event_get_pointer_event(event);
|
||||||
struct wlr_pointer_motion_event wlr_event = { 0 };
|
struct wlr_pointer_motion_event wlr_event = {
|
||||||
wlr_event.pointer = pointer;
|
.pointer = pointer,
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_pointer_get_time_usec(pevent)),
|
||||||
usec_to_msec(libinput_event_pointer_get_time_usec(pevent));
|
.delta_x = libinput_event_pointer_get_dx(pevent),
|
||||||
wlr_event.delta_x = libinput_event_pointer_get_dx(pevent);
|
.delta_y = libinput_event_pointer_get_dy(pevent),
|
||||||
wlr_event.delta_y = libinput_event_pointer_get_dy(pevent);
|
.unaccel_dx = libinput_event_pointer_get_dx_unaccelerated(pevent),
|
||||||
wlr_event.unaccel_dx = libinput_event_pointer_get_dx_unaccelerated(pevent);
|
.unaccel_dy = libinput_event_pointer_get_dy_unaccelerated(pevent),
|
||||||
wlr_event.unaccel_dy = libinput_event_pointer_get_dy_unaccelerated(pevent);
|
};
|
||||||
wl_signal_emit_mutable(&pointer->events.motion, &wlr_event);
|
wl_signal_emit_mutable(&pointer->events.motion, &wlr_event);
|
||||||
wl_signal_emit_mutable(&pointer->events.frame, pointer);
|
wl_signal_emit_mutable(&pointer->events.frame, pointer);
|
||||||
}
|
}
|
||||||
|
@ -44,12 +44,12 @@ void handle_pointer_motion_abs(struct libinput_event *event,
|
||||||
struct wlr_pointer *pointer) {
|
struct wlr_pointer *pointer) {
|
||||||
struct libinput_event_pointer *pevent =
|
struct libinput_event_pointer *pevent =
|
||||||
libinput_event_get_pointer_event(event);
|
libinput_event_get_pointer_event(event);
|
||||||
struct wlr_pointer_motion_absolute_event wlr_event = { 0 };
|
struct wlr_pointer_motion_absolute_event wlr_event = {
|
||||||
wlr_event.pointer = pointer;
|
.pointer = pointer,
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_pointer_get_time_usec(pevent)),
|
||||||
usec_to_msec(libinput_event_pointer_get_time_usec(pevent));
|
.x = libinput_event_pointer_get_absolute_x_transformed(pevent, 1),
|
||||||
wlr_event.x = libinput_event_pointer_get_absolute_x_transformed(pevent, 1);
|
.y = libinput_event_pointer_get_absolute_y_transformed(pevent, 1),
|
||||||
wlr_event.y = libinput_event_pointer_get_absolute_y_transformed(pevent, 1);
|
};
|
||||||
wl_signal_emit_mutable(&pointer->events.motion_absolute, &wlr_event);
|
wl_signal_emit_mutable(&pointer->events.motion_absolute, &wlr_event);
|
||||||
wl_signal_emit_mutable(&pointer->events.frame, pointer);
|
wl_signal_emit_mutable(&pointer->events.frame, pointer);
|
||||||
}
|
}
|
||||||
|
@ -58,11 +58,11 @@ void handle_pointer_button(struct libinput_event *event,
|
||||||
struct wlr_pointer *pointer) {
|
struct wlr_pointer *pointer) {
|
||||||
struct libinput_event_pointer *pevent =
|
struct libinput_event_pointer *pevent =
|
||||||
libinput_event_get_pointer_event(event);
|
libinput_event_get_pointer_event(event);
|
||||||
struct wlr_pointer_button_event wlr_event = { 0 };
|
struct wlr_pointer_button_event wlr_event = {
|
||||||
wlr_event.pointer = pointer;
|
.pointer = pointer,
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_pointer_get_time_usec(pevent)),
|
||||||
usec_to_msec(libinput_event_pointer_get_time_usec(pevent));
|
.button = libinput_event_pointer_get_button(pevent),
|
||||||
wlr_event.button = libinput_event_pointer_get_button(pevent);
|
};
|
||||||
// Ignore events which aren't a seat-wide state change. For instance, if
|
// Ignore events which aren't a seat-wide state change. For instance, if
|
||||||
// the same button is pressed twice on the same seat, ignore the second
|
// the same button is pressed twice on the same seat, ignore the second
|
||||||
// press.
|
// press.
|
||||||
|
@ -89,10 +89,10 @@ void handle_pointer_axis(struct libinput_event *event,
|
||||||
struct wlr_pointer *pointer) {
|
struct wlr_pointer *pointer) {
|
||||||
struct libinput_event_pointer *pevent =
|
struct libinput_event_pointer *pevent =
|
||||||
libinput_event_get_pointer_event(event);
|
libinput_event_get_pointer_event(event);
|
||||||
struct wlr_pointer_axis_event wlr_event = { 0 };
|
struct wlr_pointer_axis_event wlr_event = {
|
||||||
wlr_event.pointer = pointer;
|
.pointer = pointer,
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_pointer_get_time_usec(pevent)),
|
||||||
usec_to_msec(libinput_event_pointer_get_time_usec(pevent));
|
};
|
||||||
switch (libinput_event_pointer_get_axis_source(pevent)) {
|
switch (libinput_event_pointer_get_axis_source(pevent)) {
|
||||||
case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL:
|
case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL:
|
||||||
wlr_event.source = WLR_AXIS_SOURCE_WHEEL;
|
wlr_event.source = WLR_AXIS_SOURCE_WHEEL;
|
||||||
|
@ -139,11 +139,11 @@ void handle_pointer_axis_value120(struct libinput_event *event,
|
||||||
struct wlr_pointer *pointer, enum wlr_axis_source source) {
|
struct wlr_pointer *pointer, enum wlr_axis_source source) {
|
||||||
struct libinput_event_pointer *pevent =
|
struct libinput_event_pointer *pevent =
|
||||||
libinput_event_get_pointer_event(event);
|
libinput_event_get_pointer_event(event);
|
||||||
struct wlr_pointer_axis_event wlr_event = { 0 };
|
struct wlr_pointer_axis_event wlr_event = {
|
||||||
wlr_event.pointer = pointer;
|
.pointer = pointer,
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_pointer_get_time_usec(pevent)),
|
||||||
usec_to_msec(libinput_event_pointer_get_time_usec(pevent));
|
.source = source,
|
||||||
wlr_event.source = source;
|
};
|
||||||
|
|
||||||
const enum libinput_pointer_axis axes[] = {
|
const enum libinput_pointer_axis axes[] = {
|
||||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
|
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
|
||||||
|
|
|
@ -28,7 +28,9 @@ void handle_switch_toggle(struct libinput_event *event,
|
||||||
struct wlr_switch *wlr_switch) {
|
struct wlr_switch *wlr_switch) {
|
||||||
struct libinput_event_switch *sevent =
|
struct libinput_event_switch *sevent =
|
||||||
libinput_event_get_switch_event (event);
|
libinput_event_get_switch_event (event);
|
||||||
struct wlr_switch_toggle_event wlr_event = { 0 };
|
struct wlr_switch_toggle_event wlr_event = {
|
||||||
|
.time_msec = usec_to_msec(libinput_event_switch_get_time_usec(sevent)),
|
||||||
|
};
|
||||||
switch (libinput_event_switch_get_switch(sevent)) {
|
switch (libinput_event_switch_get_switch(sevent)) {
|
||||||
case LIBINPUT_SWITCH_LID:
|
case LIBINPUT_SWITCH_LID:
|
||||||
wlr_event.switch_type = WLR_SWITCH_TYPE_LID;
|
wlr_event.switch_type = WLR_SWITCH_TYPE_LID;
|
||||||
|
@ -45,7 +47,5 @@ void handle_switch_toggle(struct libinput_event *event,
|
||||||
wlr_event.switch_state = WLR_SWITCH_STATE_ON;
|
wlr_event.switch_state = WLR_SWITCH_STATE_ON;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
wlr_event.time_msec =
|
|
||||||
usec_to_msec(libinput_event_switch_get_time_usec(sevent));
|
|
||||||
wl_signal_emit_mutable(&wlr_switch->events.toggle, &wlr_event);
|
wl_signal_emit_mutable(&wlr_switch->events.toggle, &wlr_event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,13 +144,13 @@ void handle_tablet_pad_button(struct libinput_event *event,
|
||||||
struct wlr_tablet_pad *tablet_pad) {
|
struct wlr_tablet_pad *tablet_pad) {
|
||||||
struct libinput_event_tablet_pad *pevent =
|
struct libinput_event_tablet_pad *pevent =
|
||||||
libinput_event_get_tablet_pad_event(event);
|
libinput_event_get_tablet_pad_event(event);
|
||||||
struct wlr_tablet_pad_button_event wlr_event = { 0 };
|
struct wlr_tablet_pad_button_event wlr_event = {
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_tablet_pad_get_time_usec(pevent)),
|
||||||
usec_to_msec(libinput_event_tablet_pad_get_time_usec(pevent));
|
.button = libinput_event_tablet_pad_get_button_number(pevent),
|
||||||
wlr_event.button = libinput_event_tablet_pad_get_button_number(pevent);
|
.mode = libinput_event_tablet_pad_get_mode(pevent),
|
||||||
wlr_event.mode = libinput_event_tablet_pad_get_mode(pevent);
|
.group = libinput_tablet_pad_mode_group_get_index(
|
||||||
wlr_event.group = libinput_tablet_pad_mode_group_get_index(
|
libinput_event_tablet_pad_get_mode_group(pevent)),
|
||||||
libinput_event_tablet_pad_get_mode_group(pevent));
|
};
|
||||||
switch (libinput_event_tablet_pad_get_button_state(pevent)) {
|
switch (libinput_event_tablet_pad_get_button_state(pevent)) {
|
||||||
case LIBINPUT_BUTTON_STATE_PRESSED:
|
case LIBINPUT_BUTTON_STATE_PRESSED:
|
||||||
wlr_event.state = WLR_BUTTON_PRESSED;
|
wlr_event.state = WLR_BUTTON_PRESSED;
|
||||||
|
@ -166,12 +166,12 @@ void handle_tablet_pad_ring(struct libinput_event *event,
|
||||||
struct wlr_tablet_pad *tablet_pad) {
|
struct wlr_tablet_pad *tablet_pad) {
|
||||||
struct libinput_event_tablet_pad *pevent =
|
struct libinput_event_tablet_pad *pevent =
|
||||||
libinput_event_get_tablet_pad_event(event);
|
libinput_event_get_tablet_pad_event(event);
|
||||||
struct wlr_tablet_pad_ring_event wlr_event = { 0 };
|
struct wlr_tablet_pad_ring_event wlr_event = {
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_tablet_pad_get_time_usec(pevent)),
|
||||||
usec_to_msec(libinput_event_tablet_pad_get_time_usec(pevent));
|
.ring = libinput_event_tablet_pad_get_ring_number(pevent),
|
||||||
wlr_event.ring = libinput_event_tablet_pad_get_ring_number(pevent);
|
.position = libinput_event_tablet_pad_get_ring_position(pevent),
|
||||||
wlr_event.position = libinput_event_tablet_pad_get_ring_position(pevent);
|
.mode = libinput_event_tablet_pad_get_mode(pevent),
|
||||||
wlr_event.mode = libinput_event_tablet_pad_get_mode(pevent);
|
};
|
||||||
switch (libinput_event_tablet_pad_get_ring_source(pevent)) {
|
switch (libinput_event_tablet_pad_get_ring_source(pevent)) {
|
||||||
case LIBINPUT_TABLET_PAD_RING_SOURCE_UNKNOWN:
|
case LIBINPUT_TABLET_PAD_RING_SOURCE_UNKNOWN:
|
||||||
wlr_event.source = WLR_TABLET_PAD_RING_SOURCE_UNKNOWN;
|
wlr_event.source = WLR_TABLET_PAD_RING_SOURCE_UNKNOWN;
|
||||||
|
@ -187,12 +187,12 @@ void handle_tablet_pad_strip(struct libinput_event *event,
|
||||||
struct wlr_tablet_pad *tablet_pad) {
|
struct wlr_tablet_pad *tablet_pad) {
|
||||||
struct libinput_event_tablet_pad *pevent =
|
struct libinput_event_tablet_pad *pevent =
|
||||||
libinput_event_get_tablet_pad_event(event);
|
libinput_event_get_tablet_pad_event(event);
|
||||||
struct wlr_tablet_pad_strip_event wlr_event = { 0 };
|
struct wlr_tablet_pad_strip_event wlr_event = {
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_tablet_pad_get_time_usec(pevent)),
|
||||||
usec_to_msec(libinput_event_tablet_pad_get_time_usec(pevent));
|
.strip = libinput_event_tablet_pad_get_strip_number(pevent),
|
||||||
wlr_event.strip = libinput_event_tablet_pad_get_strip_number(pevent);
|
.position = libinput_event_tablet_pad_get_strip_position(pevent),
|
||||||
wlr_event.position = libinput_event_tablet_pad_get_strip_position(pevent);
|
.mode = libinput_event_tablet_pad_get_mode(pevent),
|
||||||
wlr_event.mode = libinput_event_tablet_pad_get_mode(pevent);
|
};
|
||||||
switch (libinput_event_tablet_pad_get_strip_source(pevent)) {
|
switch (libinput_event_tablet_pad_get_strip_source(pevent)) {
|
||||||
case LIBINPUT_TABLET_PAD_STRIP_SOURCE_UNKNOWN:
|
case LIBINPUT_TABLET_PAD_STRIP_SOURCE_UNKNOWN:
|
||||||
wlr_event.source = WLR_TABLET_PAD_STRIP_SOURCE_UNKNOWN;
|
wlr_event.source = WLR_TABLET_PAD_STRIP_SOURCE_UNKNOWN;
|
||||||
|
|
|
@ -129,11 +129,11 @@ void handle_tablet_tool_axis(struct libinput_event *event,
|
||||||
struct tablet_tool *tool =
|
struct tablet_tool *tool =
|
||||||
get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
|
get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
|
||||||
|
|
||||||
struct wlr_tablet_tool_axis_event wlr_event = { 0 };
|
struct wlr_tablet_tool_axis_event wlr_event = {
|
||||||
wlr_event.tablet = wlr_tablet;
|
.tablet = wlr_tablet,
|
||||||
wlr_event.tool = &tool->wlr_tool;
|
.tool = &tool->wlr_tool,
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)),
|
||||||
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
|
};
|
||||||
if (libinput_event_tablet_tool_x_has_changed(tevent)) {
|
if (libinput_event_tablet_tool_x_has_changed(tevent)) {
|
||||||
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_X;
|
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_X;
|
||||||
wlr_event.x = libinput_event_tablet_tool_get_x_transformed(tevent, 1);
|
wlr_event.x = libinput_event_tablet_tool_get_x_transformed(tevent, 1);
|
||||||
|
@ -183,13 +183,13 @@ void handle_tablet_tool_proximity(struct libinput_event *event,
|
||||||
struct tablet_tool *tool =
|
struct tablet_tool *tool =
|
||||||
get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
|
get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
|
||||||
|
|
||||||
struct wlr_tablet_tool_proximity_event wlr_event = { 0 };
|
struct wlr_tablet_tool_proximity_event wlr_event = {
|
||||||
wlr_event.tablet = wlr_tablet;
|
.tablet = wlr_tablet,
|
||||||
wlr_event.tool = &tool->wlr_tool;
|
.tool = &tool->wlr_tool,
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)),
|
||||||
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
|
.x = libinput_event_tablet_tool_get_x_transformed(tevent, 1),
|
||||||
wlr_event.x = libinput_event_tablet_tool_get_x_transformed(tevent, 1);
|
.y = libinput_event_tablet_tool_get_y_transformed(tevent, 1),
|
||||||
wlr_event.y = libinput_event_tablet_tool_get_y_transformed(tevent, 1);
|
};
|
||||||
|
|
||||||
switch (libinput_event_tablet_tool_get_proximity_state(tevent)) {
|
switch (libinput_event_tablet_tool_get_proximity_state(tevent)) {
|
||||||
case LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT:
|
case LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT:
|
||||||
|
@ -225,13 +225,13 @@ void handle_tablet_tool_tip(struct libinput_event *event,
|
||||||
struct tablet_tool *tool =
|
struct tablet_tool *tool =
|
||||||
get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
|
get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
|
||||||
|
|
||||||
struct wlr_tablet_tool_tip_event wlr_event = { 0 };
|
struct wlr_tablet_tool_tip_event wlr_event = {
|
||||||
wlr_event.tablet = wlr_tablet;
|
.tablet = wlr_tablet,
|
||||||
wlr_event.tool = &tool->wlr_tool;
|
.tool = &tool->wlr_tool,
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)),
|
||||||
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
|
.x = libinput_event_tablet_tool_get_x_transformed(tevent, 1),
|
||||||
wlr_event.x = libinput_event_tablet_tool_get_x_transformed(tevent, 1);
|
.y = libinput_event_tablet_tool_get_y_transformed(tevent, 1),
|
||||||
wlr_event.y = libinput_event_tablet_tool_get_y_transformed(tevent, 1);
|
};
|
||||||
|
|
||||||
switch (libinput_event_tablet_tool_get_tip_state(tevent)) {
|
switch (libinput_event_tablet_tool_get_tip_state(tevent)) {
|
||||||
case LIBINPUT_TABLET_TOOL_TIP_UP:
|
case LIBINPUT_TABLET_TOOL_TIP_UP:
|
||||||
|
@ -253,12 +253,12 @@ void handle_tablet_tool_button(struct libinput_event *event,
|
||||||
struct tablet_tool *tool =
|
struct tablet_tool *tool =
|
||||||
get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
|
get_tablet_tool(dev, libinput_event_tablet_tool_get_tool(tevent));
|
||||||
|
|
||||||
struct wlr_tablet_tool_button_event wlr_event = { 0 };
|
struct wlr_tablet_tool_button_event wlr_event = {
|
||||||
wlr_event.tablet = wlr_tablet;
|
.tablet = wlr_tablet,
|
||||||
wlr_event.tool = &tool->wlr_tool;
|
.tool = &tool->wlr_tool,
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)),
|
||||||
usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent));
|
.button = libinput_event_tablet_tool_get_button(tevent),
|
||||||
wlr_event.button = libinput_event_tablet_tool_get_button(tevent);
|
};
|
||||||
switch (libinput_event_tablet_tool_get_button_state(tevent)) {
|
switch (libinput_event_tablet_tool_get_button_state(tevent)) {
|
||||||
case LIBINPUT_BUTTON_STATE_RELEASED:
|
case LIBINPUT_BUTTON_STATE_RELEASED:
|
||||||
wlr_event.state = WLR_BUTTON_RELEASED;
|
wlr_event.state = WLR_BUTTON_RELEASED;
|
||||||
|
|
|
@ -45,11 +45,11 @@ void handle_touch_up(struct libinput_event *event,
|
||||||
struct wlr_touch *touch) {
|
struct wlr_touch *touch) {
|
||||||
struct libinput_event_touch *tevent =
|
struct libinput_event_touch *tevent =
|
||||||
libinput_event_get_touch_event(event);
|
libinput_event_get_touch_event(event);
|
||||||
struct wlr_touch_up_event wlr_event = { 0 };
|
struct wlr_touch_up_event wlr_event = {
|
||||||
wlr_event.touch = touch;
|
.touch = touch,
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_touch_get_time_usec(tevent)),
|
||||||
usec_to_msec(libinput_event_touch_get_time_usec(tevent));
|
.touch_id = libinput_event_touch_get_seat_slot(tevent),
|
||||||
wlr_event.touch_id = libinput_event_touch_get_seat_slot(tevent);
|
};
|
||||||
wl_signal_emit_mutable(&touch->events.up, &wlr_event);
|
wl_signal_emit_mutable(&touch->events.up, &wlr_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,13 +57,13 @@ void handle_touch_motion(struct libinput_event *event,
|
||||||
struct wlr_touch *touch) {
|
struct wlr_touch *touch) {
|
||||||
struct libinput_event_touch *tevent =
|
struct libinput_event_touch *tevent =
|
||||||
libinput_event_get_touch_event(event);
|
libinput_event_get_touch_event(event);
|
||||||
struct wlr_touch_motion_event wlr_event = { 0 };
|
struct wlr_touch_motion_event wlr_event = {
|
||||||
wlr_event.touch = touch;
|
.touch = touch,
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_touch_get_time_usec(tevent)),
|
||||||
usec_to_msec(libinput_event_touch_get_time_usec(tevent));
|
.touch_id = libinput_event_touch_get_seat_slot(tevent),
|
||||||
wlr_event.touch_id = libinput_event_touch_get_seat_slot(tevent);
|
.x = libinput_event_touch_get_x_transformed(tevent, 1),
|
||||||
wlr_event.x = libinput_event_touch_get_x_transformed(tevent, 1);
|
.y = libinput_event_touch_get_y_transformed(tevent, 1),
|
||||||
wlr_event.y = libinput_event_touch_get_y_transformed(tevent, 1);
|
};
|
||||||
wl_signal_emit_mutable(&touch->events.motion, &wlr_event);
|
wl_signal_emit_mutable(&touch->events.motion, &wlr_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,11 +71,11 @@ void handle_touch_cancel(struct libinput_event *event,
|
||||||
struct wlr_touch *touch) {
|
struct wlr_touch *touch) {
|
||||||
struct libinput_event_touch *tevent =
|
struct libinput_event_touch *tevent =
|
||||||
libinput_event_get_touch_event(event);
|
libinput_event_get_touch_event(event);
|
||||||
struct wlr_touch_cancel_event wlr_event = { 0 };
|
struct wlr_touch_cancel_event wlr_event = {
|
||||||
wlr_event.touch = touch;
|
.touch = touch,
|
||||||
wlr_event.time_msec =
|
.time_msec = usec_to_msec(libinput_event_touch_get_time_usec(tevent)),
|
||||||
usec_to_msec(libinput_event_touch_get_time_usec(tevent));
|
.touch_id = libinput_event_touch_get_seat_slot(tevent),
|
||||||
wlr_event.touch_id = libinput_event_touch_get_seat_slot(tevent);
|
};
|
||||||
wl_signal_emit_mutable(&touch->events.cancel, &wlr_event);
|
wl_signal_emit_mutable(&touch->events.cancel, &wlr_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue