cef139 Windows 11 white screen

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

cef139 Windows 11 white screen

Postby levili » Fri Sep 12, 2025 2:40 am

Has anyone encountered the following problem? How can I fix it?

In our project, on the Windows 11 system, calling hide() and then show() can sometimes result in a blank screen. This issue has not been encountered on Windows 10. Switching windows using alt+tab or resizing the window will restore the display.

The most common triggering paths are:
1. Pinning the CEF window to the taskbar
2. Completely covering the CEF window with another window
3. Calling hide() and then show()

It can also be easily reproduced in the Standard Distribution cefclient project.
levili
Newbie
 
Posts: 5
Joined: Thu Apr 24, 2025 7:53 am

Re: cef139 Windows 11 white screen

Postby ndesktop » Fri Sep 12, 2025 4:40 pm

Looks like some form of invalidating is needed. I won't say something like InvalidateRect/InvalidateRgn on the host HWND (it might not even work) but it might be a good idea at least to test if this is a fix. Alt-Tab or resize does this.
Running this with Spy++ attached and filtering the messages (WM_PAINT, WM_NCPAINT, WM_SETREDRAW etc.) might reveal what hide/show does not and what alt-tab does.
ndesktop
Master
 
Posts: 991
Joined: Thu Dec 03, 2015 10:10 am

Re: cef139 Windows 11 white screen

Postby levili » Tue Dec 02, 2025 8:23 am

This problem may be related to occlusion detection calculations

It started working properly after I added "--disable-features=CalculateNativeWinOcclusion" to the startup command
levili
Newbie
 
Posts: 5
Joined: Thu Apr 24, 2025 7:53 am

Re: cef139 Windows 11 white screen

Postby levili » Thu Dec 04, 2025 2:57 am

levili wrote:This problem may be related to occlusion detection calculations

It started working properly after I added "--disable-features=CalculateNativeWinOcclusion" to the startup command


I suspect that when the system event was received, the window wasn't fully displayed, causing it to be considered as obscured, which resulted in blank content being shown.
So I modified the code here for testing: I set the window text during window creation and added my window to the show and hide event conditions. It seems to be working properly now

void NativeWindowOcclusionTrackerWin::WindowOcclusionCalculator::
ProcessEventHookCallback(DWORD event,
HWND hwnd,
LONG id_object,
LONG id_child) {
......
if (event == EVENT_OBJECT_SHOW) {
if (showing_thumbnails_)
return;
wchar_t title[256];
GetWindowText(hwnd, title, 256);
std::wstring hwnd_text_name(title);
std::string hwnd_class_name = base::WideToUTF8(gfx::GetClassName(hwnd));
if ((hwnd_class_name == "MultitaskingViewFrame" ||
hwnd_class_name == "TaskListThumbnailWnd" ||
hwnd_text_name == L"Chrome Legacy Window MyWindow")) {
showing_thumbnails_ = true;
ui_thread_task_runner_->PostTask(
FROM_HERE, base::BindOnce(update_occlusion_state_callback_,
root_window_hwnds_occlusion_state_,
showing_thumbnails_));
}
return;
} else if (event == EVENT_OBJECT_HIDE) {
// Avoid getting the hwnd's class name, and recomputing occlusion, if not
// needed.
if (!showing_thumbnails_)
return;
wchar_t title[256];
GetWindowText(hwnd, title, 256);
std::wstring hwnd_text_name(title);
std::string hwnd_class_name = base::WideToUTF8(gfx::GetClassName(hwnd));
if (hwnd_class_name == "MultitaskingViewFrame" ||
hwnd_class_name == "TaskListThumbnailWnd" ||
hwnd_text_name == L"Chrome Legacy Window MyWindow") {
showing_thumbnails_ = false;
// Let occlusion calculation fix occlusion state, even though hwnd might
// be a popup window.
calculate_occlusion = true;
} else {
return;
}
}
......
task_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&WindowOcclusionCalculator::ScheduleOcclusionCalculationIfNeeded,
weak_factory_.GetWeakPtr()));
}
levili
Newbie
 
Posts: 5
Joined: Thu Apr 24, 2025 7:53 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 45 guests