|
@@ -696,11 +696,15 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
|
|
|
isMiniaturizing = NO;
|
|
|
isDragAreaRunning = NO;
|
|
|
pendingWindowWarpX = pendingWindowWarpY = FLT_MAX;
|
|
|
+ liveResizeTimer = nil;
|
|
|
|
|
|
center = [NSNotificationCenter defaultCenter];
|
|
|
|
|
|
if ([window delegate] != nil) {
|
|
|
[center addObserver:self selector:@selector(windowDidExpose:) name:NSWindowDidExposeNotification object:window];
|
|
|
+ [center addObserver:self selector:@selector(windowDidChangeOcclusionState:) name:NSWindowDidChangeOcclusionStateNotification object:window];
|
|
|
+ [center addObserver:self selector:@selector(windowWillStartLiveResize:) name:NSWindowWillStartLiveResizeNotification object:window];
|
|
|
+ [center addObserver:self selector:@selector(windowDidEndLiveResize:) name:NSWindowDidEndLiveResizeNotification object:window];
|
|
|
[center addObserver:self selector:@selector(windowWillMove:) name:NSWindowWillMoveNotification object:window];
|
|
|
[center addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:window];
|
|
|
[center addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:window];
|
|
@@ -718,7 +722,6 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
|
|
|
[center addObserver:self selector:@selector(windowDidExitFullScreen:) name:NSWindowDidExitFullScreenNotification object:window];
|
|
|
[center addObserver:self selector:@selector(windowDidFailToEnterFullScreen:) name:@"NSWindowDidFailToEnterFullScreenNotification" object:window];
|
|
|
[center addObserver:self selector:@selector(windowDidFailToExitFullScreen:) name:@"NSWindowDidFailToExitFullScreenNotification" object:window];
|
|
|
- [center addObserver:self selector:@selector(windowDidChangeOcclusionState:) name:NSWindowDidChangeOcclusionStateNotification object:window];
|
|
|
} else {
|
|
|
[window setDelegate:self];
|
|
|
}
|
|
@@ -853,6 +856,9 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
|
|
|
|
|
|
if ([window delegate] != self) {
|
|
|
[center removeObserver:self name:NSWindowDidExposeNotification object:window];
|
|
|
+ [center removeObserver:self name:NSWindowDidChangeOcclusionStateNotification object:window];
|
|
|
+ [center removeObserver:self name:NSWindowWillStartLiveResizeNotification object:window];
|
|
|
+ [center removeObserver:self name:NSWindowDidEndLiveResizeNotification object:window];
|
|
|
[center removeObserver:self name:NSWindowWillMoveNotification object:window];
|
|
|
[center removeObserver:self name:NSWindowDidMoveNotification object:window];
|
|
|
[center removeObserver:self name:NSWindowDidResizeNotification object:window];
|
|
@@ -870,7 +876,6 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
|
|
|
[center removeObserver:self name:NSWindowDidExitFullScreenNotification object:window];
|
|
|
[center removeObserver:self name:@"NSWindowDidFailToEnterFullScreenNotification" object:window];
|
|
|
[center removeObserver:self name:@"NSWindowDidFailToExitFullScreenNotification" object:window];
|
|
|
- [center removeObserver:self name:NSWindowDidChangeOcclusionStateNotification object:window];
|
|
|
} else {
|
|
|
[window setDelegate:nil];
|
|
|
}
|
|
@@ -997,6 +1002,26 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+- (void)windowWillStartLiveResize:(NSNotification *)aNotification
|
|
|
+{
|
|
|
+ // We'll try to maintain 60 FPS during live resizing
|
|
|
+ const NSTimeInterval interval = 1.0 / 60.0;
|
|
|
+ liveResizeTimer = [NSTimer scheduledTimerWithTimeInterval:interval
|
|
|
+ repeats:TRUE
|
|
|
+ block:^(NSTimer *unusedTimer)
|
|
|
+ {
|
|
|
+ SDL_OnWindowLiveResizeUpdate(_data.window);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [[NSRunLoop currentRunLoop] addTimer:liveResizeTimer forMode:NSRunLoopCommonModes];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)windowDidEndLiveResize:(NSNotification *)aNotification
|
|
|
+{
|
|
|
+ [liveResizeTimer invalidate];
|
|
|
+ liveResizeTimer = nil;
|
|
|
+}
|
|
|
+
|
|
|
- (void)windowWillMove:(NSNotification *)aNotification
|
|
|
{
|
|
|
if ([_data.nswindow isKindOfClass:[SDL3Window class]]) {
|