From 34055919f5c7b0843ea4c938b2f0043958864708 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Wed, 28 Feb 2024 14:19:20 -0500 Subject: wayland_common: toplevel resize fixes Explicitly send an UP event after the client finishes a resize for touch event, don't resize if locked_size is set for touch event, and use the correct type for resize edges. --- video/out/wayland_common.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'video') diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 3b69f60947..c7314cb144 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -306,7 +306,7 @@ static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer, if (button) mp_input_put_key(wl->vo->input_ctx, button | state | s->mpmod); - uint32_t edges; + enum xdg_toplevel_resize_edge edges; if (!mp_input_test_dragging(wl->vo->input_ctx, wl->mouse_x, wl->mouse_y) && !wl->locked_size && (button == MP_MBTN_LEFT) && (state == MP_KEY_STATE_DOWN) && !wl->vo_opts->border && check_for_resize(wl, wl->opts->edge_pixels_pointer, &edges)) @@ -429,19 +429,21 @@ static void touch_handle_down(void *data, struct wl_touch *wl_touch, wl->mouse_x = wl_fixed_to_int(x_w) * wl->scaling; wl->mouse_y = wl_fixed_to_int(y_w) * wl->scaling; + mp_input_set_mouse_pos(wl->vo->input_ctx, wl->mouse_x, wl->mouse_y); + mp_input_put_key(wl->vo->input_ctx, MP_MBTN_LEFT | MP_KEY_STATE_DOWN); + enum xdg_toplevel_resize_edge edge; if (!mp_input_test_dragging(wl->vo->input_ctx, wl->mouse_x, wl->mouse_y) && - check_for_resize(wl, wl->opts->edge_pixels_touch, &edge)) + !wl->locked_size && check_for_resize(wl, wl->opts->edge_pixels_touch, &edge)) { xdg_toplevel_resize(wl->xdg_toplevel, s->seat, serial, edge); + // Explicitly send an UP event after the client finishes a resize + mp_input_put_key(wl->vo->input_ctx, MP_MBTN_LEFT | MP_KEY_STATE_UP); } else { // Save the serial and seat for voctrl-initialized dragging requests. s->pointer_serial = serial; wl->last_button_seat = s; } - - mp_input_set_mouse_pos(wl->vo->input_ctx, wl->mouse_x, wl->mouse_y); - mp_input_put_key(wl->vo->input_ctx, MP_MBTN_LEFT | MP_KEY_STATE_DOWN); } static void touch_handle_up(void *data, struct wl_touch *wl_touch, -- cgit v1.2.3