From 4357c54bd5ea453d80b19d381c3ecd8b39175bac Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 9 Jun 2014 20:30:55 +0000 Subject: [PATCH] Fix getting position of wxPopupWindow in wxMSW. Don't offset the returned values by the parent window origin unnecessarily: as popup windows are created as children of the desktop window in wxMSW, their coordinates are already expressed in screen coordinate system (which is exactly the same as display window coordinate system) and we must not try to translate them to it once again, this is completely wrong and was probably a left over from earlier wxPopupWindow implementation in which it wasn't created as a child of desktop. In 3.0 branch we still need to continue overriding virtual DoGetPosition() for ABI reasons, but don't do anything in it any more. Closes #4440. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + include/wx/msw/popupwin.h | 1 - src/msw/popupwin.cpp | 7 ++----- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index ba093bf66b..ee05ed3ff4 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -670,6 +670,7 @@ wxMSW: - Fix precision loss in wxGraphicsContext::{Draw,Stroke}Lines() (tibo_). - Fix destroying the font from wxFont::GetFaceName() in some cases (aebailey82). - Fix wxCheckListBox appearance when using larger fonts (Igor Korot). +- Return correct results from wxPopupWindow::GetPosition() (Christian Walther). wxOSX: diff --git a/include/wx/msw/popupwin.h b/include/wx/msw/popupwin.h index d95c1dabc0..e41c82ea46 100644 --- a/include/wx/msw/popupwin.h +++ b/include/wx/msw/popupwin.h @@ -35,7 +35,6 @@ public: virtual WXHWND MSWGetParent() const; protected: - // popups handle the position like wxTopLevelWindow, not wxWindow virtual void DoGetPosition(int *x, int *y) const; DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow) diff --git a/src/msw/popupwin.cpp b/src/msw/popupwin.cpp index fbcf9961e6..666b110721 100644 --- a/src/msw/popupwin.cpp +++ b/src/msw/popupwin.cpp @@ -49,12 +49,9 @@ bool wxPopupWindow::Create(wxWindow *parent, int flags) void wxPopupWindow::DoGetPosition(int *x, int *y) const { - // the position of a "top level" window such as this should be in - // screen coordinates, not in the client ones which MSW gives us - // (because we are a child window) + // This method only exists for ABI compatibility but does nothing special + // any more, it is removed in 3.1.0 and later. wxPopupWindowBase::DoGetPosition(x, y); - - GetParent()->ClientToScreen(x, y); } WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const