Dark Mode & Stream Overlay [macOS] (#315)

* dark mode & stream overlay

* removed all redundant imports

* update for the new xcode version with fixes for the new 'implicitly retains self warning'

* reworked the overlay view

* cleaning up unused variables

* small corrections
This commit is contained in:
Felix Kratz
2018-04-22 06:44:22 +02:00
committed by Cameron Gutman
parent 74283a6763
commit f759f719e6
50 changed files with 358 additions and 146 deletions
-2
View File
@@ -6,8 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface CryptoManager : NSObject
+ (void) generateKeyPairUsingSSl;
-2
View File
@@ -6,8 +6,6 @@
// Copyright © 2015 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface IdManager : NSObject
+ (NSString*) getUniqueId;
-3
View File
@@ -6,9 +6,6 @@
// Copyright © 2015 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class Host;
@interface App : NSManagedObject
-1
View File
@@ -6,7 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AppDelegate.h"
#import "TemporaryHost.h"
#import "TemporaryApp.h"
+7 -7
View File
@@ -27,7 +27,7 @@
}
else {
dispatch_sync(dispatch_get_main_queue(), ^{
_appDelegate = (AppDelegate *)[[OSApplication sharedApplication] delegate];
self->_appDelegate = (AppDelegate *)[[OSApplication sharedApplication] delegate];
});
}
@@ -76,8 +76,8 @@
// Add a new persistent managed object if one doesn't exist
Host* parent = [self getHostForTemporaryHost:host withHostRecords:[self fetchRecords:@"Host"]];
if (parent == nil) {
NSEntityDescription* entity = [NSEntityDescription entityForName:@"Host" inManagedObjectContext:_managedObjectContext];
parent = [[Host alloc] initWithEntity:entity insertIntoManagedObjectContext:_managedObjectContext];
NSEntityDescription* entity = [NSEntityDescription entityForName:@"Host" inManagedObjectContext:self->_managedObjectContext];
parent = [[Host alloc] initWithEntity:entity insertIntoManagedObjectContext:self->_managedObjectContext];
}
// Push changes from the temp host to the persistent one
@@ -101,8 +101,8 @@
// Add a new persistent managed object if one doesn't exist
App* parentApp = [self getAppForTemporaryApp:app withAppRecords:appRecords];
if (parentApp == nil) {
NSEntityDescription* entity = [NSEntityDescription entityForName:@"App" inManagedObjectContext:_managedObjectContext];
parentApp = [[App alloc] initWithEntity:entity insertIntoManagedObjectContext:_managedObjectContext];
NSEntityDescription* entity = [NSEntityDescription entityForName:@"App" inManagedObjectContext:self->_managedObjectContext];
parentApp = [[App alloc] initWithEntity:entity insertIntoManagedObjectContext:self->_managedObjectContext];
}
[app propagateChangesToParent:parentApp withHost:parent];
@@ -158,7 +158,7 @@
[_managedObjectContext performBlockAndWait:^{
App* managedApp = [self getAppForTemporaryApp:app withAppRecords:[self fetchRecords:@"App"]];
if (managedApp != nil) {
[_managedObjectContext deleteObject:managedApp];
[self->_managedObjectContext deleteObject:managedApp];
[self saveData];
}
}];
@@ -168,7 +168,7 @@
[_managedObjectContext performBlockAndWait:^{
Host* managedHost = [self getHostForTemporaryHost:host withHostRecords:[self fetchRecords:@"Host"]];
if (managedHost != nil) {
[_managedObjectContext deleteObject:managedHost];
[self->_managedObjectContext deleteObject:managedHost];
[self saveData];
}
}];
-2
View File
@@ -6,8 +6,6 @@
// Copyright © 2015 Limelight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "Utils.h"
@interface Host : NSManagedObject
-4
View File
@@ -6,10 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface Settings : NSManagedObject
@property (nonatomic, retain) NSNumber * bitrate;
-1
View File
@@ -6,7 +6,6 @@
// Copyright © 2015 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "TemporaryHost.h"
#import "App.h"
-1
View File
@@ -6,7 +6,6 @@
// Copyright © 2015 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Utils.h"
#import "Host.h"
-1
View File
@@ -6,7 +6,6 @@
// Copyright © 2015 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Settings.h"
@interface TemporarySettings : NSObject
-2
View File
@@ -6,8 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
// Swift
#import "Moonlight-Swift.h"
#if !TARGET_OS_IPHONE
+6 -6
View File
@@ -177,7 +177,7 @@
{
if (controller != NULL) {
controller.controllerPausedHandler = ^(GCController *controller) {
Controller* limeController = [_controllers objectForKey:[NSNumber numberWithInteger:controller.playerIndex]];
Controller* limeController = [self->_controllers objectForKey:[NSNumber numberWithInteger:controller.playerIndex]];
[self setButtonFlag:limeController flags:PLAY_FLAG];
[self updateFinished:limeController];
@@ -190,7 +190,7 @@
if (controller.extendedGamepad != NULL) {
controller.extendedGamepad.valueChangedHandler = ^(GCExtendedGamepad *gamepad, GCControllerElement *element) {
Controller* limeController = [_controllers objectForKey:[NSNumber numberWithInteger:gamepad.controller.playerIndex]];
Controller* limeController = [self->_controllers objectForKey:[NSNumber numberWithInteger:gamepad.controller.playerIndex]];
short leftStickX, leftStickY;
short rightStickX, rightStickY;
char leftTrigger, rightTrigger;
@@ -225,7 +225,7 @@
}
else if (controller.gamepad != NULL) {
controller.gamepad.valueChangedHandler = ^(GCGamepad *gamepad, GCControllerElement *element) {
Controller* limeController = [_controllers objectForKey:[NSNumber numberWithInteger:gamepad.controller.playerIndex]];
Controller* limeController = [self->_controllers objectForKey:[NSNumber numberWithInteger:gamepad.controller.playerIndex]];
UPDATE_BUTTON_FLAG(limeController, A_FLAG, gamepad.buttonA.pressed);
UPDATE_BUTTON_FLAG(limeController, B_FLAG, gamepad.buttonB.pressed);
UPDATE_BUTTON_FLAG(limeController, X_FLAG, gamepad.buttonX.pressed);
@@ -408,12 +408,12 @@
GCController* controller = note.object;
[self unregisterControllerCallbacks:controller];
_controllerNumbers &= ~(1 << controller.playerIndex);
self->_controllerNumbers &= ~(1 << controller.playerIndex);
Log(LOG_I, @"Unassigning controller index: %ld", (long)controller.playerIndex);
// Inform the server of the updated active gamepads before removing this controller
[self updateFinished:[_controllers objectForKey:[NSNumber numberWithInteger:controller.playerIndex]]];
[_controllers removeObjectForKey:[NSNumber numberWithInteger:controller.playerIndex]];
[self updateFinished:[self->_controllers objectForKey:[NSNumber numberWithInteger:controller.playerIndex]]];
[self->_controllers removeObjectForKey:[NSNumber numberWithInteger:controller.playerIndex]];
// Re-evaluate the on-screen control mode
[self updateAutoOnScreenControlMode];
-1
View File
@@ -6,7 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "TemporaryApp.h"
#import "HttpManager.h"
#import "TemporaryHost.h"
-1
View File
@@ -6,7 +6,6 @@
// Copyright (c) 2015 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "HttpResponse.h"
@interface AppAssetResponse : NSObject <Response>
-1
View File
@@ -6,7 +6,6 @@
// Copyright (c) 2015 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "TemporaryHost.h"
#import "TemporaryApp.h"
#import "AppAssetManager.h"
+2 -3
View File
@@ -2,11 +2,10 @@
// ConnectionHelper.h
// Moonlight macOS
//
// Created by Felix on 22.03.18.
// Copyright © 2018 Felix. All rights reserved.
// Created by Felix Kratz on 22.03.18.
// Copyright © 2018 Felix Kratz. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AppListResponse.h"
#ifndef ConnectionHelper_h
+2 -2
View File
@@ -2,8 +2,8 @@
// ConnectionHelper.m
// Moonlight macOS
//
// Created by Felix on 22.03.18.
// Copyright © 2018 Felix. All rights reserved.
// Created by Felix Kratz on 22.03.18.
// Copyright © 2018 Felix Kratz. All rights reserved.
//
#import "ConnectionHelper.h"
-1
View File
@@ -6,7 +6,6 @@
// Copyright (c) 2015 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MDNSManager.h"
#import "TemporaryHost.h"
+1 -1
View File
@@ -153,7 +153,7 @@
[worker discoverHost];
if ([self addHostToDiscovery:host]) {
Log(LOG_I, @"Adding host to discovery: %@", host.name);
[_callback updateAllHosts:_hostQueue];
[self->_callback updateAllHosts:self->_hostQueue];
} else {
Log(LOG_I, @"Not adding host to discovery: %@", host.name);
}
-1
View File
@@ -6,7 +6,6 @@
// Copyright (c) 2015 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "TemporaryHost.h"
@interface DiscoveryWorker : NSOperation
-1
View File
@@ -6,7 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "HttpResponse.h"
#import "HttpRequest.h"
+6 -6
View File
@@ -69,23 +69,23 @@ static const NSString* HTTPS_PORT = @"47984";
if (error != NULL) {
Log(LOG_D, @"Connection error: %@", error);
_errorOccurred = true;
self->_errorOccurred = true;
}
else {
Log(LOG_D, @"Received response: %@", response);
if (data != NULL) {
Log(LOG_D, @"\n\nReceived data: %@\n\n", [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
[_respData appendData:data];
if ([[NSString alloc] initWithData:_respData encoding:NSUTF8StringEncoding] != nil) {
_requestResp = [HttpManager fixXmlVersion:_respData];
[self->_respData appendData:data];
if ([[NSString alloc] initWithData:self->_respData encoding:NSUTF8StringEncoding] != nil) {
self->_requestResp = [HttpManager fixXmlVersion:self->_respData];
} else {
_requestResp = _respData;
self->_requestResp = self->_respData;
}
}
}
dispatch_semaphore_signal(_requestLock);
dispatch_semaphore_signal(self->_requestLock);
}] resume];
dispatch_semaphore_wait(_requestLock, DISPATCH_TIME_FOREVER);
-1
View File
@@ -6,7 +6,6 @@
// Copyright (c) 2015 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "HttpResponse.h"
@interface HttpRequest : NSObject
-2
View File
@@ -6,8 +6,6 @@
// Copyright (c) 2015 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
static NSString* TAG_STATUS_CODE = @"status_code";
static NSString* TAG_STATUS_MESSAGE = @"status_message";
-2
View File
@@ -6,8 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol MDNSCallback <NSObject>
- (void) updateHosts:(NSArray*)hosts;
-1
View File
@@ -6,7 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "HttpManager.h"
@protocol PairCallback <NSObject>
-1
View File
@@ -6,7 +6,6 @@
// Copyright (c) 2015 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "TemporaryHost.h"
@interface WakeOnLanManager : NSObject
-1
View File
@@ -6,7 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "VideoDecoderRenderer.h"
#import "StreamConfiguration.h"
-2
View File
@@ -6,8 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface StreamConfiguration : NSObject
@property NSString* host;
-1
View File
@@ -6,7 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "StreamConfiguration.h"
#import "Connection.h"
-2
View File
@@ -6,8 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@import AVFoundation;
@interface VideoDecoderRenderer : NSObject
+9 -3
View File
@@ -7,11 +7,12 @@
//
#import "VideoDecoderRenderer.h"
#import "StreamView.h"
#include "Limelight.h"
@implementation VideoDecoderRenderer {
OSView *_view;
StreamView* _view;
AVSampleBufferDisplayLayer* displayLayer;
Boolean waitingForSps, waitingForPps, waitingForVps;
@@ -54,7 +55,7 @@
}
}
- (id)initWithView:(OSView*)view
- (id)initWithView:(StreamView*)view
{
self = [super init];
@@ -68,6 +69,9 @@
- (void)setupWithVideoFormat:(int)videoFormat
{
self->videoFormat = videoFormat;
#if !TARGET_OS_IPHONE
_view.codec = videoFormat;
#endif
}
#define FRAME_START_PREFIX_SIZE 4
@@ -335,7 +339,9 @@
}
[displayLayer enqueueSampleBuffer:sampleBuffer];
#if !TARGET_OS_IPHONE
_view.frameCount++;
#endif
// Dereference the buffers
CFRelease(blockBuffer);
CFRelease(sampleBuffer);
+1 -3
View File
@@ -6,8 +6,6 @@
// Copyright (c) 2014 Moonlight Stream. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Utils : NSObject
typedef NS_ENUM(int, PairState) {
@@ -29,4 +27,4 @@ FOUNDATION_EXPORT NSString *const deviceName;
- (NSString*) trim;
@end
@end