A slightly modified version of Patch #1197468. Keeps track of pending
size/position changes in case there is more than one adjustment for a window in a single DeferWindowPos set then the pending values can be used for defaults instead of current values. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33990 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -73,6 +73,8 @@ class WXDLLEXPORT wxWindow;
|
|||||||
class WXDLLEXPORT wxAccessible;
|
class WXDLLEXPORT wxAccessible;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxWindowExtraData;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// helper stuff used by wxWindow
|
// helper stuff used by wxWindow
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -1312,8 +1314,9 @@ protected:
|
|||||||
// implements the window variants
|
// implements the window variants
|
||||||
virtual void DoSetWindowVariant( wxWindowVariant variant ) ;
|
virtual void DoSetWindowVariant( wxWindowVariant variant ) ;
|
||||||
|
|
||||||
// Reserved for future use
|
// Was a reserved pointer in 2.6.0, now used to hold extra data members
|
||||||
void* m_windowReserved;
|
// without breaking compatibility.
|
||||||
|
wxWindowExtraData* m_extraData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// contains the last id generated by NewControlId
|
// contains the last id generated by NewControlId
|
||||||
|
@@ -216,8 +216,9 @@ wxWindowBase::wxWindowBase()
|
|||||||
// VZ: this one shouldn't exist...
|
// VZ: this one shouldn't exist...
|
||||||
m_isBeingDeleted = false;
|
m_isBeingDeleted = false;
|
||||||
|
|
||||||
// Reserved for future use
|
// Can be used in port specific wxWindow derived classes for holding extra
|
||||||
m_windowReserved = NULL;
|
// data memebers.
|
||||||
|
m_extraData = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// common part of window creation process
|
// common part of window creation process
|
||||||
|
@@ -231,6 +231,28 @@ bool GetCursorPosWinCE(POINT* pt)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// wxWindowExtraData
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if USE_DEFER_BUG_WORKAROUND
|
||||||
|
// This class is used to hold additional data memebers that were added after
|
||||||
|
// the stable 2.6.0 release. They should be moved into wxWindow for 2.7 after
|
||||||
|
// binary compatibility is no longer being maintained.
|
||||||
|
|
||||||
|
class wxWindowExtraData {
|
||||||
|
public:
|
||||||
|
wxWindowExtraData()
|
||||||
|
: m_pendingPosition(wxDefaultPosition),
|
||||||
|
m_pendingSize(wxDefaultSize)
|
||||||
|
{}
|
||||||
|
|
||||||
|
wxPoint m_pendingPosition;
|
||||||
|
wxSize m_pendingSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// event tables
|
// event tables
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -465,6 +487,10 @@ void wxWindowMSW::Init()
|
|||||||
m_lastMouseY = -1;
|
m_lastMouseY = -1;
|
||||||
m_lastMouseEvent = -1;
|
m_lastMouseEvent = -1;
|
||||||
#endif // wxUSE_MOUSEEVENT_HACK
|
#endif // wxUSE_MOUSEEVENT_HACK
|
||||||
|
|
||||||
|
#if USE_DEFER_BUG_WORKAROUND
|
||||||
|
m_extraData = new wxWindowExtraData;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
@@ -512,6 +538,10 @@ wxWindowMSW::~wxWindowMSW()
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete m_childrenDisabled;
|
delete m_childrenDisabled;
|
||||||
|
|
||||||
|
#if USE_DEFER_BUG_WORKAROUND
|
||||||
|
delete m_extraData;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// real construction (Init() must have been called before!)
|
// real construction (Init() must have been called before!)
|
||||||
@@ -1578,9 +1608,28 @@ void wxWindowMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
{
|
{
|
||||||
// get the current size and position...
|
// get the current size and position...
|
||||||
int currentX, currentY;
|
int currentX, currentY;
|
||||||
|
int currentW, currentH;
|
||||||
|
|
||||||
|
#if USE_DEFER_BUG_WORKAROUND
|
||||||
|
currentX = m_extraData->m_pendingPosition.x;
|
||||||
|
if (currentX == wxDefaultCoord)
|
||||||
|
GetPosition(¤tX, NULL);
|
||||||
|
|
||||||
|
currentY = m_extraData->m_pendingPosition.y;
|
||||||
|
if (currentY == wxDefaultCoord)
|
||||||
|
GetPosition(NULL, ¤tY);
|
||||||
|
|
||||||
|
currentW = m_extraData->m_pendingSize.x;
|
||||||
|
if (currentW == wxDefaultCoord)
|
||||||
|
GetSize(¤tW, NULL);
|
||||||
|
|
||||||
|
currentH = m_extraData->m_pendingSize.y;
|
||||||
|
if (currentH == wxDefaultCoord)
|
||||||
|
GetSize(NULL, ¤tH);
|
||||||
|
#else
|
||||||
GetPosition(¤tX, ¤tY);
|
GetPosition(¤tX, ¤tY);
|
||||||
int currentW,currentH;
|
|
||||||
GetSize(¤tW, ¤tH);
|
GetSize(¤tW, ¤tH);
|
||||||
|
#endif
|
||||||
|
|
||||||
// ... and don't do anything (avoiding flicker) if it's already ok
|
// ... and don't do anything (avoiding flicker) if it's already ok
|
||||||
if ( x == currentX && y == currentY &&
|
if ( x == currentX && y == currentY &&
|
||||||
@@ -1630,6 +1679,24 @@ void wxWindowMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if USE_DEFER_BUG_WORKAROUND
|
||||||
|
// We don't actually use the hdwp here, but we need to know whether to
|
||||||
|
// save the pending dimensions or not. This isn't done in DoMoveWindow
|
||||||
|
// (where the hdwp is used) because some controls have thier own
|
||||||
|
// DoMoveWindow so it is easier to catch it here.
|
||||||
|
HDWP hdwp = GetParent() && !IsTopLevel() ? (HDWP)GetParent()->m_hDWP : NULL;
|
||||||
|
if (hdwp)
|
||||||
|
{
|
||||||
|
m_extraData->m_pendingPosition = wxPoint(x, y);
|
||||||
|
m_extraData->m_pendingSize = wxSize(width, height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_extraData->m_pendingPosition = wxDefaultPosition;
|
||||||
|
m_extraData->m_pendingSize = wxDefaultSize;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
DoMoveWindow(x, y, width, height);
|
DoMoveWindow(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4156,8 +4223,6 @@ bool wxWindowMSW::HandleMoving(wxRect& rect)
|
|||||||
|
|
||||||
bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h), WXUINT wParam)
|
bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h), WXUINT wParam)
|
||||||
{
|
{
|
||||||
// when we resize this window, its children are probably going to be
|
|
||||||
// repositioned as well, prepare to use DeferWindowPos() for them
|
|
||||||
#if USE_DEFERRED_SIZING
|
#if USE_DEFERRED_SIZING
|
||||||
// when we resize this window, its children are probably going to be
|
// when we resize this window, its children are probably going to be
|
||||||
// repositioned as well, prepare to use DeferWindowPos() for them
|
// repositioned as well, prepare to use DeferWindowPos() for them
|
||||||
@@ -4236,23 +4301,14 @@ bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h), WXUINT wParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if USE_DEFER_BUG_WORKAROUND
|
#if USE_DEFER_BUG_WORKAROUND
|
||||||
// Seems to be a bug in DeferWindowPos such that going from (a) to (b) to (a)
|
// Reset our children's pending pos/size values.
|
||||||
// doesn't work (omits last position/size). So check if there's a disparity,
|
|
||||||
// and correct.
|
|
||||||
for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
|
for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
|
||||||
node;
|
node;
|
||||||
node = node->GetNext() )
|
node = node->GetNext() )
|
||||||
{
|
{
|
||||||
wxWindow *child = node->GetData();
|
wxWindow *child = node->GetData();
|
||||||
wxSizer* sizer = child->GetContainingSizer();
|
child->m_extraData->m_pendingPosition = wxDefaultPosition;
|
||||||
if (sizer)
|
child->m_extraData->m_pendingSize = wxDefaultSize;
|
||||||
{
|
|
||||||
wxSizerItem* item = sizer->GetItem(child, true);
|
|
||||||
if (item->GetRect().GetPosition() != child->GetPosition())
|
|
||||||
{
|
|
||||||
child->Move(item->GetRect().GetPosition());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user