From 11d8dfd2fb6cf04c4695e0aed64288b931b86eb6 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Wed, 24 Dec 2008 07:51:15 +0000 Subject: [PATCH] fix saving/restoring size when WM supports _NET_FRAME_EXTENTS but not _NET_REQUEST_FRAME_EXTENTS git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57525 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/toplevel.h | 6 ++++-- src/gtk/toplevel.cpp | 30 ++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/include/wx/gtk/toplevel.h b/include/wx/gtk/toplevel.h index e059880ab3..1670cff486 100644 --- a/include/wx/gtk/toplevel.h +++ b/include/wx/gtk/toplevel.h @@ -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_ diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 708f0bc2b7..cf37ab6b71 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -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;