From 4d711190c7d59c8f6cfa566d131a9f0ef86d26e6 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 19 Apr 2012 16:44:59 +0000 Subject: [PATCH] rearrange some code in DoSetSize to facilitate upcoming changes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71236 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 7ff47a7..87477ce 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2624,17 +2624,22 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags height = sizeBest.y; } - const wxSize oldSize(m_width, m_height); - if (width != -1) - m_width = width; - if (height != -1) - m_height = height; + if (width == -1) + width = m_width; + if (height == -1) + height = m_height; - if (m_parent->m_wxwindow) + const bool sizeChange = m_width != width || m_height != height; + if (sizeChange || m_x != x || m_y != y) { m_x = x; m_y = y; + m_width = width; + m_height = height; + } + if (m_parent->m_wxwindow) + { int left_border = 0; int right_border = 0; int top_border = 0; @@ -2661,21 +2666,15 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags m_height+top_border+bottom_border ); } - if (m_width != oldSize.x || m_height != oldSize.y) + if (sizeChange) { // 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 (!m_nativeSizeEvent) - { - wxSizeEvent event( wxSize(m_width,m_height), GetId() ); - event.SetEventObject( this ); - HandleWindowEvent( event ); - } - } else - if (sizeFlags & wxSIZE_FORCE_EVENT) + } + if ((sizeChange && !m_nativeSizeEvent) || (sizeFlags & wxSIZE_FORCE_EVENT)) { wxSizeEvent event( wxSize(m_width,m_height), GetId() ); event.SetEventObject( this ); -- 2.7.4