Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
|
456470fb7d |
|
@ -15,9 +15,10 @@
|
|||
IOSurfaceRef _staticBuffer;
|
||||
size_t _width;
|
||||
size_t _height;
|
||||
BOOL _useCADisplayLink;
|
||||
}
|
||||
|
||||
-(instancetype)initWithSurfaceInfo:(IOSurfaceRef)screenSurface rfbScreenInfo:(rfbScreenInfoPtr)rfbScreenInfo accelerator:(IOSurfaceAcceleratorRef)accelerator staticBuffer:(IOSurfaceRef)staticBuffer width:(size_t)width height:(size_t)height {
|
||||
-(instancetype)initWithSurfaceInfo:(IOSurfaceRef)screenSurface rfbScreenInfo:(rfbScreenInfoPtr)rfbScreenInfo accelerator:(IOSurfaceAcceleratorRef)accelerator staticBuffer:(IOSurfaceRef)staticBuffer width:(size_t)width height:(size_t)height useCADisplayLink:(BOOL)useCADisplayLink {
|
||||
if ((self = [super init])) {
|
||||
_q = [[NSOperationQueue alloc] init];
|
||||
_updatingFrames = NO;
|
||||
|
@ -30,6 +31,7 @@
|
|||
_staticBuffer = staticBuffer;
|
||||
_width = width;
|
||||
_height = height;
|
||||
_useCADisplayLink = useCADisplayLink;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -58,17 +60,25 @@
|
|||
|
||||
dispatch_async(dispatch_get_main_queue(), ^(void){
|
||||
[_updateFrameTimer invalidate];
|
||||
_updateFrameTimer = nil;
|
||||
_updatingFrames = NO;
|
||||
});
|
||||
}
|
||||
|
||||
-(void)startFrameLoop {
|
||||
// if (size_image == 0) VNCSetup();
|
||||
[self stopFrameLoop];
|
||||
_updatingFrames = YES;
|
||||
dispatch_async(dispatch_get_main_queue(), ^(void){
|
||||
_updateFrameTimer = [NSTimer scheduledTimerWithTimeInterval:1/400 target:self selector:@selector(_updateFrame) userInfo:nil repeats:YES];
|
||||
});
|
||||
|
||||
if (_useCADisplayLink) {
|
||||
CADisplayLink *displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(_updateFrame)];
|
||||
displayLink.preferredFramesPerSecond = 60; // Adjust as needed
|
||||
[displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
|
||||
_updateFrameTimer = (NSTimer *)displayLink;
|
||||
} else {
|
||||
dispatch_async(dispatch_get_main_queue(), ^(void){
|
||||
_updateFrameTimer = [NSTimer scheduledTimerWithTimeInterval:1/400 target:self selector:@selector(_updateFrame) userInfo:nil repeats:YES];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
|
|
|
@ -142,7 +142,9 @@
|
|||
|
||||
free(arg0);
|
||||
|
||||
_frameUpdater = [[FrameUpdater alloc] initWithSurfaceInfo:_screenSurface rfbScreenInfo:_rfbScreenInfo accelerator:_accelerator staticBuffer:_staticBuffer width:_width height:_height];
|
||||
NSDictionary* defaults = getPrefsForAppId(@"ru.mostmodest.screendump");
|
||||
bool useCADisplayLink = [[defaults objectForKey:@"displaysync"]?:@NO boolValue];
|
||||
_frameUpdater = [[FrameUpdater alloc] initWithSurfaceInfo:_screenSurface rfbScreenInfo:_rfbScreenInfo accelerator:_accelerator staticBuffer:_staticBuffer width:_width height:_height useCADisplayLink:useCADisplayLink];
|
||||
}
|
||||
|
||||
-(rfbBool)handleVNCAuthorization:(rfbClientPtr)client data:(const char *)data size:(int)size {
|
||||
|
|
|
@ -81,6 +81,26 @@
|
|||
<key>isNumeric</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSGroupCell</string>
|
||||
<key>label</key>
|
||||
<string>Tuning</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>PostNotification</key>
|
||||
<string>ru.mostmodest.screendump/restart</string>
|
||||
<key>cell</key>
|
||||
<string>PSSwitchCell</string>
|
||||
<key>default</key>
|
||||
<false/>
|
||||
<key>defaults</key>
|
||||
<string>ru.mostmodest.screendump</string>
|
||||
<key>key</key>
|
||||
<string>displaysync</string>
|
||||
<key>label</key>
|
||||
<string>Update screen using CADisplayLink</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
Loading…
Reference in New Issue