From 8162bbd8e886d470bd33ed1d7a9480d845d25c4c Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Thu, 17 Sep 2020 18:23:56 -0400 Subject: [PATCH] Update Windows system font change handling (#66021) The engine now has an explicit API for system font changes, rather than expecting the WM_FONTCHANGE message to be forwarded to the Flutter view. --- .../templates/app/windows.tmpl/runner/flutter_window.cpp | 7 +++++++ .../templates/app/windows.tmpl/runner/win32_window.cpp | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/flutter_tools/templates/app/windows.tmpl/runner/flutter_window.cpp b/packages/flutter_tools/templates/app/windows.tmpl/runner/flutter_window.cpp index aa0deaf343..c422723045 100644 --- a/packages/flutter_tools/templates/app/windows.tmpl/runner/flutter_window.cpp +++ b/packages/flutter_tools/templates/app/windows.tmpl/runner/flutter_window.cpp @@ -53,5 +53,12 @@ FlutterWindow::MessageHandler(HWND hwnd, UINT const message, return *result; } } + + switch (message) { + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; + } + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); } diff --git a/packages/flutter_tools/templates/app/windows.tmpl/runner/win32_window.cpp b/packages/flutter_tools/templates/app/windows.tmpl/runner/win32_window.cpp index 549e7af9ad..efc3eb9f22 100644 --- a/packages/flutter_tools/templates/app/windows.tmpl/runner/win32_window.cpp +++ b/packages/flutter_tools/templates/app/windows.tmpl/runner/win32_window.cpp @@ -187,11 +187,6 @@ Win32Window::MessageHandler(HWND hwnd, SetFocus(child_content_); } return 0; - - // Messages that are directly forwarded to embedding. - case WM_FONTCHANGE: - SendMessage(child_content_, WM_FONTCHANGE, NULL, NULL); - return 0; } return DefWindowProc(window_handle_, message, wparam, lparam);