Fix DWM frame glitches during fullscreen - #1217
Conversation
|
Какой-то "плохой" подход с созданием временного окна для перекрытия основного чтобы не видеть "артефакты". |
|
Тоже самое касается задания стиля WS_POPUP для полноэкранного окна - зачем ? |
|
DWM-cloak только с 8 винды поддерживается. |
|
Я проверил - подтверждаю что артефакты ушли и стало "хорошо". Но надо еще как-то протестировать начиная с Win 7 и заканчивая Win 10. |
b92459e to
171d0ef
Compare
|
I've substantially reduced the patch based on your feedback. The temporary cover HWND, WS_POPUP conversion, DWM transition changes, style preservation machinery, tray changes and other unrelated modifications have all been removed. While isolating the issue, I instrumented the fullscreen transition. One failed approach using SW_HIDE showed why simply hiding the window isn't viable: the main HWND could become visible at 2560×1440 while the child view was still at its previous windowed size, producing the upper-left stale content until the following WM_SIZE. The revised patch now uses only DWMWA_CLOAK on Windows 8+ around MPC-BE's existing fullscreen transition. The normal style/layout implementation is otherwise unchanged, and Windows 7 follows the original path. This eliminated the original artifact in my testing without introducing the intermediate layout problem. |
171d0ef to
213a296
Compare
|
Updated again after testing the reduced implementation across video, audio-only, The earlier cloak-only revision fixed the video case, but further testing showed While isolating this, I also tested forced synchronous repainting, but that was The final revision therefore remains minimal:
No cover window, Retested successfully with video, audio-only media, and no media loaded. |
|
Comfirm - all is ok now. |
|
It's final code ? |
до2026-08-09.10-37-25.mp4после2026-08-09.02-57-30.mp4Это исправило перерисовку рамки и верхней левой четверти в полноэкранном режиме для всех трёх сценариев: пустой плеер, загруженное видео, аудио. Изначально исправление затрагивало только видео, поэтому его пришлось доработать. Теперь я займусь проблемой с белым содержимым при восстановлении окна из системного трея. |
Summary
Fixes fullscreen transition composition artifacts by temporarily cloaking the
main window while MPC-BE performs its existing fullscreen style/layout
transition, then waiting for the compositor to reach the completed presentation
state before revealing it again.
Problem
On the affected Windows 11 system, switching between windowed and fullscreen
mode can expose intermediate window states.
Depending on the playback state, this can appear as:
of the fullscreen window.
The issue is reproducible not only during video playback, but also with
audio-only media and with no media loaded.
Investigation
Several smaller approaches were tested while isolating the problem.
Simply performing the style and geometry changes atomically was insufficient.
Temporarily hiding the main HWND prevented the original frame corruption, but
introduced another issue. Instrumentation showed that during fullscreen entry
the main window could already be at its final fullscreen dimensions while the
child view still retained its previous windowed dimensions until the subsequent
layout/WM_SIZE processing completed.
This produced the transient upper-left content.
Using
SW_HIDEis therefore unsuitable because it changes the logicalvisibility of the window and interferes with the normal child/layout path.
Fix
On Windows 8 and later:
unchanged.
MoveVideoWindow()/ layout processing to complete.DwmFlush()while the HWND is still cloaked so pending compositorupdates reach their presentation point.
This keeps the window logically visible throughout the transition, allowing
normal MFC and child-window layout processing to run, while preventing DWM from
presenting the intermediate state.
Windows 7 continues through MPC-BE's original path unchanged.
Scope
The patch intentionally does not introduce:
WS_POPUP;SW_HIDE/SW_SHOW;RedrawWindow()calls;Only the fullscreen transition composition is affected.
Testing
Tested on Windows 11 x64 in all of these states:
The corrupted frame and upper-left intermediate-content artifacts are no longer
visible in these cases, and window activation/focus remains functional.
Before
2026-08-09.10-37-25.mp4
After
2026-08-09.02-57-30.mp4