From 01a49fd4c45feebb15de2783fce97d6ed48b09e3 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 19 Apr 2012 17:15:40 +0000 Subject: [PATCH] move widget resize handling from DoSetSize to DoMoveWindow git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71240 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 9bb21cd..6018aa3 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2566,12 +2566,14 @@ bool wxWindowGTK::Destroy() void wxWindowGTK::DoMoveWindow(int x, int y, int width, int height) { - gtk_widget_set_size_request(m_widget, width, height); - - // inform the parent to perform the move - wxASSERT_MSG(m_parent && m_parent->m_wxwindow, - "the parent window has no client area?"); - WX_PIZZA(m_parent->m_wxwindow)->move(m_widget, x, y); + GtkWidget* parent = gtk_widget_get_parent(m_widget); + if (WX_IS_PIZZA(parent)) + { + WX_PIZZA(parent)->move(m_widget, x, y); + gtk_widget_set_size_request(m_widget, width, height); + } + else + gtk_widget_queue_resize(m_widget); } void wxWindowGTK::ConstrainSize() @@ -2593,8 +2595,7 @@ void wxWindowGTK::ConstrainSize() void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { - wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); - wxASSERT_MSG( (m_parent != NULL), wxT("wxWindowGTK::SetSize requires parent.\n") ); + wxCHECK_RET(m_widget, "invalid window"); int scrollX = 0, scrollY = 0; GtkWidget* parent = gtk_widget_get_parent(m_widget); @@ -2636,10 +2637,7 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags m_y = y; m_width = width; m_height = height; - } - if (m_parent->m_wxwindow) - { /* the default button has a border around it */ if (gtk_widget_get_can_default(m_widget)) { @@ -2658,16 +2656,12 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags DoMoveWindow(x, y, width, height); } - if (sizeChange) + if ((sizeChange && !m_nativeSizeEvent) || (sizeFlags & wxSIZE_FORCE_EVENT)) { // update these variables to keep size_allocate handler // from sending another size event for this change GetClientSize( &m_oldClientWidth, &m_oldClientHeight ); - gtk_widget_queue_resize(m_widget); - } - if ((sizeChange && !m_nativeSizeEvent) || (sizeFlags & wxSIZE_FORCE_EVENT)) - { wxSizeEvent event( wxSize(m_width,m_height), GetId() ); event.SetEventObject( this ); HandleWindowEvent( event ); -- 2.7.4