diff --git a/source/gui/detail/bedrock_windows.cpp b/source/gui/detail/bedrock_windows.cpp index bd02a00d..baece504 100644 --- a/source/gui/detail/bedrock_windows.cpp +++ b/source/gui/detail/bedrock_windows.cpp @@ -1092,7 +1092,9 @@ namespace detail //The focus window receives the message in Windows system, it should be redirected to the hovered window ::POINT scr_pos{ pmdec.mouse.x, pmdec.mouse.y}; //Screen position auto pointer_wd = ::WindowFromPoint(scr_pos); - if (pointer_wd == root_window) + + //Ignore the message if the window is disabled. + if ((pointer_wd == root_window) && ::IsWindowEnabled(root_window)) { ::ScreenToClient(pointer_wd, &scr_pos); auto scrolled_wd = wd_manager.find_window(reinterpret_cast(pointer_wd), { scr_pos.x, scr_pos.y }); @@ -1124,7 +1126,7 @@ namespace detail wd_manager.do_lazy_refresh(scrolled_wd, false); } } - else + else if (pointer_wd != root_window) { DWORD pid = 0; ::GetWindowThreadProcessId(pointer_wd, &pid); diff --git a/source/gui/msgbox.cpp b/source/gui/msgbox.cpp index 7263aa84..3c9d691b 100644 --- a/source/gui/msgbox.cpp +++ b/source/gui/msgbox.cpp @@ -1,7 +1,7 @@ /* * A Message Box Class * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -453,7 +453,20 @@ namespace nana default: break; } - auto bt = ::MessageBoxW(reinterpret_cast(API::root(wd_)), to_wstring(sstream_.str()).c_str(), to_wstring(title_).c_str(), type); + //Disables the owner window to prevent the owner window processing mouse wheel event + //when the message box is showing and scroll the wheel on the owner window. + auto native = reinterpret_cast(API::root(wd_)); + BOOL enabled = FALSE; + if (native) + { + enabled = ::IsWindowEnabled(native); + if (enabled) + ::EnableWindow(native, FALSE); + } + auto bt = ::MessageBoxW(native, to_wstring(sstream_.str()).c_str(), to_wstring(title_).c_str(), type); + + if (native && enabled) + ::EnableWindow(native, TRUE); switch(bt) {