From: Jan Sikorski Subject: [PATCH] winemac.drv: Omit WM_ENTER/EXITSIZEMOVE on non-interactive changes. Message-Id: <20201105164118.69510-1-jsikorski@codeweavers.com> Date: Thu, 5 Nov 2020 17:41:18 +0100 The motivating example is when a newly created window gets moved off the system menu bar. A program might not be prepared to handle these messages yet. Signed-off-by: Jan Sikorski --- dlls/winemac.drv/cocoa_window.m | 10 ++++++---- dlls/winemac.drv/macdrv_cocoa.h | 1 + dlls/winemac.drv/window.c | 5 +++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index b6c5386469c..8c3fffcdc6a 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -2114,7 +2114,7 @@ - (void) postBroughtForwardEvent macdrv_release_event(event); } - - (void) postWindowFrameChanged:(NSRect)frame fullscreen:(BOOL)isFullscreen resizing:(BOOL)resizing + - (void) postWindowFrameChanged:(NSRect)frame fullscreen:(BOOL)isFullscreen resizing:(BOOL)resizing notified:(BOOL)wasNotified { macdrv_event* event; NSUInteger style = self.styleMask; @@ -2134,6 +2134,7 @@ - (void) postWindowFrameChanged:(NSRect)frame fullscreen:(BOOL)isFullscreen resi event->window_frame_changed.frame = cgrect_win_from_mac(NSRectToCGRect(frame)); event->window_frame_changed.fullscreen = isFullscreen; event->window_frame_changed.in_resize = resizing; + event->window_frame_changed.was_notified = wasNotified; [queue postEvent:event]; macdrv_release_event(event); } @@ -2853,7 +2854,7 @@ - (void) windowDidExitFullScreen:(NSNotification*)notification { exitingFullScreen = FALSE; [self setFrameAndWineFrame:nonFullscreenFrame]; - [self windowDidResize:nil]; + [self windowDidResize:notification]; if (pendingOrderOut) [self doOrderOut]; } @@ -2920,7 +2921,8 @@ - (void)windowDidResize:(NSNotification *)notification [self postWindowFrameChanged:frame fullscreen:([self styleMask] & NSWindowStyleMaskFullScreen) != 0 - resizing:[self inLiveResize]]; + resizing:[self inLiveResize] + wasNotified:notification != nil]; [[[self contentView] inputContext] invalidateCharacterCoordinates]; [self updateFullscreen]; @@ -2982,7 +2984,7 @@ - (void) windowWillEnterFullScreen:(NSNotification*)notification - (void) windowWillExitFullScreen:(NSNotification*)notification { exitingFullScreen = TRUE; - [self postWindowFrameChanged:nonFullscreenFrame fullscreen:FALSE resizing:FALSE]; + [self postWindowFrameChanged:nonFullscreenFrame fullscreen:FALSE resizing:FALSE wasNotified:notification != nil]; } - (void)windowWillMiniaturize:(NSNotification *)notification diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index b02ad79f025..f75602d9616 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -443,6 +443,7 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display, CGRect frame; int fullscreen; int in_resize; + int was_notified; } window_frame_changed; struct { unsigned long serial; diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index e7f5327fcdc..b9ea9bea7c3 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -2322,10 +2322,11 @@ void macdrv_window_frame_changed(HWND hwnd, const macdrv_event *event) flags |= SWP_NOSENDCHANGING; if (!(flags & SWP_NOSIZE) || !(flags & SWP_NOMOVE)) { - if (!event->window_frame_changed.in_resize && !being_dragged) + int send_sizemove = !event->window_frame_changed.in_resize && !being_dragged && event->window_frame_changed.was_notified; + if (send_sizemove) SendMessageW(hwnd, WM_ENTERSIZEMOVE, 0, 0); SetWindowPos(hwnd, 0, rect.left, rect.top, width, height, flags); - if (!event->window_frame_changed.in_resize && !being_dragged) + if (send_sizemove) SendMessageW(hwnd, WM_EXITSIZEMOVE, 0, 0); } } -- 2.27.0