Allow not capture mouse

This commit is contained in:
xzzpig
2024-11-29 23:00:54 +08:00
parent 589ca19e4f
commit 62ae63d7f6
17 changed files with 327 additions and 22 deletions
@@ -18,7 +18,7 @@ static CGFloat screenWidthInPoints;
- (instancetype)initWithTarget:(nullable id)target action:(nullable SEL)action {
self = [super initWithTarget:target action:action];
screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]); // Get the screen's bounds (in points)
screenWidthInPoints = CGRectGetWidth([UIApplication.sharedApplication.windows.firstObject.screen bounds]); // Get the screen's bounds (in points)
_immediateTriggering = false;
_EDGE_TOLERANCE = 15.0f;
return self;
@@ -670,6 +670,7 @@ static NSMutableSet* hostList;
// multiController must be set before calling getConnectedGamepadMask
_streamConfig.multiController = streamSettings.multiController;
_streamConfig.gamepadMask = [ControllerSupport getConnectedGamepadMask:_streamConfig];
_streamConfig.mouseMode = streamSettings.mouseMode.intValue;
// Probe for supported channel configurations
int physicalOutputChannels = (int)[AVAudioSession sharedInstance].maximumOutputNumberOfChannels;
@@ -58,6 +58,7 @@
@property (nonatomic, strong) MainFrameViewController *mainFrameViewController;
@property (strong, nonatomic) IBOutlet UISegmentedControl *externalDisplayModeSelector;
@property (strong, nonatomic) IBOutlet UISegmentedControl *mouseModeSelector;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability"
@@ -560,6 +560,7 @@ BOOL isCustomResolution(CGSize res) {
}
[self.externalDisplayModeSelector setSelectedSegmentIndex:currentSettings.externalDisplayMode.integerValue];
[self.mouseModeSelector setSelectedSegmentIndex:currentSettings.mouseMode.integerValue];
}
- (void)slideToSettingsScreenEdgeChanged{
@@ -1067,6 +1068,7 @@ BOOL isCustomResolution(CGSize res) {
BOOL allowPortrait = [self.allowPortraitSelector selectedSegmentIndex] == 1;
NSInteger resolutionSelected = [self.resolutionSelector selectedSegmentIndex];
NSInteger externalDisplayMode = [self.externalDisplayModeSelector selectedSegmentIndex];
NSInteger mouseMode = [self.mouseModeSelector selectedSegmentIndex];
[dataMan saveSettingsWithBitrate:_bitrate
framerate:framerate
height:height
@@ -1098,7 +1100,8 @@ BOOL isCustomResolution(CGSize res) {
statsOverlay:statsOverlay
allowPortrait:allowPortrait
resolutionSelected:resolutionSelected
externalDisplayMode:externalDisplayMode];
externalDisplayMode:externalDisplayMode
mouseMode:mouseMode];
}
- (void)didReceiveMemoryWarning {
@@ -167,6 +167,7 @@
andConfig:(StreamConfiguration*)_streamConfig]; //reload OSC here.
[self->_streamView reloadOnScreenButtonViews]; //reload keyboard buttons here. the keyboard button view will be added to the streamframe view instead streamview, the highest layer, which saves a lot of reengineering
[self reloadAirPlayConfig];
[self mousePresenceChanged];
//reconfig statsOverlay
self->_statsUpdateTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f
@@ -966,7 +967,7 @@
// Pointer lock breaks the UIKit mouse APIs, which is a problem because
// GCMouse is horribly broken on iOS 14.0 for certain mice. Only lock
// the cursor if there is a GCMouse present.
return [GCMouse mice].count > 0;
return ([GCMouse mice].count > 0) && [_settings mouseMode].intValue == 0;
}
#endif