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
This commit is contained in:
parent
a8c5e1a9d1
commit
96c8547e58
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user