Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions Limelight/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,10 @@ @implementation AppDelegate
#endif

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
#if !TARGET_OS_TV
UIApplicationShortcutItem* shortcut = [launchOptions valueForKey:UIApplicationLaunchOptionsShortcutItemKey];
if (shortcut != nil) {
_pcUuidToLoad = (NSString*)[shortcut.userInfo objectForKey:@"UUID"];
}
#endif
// On iOS, quick actions are delivered to our SceneDelegate
return YES;
}

#if !TARGET_OS_TV
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL succeeded))completionHandler {
_pcUuidToLoad = (NSString*)[shortcutItem.userInfo objectForKey:@"UUID"];
_shortcutCompletionHandler = completionHandler;
}
#endif

- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Expand Down
3 changes: 2 additions & 1 deletion Limelight/Database/DataManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
enableHdr:(BOOL)enableHdr
btMouseSupport:(BOOL)btMouseSupport
absoluteTouchMode:(BOOL)absoluteTouchMode
statsOverlay:(BOOL)statsOverlay;
statsOverlay:(BOOL)statsOverlay
videoScalingMode:(uint32_t)videoScalingMode;

- (NSArray*) getHosts;
- (void) updateHost:(TemporaryHost*)host;
Expand Down
6 changes: 4 additions & 2 deletions Limelight/Database/DataManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ - (void) saveSettingsWithBitrate:(NSInteger)bitrate
enableHdr:(BOOL)enableHdr
btMouseSupport:(BOOL)btMouseSupport
absoluteTouchMode:(BOOL)absoluteTouchMode
statsOverlay:(BOOL)statsOverlay {
statsOverlay:(BOOL)statsOverlay
videoScalingMode:(uint32_t)videoScalingMode {

[_managedObjectContext performBlockAndWait:^{
Settings* settingsToSave = [self retrieveSettings];
Expand All @@ -87,7 +88,8 @@ - (void) saveSettingsWithBitrate:(NSInteger)bitrate
settingsToSave.btMouseSupport = btMouseSupport;
settingsToSave.absoluteTouchMode = absoluteTouchMode;
settingsToSave.statsOverlay = statsOverlay;

settingsToSave.videoScalingMode = videoScalingMode;

[self saveData];
}];
}
Expand Down
11 changes: 11 additions & 0 deletions Limelight/Database/TemporarySettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

#import "Settings+CoreDataClass.h"

// Special values for the width and height settings that select the full screen or
// safe area resolution of whichever display the stream is started on. These allow
// a single setting to match both the inner and outer displays of iPhone Duo.
#define RESOLUTION_MATCH_DISPLAY_FULL -1
#define RESOLUTION_MATCH_DISPLAY_SAFE_AREA -2

@interface TemporarySettings : NSObject

@property (nonatomic, retain) Settings * parent;
Expand All @@ -34,6 +40,11 @@
@property (nonatomic) BOOL btMouseSupport;
@property (nonatomic) BOOL absoluteTouchMode;
@property (nonatomic) BOOL statsOverlay;
@property (nonatomic) enum {
VIDEO_SCALING_FIT,
VIDEO_SCALING_FILL,
VIDEO_SCALING_STRETCH,
} videoScalingMode;

- (id) initFromSettings:(Settings*)settings;

Expand Down
1 change: 1 addition & 0 deletions Limelight/Database/TemporarySettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ - (id) initFromSettings:(Settings*)settings {
self.btMouseSupport = settings.btMouseSupport;
self.absoluteTouchMode = settings.absoluteTouchMode;
self.statsOverlay = settings.statsOverlay;
self.videoScalingMode = (typeof(self.videoScalingMode))settings.videoScalingMode;
#endif
self.uniqueId = settings.uniqueId;

Expand Down
3 changes: 3 additions & 0 deletions Limelight/Input/ControllerSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@

-(NSUInteger) getConnectedGamepadCount;

// Whether GCMouse has delivered mouse button events since a mouse was last disconnected
-(BOOL) hasReceivedMouseButtonEvents;

@end
12 changes: 12 additions & 0 deletions Limelight/Input/ControllerSupport.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ @implementation ControllerSupport {
NSMutableDictionary *_controllers;
id<ControllerSupportDelegate> _delegate;

BOOL _receivedMouseButtonEvents;
float accumulatedDeltaX;
float accumulatedDeltaY;
float accumulatedScrollX;
Expand Down Expand Up @@ -863,23 +864,28 @@ -(void) registerMouseCallbacks:(GCMouse*) mouse API_AVAILABLE(ios(14.0)) {
};

mouse.mouseInput.leftButton.pressedChangedHandler = ^(GCControllerButtonInput * _Nonnull button, float value, BOOL pressed) {
self->_receivedMouseButtonEvents = YES;
LiSendMouseButtonEvent(pressed ? BUTTON_ACTION_PRESS : BUTTON_ACTION_RELEASE, BUTTON_LEFT);
};
mouse.mouseInput.middleButton.pressedChangedHandler = ^(GCControllerButtonInput * _Nonnull button, float value, BOOL pressed) {
self->_receivedMouseButtonEvents = YES;
LiSendMouseButtonEvent(pressed ? BUTTON_ACTION_PRESS : BUTTON_ACTION_RELEASE, BUTTON_MIDDLE);
};
mouse.mouseInput.rightButton.pressedChangedHandler = ^(GCControllerButtonInput * _Nonnull button, float value, BOOL pressed) {
self->_receivedMouseButtonEvents = YES;
LiSendMouseButtonEvent(pressed ? BUTTON_ACTION_PRESS : BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
};

if (mouse.mouseInput.auxiliaryButtons != nil) {
if (mouse.mouseInput.auxiliaryButtons.count >= 1) {
mouse.mouseInput.auxiliaryButtons[0].pressedChangedHandler = ^(GCControllerButtonInput * _Nonnull button, float value, BOOL pressed) {
self->_receivedMouseButtonEvents = YES;
LiSendMouseButtonEvent(pressed ? BUTTON_ACTION_PRESS : BUTTON_ACTION_RELEASE, BUTTON_X1);
};
}
if (mouse.mouseInput.auxiliaryButtons.count >= 2) {
mouse.mouseInput.auxiliaryButtons[1].pressedChangedHandler = ^(GCControllerButtonInput * _Nonnull button, float value, BOOL pressed) {
self->_receivedMouseButtonEvents = YES;
LiSendMouseButtonEvent(pressed ? BUTTON_ACTION_PRESS : BUTTON_ACTION_RELEASE, BUTTON_X2);
};
}
Expand Down Expand Up @@ -1068,6 +1074,11 @@ +(int) getConnectedGamepadMask:(StreamConfiguration*)streamConfig {
return mask;
}

-(BOOL) hasReceivedMouseButtonEvents
{
return _receivedMouseButtonEvents;
}

-(NSUInteger) getConnectedGamepadCount
{
return _controllers.count;
Expand Down Expand Up @@ -1199,6 +1210,7 @@ -(id) initWithConfig:(StreamConfiguration*)streamConfig delegate:(id<ControllerS

// Unregister for mouse events
[self unregisterMouseCallbacks: mouse];
self->_receivedMouseButtonEvents = NO;

// Re-evaluate the on-screen control mode
[self updateAutoOnScreenControlMode];
Expand Down
1 change: 1 addition & 0 deletions Limelight/Input/OnScreenControls.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ typedef NS_ENUM(NSInteger, OnScreenControlsLevel) {
- (void) setLevel:(OnScreenControlsLevel)level;
- (OnScreenControlsLevel) getLevel;
- (void) show;
- (void) updateLayout;

@end
Loading