fixed: tap to toggle button not release after being cleared
reload on-screen widgets only when necessary
This commit is contained in:
1 parent
3630880454
commit
46194a5aa0
5 files changed
+30
-18
No files matched your search
@@ -11,7 +11,7 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface AbsoluteTouchHandler : UIResponder
|
@interface AbsoluteTouchHandler : UIResponder
|
||||||
@property (assign,nonatomic) int mouseButtonForCursorMove;
|
@property (class, nonatomic, assign) int mouseButtonForCursorMove;
|
||||||
|
|
||||||
- (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings;
|
- (id)initWithView:(StreamView*)view andSettings:(TemporarySettings*)settings;
|
||||||
- (void)pauseLeftButtonDrag;
|
- (void)pauseLeftButtonDrag;
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
// How far the finger can move before it can override the double tap deadzone
|
// How far the finger can move before it can override the double tap deadzone
|
||||||
#define DOUBLE_TAP_DEAD_ZONE_DELTA 0.025f
|
#define DOUBLE_TAP_DEAD_ZONE_DELTA 0.025f
|
||||||
|
|
||||||
|
static int mouseButtonForCursorMove = BUTTON_LEFT;
|
||||||
|
|
||||||
@implementation AbsoluteTouchHandler {
|
@implementation AbsoluteTouchHandler {
|
||||||
StreamView* streamView;
|
StreamView* streamView;
|
||||||
|
|
||||||
@@ -79,9 +81,7 @@
|
|||||||
slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4;
|
slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4;
|
||||||
screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - _edgeTolerance;
|
screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - _edgeTolerance;
|
||||||
self->touchPointSpawnedAtUpperScreenEdge = false;
|
self->touchPointSpawnedAtUpperScreenEdge = false;
|
||||||
|
|
||||||
_mouseButtonForCursorMove = BUTTON_LEFT;
|
|
||||||
|
|
||||||
leftClickDelay = ((CGFloat)settings.leftClickDelayMs.intValue)/1000;
|
leftClickDelay = ((CGFloat)settings.leftClickDelayMs.intValue)/1000;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
if([self touchDidntMoveOnScreen:movingTouchLocation]){
|
if([self touchDidntMoveOnScreen:movingTouchLocation]){
|
||||||
if(_delayMouseLeftClick){
|
if(_delayMouseLeftClick){
|
||||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
||||||
if(_mouseButtonForCursorMove!=BUTTON_LEFT) LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, _mouseButtonForCursorMove);
|
if(mouseButtonForCursorMove!=BUTTON_LEFT) LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, mouseButtonForCursorMove);
|
||||||
}
|
}
|
||||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
|
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
|
||||||
dispatch_time_t delayShort = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC));
|
dispatch_time_t delayShort = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC));
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
||||||
dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC));
|
dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC));
|
||||||
dispatch_after(delay, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
dispatch_after(delay, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, self->_mouseButtonForCursorMove);
|
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, mouseButtonForCursorMove);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,7 +185,7 @@
|
|||||||
currentTouchesCount = currentTouches.count;
|
currentTouchesCount = currentTouches.count;
|
||||||
|
|
||||||
if(currentTouchesCount == 2){
|
if(currentTouchesCount == 2){
|
||||||
if(_mouseButtonForCursorMove!=BUTTON_LEFT) LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, _mouseButtonForCursorMove);
|
if(mouseButtonForCursorMove!=BUTTON_LEFT) LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, mouseButtonForCursorMove);
|
||||||
if(passthroughGestures) [TouchPadGestureHandler handleGestureIn:streamView with:event];
|
if(passthroughGestures) [TouchPadGestureHandler handleGestureIn:streamView with:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,10 +201,10 @@
|
|||||||
[longPressTimer invalidate];
|
[longPressTimer invalidate];
|
||||||
longPressTimer = nil;
|
longPressTimer = nil;
|
||||||
|
|
||||||
NSTimeInterval dragDelay = _mouseButtonForCursorMove == BUTTON_LEFT ? leftClickTimeThreshold : 0;
|
NSTimeInterval dragDelay = mouseButtonForCursorMove == BUTTON_LEFT ? leftClickTimeThreshold : 0;
|
||||||
|
|
||||||
if(_delayMouseLeftClick && (CACurrentMediaTime()-touchBeganTimeStamp>dragDelay) && !dragButtonDown){
|
if(_delayMouseLeftClick && (CACurrentMediaTime()-touchBeganTimeStamp>dragDelay) && !dragButtonDown){
|
||||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, _mouseButtonForCursorMove);
|
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, mouseButtonForCursorMove);
|
||||||
dragButtonDown = true;
|
dragButtonDown = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@
|
|||||||
}
|
}
|
||||||
else if(!rightButtonClicked){
|
else if(!rightButtonClicked){
|
||||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
||||||
if(_mouseButtonForCursorMove!=BUTTON_LEFT) LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, _mouseButtonForCursorMove);
|
if(mouseButtonForCursorMove!=BUTTON_LEFT) LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, mouseButtonForCursorMove);
|
||||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
|
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -289,6 +289,13 @@
|
|||||||
return isAdjacent;
|
return isAdjacent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (int)mouseButtonForCursorMove {
|
||||||
|
return mouseButtonForCursorMove;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (void)setMouseButtonForCursorMove:(int)button {
|
||||||
|
mouseButtonForCursorMove = button;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -1967,7 +1967,6 @@ import UIKit
|
|||||||
case "SOFTKEYBOARD":
|
case "SOFTKEYBOARD":
|
||||||
self.functionalButtonDelegate?.bringUpSoftKeyboard()
|
self.functionalButtonDelegate?.bringUpSoftKeyboard()
|
||||||
case "ABSTCHDRAG":
|
case "ABSTCHDRAG":
|
||||||
// self.functionalButtonDelegate?.alterAbsTouchDragWith(mouseButton:CommandManager.mouseButtonMappings[self.comboButtonStrings.first ?? "MLEFT"] ?? BUTTON_LEFT)
|
|
||||||
self.functionalButtonDelegate?.alterAbsTouchDragWith(mouseButton:BUTTON_LEFT)
|
self.functionalButtonDelegate?.alterAbsTouchDragWith(mouseButton:BUTTON_LEFT)
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
@@ -2256,7 +2255,13 @@ import UIKit
|
|||||||
}
|
}
|
||||||
if self.motionControlButtonString == "ACCEL" {}
|
if self.motionControlButtonString == "ACCEL" {}
|
||||||
if self.motionControlButtonString == "MOTION" {}
|
if self.motionControlButtonString == "MOTION" {}
|
||||||
|
|
||||||
|
if self.widgetType == WidgetTypeEnum.button && !OnScreenWidgetView.editMode {
|
||||||
|
self.sendComboButtonsUpEvent(comboStrings: self.comboButtonStrings)
|
||||||
|
self.functionalButtonDelegate?.alterAbsTouchDragWith(mouseButton:BUTTON_LEFT)
|
||||||
|
}
|
||||||
buttonDownVisualEffectLayer.removeFromSuperlayer()
|
buttonDownVisualEffectLayer.removeFromSuperlayer()
|
||||||
|
|
||||||
crossMarkLayer.removeFromSuperlayer()
|
crossMarkLayer.removeFromSuperlayer()
|
||||||
lrudIndicatorBall.removeFromSuperlayer()
|
lrudIndicatorBall.removeFromSuperlayer()
|
||||||
l3r3Indicator.removeFromSuperlayer()
|
l3r3Indicator.removeFromSuperlayer()
|
||||||
|
|||||||
@@ -1388,7 +1388,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
|||||||
- (void)alterAbsTouchDragWith:(int32_t)mouseButton{
|
- (void)alterAbsTouchDragWith:(int32_t)mouseButton{
|
||||||
if([touchHandler isKindOfClass:[AbsoluteTouchHandler class]]){
|
if([touchHandler isKindOfClass:[AbsoluteTouchHandler class]]){
|
||||||
AbsoluteTouchHandler* handler = (AbsoluteTouchHandler* )touchHandler;
|
AbsoluteTouchHandler* handler = (AbsoluteTouchHandler* )touchHandler;
|
||||||
handler.mouseButtonForCursorMove = mouseButton;
|
AbsoluteTouchHandler.mouseButtonForCursorMove = mouseButton;
|
||||||
[handler pauseLeftButtonDrag];
|
[handler pauseLeftButtonDrag];
|
||||||
}
|
}
|
||||||
else return;
|
else return;
|
||||||
|
|||||||
@@ -342,11 +342,11 @@
|
|||||||
|
|
||||||
- (void)reConfigStreamViewRealtime {
|
- (void)reConfigStreamViewRealtime {
|
||||||
//if(!viewJustLoaded) [self handleViewResize];
|
//if(!viewJustLoaded) [self handleViewResize];
|
||||||
[self reConfigStreamViewRealtimeAndReloadSettings:YES];
|
[self reConfigStreamViewRealtimeAndReloadSettings:YES reloadOnscreenWidgets:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
// key implementation of reconfiguring streamview after realtime setting menu is closed.
|
// key implementation of reconfiguring streamview after realtime setting menu is closed.
|
||||||
- (void)reConfigStreamViewRealtimeAndReloadSettings:(BOOL)reloadSettings{
|
- (void)reConfigStreamViewRealtimeAndReloadSettings:(BOOL)reloadSettings reloadOnscreenWidgets:(BOOL)reloadOnscreenWidgets{
|
||||||
//[self.view removeGestureRecognizer:]
|
//[self.view removeGestureRecognizer:]
|
||||||
//first, remove all gesture recognizers:
|
//first, remove all gesture recognizers:
|
||||||
for (UIGestureRecognizer *recognizer in _streamView.gestureRecognizers) {
|
for (UIGestureRecognizer *recognizer in _streamView.gestureRecognizers) {
|
||||||
@@ -384,7 +384,7 @@
|
|||||||
// we got self.view passed to streamView class as the topLayerView, will be useful in many cases
|
// we got self.view passed to streamView class as the topLayerView, will be useful in many cases
|
||||||
[self->_streamView reloadOnScreenControlsRealtimeWith:(ControllerSupport*)_controllerSupport
|
[self->_streamView reloadOnScreenControlsRealtimeWith:(ControllerSupport*)_controllerSupport
|
||||||
andConfig:(StreamConfiguration*)_streamConfig]; //reload OSC here.
|
andConfig:(StreamConfiguration*)_streamConfig]; //reload OSC here.
|
||||||
[self->_streamView reloadOnScreenWidgetViews]; //reload keyboard buttons here. the keyboard widget view will be added to the streamframe view instead streamview, the highest layer, which saves a lot of reengineering
|
if(viewJustLoaded||reloadOnscreenWidgets) [self->_streamView reloadOnScreenWidgetViews]; //reload keyboard buttons here. the keyboard widget view will be added to the streamframe view instead streamview, the highest layer, which saves a lot of reengineering
|
||||||
|
|
||||||
[self reloadAirPlayConfig];
|
[self reloadAirPlayConfig];
|
||||||
[self mousePresenceChanged];
|
[self mousePresenceChanged];
|
||||||
@@ -984,7 +984,7 @@
|
|||||||
if (_streamVideoRenderView && _streamView) {
|
if (_streamVideoRenderView && _streamView) {
|
||||||
[_streamView insertSubview:_streamVideoRenderView atIndex:0];
|
[_streamView insertSubview:_streamVideoRenderView atIndex:0];
|
||||||
[self handleViewResize]; // Adjust frames as needed
|
[self handleViewResize]; // Adjust frames as needed
|
||||||
[self reConfigStreamViewRealtimeAndReloadSettings:YES];
|
[self reConfigStreamViewRealtimeAndReloadSettings:YES reloadOnscreenWidgets:YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||||
@@ -1518,7 +1518,7 @@
|
|||||||
// _settings.enableGraphs = _settings.statsOverlayEnabled;
|
// _settings.enableGraphs = _settings.statsOverlayEnabled;
|
||||||
|
|
||||||
// Reconfigure the UI using the current in-memory settings, without reloading from disk
|
// Reconfigure the UI using the current in-memory settings, without reloading from disk
|
||||||
[self reConfigStreamViewRealtimeAndReloadSettings:NO];
|
[self reConfigStreamViewRealtimeAndReloadSettings:NO reloadOnscreenWidgets:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)toggleMouseCapture{
|
- (void)toggleMouseCapture{
|
||||||
@@ -1644,7 +1644,7 @@
|
|||||||
}
|
}
|
||||||
dispatch_block_t block = dispatch_block_create(0, ^{
|
dispatch_block_t block = dispatch_block_create(0, ^{
|
||||||
[self handleViewResize];
|
[self handleViewResize];
|
||||||
[self reConfigStreamViewRealtimeAndReloadSettings:YES];
|
[self reConfigStreamViewRealtimeAndReloadSettings:YES reloadOnscreenWidgets:YES];
|
||||||
});
|
});
|
||||||
_delayedRemoveExtScreen = block;
|
_delayedRemoveExtScreen = block;
|
||||||
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
|
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
|
||||||
|
|||||||
Reference in new issue
Block a user