1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-19 09:57:34 +00:00

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
This commit is contained in:
Kacper Michajłow 2023-10-04 19:53:46 +02:00 committed by sfan5
parent 817c6f9cb7
commit d17db1367a

View File

@ -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",
});
}