]> git.saurik.com Git - wxWidgets.git/commitdiff
restore caching of WM frame extents
authorPaul Cornett <paulcor@bullseye.com>
Wed, 23 Apr 2008 17:05:47 +0000 (17:05 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Wed, 23 Apr 2008 17:05:47 +0000 (17:05 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53322 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index 61ec62fc9aea8d65ebd9bf9400163560150c6cb4..463537c387b637f831df6889a4abaf6ca40ad977 100644 (file)
@@ -143,6 +143,8 @@ protected:
     wxString m_title;
 
 private:
+    wxSize& GetCachedDecorSize();
+
     // is the frame currently iconized?
     bool m_isIconized;
 
index b84b537ef27face04f0e5157540b67216395a36b..a452992cc83f23dd2de45b974195795df90281e0 100644 (file)
@@ -354,6 +354,9 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
     m_gdkFunc = 0;
     if (style & wxRESIZE_BORDER)
        m_gdkFunc = GDK_FUNC_RESIZE;
+    gtk_window_set_default_size(GTK_WINDOW(m_widget), m_width, m_height);
+    m_decorSize.Set(0, 0);
+    m_deferShow = false;
 
     // don't allow sizing smaller than decorations
     GdkGeometry geom;
index bf8bde87c04b6b36ae8078abead99d76bf342ec5..f54484436b408a63d3788d0162cf95c31e826ee4 100644 (file)
@@ -624,7 +624,10 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
         }
     }
 
-    gtk_window_set_default_size(GTK_WINDOW(m_widget), m_width, m_height);
+    m_decorSize = GetCachedDecorSize();
+    int w, h;
+    GTKDoGetSize(&w, &h);
+    gtk_window_set_default_size(GTK_WINDOW(m_widget), w, h);
 
     return true;
 }
@@ -975,6 +978,8 @@ void wxTopLevelWindowGTK::DoSetSizeHints( int minW, int minH,
 
 void wxTopLevelWindowGTK::GTKUpdateDecorSize(const wxSize& decorSize)
 {
+    if (!IsMaximized() && !IsFullScreen())
+        GetCachedDecorSize() = decorSize;
     if (m_decorSize != decorSize)
     {
         const wxSize diff = decorSize - m_decorSize;
@@ -1021,6 +1026,23 @@ void wxTopLevelWindowGTK::GTKUpdateDecorSize(const wxSize& decorSize)
     }
 }
 
+wxSize& wxTopLevelWindowGTK::GetCachedDecorSize()
+{
+    static wxSize size[8];
+
+    int index = 0;
+    // title bar
+    if (m_gdkDecor & (GDK_DECOR_MENU | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE | GDK_DECOR_TITLE))
+        index = 1;
+    // border
+    if (m_gdkDecor & GDK_DECOR_BORDER)
+        index |= 2;
+    // utility window decor can be different
+    if (m_windowStyle & wxFRAME_TOOL_WINDOW)
+        index |= 4;
+    return size[index];
+}
+
 void wxTopLevelWindowGTK::OnInternalIdle()
 {
     wxWindow::OnInternalIdle();