]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/popupcmn.cpp
Fix tracking rectangles in 64-bit build by remembering the tag as the 64-bit integer...
[wxWidgets.git] / src / common / popupcmn.cpp
index 395374ad6619762ac16f29c95c664abe7bb4d165..57ba86c0a00314f91dbcd0111c7fbdc282a7b5da 100644 (file)
     #include "wx/log.h"
 #endif //WX_PRECOMP
 
+#include "wx/recguard.h"
+
 #ifdef __WXUNIVERSAL__
     #include "wx/univ/renderer.h"
-#if wxUSE_SCROLLBAR
     #include "wx/scrolbar.h"
-#endif
 #endif // __WXUNIVERSAL__
 
 #ifdef __WXGTK__
@@ -151,7 +151,18 @@ void wxPopupWindowBase::Position(const wxPoint& ptOrigin,
     }
 
     // now check left/right too
-    wxCoord x = ptOrigin.x + size.x;
+    wxCoord x = ptOrigin.x;
+            
+    if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft )
+    {
+        // shift the window to the left instead of the right.
+        x -= size.x;
+        x -= sizeSelf.x;        // also shift it by window width.
+    }
+    else
+        x += size.x;
+
+    
     if ( x + sizeSelf.x > sizeScreen.x )
     {
         // check if there is enough space to the left
@@ -563,6 +574,16 @@ void wxPopupFocusHandler::OnKillFocus(wxFocusEvent& event)
 
 void wxPopupFocusHandler::OnKeyDown(wxKeyEvent& event)
 {
+    // we can be associated with the popup itself in which case we should avoid
+    // infinite recursion
+    static int s_inside;
+    wxRecursionGuard guard(s_inside);
+    if ( guard.IsInside() )
+    {
+        event.Skip();
+        return;
+    }
+
     // let the window have it first, it might process the keys
     if ( !m_popup->GetEventHandler()->ProcessEvent(event) )
     {