mirror of
https://codeberg.org/vyivel/dulcepan/
synced 2025-03-12 18:59:15 +02:00
seat: use correct serial when updating cursor shape
This commit is contained in:
parent
553147259b
commit
6f7dfab735
@ -88,6 +88,7 @@ struct dp_seat {
|
||||
struct xkb_keymap *xkb_keymap;
|
||||
struct xkb_state *xkb_state;
|
||||
|
||||
uint32_t pointer_serial;
|
||||
struct wp_cursor_shape_device_v1 *cursor_shape_device;
|
||||
|
||||
// The output the pointer is on
|
||||
|
26
src/seat.c
26
src/seat.c
@ -123,17 +123,17 @@ static enum wp_cursor_shape_device_v1_shape get_cursor_shape(struct dp_selection
|
||||
abort(); // Unreachable
|
||||
}
|
||||
|
||||
static void update_cursor(struct dp_seat *seat, uint32_t serial) {
|
||||
wp_cursor_shape_device_v1_set_shape(
|
||||
seat->cursor_shape_device, serial, get_cursor_shape(&seat->state->selection));
|
||||
static void update_cursor(struct dp_seat *seat) {
|
||||
wp_cursor_shape_device_v1_set_shape(seat->cursor_shape_device, seat->pointer_serial,
|
||||
get_cursor_shape(&seat->state->selection));
|
||||
}
|
||||
|
||||
static void process_position(struct dp_seat *seat, wl_fixed_t x, wl_fixed_t y, uint32_t serial) {
|
||||
static void process_position(struct dp_seat *seat, wl_fixed_t x, wl_fixed_t y) {
|
||||
struct dp_output *output = seat->ptr_output;
|
||||
seat->ptr_x = wl_fixed_to_double(x);
|
||||
seat->ptr_y = wl_fixed_to_double(y);
|
||||
dp_select_notify_pointer_position(&seat->state->selection, output, seat->ptr_x, seat->ptr_y);
|
||||
update_cursor(seat, serial);
|
||||
update_cursor(seat);
|
||||
}
|
||||
|
||||
static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
|
||||
@ -141,22 +141,24 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, uint
|
||||
struct dp_seat *seat = data;
|
||||
seat->ptr_output = wl_surface_get_user_data(surface);
|
||||
assert(seat->ptr_output != NULL);
|
||||
process_position(seat, sx, sy, serial);
|
||||
seat->pointer_serial = serial;
|
||||
process_position(seat, sx, sy);
|
||||
}
|
||||
|
||||
static void pointer_handle_leave(
|
||||
void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface) {
|
||||
struct dp_seat *seat = data;
|
||||
seat->ptr_output = NULL;
|
||||
seat->pointer_serial = serial;
|
||||
}
|
||||
|
||||
static void pointer_handle_motion(
|
||||
void *data, struct wl_pointer *wl_pointer, uint32_t serial, wl_fixed_t sx, wl_fixed_t sy) {
|
||||
static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer, uint32_t time_msec,
|
||||
wl_fixed_t sx, wl_fixed_t sy) {
|
||||
struct dp_seat *seat = data;
|
||||
if (seat->ptr_output == NULL) {
|
||||
return; // Shouldn't happen
|
||||
}
|
||||
process_position(seat, sx, sy, serial);
|
||||
process_position(seat, sx, sy);
|
||||
}
|
||||
|
||||
static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
|
||||
@ -164,6 +166,8 @@ static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer, uin
|
||||
struct dp_seat *seat = data;
|
||||
struct dp_state *state = seat->state;
|
||||
|
||||
seat->pointer_serial = serial;
|
||||
|
||||
struct dp_selection *selection = &state->selection;
|
||||
if (button_state != WL_POINTER_BUTTON_STATE_PRESSED) {
|
||||
if (selection->width > 0 && selection->height > 0 && state->config.quick_select) {
|
||||
@ -182,14 +186,14 @@ static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer, uin
|
||||
case BTN_RIGHT:
|
||||
dp_select_start_interactive(
|
||||
selection, seat->ptr_output, seat->ptr_x, seat->ptr_y, button == BTN_LEFT);
|
||||
update_cursor(seat, serial);
|
||||
update_cursor(seat);
|
||||
break;
|
||||
case BTN_MIDDLE:
|
||||
dp_select_whole(selection, seat->ptr_output);
|
||||
|
||||
// dp_select_whole() doesn't invalidate the interactive state, so do it manually
|
||||
dp_select_notify_pointer_position(selection, seat->ptr_output, seat->ptr_x, seat->ptr_y);
|
||||
update_cursor(seat, serial);
|
||||
update_cursor(seat);
|
||||
|
||||
if (state->config.quick_select) {
|
||||
state->status = DP_STATUS_SAVED;
|
||||
|
Loading…
x
Reference in New Issue
Block a user