X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f3ecfad1923022f59dca6fe065e5f278e2802faf..650ff63d999552a4758328444b22504077db998f:/src/gtk/popupwin.cpp diff --git a/src/gtk/popupwin.cpp b/src/gtk/popupwin.cpp index 36ef2e7b62..923a68bbd1 100644 --- a/src/gtk/popupwin.cpp +++ b/src/gtk/popupwin.cpp @@ -142,10 +142,18 @@ static void wxInsertChildInDialog( wxPopupWindow* parent, wxWindow* child ) //----------------------------------------------------------------------------- BEGIN_EVENT_TABLE(wxPopupWindow,wxPopupWindowBase) - EVT_SIZE (wxPopupWindow::OnSize) +#ifdef __WXUNIVERSAL__ + EVT_SIZE(wxPopupWindow::OnSize) +#endif END_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow,wxPopupWindowBase) +IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow) + +wxPopupWindow::~wxPopupWindow() +{ + if (GTK_WIDGET_HAS_GRAB(m_widget)) + gtk_grab_remove( m_widget ); +} bool wxPopupWindow::Create( wxWindow *parent, int style ) { @@ -245,10 +253,15 @@ void wxPopupWindow::DoSetSize( int x, int y, int width, int height, int sizeFlag } */ - if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth; - if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; - if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth; - if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; + int minWidth = GetMinWidth(), + minHeight = GetMinHeight(), + maxWidth = GetMaxWidth(), + maxHeight = GetMaxHeight(); + + if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth; + if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight; + if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; + if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight; if ((m_x != -1) || (m_y != -1)) { @@ -285,20 +298,25 @@ void wxPopupWindow::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int m_width = width; m_height = height; - if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth; - if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; - if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth; - if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; + int minWidth = GetMinWidth(), + minHeight = GetMinHeight(), + maxWidth = GetMaxWidth(), + maxHeight = GetMaxHeight(); + + if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth; + if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight; + if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth; + if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight; /* set size hints */ gint flag = 0; // GDK_HINT_POS; - if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE; - if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE; + if ((minWidth != -1) || (minHeight != -1)) flag |= GDK_HINT_MIN_SIZE; + if ((maxWidth != -1) || (maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE; GdkGeometry geom; - geom.min_width = m_minWidth; - geom.min_height = m_minHeight; - geom.max_width = m_maxWidth; - geom.max_height = m_maxHeight; + geom.min_width = minWidth; + geom.min_height = minHeight; + geom.max_width = maxWidth; + geom.max_height = maxHeight; gtk_window_set_geometry_hints( GTK_WINDOW(m_widget), (GtkWidget*) NULL, &geom, @@ -330,9 +348,15 @@ bool wxPopupWindow::Show( bool show ) GtkOnSize( m_x, m_y, m_width, m_height ); } - + + if (!show) + gtk_grab_remove( m_widget ); + bool ret = wxWindow::Show( show ); - + + if (show) + gtk_grab_add( m_widget ); + return ret; }