diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2021-05-27 12:07:28 +0300 |
---|---|---|
committer | avih <avih@users.noreply.github.com> | 2021-05-27 13:49:07 +0300 |
commit | 89684976acdfae7fdcec9a1b1819ab7f19012332 (patch) | |
tree | ac869ccb63e6cfdbdf78290441ff4dc7158c8d2b /video/out | |
parent | 6abb7e385f8f2f22511da13fe506a2cbdf7f5584 (diff) | |
download | mpv-89684976acdfae7fdcec9a1b1819ab7f19012332.tar.bz2 mpv-89684976acdfae7fdcec9a1b1819ab7f19012332.tar.xz |
win32: support the property 'focused'
And also change the existing WM_KILLFOCUS handler to return 0 instead
of 'break' (which later calls DefWindowProcW), as MSDN says we should
do for WM_{KILL,SET}FOCUS.
It seems that the 'focused' property is now supported by all main VOs:
x11, macOS, wayland, Windows.
TCT/sixel/caca probably don't support it, and unknown with SDL.
Fixes #8868
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/w32_common.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c index c819803a63..86334688be 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -97,6 +97,8 @@ struct vo_w32_state { // Has the window seen a WM_DESTROY? If so, don't call DestroyWindow again. bool destroyed; + bool focused; + // whether the window position and size were intialized bool window_bounds_initialized; @@ -1210,7 +1212,13 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, break; case WM_KILLFOCUS: mp_input_put_key(w32->input_ctx, MP_INPUT_RELEASE_ALL); - break; + w32->focused = false; + signal_events(w32, VO_EVENT_FOCUS); + return 0; + case WM_SETFOCUS: + w32->focused = true; + signal_events(w32, VO_EVENT_FOCUS); + return 0; case WM_SETCURSOR: // The cursor should only be hidden if the mouse is in the client area // and if the window isn't in menu mode (HIWORD(lParam) is non-zero) @@ -1785,6 +1793,9 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg) return p->len ? VO_TRUE : VO_FALSE; } return VO_FALSE; + case VOCTRL_GET_FOCUSED: + *(bool *)arg = w32->focused; + return VO_TRUE; } return VO_NOTIMPL; } |