]> git.saurik.com Git - wxWidgets.git/commitdiff
Implement wxDisplay::GetFromWindow() for wxGTK/Windows.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 1 Jul 2012 11:35:52 +0000 (11:35 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 1 Jul 2012 11:35:52 +0000 (11:35 +0000)
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

index f9f6b15102cfabbd269ff29fd349f694401a9c6a..74b0e7bbd5ce04246588234171d74828d7d7486e 100644 (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