win32: update the fullscreen state on restoring

If a maximized window restored from fullscreen,
the fullscreen state needs to be updated manually.
This commit is contained in:
pavelxdd 2016-12-13 06:29:50 +03:00 committed by James Ross-Gowan
parent 8432514c5f
commit 3739d1318f
1 changed files with 22 additions and 1 deletions

View File

@ -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;