mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-05 19:08:12 +00:00
Check NSWindow::isVisible before sending SDL_WINDOWEVENT_RESTORED during Cocoa_WindowListener::windowDidResize
(cherry picked from commit 30f0aeb26a
)
This commit is contained in:

committed by
Frank Praznik

parent
eaa2a8239f
commit
c31ddf021e
@@ -1199,21 +1199,27 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
|
|||||||
|
|
||||||
ScheduleContextUpdates(_data);
|
ScheduleContextUpdates(_data);
|
||||||
|
|
||||||
/* isZoomed always returns true if the window is not resizable
|
/* The OS can resize the window automatically if the display density
|
||||||
* and fullscreen windows are considered zoomed.
|
* changes while the window is miniaturized or hidden.
|
||||||
*/
|
*/
|
||||||
if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed] &&
|
if ([nswindow isVisible])
|
||||||
!(window->flags & SDL_WINDOW_FULLSCREEN) && ![self isInFullscreenSpace]) {
|
{
|
||||||
zoomed = YES;
|
/* isZoomed always returns true if the window is not resizable
|
||||||
} else {
|
* and fullscreen windows are considered zoomed.
|
||||||
zoomed = NO;
|
*/
|
||||||
}
|
if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed] &&
|
||||||
if (!zoomed) {
|
!(window->flags & SDL_WINDOW_FULLSCREEN) && ![self isInFullscreenSpace]) {
|
||||||
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
zoomed = YES;
|
||||||
} else {
|
} else {
|
||||||
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
|
zoomed = NO;
|
||||||
if ([self windowOperationIsPending:PENDING_OPERATION_MINIMIZE]) {
|
}
|
||||||
[nswindow miniaturize:nil];
|
if (!zoomed) {
|
||||||
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||||
|
} else {
|
||||||
|
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
|
||||||
|
if ([self windowOperationIsPending:PENDING_OPERATION_MINIMIZE]) {
|
||||||
|
[nswindow miniaturize:nil];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user