diff --git a/server/src/defines/defines.h b/server/src/defines/defines.h index d9f6621c..2b093db4 100644 --- a/server/src/defines/defines.h +++ b/server/src/defines/defines.h @@ -19,4 +19,5 @@ inline const UINT WM_DOUBLESINGLEBYTESWITCH = WM_USER + 107; inline const UINT UPDATE_FTB_STATUS = WM_USER + 108; inline const UINT WM_PIN_TO_TOP_CANDIDATE = WM_USER + 109; inline const UINT WM_COMMIT_CANDIDATE = WM_USER + 110; -inline const UINT WM_CLEAR_IME_ENGINE_CACHE = WM_USER + 111; \ No newline at end of file +inline const UINT WM_CLEAR_IME_ENGINE_CACHE = WM_USER + 111; +inline const UINT WM_REFRESH_MENU_SIZE = WM_USER + 112; diff --git a/server/src/webview2/windows_webview2.cpp b/server/src/webview2/windows_webview2.cpp index c7729d31..21e7da9c 100644 --- a/server/src/webview2/windows_webview2.cpp +++ b/server/src/webview2/windows_webview2.cpp @@ -732,6 +732,21 @@ HRESULT OnControllerCreatedMenuWnd( // GetClientRect(hwnd, &bounds); webviewControllerMenuWnd->put_Bounds(bounds); + EventRegistrationToken menuNavigationCompletedToken{}; + webviewMenuWnd->add_NavigationCompleted( + Microsoft::WRL::Callback( + [hwnd](ICoreWebView2 *sender, ICoreWebView2NavigationCompletedEventArgs *args) -> HRESULT { + BOOL success = FALSE; + if (!args || FAILED(args->get_IsSuccess(&success)) || !success) + { + return S_OK; + } + PostMessage(hwnd, WM_REFRESH_MENU_SIZE, 0, 0); + return S_OK; + }) + .Get(), + &menuNavigationCompletedToken); + // Navigate to HTML HRESULT hr = webviewMenuWnd->NavigateToString(::HTMLStringMenuWnd.c_str()); if (FAILED(hr)) @@ -770,6 +785,11 @@ HRESULT OnControllerCreatedMenuWnd( // OpenSettingsApplication(); ShowWindow(::global_hwnd_menu, SW_HIDE); } + else if (type == "emojiSymbols") + { + OpenEmojiPanelApplication(); + ShowWindow(::global_hwnd_menu, SW_HIDE); + } } return S_OK; }) diff --git a/server/src/window/ime_windows.cpp b/server/src/window/ime_windows.cpp index 1d7a4f2d..13c844bc 100644 --- a/server/src/window/ime_windows.cpp +++ b/server/src/window/ime_windows.cpp @@ -697,6 +697,10 @@ LRESULT CALLBACK WndProcMenuWindow(HWND hwnd, UINT message, WPARAM wParam, LPARA break; } + case WM_REFRESH_MENU_SIZE: + SetTimer(hwnd, TIMER_ID_INIT_WEBVIEW_MENU, 1, nullptr); + return 0; + case WM_TIMER: { if (wParam == TIMER_ID_INIT_WEBVIEW_MENU) {