]> git.saurik.com Git - wxWidgets.git/commitdiff
Implement wxFindWindowAtPoint() correctly for wxOSX/Carbon.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 5 Nov 2009 14:59:14 +0000 (14:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 5 Nov 2009 14:59:14 +0000 (14:59 +0000)
Use Carbon FindWindow() function instead of the generic wx version which
doesn't take the relative windows Z-order into account correctly.

Closes #11412.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62559 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/utils_osx.cpp

index 8a612a66dafe954942253f27918e4db7a3c08a11..20d791b1a7373967f6af31d6d7f1c1f2873d062d 100644 (file)
@@ -154,9 +154,31 @@ wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
     return new wxEventLoop;
 }
 
+wxNonOwnedWindow *wxFindWindowFromWXWindow(WXWindow inWindowRef);
+wxWindow* wxFindWindowAtPoint(wxWindow* win, const wxPoint& pt);
+
 wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
 {
-    return wxGenericFindWindowAtPoint(pt);
+#if wxOSX_USE_CARBON
+
+    Point screenPoint = { pt.y , pt.x };
+    WindowRef windowRef;
+
+    if ( FindWindow( screenPoint , &windowRef ) )
+    {
+        wxNonOwnedWindow *nonOwned = wxFindWindowFromWXWindow( windowRef );
+
+        if ( nonOwned )
+            return wxFindWindowAtPoint( nonOwned , pt );
+    }
+
+    return NULL;
+
+#else
+
+    return wxGenericFindWindowAtPoint( pt );
+
+#endif
 }
 
 /*