From bde63fe092a9eb285b92834cfe403df17018d04d Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Tue, 19 Aug 2025 19:02:56 -0400 Subject: [PATCH] wayland_common: handle wayland events in VOCTRL_CHECK_EVENTS VOCTRL_CHECK_EVENTS is used to handle input and redraw events, so it is necessary to check the input events from the windows system when this is called. X11 already does this, and win32 does not need to do this since the input events are processed in the UI thread, not VO thread. However, this is not done on wayland. On wayland, input events are only processed in vo_wayland_wait_frame and vo_wayland_wait_events. If Vulkan gpu api is used, then vo_wayland_wait_frame is only called in wayland_vk_swap_buffers, and only when using the internal vsync, and not when fifo protocol is being used. vo_wayland_wait_events is only called in wait_vo. However, unlike VOCTRL_CHECK_EVENTS which is sent on every VO render loop, wait_vo is not called when the VO has a frame to redraw immediately, which can happen often in display-sync modes. In the worst case, this is never called. All of the above result in situations where inputs and other wayland events not being handled in time while not rendering, or rapid rendering with wayland internal vsync disabled. Fix this by checking wayland events in VOCTRL_CHECK_EVENTS, similar to X11, to make sure these events are handled. --- video/out/wayland_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 3d0227e864..3f924c172d 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -3919,6 +3919,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg) switch (request) { case VOCTRL_CHECK_EVENTS: { + wayland_dispatch_events(wl, 1, 0); struct vo_wayland_seat *seat; wl_list_for_each(seat, &wl->seat_list, link) { check_fd(wl, seat->dnd_offer, true);