+#ifdef __WXX11__
+ if (!show)
+ {
+ XUngrabPointer( wxGlobalDisplay(), CurrentTime );
+ }
+#endif
+
+#ifdef __WXMSW__
+ if (!show && m_child && m_child->HasCapture())
+ {
+ m_child->ReleaseMouse();
+ }
+#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
+
+#ifdef __WXMSW__
+ if (show && m_child)
+ {
+ // Assume that the mouse is outside the popup to begin with
+ m_child->CaptureMouse();
+ }
+#endif
+
+ return ret;