From 9e27a1ca3aef0ff36cb7c9d2e3f6618505733834 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 8 Jun 2016 02:31:19 +0200 Subject: [PATCH] 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. --- src/msw/window.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index a76d66c1f1..ea048e8c0b 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -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) )