fix bug that mouse wheel when displaying a msgbox(#411)
This commit is contained in:
parent
01b7f6ff09
commit
bd01cb447e
@ -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<native_window_type>(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);
|
||||
|
@ -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<HWND>(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<HWND>(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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user