]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/toplevel.cpp
Forward declare classes instead of including their declarations.
[wxWidgets.git] / src / gtk / toplevel.cpp
index 81c5430f1e6252668e007e4f236d0ad72051577e..18d5775a2fc73a5d5231e89189ea0b68d39485a1 100644 (file)
@@ -339,7 +339,6 @@ gtk_frame_map_callback( GtkWidget*,
                         wxTopLevelWindow *win )
 {
     const bool wasIconized = win->IsIconized();
-    win->SetIconizeState(false);
     if (wasIconized)
     {
         // Because GetClientSize() returns (0,0) when IsIconized() is true,
@@ -372,16 +371,18 @@ gtk_frame_map_callback( GtkWidget*,
 }
 
 //-----------------------------------------------------------------------------
-// "unmap_event" from m_widget
+// "window-state-event" from m_widget
 //-----------------------------------------------------------------------------
 
 extern "C" {
 static gboolean
-gtk_frame_unmap_callback( GtkWidget * WXUNUSED(widget),
-                          GdkEvent * WXUNUSED(event),
+gtk_frame_window_state_callback( GtkWidget* WXUNUSED(widget),
+                          GdkEventWindowState *event,
                           wxTopLevelWindow *win )
 {
-    win->SetIconizeState(true);
+    if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED)
+        win->SetIconizeState((event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) != 0);
+
     return false;
 }
 }
@@ -592,11 +593,14 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
     g_signal_connect (m_widget, "realize",
                       G_CALLBACK (gtk_frame_realized_callback), this);
 
-    // map and unmap for iconized state
+    // for some reported size corrections
     g_signal_connect (m_widget, "map_event",
                       G_CALLBACK (gtk_frame_map_callback), this);
-    g_signal_connect (m_widget, "unmap_event",
-                      G_CALLBACK (gtk_frame_unmap_callback), this);
+
+    // for iconized state
+    g_signal_connect (m_widget, "window_state_event",
+                      G_CALLBACK (gtk_frame_window_state_callback), this);
+
 
     // for wxMoveEvent
     g_signal_connect (m_widget, "configure_event",
@@ -1012,17 +1016,6 @@ void wxTopLevelWindowGTK::DoSetClientSize(int width, int height)
     m_deferShowAllowed = false;
 }
 
-wxSize wxTopLevelWindowGTK::DoGetBestSize() const
-{
-    // temporarily turn off m_isIconized,
-    // so we get an accurate client size from DoGetClientSize
-    const bool save = m_isIconized;
-    const_cast<wxTopLevelWindowGTK*>(this)->m_isIconized = false;
-    const wxSize size = base_type::DoGetBestSize();
-    const_cast<wxTopLevelWindowGTK*>(this)->m_isIconized = save;
-    return size;
-}
-
 void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const
 {
     wxASSERT_MSG(m_widget, wxT("invalid frame"));