mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-25 08:32:30 +00:00
types/wlr_pointer: uniformize events name
This commit is contained in:
parent
96ccc50c57
commit
bd6c000d14
@ -29,8 +29,8 @@ void handle_pointer_motion(struct libinput_event *event,
|
||||
struct wlr_pointer *pointer) {
|
||||
struct libinput_event_pointer *pevent =
|
||||
libinput_event_get_pointer_event(event);
|
||||
struct wlr_event_pointer_motion wlr_event = { 0 };
|
||||
wlr_event.device = &pointer->base;
|
||||
struct wlr_pointer_motion_event wlr_event = { 0 };
|
||||
wlr_event.pointer = pointer;
|
||||
wlr_event.time_msec =
|
||||
usec_to_msec(libinput_event_pointer_get_time_usec(pevent));
|
||||
wlr_event.delta_x = libinput_event_pointer_get_dx(pevent);
|
||||
@ -45,8 +45,8 @@ void handle_pointer_motion_abs(struct libinput_event *event,
|
||||
struct wlr_pointer *pointer) {
|
||||
struct libinput_event_pointer *pevent =
|
||||
libinput_event_get_pointer_event(event);
|
||||
struct wlr_event_pointer_motion_absolute wlr_event = { 0 };
|
||||
wlr_event.device = &pointer->base;
|
||||
struct wlr_pointer_motion_absolute_event wlr_event = { 0 };
|
||||
wlr_event.pointer = pointer;
|
||||
wlr_event.time_msec =
|
||||
usec_to_msec(libinput_event_pointer_get_time_usec(pevent));
|
||||
wlr_event.x = libinput_event_pointer_get_absolute_x_transformed(pevent, 1);
|
||||
@ -59,8 +59,8 @@ void handle_pointer_button(struct libinput_event *event,
|
||||
struct wlr_pointer *pointer) {
|
||||
struct libinput_event_pointer *pevent =
|
||||
libinput_event_get_pointer_event(event);
|
||||
struct wlr_event_pointer_button wlr_event = { 0 };
|
||||
wlr_event.device = &pointer->base;
|
||||
struct wlr_pointer_button_event wlr_event = { 0 };
|
||||
wlr_event.pointer = pointer;
|
||||
wlr_event.time_msec =
|
||||
usec_to_msec(libinput_event_pointer_get_time_usec(pevent));
|
||||
wlr_event.button = libinput_event_pointer_get_button(pevent);
|
||||
@ -80,8 +80,8 @@ void handle_pointer_axis(struct libinput_event *event,
|
||||
struct wlr_pointer *pointer) {
|
||||
struct libinput_event_pointer *pevent =
|
||||
libinput_event_get_pointer_event(event);
|
||||
struct wlr_event_pointer_axis wlr_event = { 0 };
|
||||
wlr_event.device = &pointer->base;
|
||||
struct wlr_pointer_axis_event wlr_event = { 0 };
|
||||
wlr_event.pointer = pointer;
|
||||
wlr_event.time_msec =
|
||||
usec_to_msec(libinput_event_pointer_get_time_usec(pevent));
|
||||
switch (libinput_event_pointer_get_axis_source(pevent)) {
|
||||
@ -126,8 +126,8 @@ void handle_pointer_swipe_begin(struct libinput_event *event,
|
||||
struct wlr_pointer *pointer) {
|
||||
struct libinput_event_gesture *gevent =
|
||||
libinput_event_get_gesture_event(event);
|
||||
struct wlr_event_pointer_swipe_begin wlr_event = {
|
||||
.device = &pointer->base,
|
||||
struct wlr_pointer_swipe_begin_event wlr_event = {
|
||||
.pointer = pointer,
|
||||
.time_msec =
|
||||
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
|
||||
.fingers = libinput_event_gesture_get_finger_count(gevent),
|
||||
@ -139,8 +139,8 @@ void handle_pointer_swipe_update(struct libinput_event *event,
|
||||
struct wlr_pointer *pointer) {
|
||||
struct libinput_event_gesture *gevent =
|
||||
libinput_event_get_gesture_event(event);
|
||||
struct wlr_event_pointer_swipe_update wlr_event = {
|
||||
.device = &pointer->base,
|
||||
struct wlr_pointer_swipe_update_event wlr_event = {
|
||||
.pointer = pointer,
|
||||
.time_msec =
|
||||
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
|
||||
.fingers = libinput_event_gesture_get_finger_count(gevent),
|
||||
@ -154,8 +154,8 @@ void handle_pointer_swipe_end(struct libinput_event *event,
|
||||
struct wlr_pointer *pointer) {
|
||||
struct libinput_event_gesture *gevent =
|
||||
libinput_event_get_gesture_event(event);
|
||||
struct wlr_event_pointer_swipe_end wlr_event = {
|
||||
.device = &pointer->base,
|
||||
struct wlr_pointer_swipe_end_event wlr_event = {
|
||||
.pointer = pointer,
|
||||
.time_msec =
|
||||
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
|
||||
.cancelled = libinput_event_gesture_get_cancelled(gevent),
|
||||
@ -167,8 +167,8 @@ void handle_pointer_pinch_begin(struct libinput_event *event,
|
||||
struct wlr_pointer *pointer) {
|
||||
struct libinput_event_gesture *gevent =
|
||||
libinput_event_get_gesture_event(event);
|
||||
struct wlr_event_pointer_pinch_begin wlr_event = {
|
||||
.device = &pointer->base,
|
||||
struct wlr_pointer_pinch_begin_event wlr_event = {
|
||||
.pointer = pointer,
|
||||
.time_msec =
|
||||
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
|
||||
.fingers = libinput_event_gesture_get_finger_count(gevent),
|
||||
@ -180,8 +180,8 @@ void handle_pointer_pinch_update(struct libinput_event *event,
|
||||
struct wlr_pointer *pointer) {
|
||||
struct libinput_event_gesture *gevent =
|
||||
libinput_event_get_gesture_event(event);
|
||||
struct wlr_event_pointer_pinch_update wlr_event = {
|
||||
.device = &pointer->base,
|
||||
struct wlr_pointer_pinch_update_event wlr_event = {
|
||||
.pointer = pointer,
|
||||
.time_msec =
|
||||
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
|
||||
.fingers = libinput_event_gesture_get_finger_count(gevent),
|
||||
@ -197,8 +197,8 @@ void handle_pointer_pinch_end(struct libinput_event *event,
|
||||
struct wlr_pointer *pointer) {
|
||||
struct libinput_event_gesture *gevent =
|
||||
libinput_event_get_gesture_event(event);
|
||||
struct wlr_event_pointer_pinch_end wlr_event = {
|
||||
.device = &pointer->base,
|
||||
struct wlr_pointer_pinch_end_event wlr_event = {
|
||||
.pointer = pointer,
|
||||
.time_msec =
|
||||
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
|
||||
.cancelled = libinput_event_gesture_get_cancelled(gevent),
|
||||
@ -210,8 +210,8 @@ void handle_pointer_hold_begin(struct libinput_event *event,
|
||||
struct wlr_pointer *pointer) {
|
||||
struct libinput_event_gesture *gevent =
|
||||
libinput_event_get_gesture_event(event);
|
||||
struct wlr_event_pointer_hold_begin wlr_event = {
|
||||
.device = &pointer->base,
|
||||
struct wlr_pointer_hold_begin_event wlr_event = {
|
||||
.pointer = pointer,
|
||||
.time_msec =
|
||||
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
|
||||
.fingers = libinput_event_gesture_get_finger_count(gevent),
|
||||
@ -223,8 +223,8 @@ void handle_pointer_hold_end(struct libinput_event *event,
|
||||
struct wlr_pointer *pointer) {
|
||||
struct libinput_event_gesture *gevent =
|
||||
libinput_event_get_gesture_event(event);
|
||||
struct wlr_event_pointer_hold_end wlr_event = {
|
||||
.device = &pointer->base,
|
||||
struct wlr_pointer_hold_end_event wlr_event = {
|
||||
.pointer = pointer,
|
||||
.time_msec =
|
||||
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
|
||||
.cancelled = libinput_event_gesture_get_cancelled(gevent),
|
||||
|
@ -88,8 +88,8 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
|
||||
}
|
||||
|
||||
struct wlr_output *wlr_output = &pointer->output->wlr_output;
|
||||
struct wlr_event_pointer_motion_absolute event = {
|
||||
.device = &pointer->wlr_pointer.base,
|
||||
struct wlr_pointer_motion_absolute_event event = {
|
||||
.pointer = &pointer->wlr_pointer,
|
||||
.time_msec = time,
|
||||
.x = wl_fixed_to_double(sx) / wlr_output->width,
|
||||
.y = wl_fixed_to_double(sy) / wlr_output->height,
|
||||
@ -105,8 +105,8 @@ static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer,
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_event_pointer_button event = {
|
||||
.device = &pointer->wlr_pointer.base,
|
||||
struct wlr_pointer_button_event event = {
|
||||
.pointer = &pointer->wlr_pointer,
|
||||
.button = button,
|
||||
.state = state,
|
||||
.time_msec = time,
|
||||
@ -122,8 +122,8 @@ static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer,
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_event_pointer_axis event = {
|
||||
.device = &pointer->wlr_pointer.base,
|
||||
struct wlr_pointer_axis_event event = {
|
||||
.pointer = &pointer->wlr_pointer,
|
||||
.delta = wl_fixed_to_double(value),
|
||||
.delta_discrete = pointer->axis_discrete,
|
||||
.orientation = axis,
|
||||
@ -165,8 +165,8 @@ static void pointer_handle_axis_stop(void *data, struct wl_pointer *wl_pointer,
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_event_pointer_axis event = {
|
||||
.device = &pointer->wlr_pointer.base,
|
||||
struct wlr_pointer_axis_event event = {
|
||||
.pointer = &pointer->wlr_pointer,
|
||||
.delta = 0,
|
||||
.delta_discrete = 0,
|
||||
.orientation = axis,
|
||||
@ -211,8 +211,8 @@ static void gesture_swipe_begin(void *data,
|
||||
|
||||
pointer->fingers = fingers;
|
||||
|
||||
struct wlr_event_pointer_swipe_begin wlr_event = {
|
||||
.device = &pointer->wlr_pointer.base,
|
||||
struct wlr_pointer_swipe_begin_event wlr_event = {
|
||||
.pointer = &pointer->wlr_pointer,
|
||||
.time_msec = time,
|
||||
.fingers = fingers,
|
||||
};
|
||||
@ -228,8 +228,8 @@ static void gesture_swipe_update(void *data,
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_event_pointer_swipe_update wlr_event = {
|
||||
.device = &pointer->wlr_pointer.base,
|
||||
struct wlr_pointer_swipe_update_event wlr_event = {
|
||||
.pointer = &pointer->wlr_pointer,
|
||||
.time_msec = time,
|
||||
.fingers = pointer->fingers,
|
||||
.dx = wl_fixed_to_double(dx),
|
||||
@ -247,8 +247,8 @@ static void gesture_swipe_end(void *data,
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_event_pointer_swipe_end wlr_event = {
|
||||
.device = &pointer->wlr_pointer.base,
|
||||
struct wlr_pointer_swipe_end_event wlr_event = {
|
||||
.pointer = &pointer->wlr_pointer,
|
||||
.time_msec = time,
|
||||
.cancelled = cancelled,
|
||||
};
|
||||
@ -273,8 +273,8 @@ static void gesture_pinch_begin(void *data,
|
||||
|
||||
pointer->fingers = fingers;
|
||||
|
||||
struct wlr_event_pointer_pinch_begin wlr_event = {
|
||||
.device = &pointer->wlr_pointer.base,
|
||||
struct wlr_pointer_pinch_begin_event wlr_event = {
|
||||
.pointer = &pointer->wlr_pointer,
|
||||
.time_msec = time,
|
||||
.fingers = pointer->fingers,
|
||||
};
|
||||
@ -292,8 +292,8 @@ static void gesture_pinch_update(void *data,
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_event_pointer_pinch_update wlr_event = {
|
||||
.device = &pointer->wlr_pointer.base,
|
||||
struct wlr_pointer_pinch_update_event wlr_event = {
|
||||
.pointer = &pointer->wlr_pointer,
|
||||
.time_msec = time,
|
||||
.fingers = pointer->fingers,
|
||||
.dx = wl_fixed_to_double(dx),
|
||||
@ -313,8 +313,8 @@ static void gesture_pinch_end(void *data,
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_event_pointer_pinch_end wlr_event = {
|
||||
.device = &pointer->wlr_pointer.base,
|
||||
struct wlr_pointer_pinch_end_event wlr_event = {
|
||||
.pointer = &pointer->wlr_pointer,
|
||||
.time_msec = time,
|
||||
.cancelled = cancelled,
|
||||
};
|
||||
@ -339,8 +339,8 @@ static void gesture_hold_begin(void *data,
|
||||
|
||||
pointer->fingers = fingers;
|
||||
|
||||
struct wlr_event_pointer_hold_begin wlr_event = {
|
||||
.device = &pointer->wlr_pointer.base,
|
||||
struct wlr_pointer_hold_begin_event wlr_event = {
|
||||
.pointer = &pointer->wlr_pointer,
|
||||
.time_msec = time,
|
||||
.fingers = fingers,
|
||||
};
|
||||
@ -356,8 +356,8 @@ static void gesture_hold_end(void *data,
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_event_pointer_hold_end wlr_event = {
|
||||
.device = &pointer->wlr_pointer.base,
|
||||
struct wlr_pointer_hold_end_event wlr_event = {
|
||||
.pointer = &pointer->wlr_pointer,
|
||||
.time_msec = time,
|
||||
.cancelled = cancelled,
|
||||
};
|
||||
@ -381,8 +381,8 @@ static void relative_pointer_handle_relative_motion(void *data,
|
||||
|
||||
uint64_t time_usec = (uint64_t)utime_hi << 32 | utime_lo;
|
||||
|
||||
struct wlr_event_pointer_motion wlr_event = {
|
||||
.device = &pointer->wlr_pointer.base,
|
||||
struct wlr_pointer_motion_event wlr_event = {
|
||||
.pointer = &pointer->wlr_pointer,
|
||||
.time_msec = (uint32_t)(time_usec / 1000),
|
||||
.delta_x = wl_fixed_to_double(dx),
|
||||
.delta_y = wl_fixed_to_double(dy),
|
||||
|
@ -31,8 +31,8 @@ static void send_key_event(struct wlr_x11_backend *x11, uint32_t key,
|
||||
|
||||
static void send_button_event(struct wlr_x11_output *output, uint32_t key,
|
||||
enum wlr_button_state st, xcb_timestamp_t time) {
|
||||
struct wlr_event_pointer_button ev = {
|
||||
.device = &output->pointer.base,
|
||||
struct wlr_pointer_button_event ev = {
|
||||
.pointer = &output->pointer,
|
||||
.time_msec = time,
|
||||
.button = key,
|
||||
.state = st,
|
||||
@ -43,8 +43,8 @@ static void send_button_event(struct wlr_x11_output *output, uint32_t key,
|
||||
|
||||
static void send_axis_event(struct wlr_x11_output *output, int32_t delta,
|
||||
xcb_timestamp_t time) {
|
||||
struct wlr_event_pointer_axis ev = {
|
||||
.device = &output->pointer.base,
|
||||
struct wlr_pointer_axis_event ev = {
|
||||
.pointer = &output->pointer,
|
||||
.time_msec = time,
|
||||
.source = WLR_AXIS_SOURCE_WHEEL,
|
||||
.orientation = WLR_AXIS_ORIENTATION_VERTICAL,
|
||||
@ -58,8 +58,8 @@ static void send_axis_event(struct wlr_x11_output *output, int32_t delta,
|
||||
|
||||
static void send_pointer_position_event(struct wlr_x11_output *output,
|
||||
int16_t x, int16_t y, xcb_timestamp_t time) {
|
||||
struct wlr_event_pointer_motion_absolute ev = {
|
||||
.device = &output->pointer.base,
|
||||
struct wlr_pointer_motion_absolute_event ev = {
|
||||
.pointer = &output->pointer,
|
||||
.time_msec = time,
|
||||
.x = (double)x / output->wlr_output.width,
|
||||
.y = (double)y / output->wlr_output.height,
|
||||
|
@ -109,8 +109,8 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
||||
static void handle_cursor_motion(struct wl_listener *listener, void *data) {
|
||||
struct sample_cursor *cursor =
|
||||
wl_container_of(listener, cursor, cursor_motion);
|
||||
struct wlr_event_pointer_motion *event = data;
|
||||
wlr_cursor_move(cursor->cursor, event->device, event->delta_x,
|
||||
struct wlr_pointer_motion_event *event = data;
|
||||
wlr_cursor_move(cursor->cursor, &event->pointer->base, event->delta_x,
|
||||
event->delta_y);
|
||||
}
|
||||
|
||||
@ -118,8 +118,9 @@ static void handle_cursor_motion_absolute(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct sample_cursor *cursor =
|
||||
wl_container_of(listener, cursor, cursor_motion_absolute);
|
||||
struct wlr_event_pointer_motion_absolute *event = data;
|
||||
wlr_cursor_warp_absolute(cursor->cursor, event->device, event->x, event->y);
|
||||
struct wlr_pointer_motion_absolute_event *event = data;
|
||||
wlr_cursor_warp_absolute(cursor->cursor, &event->pointer->base, event->x,
|
||||
event->y);
|
||||
}
|
||||
|
||||
static void cursor_destroy(struct sample_cursor *cursor) {
|
||||
|
@ -112,8 +112,8 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
||||
static void handle_cursor_motion(struct wl_listener *listener, void *data) {
|
||||
struct sample_state *sample =
|
||||
wl_container_of(listener, sample, cursor_motion);
|
||||
struct wlr_event_pointer_motion *event = data;
|
||||
wlr_cursor_move(sample->cursor, event->device, event->delta_x,
|
||||
struct wlr_pointer_motion_event *event = data;
|
||||
wlr_cursor_move(sample->cursor, &event->pointer->base, event->delta_x,
|
||||
event->delta_y);
|
||||
}
|
||||
|
||||
@ -121,19 +121,19 @@ static void handle_cursor_motion_absolute(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct sample_state *sample =
|
||||
wl_container_of(listener, sample, cursor_motion_absolute);
|
||||
struct wlr_event_pointer_motion_absolute *event = data;
|
||||
struct wlr_pointer_motion_absolute_event *event = data;
|
||||
|
||||
sample->cur_x = event->x;
|
||||
sample->cur_y = event->y;
|
||||
|
||||
wlr_cursor_warp_absolute(sample->cursor, event->device, sample->cur_x,
|
||||
sample->cur_y);
|
||||
wlr_cursor_warp_absolute(sample->cursor, &event->pointer->base,
|
||||
sample->cur_x, sample->cur_y);
|
||||
}
|
||||
|
||||
static void handle_cursor_button(struct wl_listener *listener, void *data) {
|
||||
struct sample_state *sample =
|
||||
wl_container_of(listener, sample, cursor_button);
|
||||
struct wlr_event_pointer_button *event = data;
|
||||
struct wlr_pointer_button_event *event = data;
|
||||
|
||||
float (*color)[4];
|
||||
if (event->state == WLR_BUTTON_RELEASED) {
|
||||
@ -150,7 +150,7 @@ static void handle_cursor_button(struct wl_listener *listener, void *data) {
|
||||
static void handle_cursor_axis(struct wl_listener *listener, void *data) {
|
||||
struct sample_state *sample =
|
||||
wl_container_of(listener, sample, cursor_axis);
|
||||
struct wlr_event_pointer_axis *event = data;
|
||||
struct wlr_pointer_axis_event *event = data;
|
||||
|
||||
for (size_t i = 0; i < 3; ++i) {
|
||||
sample->default_color[i] += event->delta > 0 ? -0.05f : 0.05f;
|
||||
|
@ -45,22 +45,22 @@ struct wlr_pointer {
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct wlr_event_pointer_motion {
|
||||
struct wlr_input_device *device;
|
||||
struct wlr_pointer_motion_event {
|
||||
struct wlr_pointer *pointer;
|
||||
uint32_t time_msec;
|
||||
double delta_x, delta_y;
|
||||
double unaccel_dx, unaccel_dy;
|
||||
};
|
||||
|
||||
struct wlr_event_pointer_motion_absolute {
|
||||
struct wlr_input_device *device;
|
||||
struct wlr_pointer_motion_absolute_event {
|
||||
struct wlr_pointer *pointer;
|
||||
uint32_t time_msec;
|
||||
// From 0..1
|
||||
double x, y;
|
||||
};
|
||||
|
||||
struct wlr_event_pointer_button {
|
||||
struct wlr_input_device *device;
|
||||
struct wlr_pointer_button_event {
|
||||
struct wlr_pointer *pointer;
|
||||
uint32_t time_msec;
|
||||
uint32_t button;
|
||||
enum wlr_button_state state;
|
||||
@ -78,8 +78,8 @@ enum wlr_axis_orientation {
|
||||
WLR_AXIS_ORIENTATION_HORIZONTAL,
|
||||
};
|
||||
|
||||
struct wlr_event_pointer_axis {
|
||||
struct wlr_input_device *device;
|
||||
struct wlr_pointer_axis_event {
|
||||
struct wlr_pointer *pointer;
|
||||
uint32_t time_msec;
|
||||
enum wlr_axis_source source;
|
||||
enum wlr_axis_orientation orientation;
|
||||
@ -87,14 +87,14 @@ struct wlr_event_pointer_axis {
|
||||
int32_t delta_discrete;
|
||||
};
|
||||
|
||||
struct wlr_event_pointer_swipe_begin {
|
||||
struct wlr_input_device *device;
|
||||
struct wlr_pointer_swipe_begin_event {
|
||||
struct wlr_pointer *pointer;
|
||||
uint32_t time_msec;
|
||||
uint32_t fingers;
|
||||
};
|
||||
|
||||
struct wlr_event_pointer_swipe_update {
|
||||
struct wlr_input_device *device;
|
||||
struct wlr_pointer_swipe_update_event {
|
||||
struct wlr_pointer *pointer;
|
||||
uint32_t time_msec;
|
||||
uint32_t fingers;
|
||||
// Relative coordinates of the logical center of the gesture
|
||||
@ -102,20 +102,20 @@ struct wlr_event_pointer_swipe_update {
|
||||
double dx, dy;
|
||||
};
|
||||
|
||||
struct wlr_event_pointer_swipe_end {
|
||||
struct wlr_input_device *device;
|
||||
struct wlr_pointer_swipe_end_event {
|
||||
struct wlr_pointer *pointer;
|
||||
uint32_t time_msec;
|
||||
bool cancelled;
|
||||
};
|
||||
|
||||
struct wlr_event_pointer_pinch_begin {
|
||||
struct wlr_input_device *device;
|
||||
struct wlr_pointer_pinch_begin_event {
|
||||
struct wlr_pointer *pointer;
|
||||
uint32_t time_msec;
|
||||
uint32_t fingers;
|
||||
};
|
||||
|
||||
struct wlr_event_pointer_pinch_update {
|
||||
struct wlr_input_device *device;
|
||||
struct wlr_pointer_pinch_update_event {
|
||||
struct wlr_pointer *pointer;
|
||||
uint32_t time_msec;
|
||||
uint32_t fingers;
|
||||
// Relative coordinates of the logical center of the gesture
|
||||
@ -127,20 +127,20 @@ struct wlr_event_pointer_pinch_update {
|
||||
double rotation;
|
||||
};
|
||||
|
||||
struct wlr_event_pointer_pinch_end {
|
||||
struct wlr_input_device *device;
|
||||
struct wlr_pointer_pinch_end_event {
|
||||
struct wlr_pointer *pointer;
|
||||
uint32_t time_msec;
|
||||
bool cancelled;
|
||||
};
|
||||
|
||||
struct wlr_event_pointer_hold_begin {
|
||||
struct wlr_input_device *device;
|
||||
struct wlr_pointer_hold_begin_event {
|
||||
struct wlr_pointer *pointer;
|
||||
uint32_t time_msec;
|
||||
uint32_t fingers;
|
||||
};
|
||||
|
||||
struct wlr_event_pointer_hold_end {
|
||||
struct wlr_input_device *device;
|
||||
struct wlr_pointer_hold_end_event {
|
||||
struct wlr_pointer *pointer;
|
||||
uint32_t time_msec;
|
||||
bool cancelled;
|
||||
};
|
||||
|
@ -30,7 +30,7 @@ struct wlr_virtual_pointer_v1 {
|
||||
struct wlr_pointer pointer;
|
||||
struct wl_resource *resource;
|
||||
/* Vertical and horizontal */
|
||||
struct wlr_event_pointer_axis axis_event[2];
|
||||
struct wlr_pointer_axis_event axis_event[2];
|
||||
enum wl_pointer_axis axis;
|
||||
bool axis_valid[2];
|
||||
|
||||
|
@ -458,13 +458,13 @@ static void server_cursor_motion(struct wl_listener *listener, void *data) {
|
||||
* pointer motion event (i.e. a delta) */
|
||||
struct tinywl_server *server =
|
||||
wl_container_of(listener, server, cursor_motion);
|
||||
struct wlr_event_pointer_motion *event = data;
|
||||
struct wlr_pointer_motion_event *event = data;
|
||||
/* The cursor doesn't move unless we tell it to. The cursor automatically
|
||||
* handles constraining the motion to the output layout, as well as any
|
||||
* special configuration applied for the specific input device which
|
||||
* generated the event. You can pass NULL for the device if you want to move
|
||||
* the cursor around without any input. */
|
||||
wlr_cursor_move(server->cursor, event->device,
|
||||
wlr_cursor_move(server->cursor, &event->pointer->base,
|
||||
event->delta_x, event->delta_y);
|
||||
process_cursor_motion(server, event->time_msec);
|
||||
}
|
||||
@ -479,8 +479,9 @@ static void server_cursor_motion_absolute(
|
||||
* emits these events. */
|
||||
struct tinywl_server *server =
|
||||
wl_container_of(listener, server, cursor_motion_absolute);
|
||||
struct wlr_event_pointer_motion_absolute *event = data;
|
||||
wlr_cursor_warp_absolute(server->cursor, event->device, event->x, event->y);
|
||||
struct wlr_pointer_motion_absolute_event *event = data;
|
||||
wlr_cursor_warp_absolute(server->cursor, &event->pointer->base, event->x,
|
||||
event->y);
|
||||
process_cursor_motion(server, event->time_msec);
|
||||
}
|
||||
|
||||
@ -489,7 +490,7 @@ static void server_cursor_button(struct wl_listener *listener, void *data) {
|
||||
* event. */
|
||||
struct tinywl_server *server =
|
||||
wl_container_of(listener, server, cursor_button);
|
||||
struct wlr_event_pointer_button *event = data;
|
||||
struct wlr_pointer_button_event *event = data;
|
||||
/* Notify the client with pointer focus that a button press has occurred */
|
||||
wlr_seat_pointer_notify_button(server->seat,
|
||||
event->time_msec, event->button, event->state);
|
||||
@ -511,7 +512,7 @@ static void server_cursor_axis(struct wl_listener *listener, void *data) {
|
||||
* for example when you move the scroll wheel. */
|
||||
struct tinywl_server *server =
|
||||
wl_container_of(listener, server, cursor_axis);
|
||||
struct wlr_event_pointer_axis *event = data;
|
||||
struct wlr_pointer_axis_event *event = data;
|
||||
/* Notify the client with pointer focus of the axis event. */
|
||||
wlr_seat_pointer_notify_axis(server->seat,
|
||||
event->time_msec, event->orientation, event->delta,
|
||||
|
@ -431,7 +431,7 @@ static struct wlr_output *get_mapped_output(struct wlr_cursor_device *cursor_dev
|
||||
|
||||
static void handle_pointer_motion_absolute(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct wlr_event_pointer_motion_absolute *event = data;
|
||||
struct wlr_pointer_motion_absolute_event *event = data;
|
||||
struct wlr_cursor_device *device =
|
||||
wl_container_of(listener, device, motion_absolute);
|
||||
|
||||
@ -444,14 +444,14 @@ static void handle_pointer_motion_absolute(struct wl_listener *listener,
|
||||
}
|
||||
|
||||
static void handle_pointer_button(struct wl_listener *listener, void *data) {
|
||||
struct wlr_event_pointer_button *event = data;
|
||||
struct wlr_pointer_button_event *event = data;
|
||||
struct wlr_cursor_device *device =
|
||||
wl_container_of(listener, device, button);
|
||||
wlr_signal_emit_safe(&device->cursor->events.button, event);
|
||||
}
|
||||
|
||||
static void handle_pointer_axis(struct wl_listener *listener, void *data) {
|
||||
struct wlr_event_pointer_axis *event = data;
|
||||
struct wlr_pointer_axis_event *event = data;
|
||||
struct wlr_cursor_device *device = wl_container_of(listener, device, axis);
|
||||
wlr_signal_emit_safe(&device->cursor->events.axis, event);
|
||||
}
|
||||
@ -462,49 +462,49 @@ static void handle_pointer_frame(struct wl_listener *listener, void *data) {
|
||||
}
|
||||
|
||||
static void handle_pointer_swipe_begin(struct wl_listener *listener, void *data) {
|
||||
struct wlr_event_pointer_swipe_begin *event = data;
|
||||
struct wlr_pointer_swipe_begin_event *event = data;
|
||||
struct wlr_cursor_device *device = wl_container_of(listener, device, swipe_begin);
|
||||
wlr_signal_emit_safe(&device->cursor->events.swipe_begin, event);
|
||||
}
|
||||
|
||||
static void handle_pointer_swipe_update(struct wl_listener *listener, void *data) {
|
||||
struct wlr_event_pointer_swipe_update *event = data;
|
||||
struct wlr_pointer_swipe_update_event *event = data;
|
||||
struct wlr_cursor_device *device = wl_container_of(listener, device, swipe_update);
|
||||
wlr_signal_emit_safe(&device->cursor->events.swipe_update, event);
|
||||
}
|
||||
|
||||
static void handle_pointer_swipe_end(struct wl_listener *listener, void *data) {
|
||||
struct wlr_event_pointer_swipe_end *event = data;
|
||||
struct wlr_pointer_swipe_end_event *event = data;
|
||||
struct wlr_cursor_device *device = wl_container_of(listener, device, swipe_end);
|
||||
wlr_signal_emit_safe(&device->cursor->events.swipe_end, event);
|
||||
}
|
||||
|
||||
static void handle_pointer_pinch_begin(struct wl_listener *listener, void *data) {
|
||||
struct wlr_event_pointer_pinch_begin *event = data;
|
||||
struct wlr_pointer_pinch_begin_event *event = data;
|
||||
struct wlr_cursor_device *device = wl_container_of(listener, device, pinch_begin);
|
||||
wlr_signal_emit_safe(&device->cursor->events.pinch_begin, event);
|
||||
}
|
||||
|
||||
static void handle_pointer_pinch_update(struct wl_listener *listener, void *data) {
|
||||
struct wlr_event_pointer_pinch_update *event = data;
|
||||
struct wlr_pointer_pinch_update_event *event = data;
|
||||
struct wlr_cursor_device *device = wl_container_of(listener, device, pinch_update);
|
||||
wlr_signal_emit_safe(&device->cursor->events.pinch_update, event);
|
||||
}
|
||||
|
||||
static void handle_pointer_pinch_end(struct wl_listener *listener, void *data) {
|
||||
struct wlr_event_pointer_pinch_end *event = data;
|
||||
struct wlr_pointer_pinch_end_event *event = data;
|
||||
struct wlr_cursor_device *device = wl_container_of(listener, device, pinch_end);
|
||||
wlr_signal_emit_safe(&device->cursor->events.pinch_end, event);
|
||||
}
|
||||
|
||||
static void handle_pointer_hold_begin(struct wl_listener *listener, void *data) {
|
||||
struct wlr_event_pointer_hold_begin *event = data;
|
||||
struct wlr_pointer_hold_begin_event *event = data;
|
||||
struct wlr_cursor_device *device = wl_container_of(listener, device, hold_begin);
|
||||
wlr_signal_emit_safe(&device->cursor->events.hold_begin, event);
|
||||
}
|
||||
|
||||
static void handle_pointer_hold_end(struct wl_listener *listener, void *data) {
|
||||
struct wlr_event_pointer_hold_end *event = data;
|
||||
struct wlr_pointer_hold_end_event *event = data;
|
||||
struct wlr_cursor_device *device = wl_container_of(listener, device, hold_end);
|
||||
wlr_signal_emit_safe(&device->cursor->events.hold_end, event);
|
||||
}
|
||||
|
@ -29,9 +29,8 @@ static void virtual_pointer_motion(struct wl_client *client,
|
||||
if (pointer == NULL) {
|
||||
return;
|
||||
}
|
||||
struct wlr_input_device *wlr_dev = &pointer->pointer.base;
|
||||
struct wlr_event_pointer_motion event = {
|
||||
.device = wlr_dev,
|
||||
struct wlr_pointer_motion_event event = {
|
||||
.pointer = &pointer->pointer,
|
||||
.time_msec = time,
|
||||
.delta_x = wl_fixed_to_double(dx),
|
||||
.delta_y = wl_fixed_to_double(dy),
|
||||
@ -52,14 +51,13 @@ static void virtual_pointer_motion_absolute(struct wl_client *client,
|
||||
if (x_extent == 0 || y_extent == 0) {
|
||||
return;
|
||||
}
|
||||
struct wlr_input_device *wlr_dev = &pointer->pointer.base;
|
||||
struct wlr_event_pointer_motion_absolute event = {
|
||||
.device = wlr_dev,
|
||||
struct wlr_pointer_motion_absolute_event event = {
|
||||
.pointer = &pointer->pointer,
|
||||
.time_msec = time,
|
||||
.x = (double)x / x_extent,
|
||||
.y = (double)y / y_extent,
|
||||
};
|
||||
wlr_signal_emit_safe(&wlr_dev->pointer->events.motion_absolute, &event);
|
||||
wlr_signal_emit_safe(&pointer->pointer.events.motion_absolute, &event);
|
||||
}
|
||||
|
||||
static void virtual_pointer_button(struct wl_client *client,
|
||||
@ -70,14 +68,13 @@ static void virtual_pointer_button(struct wl_client *client,
|
||||
if (pointer == NULL) {
|
||||
return;
|
||||
}
|
||||
struct wlr_input_device *wlr_dev = &pointer->pointer.base;
|
||||
struct wlr_event_pointer_button event = {
|
||||
.device = wlr_dev,
|
||||
struct wlr_pointer_button_event event = {
|
||||
.pointer = &pointer->pointer,
|
||||
.time_msec = time,
|
||||
.button = button,
|
||||
.state = state ? WLR_BUTTON_PRESSED : WLR_BUTTON_RELEASED
|
||||
};
|
||||
wlr_signal_emit_safe(&wlr_dev->pointer->events.button, &event);
|
||||
wlr_signal_emit_safe(&pointer->pointer.events.button, &event);
|
||||
}
|
||||
|
||||
static void virtual_pointer_axis(struct wl_client *client,
|
||||
@ -94,10 +91,9 @@ static void virtual_pointer_axis(struct wl_client *client,
|
||||
if (pointer == NULL) {
|
||||
return;
|
||||
}
|
||||
struct wlr_input_device *wlr_dev = &pointer->pointer.base;
|
||||
pointer->axis = axis;
|
||||
pointer->axis_valid[pointer->axis] = true;
|
||||
pointer->axis_event[pointer->axis].device = wlr_dev;
|
||||
pointer->axis_event[pointer->axis].pointer = &pointer->pointer;
|
||||
pointer->axis_event[pointer->axis].time_msec = time;
|
||||
pointer->axis_event[pointer->axis].orientation = axis;
|
||||
pointer->axis_event[pointer->axis].delta = wl_fixed_to_double(value);
|
||||
@ -140,8 +136,7 @@ static void virtual_pointer_axis_source(struct wl_client *client,
|
||||
if (pointer == NULL) {
|
||||
return;
|
||||
}
|
||||
struct wlr_input_device *wlr_dev = &pointer->pointer.base;
|
||||
pointer->axis_event[pointer->axis].device = wlr_dev;
|
||||
pointer->axis_event[pointer->axis].pointer = &pointer->pointer;
|
||||
pointer->axis_event[pointer->axis].source = source;
|
||||
}
|
||||
|
||||
@ -158,10 +153,9 @@ static void virtual_pointer_axis_stop(struct wl_client *client,
|
||||
if (pointer == NULL) {
|
||||
return;
|
||||
}
|
||||
struct wlr_input_device *wlr_dev = &pointer->pointer.base;
|
||||
pointer->axis = axis;
|
||||
pointer->axis_valid[pointer->axis] = true;
|
||||
pointer->axis_event[pointer->axis].device = wlr_dev;
|
||||
pointer->axis_event[pointer->axis].pointer = &pointer->pointer;
|
||||
pointer->axis_event[pointer->axis].time_msec = time;
|
||||
pointer->axis_event[pointer->axis].orientation = axis;
|
||||
pointer->axis_event[pointer->axis].delta = 0;
|
||||
@ -182,10 +176,9 @@ static void virtual_pointer_axis_discrete(struct wl_client *client,
|
||||
if (pointer == NULL) {
|
||||
return;
|
||||
}
|
||||
struct wlr_input_device *wlr_dev = &pointer->pointer.base;
|
||||
pointer->axis = axis;
|
||||
pointer->axis_valid[pointer->axis] = true;
|
||||
pointer->axis_event[pointer->axis].device = wlr_dev;
|
||||
pointer->axis_event[pointer->axis].pointer = &pointer->pointer;
|
||||
pointer->axis_event[pointer->axis].time_msec = time;
|
||||
pointer->axis_event[pointer->axis].orientation = axis;
|
||||
pointer->axis_event[pointer->axis].delta = wl_fixed_to_double(value);
|
||||
|
Loading…
Reference in New Issue
Block a user