]> git.saurik.com Git - wxWidgets.git/commitdiff
fix saving/restoring size when WM supports _NET_FRAME_EXTENTS but not _NET_REQUEST_FR...
authorPaul Cornett <paulcor@bullseye.com>
Wed, 24 Dec 2008 07:51:15 +0000 (07:51 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Wed, 24 Dec 2008 07:51:15 +0000 (07:51 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57525 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/toplevel.h
src/gtk/toplevel.cpp

index e059880ab3b106e8d6a01658499de2b1d5a770bc..1670cff48678f2ff939aa14b8484202564d06817 100644 (file)
@@ -90,8 +90,6 @@ public:
 
     GtkWidget    *m_mainWidget;
 
-    bool m_deferShow;
-
     bool          m_fsIsShowing;         /* full screen */
     int           m_fsSaveGdkFunc, m_fsSaveGdkDecor;
     wxRect        m_fsSaveFrame;
@@ -138,6 +136,8 @@ protected:
     // string shown in the title bar
     wxString m_title;
 
+    bool m_deferShow;
+
 private:
     wxSize& GetCachedDecorSize();
 
@@ -146,6 +146,8 @@ private:
 
     // is the frame currently grabbed explicitly by the application?
     bool m_grabbed;
+
+    bool m_updateDecorSize;
 };
 
 #endif // _WX_GTK_TOPLEVEL_H_
index 708f0bc2b76b46dd7e24536cc68da22937d079ac..cf37ab6b711115727566dbfe2dd1dfe1dc5fa7ab 100644 (file)
@@ -442,6 +442,7 @@ void wxTopLevelWindowGTK::Init()
     m_gdkFunc = 0;
     m_grabbed = false;
     m_deferShow = true;
+    m_updateDecorSize = true;
 
     m_urgency_hint = -2;
 }
@@ -779,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)
     {
@@ -995,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;