From 6fed2f8e5816765b6a99a9e3dbf87e4229eb5800 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Thu, 21 Mar 2024 09:16:01 -0400 Subject: win32: fix native key repeat support win32 does not respect --native-keyrepeat option, and native key repeat has been broken since 0ab3482f73a199b2e839ad4ec0a4b21adc1e75d5. This lets mpv respect the --native-keyrepeat option on win32. --- video/out/w32_common.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'video/out') diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 50e07ec9a9..66d1fc4701 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -502,10 +502,6 @@ static bool handle_appcommand(struct vo_w32_state *w32, UINT cmd) static void handle_key_down(struct vo_w32_state *w32, UINT vkey, UINT scancode) { - // Ignore key repeat - if (scancode & KF_REPEAT) - return; - int mpkey = mp_w32_vkey_to_mpkey(vkey, scancode & KF_EXTENDED); if (!mpkey) { mpkey = decode_key(w32, vkey, scancode & (0xff | KF_EXTENDED)); @@ -513,7 +509,8 @@ static void handle_key_down(struct vo_w32_state *w32, UINT vkey, UINT scancode) return; } - mp_input_put_key(w32->input_ctx, mpkey | mod_state(w32) | MP_KEY_STATE_DOWN); + int state = w32->opts->native_keyrepeat ? 0 : MP_KEY_STATE_DOWN; + mp_input_put_key(w32->input_ctx, mpkey | mod_state(w32) | state); } static void handle_key_up(struct vo_w32_state *w32, UINT vkey, UINT scancode) -- cgit v1.2.3