From 96c8547e587d7c7bc95c4a116c03ae513d01457a Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 12 Sep 2006 11:57:55 +0000 Subject: [PATCH] Sometimes, m_x and m_y don't reflect the true position of the window, for example after using wxToolBar::AddControl. This change gets the actual position if necessary; it fixes a popup window positioning problem for combo controls on a toolbar. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41176 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 9f639a3586..ccc7fe9e9b 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -3066,6 +3066,28 @@ void wxWindowGTK::DoGetPosition( int *x, int *y ) const dy = gtk_pizza_get_yoffset( pizza ); } + if (m_x == -1 && m_y == -1) + { + GdkWindow *source = (GdkWindow *) NULL; + if (m_wxwindow) + source = GTK_PIZZA(m_wxwindow)->bin_window; + else + source = m_widget->window; + + if (source) + { + int org_x = 0; + int org_y = 0; + gdk_window_get_origin( source, &org_x, &org_y ); + + if (GetParent()) + GetParent()->ScreenToClient(&org_x, &org_y); + + ((wxWindowGTK*) this)->m_x = org_x; + ((wxWindowGTK*) this)->m_y = org_y; + } + } + if (x) (*x) = m_x - dx; if (y) (*y) = m_y - dy; }