Applied patch #841324 from Ian Brown:
"GetPosition() returns wrong result for dialog" modified for better backward binary compatibility. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@24574 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -114,7 +114,11 @@ protected:
|
|||||||
int sizeFlags = wxSIZE_AUTO);
|
int sizeFlags = wxSIZE_AUTO);
|
||||||
|
|
||||||
virtual void DoSetClientSize(int width, int height);
|
virtual void DoSetClientSize(int width, int height);
|
||||||
|
public:
|
||||||
|
// hack for binary compatibility
|
||||||
|
void DoGetPosition_(int* x, int* y) const;
|
||||||
|
private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@@ -395,6 +395,28 @@ void wxDialog::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
XtVaSetValues((Widget) m_mainWidget, XmNresizePolicy, XmRESIZE_NONE, NULL);
|
XtVaSetValues((Widget) m_mainWidget, XmNresizePolicy, XmRESIZE_NONE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxDialog::DoGetPosition_(int *x, int *y) const
|
||||||
|
{
|
||||||
|
Window parent_window = XtWindow((Widget) m_mainWidget),
|
||||||
|
next_parent = XtWindow((Widget) m_mainWidget),
|
||||||
|
root = RootWindowOfScreen(XtScreen((Widget) m_mainWidget));
|
||||||
|
|
||||||
|
// search for the parent that is child of ROOT, because the WM may
|
||||||
|
// reparent twice and notify only the next parent (like FVWM)
|
||||||
|
while (next_parent != root) {
|
||||||
|
Window *theChildren; unsigned int n;
|
||||||
|
parent_window = next_parent;
|
||||||
|
XQueryTree(XtDisplay((Widget) m_mainWidget), parent_window, &root,
|
||||||
|
&next_parent, &theChildren, &n);
|
||||||
|
XFree(theChildren); // not needed
|
||||||
|
}
|
||||||
|
int xx, yy; unsigned int dummy;
|
||||||
|
XGetGeometry(XtDisplay((Widget) m_mainWidget), parent_window, &root,
|
||||||
|
&xx, &yy, &dummy, &dummy, &dummy, &dummy);
|
||||||
|
if (x) *x = xx;
|
||||||
|
if (y) *y = yy;
|
||||||
|
}
|
||||||
|
|
||||||
void wxDialog::DoSetClientSize(int width, int height)
|
void wxDialog::DoSetClientSize(int width, int height)
|
||||||
{
|
{
|
||||||
wxWindow::SetSize(-1, -1, width, height);
|
wxWindow::SetSize(-1, -1, width, height);
|
||||||
|
@@ -1282,6 +1282,16 @@ void wxWindow::DoGetPosition(int *x, int *y) const
|
|||||||
CanvasGetPosition(x, y);
|
CanvasGetPosition(x, y);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// hack for binary compatibility
|
||||||
|
if (IsTopLevel())
|
||||||
|
{
|
||||||
|
wxDialog* dlg = wxDynamicCast(this, wxDialog);
|
||||||
|
if (dlg)
|
||||||
|
{
|
||||||
|
dlg->DoGetPosition_(x, y);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
Widget widget = (Widget) GetTopWidget();
|
Widget widget = (Widget) GetTopWidget();
|
||||||
Position xx, yy;
|
Position xx, yy;
|
||||||
XtVaGetValues(widget, XmNx, &xx, XmNy, &yy, NULL);
|
XtVaGetValues(widget, XmNx, &xx, XmNy, &yy, NULL);
|
||||||
|
Reference in New Issue
Block a user