summaryrefslogtreecommitdiffstats
path: root/video/out/w32_common.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-10-04 19:53:46 +0200
committersfan5 <sfan5@live.de>2023-10-05 17:10:23 +0200
commitd17db1367affa954f5c52c793840b667527d88d3 (patch)
treecdf8d32c100a9de38f1d32e89974477c79a343b3 /video/out/w32_common.c
parent817c6f9cb72301469e9df13d327bdae75d2d8e76 (diff)
downloadmpv-d17db1367affa954f5c52c793840b667527d88d3.tar.bz2
mpv-d17db1367affa954f5c52c793840b667527d88d3.tar.xz
win32: clear client area to black early
This fixes white background appearing for short period of time before first frame is drawn. Clear to black as this is way less distracting than bright white flash. Borderless window and fullscreen seems to be initially not drawn/transparent, so no need to clear it to black. Only when decorations are enabled (--border) the issue happens. Fixes: #12549
Diffstat (limited to 'video/out/w32_common.c')
-rw-r--r--video/out/w32_common.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index ecb33d2479..5e3f7b4808 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -1141,8 +1141,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
}
switch (message) {
- case WM_ERASEBKGND: // no need to erase background separately
- return 1;
+ case WM_ERASEBKGND:
+ if (!w32->parent && (!w32->opts->border || w32->current_fs))
+ return TRUE;
+ break;
case WM_PAINT:
signal_events(w32, VO_EVENT_EXPOSE);
break;
@@ -1446,6 +1448,7 @@ static void register_window_class(void)
.hInstance = HINST_THISCOMPONENT,
.hIcon = LoadIconW(HINST_THISCOMPONENT, L"IDI_ICON1"),
.hCursor = LoadCursor(NULL, IDC_ARROW),
+ .hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH),
.lpszClassName = L"mpv",
});
}