mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-02-16 02:20:53 +00:00
Fix first tap in touch mode not registering
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
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];
|
||||
[view updateCursorLocation:touchLocation isMouse:NO];
|
||||
}
|
||||
|
||||
// Press the left button down
|
||||
@@ -90,7 +90,7 @@
|
||||
longPressTimer = nil;
|
||||
}
|
||||
|
||||
[view updateCursorLocation:[[touches anyObject] locationInView:view]];
|
||||
[view updateCursorLocation:[[touches anyObject] locationInView:view] isMouse:NO];
|
||||
}
|
||||
|
||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
- (OnScreenControlsLevel) getCurrentOscState;
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
- (void) updateCursorLocation:(CGPoint)location;
|
||||
- (void) updateCursorLocation:(CGPoint)location isMouse:(BOOL)isMouse;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
@@ -265,7 +265,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
// don't require this, but we do it anyway for them too.
|
||||
// Cursor movement without a button held down is handled
|
||||
// in pointerInteraction:regionForRequest:defaultRegion.
|
||||
[self updateCursorLocation:[touch locationInView:self]];
|
||||
[self updateCursorLocation:[touch locationInView:self] isMouse:YES];
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -341,7 +341,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
}
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
- (void) updateCursorLocation:(CGPoint)location {
|
||||
- (void) updateCursorLocation:(CGPoint)location isMouse:(BOOL)isMouse {
|
||||
// These are now relative to the StreamView, however we need to scale them
|
||||
// further to make them relative to the actual video portion.
|
||||
float x = location.x - self.bounds.origin.x;
|
||||
@@ -382,19 +382,22 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
y = MIN(MAX(y, videoOrigin.y), videoOrigin.y + videoSize.height);
|
||||
|
||||
// Send the mouse position relative to the video region if it has changed
|
||||
// if we're receiving coordinates from a real mouse.
|
||||
//
|
||||
// NB: It is important for functionality (not just optimization) to only
|
||||
// send it if the value has changed. We will receive one of these events
|
||||
// any time the user presses a modifier key, which can result in errant
|
||||
// mouse motion when using a Citrix X1 mouse.
|
||||
if (x != lastMouseX || y != lastMouseY) {
|
||||
if (lastMouseX != 0 || lastMouseY != 0) {
|
||||
if (x != lastMouseX || y != lastMouseY || !isMouse) {
|
||||
if (lastMouseX != 0 || lastMouseY != 0 || !isMouse) {
|
||||
LiSendMousePositionEvent(x - videoOrigin.x, y - videoOrigin.y,
|
||||
videoSize.width, videoSize.height);
|
||||
}
|
||||
|
||||
lastMouseX = x;
|
||||
lastMouseY = y;
|
||||
if (isMouse) {
|
||||
lastMouseX = x;
|
||||
lastMouseY = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,7 +425,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
|
||||
// Move the cursor on the host if no buttons are pressed.
|
||||
// Motion with buttons pressed in handled in touchesMoved:
|
||||
if (lastMouseButtonMask == 0) {
|
||||
[self updateCursorLocation:request.location];
|
||||
[self updateCursorLocation:request.location isMouse:YES];
|
||||
}
|
||||
|
||||
// The pointer interaction should cover the video region only
|
||||
|
||||
Reference in New Issue
Block a user