From 02fbd5f1d2a56c862a8f08eee74de0425c83c3c6 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 20 Oct 2014 02:38:01 -0400 Subject: [PATCH] Add some WIP touch input support --- Limelight.xcodeproj/project.pbxproj | 6 +++ Limelight/StreamView.h | 13 +++++++ Limelight/StreamView.m | 58 +++++++++++++++++++++++++++++ MainFrame-iPad.storyboard | 5 +-- MainFrame-iPhone.storyboard | 6 +-- 5 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 Limelight/StreamView.h create mode 100644 Limelight/StreamView.m diff --git a/Limelight.xcodeproj/project.pbxproj b/Limelight.xcodeproj/project.pbxproj index ce4644e..a2a61a6 100644 --- a/Limelight.xcodeproj/project.pbxproj +++ b/Limelight.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 984C441819F48D1D0061A500 /* StreamView.m in Sources */ = {isa = PBXBuildFile; fileRef = 984C441719F48D1D0061A500 /* StreamView.m */; }; 98A03B4D19F352EB00861ACA /* liblimelight-common.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 98A03B4A19F3514B00861ACA /* liblimelight-common.a */; }; 98A03B5019F3598400861ACA /* VideoDecoderRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 98A03B4F19F3598400861ACA /* VideoDecoderRenderer.m */; }; 98A03B5119F35AAC00861ACA /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FBCC0E9819EF9703009729EB /* libcrypto.a */; }; @@ -76,6 +77,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 984C441619F48D1D0061A500 /* StreamView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamView.h; sourceTree = ""; }; + 984C441719F48D1D0061A500 /* StreamView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StreamView.m; sourceTree = ""; }; 98A03B4519F3514B00861ACA /* limelight-common.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "limelight-common.xcodeproj"; path = "limelight-common-c/limelight-common.xcodeproj"; sourceTree = ""; }; 98A03B4E19F3598400861ACA /* VideoDecoderRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VideoDecoderRenderer.h; path = Limelight/VideoDecoderRenderer.h; sourceTree = SOURCE_ROOT; }; 98A03B4F19F3598400861ACA /* VideoDecoderRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VideoDecoderRenderer.m; path = Limelight/VideoDecoderRenderer.m; sourceTree = SOURCE_ROOT; }; @@ -412,6 +415,8 @@ FBCC0E9C19F00659009729EB /* mkcert.c */, FBC8622B19F0BEFB0087327B /* HttpManager.h */, FBC8622C19F0BEFB0087327B /* HttpManager.m */, + 984C441619F48D1D0061A500 /* StreamView.h */, + 984C441719F48D1D0061A500 /* StreamView.m */, ); path = Limelight; sourceTree = ""; @@ -959,6 +964,7 @@ FB290D3A19B2C6E3004C83CF /* StreamFrameViewController.m in Sources */, FB290D0019B2C406004C83CF /* main.m in Sources */, FB290D3919B2C6E3004C83CF /* MainFrameViewController.m in Sources */, + 984C441819F48D1D0061A500 /* StreamView.m in Sources */, FB290D3719B2C6E3004C83CF /* Connection.m in Sources */, FBCC0E9D19F00659009729EB /* mkcert.c in Sources */, FB290D3819B2C6E3004C83CF /* ConnectionHandler.m in Sources */, diff --git a/Limelight/StreamView.h b/Limelight/StreamView.h new file mode 100644 index 0000000..b722ed9 --- /dev/null +++ b/Limelight/StreamView.h @@ -0,0 +1,13 @@ +// +// StreamView.h +// Limelight +// +// Created by Cameron Gutman on 10/19/14. +// Copyright (c) 2014 Limelight Stream. All rights reserved. +// + +#import + +@interface StreamView : UIView + +@end diff --git a/Limelight/StreamView.m b/Limelight/StreamView.m new file mode 100644 index 0000000..9905d0c --- /dev/null +++ b/Limelight/StreamView.m @@ -0,0 +1,58 @@ +// +// StreamView.m +// Limelight +// +// Created by Cameron Gutman on 10/19/14. +// Copyright (c) 2014 Limelight Stream. All rights reserved. +// + +#import "StreamView.h" +#include + +@implementation StreamView { + CGPoint touchLocation; + BOOL touchMoved; +} + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { + UITouch *touch = [[event allTouches] anyObject]; + touchLocation = [touch locationInView:self]; + touchMoved = false; + + NSLog(@"Touch down"); +} + +- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { + UITouch *touch = [[event allTouches] anyObject]; + CGPoint currentLocation = [touch locationInView:self]; + + NSLog(@"Touch move"); + + if (touchLocation.x != currentLocation.x && + touchLocation.y != currentLocation.y) + { + LiSendMouseMoveEvent(touchLocation.x - currentLocation.x, + touchLocation.y - currentLocation.y); + + touchMoved = true; + touchLocation = currentLocation; + } +} + +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { + NSLog(@"Touch up"); + + if (!touchMoved) { + LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT); + + usleep(50 * 1000); + + LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT); + } +} + +- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { +} + + +@end diff --git a/MainFrame-iPad.storyboard b/MainFrame-iPad.storyboard index 6063b3c..beb2966 100644 --- a/MainFrame-iPad.storyboard +++ b/MainFrame-iPad.storyboard @@ -1,7 +1,6 @@ - + - @@ -73,7 +72,7 @@ - + diff --git a/MainFrame-iPhone.storyboard b/MainFrame-iPhone.storyboard index 57a3d2c..b00cd4e 100644 --- a/MainFrame-iPhone.storyboard +++ b/MainFrame-iPhone.storyboard @@ -1,7 +1,7 @@ - + - + @@ -88,7 +88,7 @@ - +