diff --git a/Limelight/Input/AbsoluteTouchHandler.m b/Limelight/Input/AbsoluteTouchHandler.m index b9b8c59c..0066283b 100644 --- a/Limelight/Input/AbsoluteTouchHandler.m +++ b/Limelight/Input/AbsoluteTouchHandler.m @@ -38,83 +38,85 @@ return self; } -- (void)onLongPressStart:(NSTimer*)timer { - // Raise the left click and start a right click - LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT); - LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT); -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - // Ignore touch down events with more than one finger - if ([[event allTouches] count] > 1) { - return; - } - - UITouch* touch = [touches anyObject]; - CGPoint touchLocation = [touch locationInView:view]; - - // Don't reposition for finger down events within the deadzone. This makes double-clicking easier. - if (touch.timestamp - lastTouchUp.timestamp > DOUBLE_TAP_DEAD_ZONE_DELAY || - sqrt(pow((touchLocation.x / view.bounds.size.width) - (lastTouchUpLocation.x / view.bounds.size.width), 2) + - pow((touchLocation.y / view.bounds.size.height) - (lastTouchUpLocation.y / view.bounds.size.height), 2)) > DOUBLE_TAP_DEAD_ZONE_DELTA) { - [view updateCursorLocation:touchLocation isMouse:NO]; - } - - // Press the left button down - LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT); - - // Start the long press timer - longPressTimer = [NSTimer scheduledTimerWithTimeInterval:LONG_PRESS_ACTIVATION_DELAY - target:self - selector:@selector(onLongPressStart:) - userInfo:nil - repeats:NO]; - - lastTouchDown = touch; - lastTouchDownLocation = touchLocation; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - // Ignore touch move events with more than one finger - if ([[event allTouches] count] > 1) { - return; - } - - UITouch* touch = [touches anyObject]; - CGPoint touchLocation = [touch locationInView:view]; - - if (sqrt(pow((touchLocation.x / view.bounds.size.width) - (lastTouchDownLocation.x / view.bounds.size.width), 2) + - pow((touchLocation.y / view.bounds.size.height) - (lastTouchDownLocation.y / view.bounds.size.height), 2)) > LONG_PRESS_ACTIVATION_DELTA) { - // Moved too far since touch down. Cancel the long press timer. - [longPressTimer invalidate]; - longPressTimer = nil; - } - - [view updateCursorLocation:[[touches anyObject] locationInView:view] isMouse:NO]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - // Only fire this logic if all touches have ended - if ([[event allTouches] count] == [touches count]) { - // Cancel the long press timer - [longPressTimer invalidate]; - longPressTimer = nil; - - // Left button up on finger up - LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT); - - // Raise right button too in case we triggered a long press gesture - LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_RIGHT); - - // Remember this last touch for touch-down deadzoning - lastTouchUp = [touches anyObject]; - lastTouchUpLocation = [lastTouchUp locationInView:view]; - } -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { - // Treat this as a normal touchesEnded event - [self touchesEnded:touches withEvent:event]; -} +//- (void)onLongPressStart:(NSTimer*)timer { +// // Raise the left click and start a right click +// LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT); +// LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT); +//} +// +//- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { +// // Ignore touch down events with more than one finger +// return; +// if ([[event allTouches] count] > 1) { +// return; +// } +// +// UITouch* touch = [touches anyObject]; +// CGPoint touchLocation = [touch locationInView:view]; +// +// // Don't reposition for finger down events within the deadzone. This makes double-clicking easier. +// if (touch.timestamp - lastTouchUp.timestamp > DOUBLE_TAP_DEAD_ZONE_DELAY || +// sqrt(pow((touchLocation.x / view.bounds.size.width) - (lastTouchUpLocation.x / view.bounds.size.width), 2) + +// pow((touchLocation.y / view.bounds.size.height) - (lastTouchUpLocation.y / view.bounds.size.height), 2)) > DOUBLE_TAP_DEAD_ZONE_DELTA) { +// [view updateCursorLocation:touchLocation isMouse:NO]; +// } +// +// // Press the left button down +// LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT); +// +// // Start the long press timer +// longPressTimer = [NSTimer scheduledTimerWithTimeInterval:LONG_PRESS_ACTIVATION_DELAY +// target:self +// selector:@selector(onLongPressStart:) +// userInfo:nil +// repeats:NO]; +// +// lastTouchDown = touch; +// lastTouchDownLocation = touchLocation; +//} +// +//- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { +// // Ignore touch move events with more than one finger +// return; +// if ([[event allTouches] count] > 1) { +// return; +// } +// +// UITouch* touch = [touches anyObject]; +// CGPoint touchLocation = [touch locationInView:view]; +// +// if (sqrt(pow((touchLocation.x / view.bounds.size.width) - (lastTouchDownLocation.x / view.bounds.size.width), 2) + +// pow((touchLocation.y / view.bounds.size.height) - (lastTouchDownLocation.y / view.bounds.size.height), 2)) > LONG_PRESS_ACTIVATION_DELTA) { +// // Moved too far since touch down. Cancel the long press timer. +// [longPressTimer invalidate]; +// longPressTimer = nil; +// } +// +// [view updateCursorLocation:[[touches anyObject] locationInView:view] isMouse:NO]; +//} +// +//- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { +// // Only fire this logic if all touches have ended +// if ([[event allTouches] count] == [touches count]) { +// // Cancel the long press timer +// [longPressTimer invalidate]; +// longPressTimer = nil; +// +// // Left button up on finger up +// LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT); +// +// // Raise right button too in case we triggered a long press gesture +// LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_RIGHT); +// +// // Remember this last touch for touch-down deadzoning +// lastTouchUp = [touches anyObject]; +// lastTouchUpLocation = [lastTouchUp locationInView:view]; +// } +//} +// +//- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { +// // Treat this as a normal touchesEnded event +// [self touchesEnded:touches withEvent:event]; +//} @end diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index 86ab0beb..82e3dc61 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -87,25 +87,24 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; Log(LOG_I, @"Setting manual on-screen controls level: %d", (int)level); [onScreenControls setLevel:level]; } - // It would be nice to just use GCMouse on iOS 14+ and the older API on iOS 13 // but unfortunately that isn't possible today. GCMouse doesn't recognize many // mice correctly, but UIKit does. We will register for both and ignore UIKit // events if a GCMouse is connected. if (@available(iOS 13.4, *)) { - [self addInteraction:[[UIPointerInteraction alloc] initWithDelegate:self]]; - - UIPanGestureRecognizer *discreteMouseWheelRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mouseWheelMovedDiscrete:)]; - discreteMouseWheelRecognizer.maximumNumberOfTouches = 0; - discreteMouseWheelRecognizer.allowedScrollTypesMask = UIScrollTypeMaskDiscrete; - discreteMouseWheelRecognizer.allowedTouchTypes = @[@(UITouchTypeIndirectPointer)]; - [self addGestureRecognizer:discreteMouseWheelRecognizer]; - - UIPanGestureRecognizer *continuousMouseWheelRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mouseWheelMovedContinuous:)]; - continuousMouseWheelRecognizer.maximumNumberOfTouches = 0; - continuousMouseWheelRecognizer.allowedScrollTypesMask = UIScrollTypeMaskContinuous; - continuousMouseWheelRecognizer.allowedTouchTypes = @[@(UITouchTypeIndirectPointer)]; - [self addGestureRecognizer:continuousMouseWheelRecognizer]; +// [self addInteraction:[[UIPointerInteraction alloc] initWithDelegate:self]]; +// +// UIPanGestureRecognizer *discreteMouseWheelRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mouseWheelMovedDiscrete:)]; +// discreteMouseWheelRecognizer.maximumNumberOfTouches = 0; +// discreteMouseWheelRecognizer.allowedScrollTypesMask = UIScrollTypeMaskDiscrete; +// discreteMouseWheelRecognizer.allowedTouchTypes = @[@(UITouchTypeIndirectPointer)]; +// [self addGestureRecognizer:discreteMouseWheelRecognizer]; +// +// UIPanGestureRecognizer *continuousMouseWheelRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mouseWheelMovedContinuous:)]; +// continuousMouseWheelRecognizer.maximumNumberOfTouches = 0; +// continuousMouseWheelRecognizer.allowedScrollTypesMask = UIScrollTypeMaskContinuous; +// continuousMouseWheelRecognizer.allowedTouchTypes = @[@(UITouchTypeIndirectPointer)]; +// [self addGestureRecognizer:continuousMouseWheelRecognizer]; } #if defined(__IPHONE_16_1) || defined(__TVOS_16_1) @@ -240,6 +239,73 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; return 90 - MIN(90, altitudeDegs); } +- (void)trySendTouchEvent:(UITouch*)event index:(int)index{ + uint8_t type; + NSLog(@"trySendTouchEvent %ld,%d",(long)event.phase,(uint32_t)event); +//#define LI_TOUCH_EVENT_HOVER 0x00 +//#define LI_TOUCH_EVENT_DOWN 0x01 +//#define LI_TOUCH_EVENT_UP 0x02 +//#define LI_TOUCH_EVENT_MOVE 0x03 +//#define LI_TOUCH_EVENT_CANCEL 0x04 +//#define LI_TOUCH_EVENT_BUTTON_ONLY 0x05 +//#define LI_TOUCH_EVENT_HOVER_LEAVE 0x06 +//#define LI_TOUCH_EVENT_CANCEL_ALL 0x07 +//#define LI_ROT_UNKNOWN 0xFFFF + + +// UITouchPhaseBegan, // whenever a finger touches the surface. +// UITouchPhaseMoved, // whenever a finger moves on the surface. +// UITouchPhaseStationary, // whenever a finger is touching the surface but hasn't moved since the previous event. +// UITouchPhaseEnded, // whenever a finger leaves the surface. +// UITouchPhaseCancelled, // whenever a touch doesn't end but we need to stop tracking (e.g. putting device to face) +// UITouchPhaseRegionEntered API_AVAILABLE(ios(13.4), tvos(13.4)) API_UNAVAILABLE(watchos), // whenever a touch is entering the region of a user interface +// UITouchPhaseRegionMoved API_AVAILABLE(ios(13.4), tvos(13.4)) API_UNAVAILABLE(watchos), // when a touch is inside the region of a user interface, but hasn’t yet made contact or left the region +// UITouchPhaseRegionExited API_AVAILABLE(ios(13.4), tvos(13.4)) + + switch (event.phase) { + case UITouchPhaseBegan://开始触摸 + type = LI_TOUCH_EVENT_DOWN; + break; + case UITouchPhaseMoved://移动 + case UITouchPhaseStationary: + type = LI_TOUCH_EVENT_MOVE; + break; + case UITouchPhaseEnded://触摸结束 + type = LI_TOUCH_EVENT_UP; + break; + case UITouchPhaseCancelled://触摸取消 + type = LI_TOUCH_EVENT_CANCEL; + break; + case UITouchPhaseRegionEntered://停留 + case UITouchPhaseRegionMoved://停留 + type = LI_TOUCH_EVENT_HOVER; + break; + default: + return; + } +// switch (event.phase) { +// case UITouchPhaseBegan: +// type = LI_TOUCH_EVENT_DOWN; +// break; +// case UITouchPhaseMoved: +// type = LI_TOUCH_EVENT_MOVE; +// break; +// case UITouchPhaseEnded: +// type = LI_TOUCH_EVENT_UP; +// break; +// case UITouchPhaseCancelled: +// type = LI_TOUCH_EVENT_CANCEL; +// break; +// default: +// return; +// } + + CGPoint location = [self adjustCoordinatesForVideoArea:[event locationInView:self]]; + CGSize videoSize = [self getVideoAreaSize]; + LiSendTouchEvent(type,(uint32_t)event,location.x / videoSize.width, location.y / videoSize.height,(event.force / event.maximumPossibleForce) / sin(event.altitudeAngle),0.0f, 0.0f,[self getRotationFromAzimuthAngle:[event azimuthAngleInView:self]]); +} + + - (void)sendStylusEvent:(UITouch*)event { uint8_t type; @@ -327,11 +393,32 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; #if !TARGET_OS_TV if (@available(iOS 13.4, *)) { +// NSArray *arr1 = [[event allTouches] allObjects]; +//// NSLog(@"touchesBegan - %lu",[[event allTouches] count]); +//// NSLog(@"touchesBegan - %lu",arr1.count); +// +// for(int i=0;iCFBundleDevelopmentRegion en CFBundleDisplayName - ${PRODUCT_NAME} + Moonlight-阿西 CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier @@ -69,7 +69,7 @@ armv7 UIRequiresFullScreen - + UIStatusBarHidden UISupportedInterfaceOrientations diff --git a/Limelight/ViewControllers/StreamFrameViewController.m b/Limelight/ViewControllers/StreamFrameViewController.m index 7720a9ff..50566e1d 100644 --- a/Limelight/ViewControllers/StreamFrameViewController.m +++ b/Limelight/ViewControllers/StreamFrameViewController.m @@ -187,25 +187,25 @@ #endif // Only enable scroll and zoom in absolute touch mode - if (_settings.absoluteTouchMode) { - _scrollView = [[UIScrollView alloc] initWithFrame:self.view.frame]; -#if !TARGET_OS_TV - [_scrollView.panGestureRecognizer setMinimumNumberOfTouches:2]; -#endif - [_scrollView setShowsHorizontalScrollIndicator:NO]; - [_scrollView setShowsVerticalScrollIndicator:NO]; - [_scrollView setDelegate:self]; - [_scrollView setMaximumZoomScale:10.0f]; - - // Add StreamView inside a UIScrollView for absolute mode - [_scrollView addSubview:_streamView]; - [self.view addSubview:_scrollView]; - } - else { - // Add StreamView directly in relative mode - [self.view addSubview:_streamView]; - } - +// if (_settings.absoluteTouchMode) { +// _scrollView = [[UIScrollView alloc] initWithFrame:self.view.frame]; +//#if !TARGET_OS_TV +// [_scrollView.panGestureRecognizer setMinimumNumberOfTouches:2]; +//#endif +// [_scrollView setShowsHorizontalScrollIndicator:NO]; +// [_scrollView setShowsVerticalScrollIndicator:NO]; +// [_scrollView setDelegate:self]; +// [_scrollView setMaximumZoomScale:10.0f]; +// +// // Add StreamView inside a UIScrollView for absolute mode +// [_scrollView addSubview:_streamView]; +// [self.view addSubview:_scrollView]; +// } +// else { +// // Add StreamView directly in relative mode +// [self.view addSubview:_streamView]; +// } + [self.view addSubview:_streamView]; [self.view addSubview:_stageLabel]; [self.view addSubview:_spinner]; [self.view addSubview:_tipLabel]; diff --git a/Moonlight TV/Info.plist b/Moonlight TV/Info.plist index b91ee818..05dec8a1 100644 --- a/Moonlight TV/Info.plist +++ b/Moonlight TV/Info.plist @@ -5,7 +5,7 @@ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName - Moonlight + MoonlightAXI CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/Moonlight.xcodeproj/project.pbxproj b/Moonlight.xcodeproj/project.pbxproj index 2deeb005..9fd7caa3 100644 --- a/Moonlight.xcodeproj/project.pbxproj +++ b/Moonlight.xcodeproj/project.pbxproj @@ -933,7 +933,6 @@ }; }; FB290CED19B2C406004C83CF = { - DevelopmentTeam = DM46QST4M7; LastSwiftMigration = 1140; }; }; @@ -1378,6 +1377,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CURRENT_PROJECT_VERSION = 2; + DEVELOPMENT_TEAM = U39XM5BN3U; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Limelight/Limelight-Prefix.pch"; HEADER_SEARCH_PATHS = ( @@ -1388,6 +1388,7 @@ "$(PROJECT_DIR)/libs/**", ); INFOPLIST_FILE = "Limelight/Limelight-Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = MoonlightAXI; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -1406,7 +1407,7 @@ "$(PROJECT_DIR)/libs/FFmpeg/lib/iOS-Sim", ); MARKETING_VERSION = 9.0.0; - PRODUCT_BUNDLE_IDENTIFIER = "com.moonlight-stream.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = "com.moonlight-stream.iPadOS"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; SKIP_INSTALL = NO; @@ -1427,6 +1428,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CURRENT_PROJECT_VERSION = 2; + DEVELOPMENT_TEAM = U39XM5BN3U; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Limelight/Limelight-Prefix.pch"; HEADER_SEARCH_PATHS = ( @@ -1437,6 +1439,7 @@ "$(PROJECT_DIR)/libs/**", ); INFOPLIST_FILE = "Limelight/Limelight-Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = MoonlightAXI; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -1455,7 +1458,7 @@ "$(PROJECT_DIR)/libs/FFmpeg/lib/iOS-Sim", ); MARKETING_VERSION = 9.0.0; - PRODUCT_BUNDLE_IDENTIFIER = "com.moonlight-stream.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = "com.moonlight-stream.iPadOS"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; SKIP_INSTALL = NO; diff --git a/moonlight-common/moonlight-common-c b/moonlight-common/moonlight-common-c index 3ed3ba62..4f983ff5 160000 --- a/moonlight-common/moonlight-common-c +++ b/moonlight-common/moonlight-common-c @@ -1 +1 @@ -Subproject commit 3ed3ba62534ce06c1b97fec46722969e7710fee6 +Subproject commit 4f983ff5849dfa63ce8a0d8de2f69f94f8bfd56a