]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/window.cpp
wxGTK1 : wx/private/eventloopsourcesmanager.h was missing in evtloop.cpp
[wxWidgets.git] / src / gtk / window.cpp
index bedca9fba3915fe371b5bfaae09e7d0b0480679b..0be16df1c992ab92693d9ebd042631ed9ef39e08 100644 (file)
@@ -2,7 +2,6 @@
 // Name:        src/gtk/window.cpp
 // Purpose:     wxWindowGTK implementation
 // Author:      Robert Roebling
-// Id:          $Id$
 // Copyright:   (c) 1998 Robert Roebling, Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -2424,9 +2423,6 @@ wxWindowGTK::~wxWindowGTK()
     // destroy children before destroying this window itself
     DestroyChildren();
 
-    if (m_widget)
-        Show( false );
-
     // delete before the widgets to avoid a crash on solaris
     if ( m_imContext )
     {
@@ -3376,8 +3372,9 @@ void wxWindowGTK::SetFocus()
 
 void wxWindowGTK::SetCanFocus(bool canFocus)
 {
-    if ( m_widget )
-        gtk_widget_set_can_focus(m_widget, canFocus);
+    wxCHECK_RET(m_widget, "invalid window");
+
+    gtk_widget_set_can_focus(m_widget, canFocus);
 
     if ( m_wxwindow && (m_widget != m_wxwindow) )
     {
@@ -4368,6 +4365,13 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
                   gtk_get_current_event_time()
                 );
 
+    // it is possible for gtk_menu_popup() to fail
+    if (!gtk_widget_get_visible(GTK_WIDGET(menu->m_menu)))
+    {
+        menu->m_popupShown = false;
+        return false;
+    }
+
     while (menu->m_popupShown)
     {
         gtk_main_iteration();