From 90dcb0d968ebd4adb4a36557bac487c7a88b83c1 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Wed, 18 Apr 2012 16:30:11 +0000 Subject: [PATCH] Adjust x,y parameters by pizza scroll offset in DoSetSize This should cause no change in behavior, and is merely preparation for further changes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71228 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index a27263a89c..3d0cf28dce 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2596,15 +2596,22 @@ 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") ); - if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0 && (x == -1 || y == -1)) + int scrollX = 0, scrollY = 0; + GtkWidget* parent = gtk_widget_get_parent(m_widget); + if (WX_IS_PIZZA(parent)) { - int currentX, currentY; - GetPosition(¤tX, ¤tY); - if (x == -1) - x = currentX; - if (y == -1) - y = currentY; + wxPizza* pizza = WX_PIZZA(parent); + scrollX = pizza->m_scroll_x; + scrollY = pizza->m_scroll_y; } + if (x != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) + x += scrollX; + else + x = m_x; + if (y != -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) + y += scrollY; + else + y = m_y; // calculate the best size if we should auto size the window if ( ((sizeFlags & wxSIZE_AUTO_WIDTH) && width == -1) || @@ -2625,9 +2632,8 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags if (m_parent->m_wxwindow) { - wxPizza* pizza = WX_PIZZA(m_parent->m_wxwindow); - m_x = x + pizza->m_scroll_x; - m_y = y + pizza->m_scroll_y; + m_x = x; + m_y = y; int left_border = 0; int right_border = 0; -- 2.45.2