Removed previous broken fix for deferred positioning bug, and added
fix using sizers, which works better git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -23,6 +23,9 @@ wxMSW:
|
|||||||
by refreshing parent when the radio box moves.
|
by refreshing parent when the radio box moves.
|
||||||
- Added ability set the system option "msw.staticbox.optimized-paint" to 0 to
|
- Added ability set the system option "msw.staticbox.optimized-paint" to 0 to
|
||||||
allow a panel to paint graphics around controls within a static box.
|
allow a panel to paint graphics around controls within a static box.
|
||||||
|
- Worked around an apparent bug in deferred window positioning (moving a
|
||||||
|
window from (x, y) to (a, b) and back to (x, y) misses the last step) by
|
||||||
|
checking window positions against corresponding sizer state, if any.
|
||||||
|
|
||||||
wxMac:
|
wxMac:
|
||||||
|
|
||||||
|
@@ -544,17 +544,5 @@ WX_DECLARE_HASH(wxWindowMSW, wxWindowList, wxWinHashTable);
|
|||||||
|
|
||||||
extern wxWinHashTable *wxWinHandleHash;
|
extern wxWinHashTable *wxWinHandleHash;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// extra data needed for correcting problems with deferred positioning
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
struct wxExtraWindowData
|
|
||||||
{
|
|
||||||
// Stored during deferred positioning
|
|
||||||
wxPoint m_pos;
|
|
||||||
wxSize m_size;
|
|
||||||
bool m_deferring:1;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_WINDOW_H_
|
// _WX_WINDOW_H_
|
||||||
|
@@ -657,22 +657,14 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
x_offset += widthBtn + cx1;
|
x_offset += widthBtn + cx1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hdwp)
|
|
||||||
{
|
|
||||||
// Store the size so we can report it accurately
|
|
||||||
wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
|
|
||||||
if (!extraData)
|
|
||||||
{
|
|
||||||
extraData = new wxExtraWindowData;
|
|
||||||
m_windowReserved = (void*) extraData;
|
|
||||||
}
|
|
||||||
extraData->m_pos = wxPoint(xx, yy);
|
|
||||||
extraData->m_size = wxSize(width, height);
|
|
||||||
extraData->m_deferring = true;
|
|
||||||
|
|
||||||
|
#if USE_DEFERRED_SIZING
|
||||||
|
if (parent)
|
||||||
|
{
|
||||||
// hdwp must be updated as it may have been changed
|
// hdwp must be updated as it may have been changed
|
||||||
parent->m_hDWP = (WXHANDLE)hdwp;
|
parent->m_hDWP = (WXHANDLE)hdwp;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -43,7 +43,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_DEFERRED_SIZING 1
|
#define USE_DEFERRED_SIZING 1
|
||||||
#define USE_DEFER_BUG_WORKAROUND 0
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
@@ -507,22 +506,14 @@ void wxSlider::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
width,
|
width,
|
||||||
height - hLabel);
|
height - hLabel);
|
||||||
}
|
}
|
||||||
if ( hdwp )
|
|
||||||
{
|
|
||||||
// Store the size so we can report it accurately
|
|
||||||
wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
|
|
||||||
if (!extraData)
|
|
||||||
{
|
|
||||||
extraData = new wxExtraWindowData;
|
|
||||||
m_windowReserved = (void*) extraData;
|
|
||||||
}
|
|
||||||
extraData->m_pos = wxPoint(x, y);
|
|
||||||
extraData->m_size = wxSize(width, height);
|
|
||||||
extraData->m_deferring = true;
|
|
||||||
|
|
||||||
|
#if USE_DEFERRED_SIZING
|
||||||
|
if ( parent )
|
||||||
|
{
|
||||||
// hdwp must be updated as it may have been changed
|
// hdwp must be updated as it may have been changed
|
||||||
parent->m_hDWP = (WXHANDLE)hdwp;
|
parent->m_hDWP = (WXHANDLE)hdwp;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxSlider::DoGetBestSize() const
|
wxSize wxSlider::DoGetBestSize() const
|
||||||
|
@@ -590,37 +590,18 @@ void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
wxMoveWindowDeferred(hdwp, this, GetHwnd(),
|
wxMoveWindowDeferred(hdwp, this, GetHwnd(),
|
||||||
x, y, widthBtn, height);
|
x, y, widthBtn, height);
|
||||||
|
|
||||||
if (hdwp)
|
#if USE_DEFERRED_SIZING
|
||||||
|
if (parent)
|
||||||
{
|
{
|
||||||
// Store the size so we can report it accurately
|
|
||||||
wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
|
|
||||||
if (!extraData)
|
|
||||||
{
|
|
||||||
extraData = new wxExtraWindowData;
|
|
||||||
m_windowReserved = (void*) extraData;
|
|
||||||
}
|
|
||||||
extraData->m_pos = wxPoint(originalX, y);
|
|
||||||
extraData->m_size = wxSize(width, height);
|
|
||||||
extraData->m_deferring = true;
|
|
||||||
|
|
||||||
// hdwp must be updated as it may have been changed
|
// hdwp must be updated as it may have been changed
|
||||||
parent->m_hDWP = (WXHANDLE)hdwp;
|
parent->m_hDWP = (WXHANDLE)hdwp;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// get total size of the control
|
// get total size of the control
|
||||||
void wxSpinCtrl::DoGetSize(int *x, int *y) const
|
void wxSpinCtrl::DoGetSize(int *x, int *y) const
|
||||||
{
|
{
|
||||||
#if USE_DEFER_BUG_WORKAROUND
|
|
||||||
wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
|
|
||||||
if (extraData && extraData->m_deferring && GetParent() && GetParent()->m_hDWP)
|
|
||||||
{
|
|
||||||
*x = extraData->m_size.x;
|
|
||||||
*y = extraData->m_size.y;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RECT spinrect, textrect, ctrlrect;
|
RECT spinrect, textrect, ctrlrect;
|
||||||
GetWindowRect(GetHwnd(), &spinrect);
|
GetWindowRect(GetHwnd(), &spinrect);
|
||||||
GetWindowRect(GetBuddyHwnd(), &textrect);
|
GetWindowRect(GetBuddyHwnd(), &textrect);
|
||||||
@@ -634,16 +615,6 @@ void wxSpinCtrl::DoGetSize(int *x, int *y) const
|
|||||||
|
|
||||||
void wxSpinCtrl::DoGetPosition(int *x, int *y) const
|
void wxSpinCtrl::DoGetPosition(int *x, int *y) const
|
||||||
{
|
{
|
||||||
#if USE_DEFER_BUG_WORKAROUND
|
|
||||||
wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
|
|
||||||
if (extraData && extraData->m_deferring && GetParent() && GetParent()->m_hDWP)
|
|
||||||
{
|
|
||||||
*x = extraData->m_pos.x;
|
|
||||||
*y = extraData->m_pos.y;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// hack: pretend that our HWND is the text control just for a moment
|
// hack: pretend that our HWND is the text control just for a moment
|
||||||
WXHWND hWnd = GetHWND();
|
WXHWND hWnd = GetHWND();
|
||||||
wxConstCast(this, wxSpinCtrl)->m_hWnd = m_hwndBuddy;
|
wxConstCast(this, wxSpinCtrl)->m_hWnd = m_hwndBuddy;
|
||||||
|
@@ -120,7 +120,7 @@
|
|||||||
#endif // everything needed for TrackMouseEvent()
|
#endif // everything needed for TrackMouseEvent()
|
||||||
|
|
||||||
#define USE_DEFERRED_SIZING 1
|
#define USE_DEFERRED_SIZING 1
|
||||||
#define USE_DEFER_BUG_WORKAROUND 0
|
#define USE_DEFER_BUG_WORKAROUND 1
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// global variables
|
// global variables
|
||||||
@@ -471,12 +471,6 @@ wxWindowMSW::~wxWindowMSW()
|
|||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
m_isBeingDeleted = true;
|
||||||
|
|
||||||
if (m_windowReserved)
|
|
||||||
{
|
|
||||||
delete (wxExtraWindowData*) m_windowReserved;
|
|
||||||
m_windowReserved = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef __WXUNIVERSAL__
|
#ifndef __WXUNIVERSAL__
|
||||||
// VS: make sure there's no wxFrame with last focus set to us:
|
// VS: make sure there's no wxFrame with last focus set to us:
|
||||||
for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
|
for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
|
||||||
@@ -1452,16 +1446,6 @@ void wxWindowMSW::DoSetToolTip(wxToolTip *tooltip)
|
|||||||
// Get total size
|
// Get total size
|
||||||
void wxWindowMSW::DoGetSize(int *x, int *y) const
|
void wxWindowMSW::DoGetSize(int *x, int *y) const
|
||||||
{
|
{
|
||||||
#if USE_DEFER_BUG_WORKAROUND
|
|
||||||
wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
|
|
||||||
if (extraData && extraData->m_deferring && GetParent() && GetParent()->m_hDWP)
|
|
||||||
{
|
|
||||||
*x = extraData->m_size.x;
|
|
||||||
*y = extraData->m_size.y;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RECT rect = wxGetWindowRect(GetHwnd());
|
RECT rect = wxGetWindowRect(GetHwnd());
|
||||||
|
|
||||||
if ( x )
|
if ( x )
|
||||||
@@ -1483,16 +1467,6 @@ void wxWindowMSW::DoGetClientSize(int *x, int *y) const
|
|||||||
|
|
||||||
void wxWindowMSW::DoGetPosition(int *x, int *y) const
|
void wxWindowMSW::DoGetPosition(int *x, int *y) const
|
||||||
{
|
{
|
||||||
#if USE_DEFER_BUG_WORKAROUND
|
|
||||||
wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
|
|
||||||
if (extraData && extraData->m_deferring && GetParent() && GetParent()->m_hDWP)
|
|
||||||
{
|
|
||||||
*x = extraData->m_pos.x;
|
|
||||||
*y = extraData->m_pos.y;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RECT rect = wxGetWindowRect(GetHwnd());
|
RECT rect = wxGetWindowRect(GetHwnd());
|
||||||
|
|
||||||
POINT point;
|
POINT point;
|
||||||
@@ -1584,22 +1558,11 @@ void wxWindowMSW::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
|
|
||||||
wxMoveWindowDeferred(hdwp, this, GetHwnd(), x, y, width, height);
|
wxMoveWindowDeferred(hdwp, this, GetHwnd(), x, y, width, height);
|
||||||
|
|
||||||
if ( hdwp )
|
#if USE_DEFERRED_SIZING
|
||||||
{
|
if ( parent )
|
||||||
// Store the size so we can report it accurately
|
|
||||||
wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
|
|
||||||
if (!extraData)
|
|
||||||
{
|
|
||||||
extraData = new wxExtraWindowData;
|
|
||||||
m_windowReserved = (void*) extraData;
|
|
||||||
}
|
|
||||||
extraData->m_pos = wxPoint(x, y);
|
|
||||||
extraData->m_size = wxSize(width, height);
|
|
||||||
extraData->m_deferring = true;
|
|
||||||
|
|
||||||
// hdwp must be updated as it may have been changed
|
// hdwp must be updated as it may have been changed
|
||||||
parent->m_hDWP = (WXHANDLE)hdwp;
|
parent->m_hDWP = (WXHANDLE)hdwp;
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the size of the window: if the dimensions are positive, just use them,
|
// set the size of the window: if the dimensions are positive, just use them,
|
||||||
@@ -4255,15 +4218,14 @@ bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h), WXUINT wParam)
|
|||||||
node = node->GetNext() )
|
node = node->GetNext() )
|
||||||
{
|
{
|
||||||
wxWindow *child = node->GetData();
|
wxWindow *child = node->GetData();
|
||||||
wxExtraWindowData* extraData = (wxExtraWindowData*) child->m_windowReserved;
|
wxSizer* sizer = child->GetContainingSizer();
|
||||||
if (extraData && extraData->m_deferring)
|
if (sizer)
|
||||||
{
|
{
|
||||||
wxPoint pos = child->GetPosition();
|
wxSizerItem* item = sizer->GetItem(child, true);
|
||||||
|
if (item->GetRect().GetPosition() != child->GetPosition())
|
||||||
if (extraData->m_pos != pos)
|
{
|
||||||
child->Move(extraData->m_pos);
|
child->Move(item->GetRect().GetPosition());
|
||||||
|
}
|
||||||
extraData->m_deferring = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user