windowWillStartLiveResize: legacy OS compatibility fix
(cherry picked from commit d58f026827)
This commit is contained in:
1 parent
a5c518bf71
commit
732f779606
2 files changed
+16
-5
No files matched your search
@@ -78,6 +78,7 @@ typedef enum
|
|||||||
/* Window delegate functionality */
|
/* Window delegate functionality */
|
||||||
-(BOOL) windowShouldClose:(id) sender;
|
-(BOOL) windowShouldClose:(id) sender;
|
||||||
-(void) windowDidExpose:(NSNotification *) aNotification;
|
-(void) windowDidExpose:(NSNotification *) aNotification;
|
||||||
|
-(void) onLiveResizeTimerFire:(id) sender;
|
||||||
-(void) windowWillStartLiveResize:(NSNotification *)aNotification;
|
-(void) windowWillStartLiveResize:(NSNotification *)aNotification;
|
||||||
-(void) windowDidEndLiveResize:(NSNotification *)aNotification;
|
-(void) windowDidEndLiveResize:(NSNotification *)aNotification;
|
||||||
-(void) windowDidMove:(NSNotification *) aNotification;
|
-(void) windowDidMove:(NSNotification *) aNotification;
|
||||||
|
|||||||
@@ -743,16 +743,26 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
|
|||||||
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
|
SDL_SendWindowEvent(_data.window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)onLiveResizeTimerFire:(id)sender
|
||||||
|
{
|
||||||
|
SDL_OnWindowLiveResizeUpdate(_data.window);
|
||||||
|
}
|
||||||
|
|
||||||
- (void)windowWillStartLiveResize:(NSNotification *)aNotification
|
- (void)windowWillStartLiveResize:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
// We'll try to maintain 60 FPS during live resizing
|
// We'll try to maintain 60 FPS during live resizing
|
||||||
const NSTimeInterval interval = 1.0 / 60.0;
|
const NSTimeInterval interval = 1.0 / 60.0;
|
||||||
|
|
||||||
|
NSMethodSignature *invocationSig = [Cocoa_WindowListener
|
||||||
|
instanceMethodSignatureForSelector:@selector(onLiveResizeTimerFire:)];
|
||||||
|
NSInvocation *invocation = [NSInvocation
|
||||||
|
invocationWithMethodSignature:invocationSig];
|
||||||
|
[invocation setTarget:self];
|
||||||
|
[invocation setSelector:@selector(onLiveResizeTimerFire:)];
|
||||||
|
|
||||||
liveResizeTimer = [NSTimer scheduledTimerWithTimeInterval:interval
|
liveResizeTimer = [NSTimer scheduledTimerWithTimeInterval:interval
|
||||||
repeats:TRUE
|
invocation:invocation
|
||||||
block:^(NSTimer *unusedTimer)
|
repeats:TRUE];
|
||||||
{
|
|
||||||
SDL_OnWindowLiveResizeUpdate(_data.window);
|
|
||||||
}];
|
|
||||||
|
|
||||||
[[NSRunLoop currentRunLoop] addTimer:liveResizeTimer forMode:NSRunLoopCommonModes];
|
[[NSRunLoop currentRunLoop] addTimer:liveResizeTimer forMode:NSRunLoopCommonModes];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user