diff --git a/screendump/FrameUpdater.h b/screendump/FrameUpdater.h
index 80016cf..c966aa1 100644
--- a/screendump/FrameUpdater.h
+++ b/screendump/FrameUpdater.h
@@ -14,7 +14,8 @@
nativeWidth:(size_t)nativeWidth
nativeHeight:(size_t)nativeHeight
renderServerSurface:(IOSurfaceRef)renderServerSurface
- captureModeBlock:(CaptureMode(^)(void))captureModeBlock;
+ captureModeBlock:(CaptureMode(^)(void))captureModeBlock
+ preferredFramesPerSecond:(int)preferredFramesPerSecond;
- (void)startFrameLoop;
- (void)stopFrameLoop;
@end
diff --git a/screendump/FrameUpdater.m b/screendump/FrameUpdater.m
index c3ff5f6..e48afc7 100644
--- a/screendump/FrameUpdater.m
+++ b/screendump/FrameUpdater.m
@@ -22,6 +22,9 @@
IOSurfaceRef _renderServerSurface; // Separate surface for CARenderServer (avoids framebuffer locking)
CaptureMode(^_captureModeBlock)(void);
+ // Frame rate
+ int _preferredFramesPerSecond;
+
// Diagnostics
uint64_t _timerFires;
uint64_t _framesRendered;
@@ -40,7 +43,8 @@
nativeWidth:(size_t)nativeWidth
nativeHeight:(size_t)nativeHeight
renderServerSurface:(IOSurfaceRef)renderServerSurface
- captureModeBlock:(CaptureMode(^)(void))captureModeBlock {
+ captureModeBlock:(CaptureMode(^)(void))captureModeBlock
+ preferredFramesPerSecond:(int)preferredFramesPerSecond {
if ((self = [super init])) {
_q = [[NSOperationQueue alloc] init];
_q.maxConcurrentOperationCount = 1; // Serialize to prevent frame queue buildup
@@ -59,6 +63,7 @@
_renderServerSurface = renderServerSurface;
_captureModeBlock = [captureModeBlock copy];
+ _preferredFramesPerSecond = preferredFramesPerSecond;
}
return self;
}
@@ -155,7 +160,7 @@
dispatch_async(dispatch_get_main_queue(), ^{
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(_updateFrame)];
- _displayLink.preferredFramesPerSecond = 30;
+ _displayLink.preferredFramesPerSecond = _preferredFramesPerSecond;
[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
});
}
diff --git a/screendump/ScreenDumpVNC.m b/screendump/ScreenDumpVNC.m
index 25d8e34..5bf1c42 100644
--- a/screendump/ScreenDumpVNC.m
+++ b/screendump/ScreenDumpVNC.m
@@ -10,6 +10,7 @@
@implementation ScreenDumpVNC {
int _prefsHeight;
int _prefsWidth;
+ int _prefsFramesPerSecond;
bool _enabled;
NSString *_password;
rfbScreenInfoPtr _rfbScreenInfo;
@@ -90,6 +91,9 @@
NSNumber *enabled = [defaults objectForKey:@"enabled"];
_enabled = enabled ? [enabled boolValue] : NO;
_password = [defaults objectForKey:@"password"];
+
+ NSNumber *framesPerSecond = [defaults objectForKey:@"framesPerSecond"];
+ _prefsFramesPerSecond = framesPerSecond ? [framesPerSecond intValue] : 30;
}
-(void)setupVNCAuthentication {
@@ -319,7 +323,8 @@
captureModeBlock:^CaptureMode(void) {
ScreenDumpVNC *strongSelf = weakSelf;
return strongSelf ? strongSelf->_captureMode : CaptureModeCARenderServer;
- }];
+ }
+ preferredFramesPerSecond:_prefsFramesPerSecond];
}
-(rfbBool)handleVNCAuthorization:(rfbClientPtr)client data:(const char *)data size:(int)size {
diff --git a/screendump/layout/Library/PreferenceLoader/Preferences/screendump/Preferences.plist b/screendump/layout/Library/PreferenceLoader/Preferences/screendump/Preferences.plist
index 518421f..609ebc8 100644
--- a/screendump/layout/Library/PreferenceLoader/Preferences/screendump/Preferences.plist
+++ b/screendump/layout/Library/PreferenceLoader/Preferences/screendump/Preferences.plist
@@ -16,8 +16,6 @@
cell
PSGroupCell
- label
- General
PostNotification
@@ -49,9 +47,7 @@
cell
PSGroupCell
label
- Custom Resolution
- footerText
- High Resolution Can Be Slow
+ Performance
PostNotification
@@ -81,6 +77,22 @@
isNumeric
+
+ PostNotification
+ com.mousen.screendump/restart
+ cell
+ PSEditTextCell
+ defaults
+ com.mousen.screendump
+ key
+ framesPerSecond
+ label
+ Max FPS
+ default
+ 30
+ isNumeric
+
+