]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/toplevel.cpp
avoiding warning for unused var in cocoa build
[wxWidgets.git] / src / gtk / toplevel.cpp
index 319887643f141e25e0176697880676a6652c5d81..cf37ab6b711115727566dbfe2dd1dfe1dc5fa7ab 100644 (file)
@@ -335,9 +335,7 @@ 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,
@@ -349,7 +347,13 @@ gtk_frame_map_callback( GtkWidget*,
         win->m_oldClientWidth = 0;
         gtk_widget_queue_resize(win->m_wxwindow);
     }
-
+    // it is possible for m_isShown to be false here, see bug #9909
+    if (win->wxWindowBase::Show(true))
+    {
+        wxShowEvent eventShow(win->GetId(), true);
+        eventShow.SetEventObject(win);
+        win->GetEventHandler()->ProcessEvent(eventShow);
+    }
     return false;
 }
 }
@@ -438,6 +442,7 @@ void wxTopLevelWindowGTK::Init()
     m_gdkFunc = 0;
     m_grabbed = false;
     m_deferShow = true;
+    m_updateDecorSize = true;
 
     m_urgency_hint = -2;
 }
@@ -775,18 +780,31 @@ bool wxTopLevelWindowGTK::Show( bool show )
 {
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
 
-    bool deferShow = show && m_deferShow && !m_isShown;
+    bool deferShow = show && !m_isShown && m_deferShow;
     if (deferShow)
     {
-        m_deferShow =
-        deferShow = !GTK_WIDGET_REALIZED(m_widget) &&
-            gdk_x11_screen_supports_net_wm_hint(
-                gtk_widget_get_screen(m_widget),
-                gdk_atom_intern("_NET_REQUEST_FRAME_EXTENTS", false)) &&
+        deferShow = false;
+        if (!GTK_WIDGET_REALIZED(m_widget) &&
             g_signal_handler_find(m_widget,
                 GSignalMatchType(G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA),
                 g_signal_lookup("property_notify_event", GTK_TYPE_WIDGET),
-                0, NULL, NULL, this);
+                0, NULL, NULL, this))
+        {
+            if (gdk_x11_screen_supports_net_wm_hint(
+                gtk_widget_get_screen(m_widget),
+                gdk_atom_intern("_NET_REQUEST_FRAME_EXTENTS", false)))
+            {
+                deferShow = true;
+            }
+            else
+            {
+                // Don't allow changes to m_decorSize, it breaks saving/restoring
+                // window size with GetSize()/SetSize() because it makes window
+                // bigger between each restore and save.
+                m_updateDecorSize = false;
+            }
+        }
+        m_deferShow = deferShow;
     }
     if (deferShow)
     {
@@ -991,7 +1009,7 @@ void wxTopLevelWindowGTK::GTKUpdateDecorSize(const wxSize& decorSize)
 {
     if (!IsMaximized() && !IsFullScreen())
         GetCachedDecorSize() = decorSize;
-    if (m_decorSize != decorSize)
+    if (m_updateDecorSize && m_decorSize != decorSize)
     {
         const wxSize diff = decorSize - m_decorSize;
         m_decorSize = decorSize;