Implement wxDisplay::GetFromWindow() for wxGTK/Windows.

As wxWindow doesn't have an associated HWND when using wxGTK, use
MonitorFromPoint() instead of MonitorFromWindow() for this port.

Closes #14408.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71912 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-07-01 11:35:52 +00:00
parent 7462bddbaf
commit fa88bebec1

View File

@ -608,8 +608,16 @@ int wxDisplayFactoryMSW::GetFromPoint(const wxPoint& pt)
int wxDisplayFactoryMSW::GetFromWindow(const wxWindow *window)
{
#ifdef __WXMSW__
return FindDisplayFromHMONITOR(gs_MonitorFromWindow(GetHwndOf(window),
MONITOR_DEFAULTTONULL));
#else
const wxSize halfsize = window->GetSize() / 2;
wxPoint pt = window->GetScreenPosition();
pt.x += halfsize.x;
pt.y += halfsize.y;
return GetFromPoint(pt);
#endif
}
#endif // wxUSE_DISPLAY