summaryrefslogtreecommitdiffstats
path: root/video/out/w32_common.c
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2024-02-28 00:07:33 -0500
committersfan5 <sfan5@live.de>2024-03-01 18:25:12 +0100
commitfb02626cd9d975f717a0d74652e5f4d22429d66d (patch)
tree73ac1819f755877d66c7ef63cd6f297c1d4e7777 /video/out/w32_common.c
parent4b8c47d20bc2cb5196a693d72483d6c6481c62b3 (diff)
downloadmpv-fb02626cd9d975f717a0d74652e5f4d22429d66d.tar.bz2
mpv-fb02626cd9d975f717a0d74652e5f4d22429d66d.tar.xz
w32_common: make dragging asynchronous
VOCTRLs are processed in the GUI thread through the mp_dispatch mechanism. Window dragging requests are asynchronous on x11 and wayland, so the item is processed quickly without problem. However, currently win32 uses the SendMessage call for this, which is synchronous. This causes the playback to stop while the dragging request is being processed because the dispatch queue is blocked. Work around this by setting a flag instead if the window dragging is requested, and immediately starts dragging after processing the dispatch queue. This doesn't block the dispatch queue while also avoiding any extra latency added by the Windows message queue.
Diffstat (limited to 'video/out/w32_common.c')
-rw-r--r--video/out/w32_common.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index 24efce1dd3..eb9f18948a 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -181,6 +181,7 @@ struct vo_w32_state {
bool cleared;
bool dragging;
+ bool start_dragging;
BOOL win_arranging;
bool conversion_mode_init;
@@ -1262,6 +1263,12 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
mp_dispatch_queue_process(w32->dispatch, 0);
w32->in_dispatch = false;
}
+ // Start window dragging if the flag is set by the voctrl.
+ // This is processed here to avoid blocking the dispatch queue.
+ if (w32->start_dragging) {
+ w32->start_dragging = false;
+ begin_dragging(w32);
+ }
switch (message) {
case WM_ERASEBKGND:
@@ -2165,7 +2172,7 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg)
*(bool *)arg = w32->focused;
return VO_TRUE;
case VOCTRL_BEGIN_DRAGGING:
- begin_dragging(w32);
+ w32->start_dragging = true;
return VO_TRUE;
}
return VO_NOTIMPL;