From 3739d1318fdb658bb6037bfe06bb6cefb3b50a09 Mon Sep 17 00:00:00 2001 From: pavelxdd Date: Tue, 13 Dec 2016 06:29:50 +0300 Subject: win32: update the fullscreen state on restoring If a maximized window restored from fullscreen, the fullscreen state needs to be updated manually. --- video/out/w32_common.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 4ff8d7b5bd..287bb24618 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -101,6 +101,7 @@ struct vo_w32_state { bool window_bounds_initialized; bool current_fs; + bool toggle_fs; // whether the current fullscreen state needs to be switched // currently known window state int window_x; @@ -814,6 +815,12 @@ static bool snap_to_screen_edges(struct vo_w32_state *w32, RECT *rc) return true; } +static void toggle_fullscreen(struct vo_w32_state *w32) +{ + w32->toggle_fs = true; + signal_events(w32, VO_EVENT_FULLSCREEN_STATE); +} + static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { @@ -932,6 +939,12 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, return 0; } break; + case SC_RESTORE: + if (IsMaximized(w32->window) && w32->current_fs) { + toggle_fullscreen(w32); + return 0; + } + break; } break; case WM_NCHITTEST: @@ -1271,9 +1284,10 @@ static void reinit_window_state(struct vo_w32_state *w32) if (w32->parent) return; - bool new_fs = w32->opts->fullscreen; + bool new_fs = w32->toggle_fs ? !w32->current_fs : w32->opts->fullscreen; bool toggle_fs = w32->current_fs != new_fs; w32->current_fs = new_fs; + w32->toggle_fs = false; if (w32->taskbar_list) { ITaskbarList2_MarkFullscreenWindow(w32->taskbar_list, @@ -1695,6 +1709,9 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg) case VOCTRL_BORDER: reinit_window_state(w32); return VO_TRUE; + case VOCTRL_GET_FULLSCREEN: + *(bool *)arg = w32->toggle_fs != w32->current_fs; + return VO_TRUE; case VOCTRL_GET_UNFS_WINDOW_SIZE: { int *s = arg; @@ -1794,6 +1811,8 @@ static void do_control(void *ptr) w32->vo->dwidth = w32->dw; w32->vo->dheight = w32->dh; } + if (*events & VO_EVENT_FULLSCREEN_STATE) + reinit_window_state(w32); } int vo_w32_control(struct vo *vo, int *events, int request, void *arg) @@ -1807,6 +1826,8 @@ int vo_w32_control(struct vo *vo, int *events, int request, void *arg) vo->dheight = w32->dh; mp_dispatch_unlock(w32->dispatch); } + if (*events & VO_EVENT_FULLSCREEN_STATE) + reinit_window_state(w32); return VO_TRUE; } else { int r; -- cgit v1.2.3