From d43c2fabc6e807888a7b53f0b68080eb89d67b69 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Mon, 4 May 2015 03:10:50 +0800 Subject: [PATCH] fix an issue that menu is closed unexpected if form is modal --- source/gui/detail/win32/bedrock.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/gui/detail/win32/bedrock.cpp b/source/gui/detail/win32/bedrock.cpp index 71ae2f02..a0706ff8 100644 --- a/source/gui/detail/win32/bedrock.cpp +++ b/source/gui/detail/win32/bedrock.cpp @@ -392,8 +392,7 @@ namespace detail while (::PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) break; - - if ((msg.message == WM_CHAR || msg.message == WM_KEYDOWN || msg.message == WM_KEYUP) || !::IsDialogMessage(native_handle, &msg)) + if ((WM_KEYFIRST <= msg.message && msg.message <= WM_KEYLAST) || !::IsDialogMessage(native_handle, &msg)) { auto menu_wd = get_menu(reinterpret_cast(msg.hwnd), true); if (menu_wd) interior_helper_for_menu(msg, menu_wd); @@ -1359,6 +1358,7 @@ namespace detail { //Don't call default window proc to avoid popuping system menu. def_window_proc = false; + bool set_focus = (brock.focus() != msgwnd) && (!msgwnd->root_widget->flags.ignore_menubar_focus); if (set_focus) brock.wd_manager.set_focus(msgwnd, false);