]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/popupcmn.cpp
Applied patch [ 1117207 ] changed the test for SQL_C_WCHAR
[wxWidgets.git] / src / common / popupcmn.cpp
index 0c94b3838d6197bfdda31076aa0599e2119fe7d0..79b3bbf23b96aa956a6ff7b48e15dd4342f1676a 100644 (file)
@@ -46,6 +46,9 @@
 #ifdef __WXGTK__
     #include <gtk/gtk.h>
 #endif
+#ifdef __WXX11__
+#include "wx/x11/private.h"
+#endif
 
 IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow)
 IMPLEMENT_DYNAMIC_CLASS(wxPopupTransientWindow, wxPopupWindow)
@@ -198,7 +201,7 @@ void wxPopupTransientWindow::PopHandlers()
             m_handlerPopup = NULL;
         }
 
-        m_child->ReleaseMouse();
+        // m_child->ReleaseMouse();
         m_child = NULL;
     }
 
@@ -277,16 +280,54 @@ bool wxPopupTransientWindow::Show( bool show )
 {
 #ifdef __WXGTK__
     if (!show)
+    {
+        gdk_pointer_ungrab( (guint32)GDK_CURRENT_TIME );
+    
         gtk_grab_remove( m_widget );
+    }
+#endif
+
+#ifdef __WXX11__
+    if (!show)
+    {
+        XUngrabPointer( wxGlobalDisplay(), CurrentTime );
+    }
 #endif
 
     bool ret = wxPopupWindow::Show( show );
     
 #ifdef __WXGTK__
     if (show)
+    {
         gtk_grab_add( m_widget );
+        
+        gdk_pointer_grab( m_widget->window, TRUE,
+                          (GdkEventMask)
+                            (GDK_BUTTON_PRESS_MASK |
+                             GDK_BUTTON_RELEASE_MASK |
+                             GDK_POINTER_MOTION_HINT_MASK |
+                             GDK_POINTER_MOTION_MASK),
+                          (GdkWindow *) NULL,
+                          (GdkCursor *) NULL,
+                          (guint32)GDK_CURRENT_TIME );
+    }
 #endif
 
+#ifdef __WXX11__
+    if (show)
+    {
+        Window xwindow = (Window) m_clientWindow;
+        
+        /* int res =*/ XGrabPointer(wxGlobalDisplay(), xwindow,
+            True,
+            ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask,
+            GrabModeAsync,
+            GrabModeAsync,
+            None,
+            None,
+            CurrentTime );
+    }
+#endif
     return ret;
 }