-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Description
Right now actions like displaying a MessageBox will prevent TaskRunnerWin32 from processing flutter platform thread tasks. That is because it currently relies on the outer event loop calling FlutterDesktopEngineProcessMessages whenever TaskRunnerWin32 post message to thread queue. However during modal dialogs, popup menus, etc the outer message loop is essential stuck in DispatchMessage and will not process thread messages.
The solution to this would be for TaskRunner to use a hidden window (created on main thread), which can be woken up from EnqueueTask, and by WM_TIMER when scheduling delayed tasks. This way everything can be handled transparently by TaskRunnerWin32 and the outer loop can essentialy become idiomatic
while ((ret = GetMessage(&msg, nullptr, 0, 0)) != 0)
{
if (ret == -1){
// handle the error and possibly exit
} else {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}with no need to call FlutterDesktopEngineProcessMessages anymore. ProcessTasks will be called from DispatchMessage as necessary.