From fa88bebec1b984ff49e2b22ad91999d1e514d75e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 1 Jul 2012 11:35:52 +0000 Subject: [PATCH] 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 --- src/msw/display.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/msw/display.cpp b/src/msw/display.cpp index f9f6b15102..74b0e7bbd5 100644 --- a/src/msw/display.cpp +++ b/src/msw/display.cpp @@ -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 -- 2.45.2