Make wxSIZE_FORCE_EVENT work if only position changed in wxMSW

If the position changed but the size didn't, we just call Win32 API for
updating the window geometry but it didn't generate WM_SIZE in this case, so
even when wxSIZE_FORCE_EVENT was used, no wxSizeEvent was sent.
This commit is contained in:
Vadim Zeitlin 2016-06-08 02:31:19 +02:00
parent 7f603c959f
commit 9e27a1ca3a

View File

@ -1894,17 +1894,24 @@ void wxWindowMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags)
// ... and don't do anything (avoiding flicker) if it's already ok unless
// we're forced to resize the window
if ( x == currentX && y == currentY &&
width == currentW && height == currentH &&
!(sizeFlags & wxSIZE_FORCE) )
if ( !(sizeFlags & wxSIZE_FORCE) )
{
if (sizeFlags & wxSIZE_FORCE_EVENT)
if ( width == currentW && height == currentH )
{
wxSizeEvent event( wxSize(width,height), GetId() );
event.SetEventObject( this );
HandleWindowEvent( event );
// We need to send wxSizeEvent ourselves because Windows won't do
// it if the size doesn't change.
if ( sizeFlags & wxSIZE_FORCE_EVENT )
{
wxSizeEvent event( wxSize(width,height), GetId() );
event.SetEventObject( this );
HandleWindowEvent( event );
}
// Still call DoMoveWindow() below if we need to change the
// position, otherwise we're done.
if ( x == currentX && y == currentY )
return;
}
return;
}
if ( x == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )