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()));
}