mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2025-07-02 15:56:21 +00:00
Disable iOS 13.4+ mouse support on iOS 14 in preparation for GCMouse work
This commit is contained in:
parent
452b001c99
commit
4c68a5d8c3
@ -76,7 +76,11 @@ static const int REFERENCE_HEIGHT = 720;
|
|||||||
[onScreenControls setLevel:level];
|
[onScreenControls setLevel:level];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (@available(iOS 13.4, *)) {
|
if (@available(iOS 14.0, *)) {
|
||||||
|
// Use the new GCMouse API on iOS 14
|
||||||
|
}
|
||||||
|
else if (@available(iOS 13.4, *)) {
|
||||||
|
// Use the legacy mouse API on iOS 13.4
|
||||||
[self addInteraction:[[UIPointerInteraction alloc] initWithDelegate:self]];
|
[self addInteraction:[[UIPointerInteraction alloc] initWithDelegate:self]];
|
||||||
|
|
||||||
UIPanGestureRecognizer *mouseWheelRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mouseWheelMoved:)];
|
UIPanGestureRecognizer *mouseWheelRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mouseWheelMoved:)];
|
||||||
@ -179,32 +183,38 @@ static const int REFERENCE_HEIGHT = 720;
|
|||||||
if (@available(iOS 13.4, *)) {
|
if (@available(iOS 13.4, *)) {
|
||||||
UITouch* touch = [touches anyObject];
|
UITouch* touch = [touches anyObject];
|
||||||
if (touch.type == UITouchTypeIndirectPointer) {
|
if (touch.type == UITouchTypeIndirectPointer) {
|
||||||
UIEventButtonMask changedButtons = lastMouseButtonMask ^ event.buttonMask;
|
if (@available(iOS 14.0, *)) {
|
||||||
|
// We'll handle this with GCMouse. Do nothing here.
|
||||||
for (int i = BUTTON_LEFT; i <= BUTTON_X2; i++) {
|
return YES;
|
||||||
UIEventButtonMask buttonFlag;
|
}
|
||||||
|
else {
|
||||||
switch (i) {
|
UIEventButtonMask changedButtons = lastMouseButtonMask ^ event.buttonMask;
|
||||||
// Right and Middle are reversed from what iOS uses
|
|
||||||
case BUTTON_RIGHT:
|
for (int i = BUTTON_LEFT; i <= BUTTON_X2; i++) {
|
||||||
buttonFlag = UIEventButtonMaskForButtonNumber(2);
|
UIEventButtonMask buttonFlag;
|
||||||
break;
|
|
||||||
case BUTTON_MIDDLE:
|
switch (i) {
|
||||||
buttonFlag = UIEventButtonMaskForButtonNumber(3);
|
// Right and Middle are reversed from what iOS uses
|
||||||
break;
|
case BUTTON_RIGHT:
|
||||||
|
buttonFlag = UIEventButtonMaskForButtonNumber(2);
|
||||||
default:
|
break;
|
||||||
buttonFlag = UIEventButtonMaskForButtonNumber(i);
|
case BUTTON_MIDDLE:
|
||||||
break;
|
buttonFlag = UIEventButtonMaskForButtonNumber(3);
|
||||||
}
|
break;
|
||||||
|
|
||||||
if (changedButtons & buttonFlag) {
|
default:
|
||||||
LiSendMouseButtonEvent(buttonAction, i);
|
buttonFlag = UIEventButtonMaskForButtonNumber(i);
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changedButtons & buttonFlag) {
|
||||||
|
LiSendMouseButtonEvent(buttonAction, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lastMouseButtonMask = event.buttonMask;
|
||||||
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastMouseButtonMask = event.buttonMask;
|
|
||||||
return YES;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -217,14 +227,20 @@ static const int REFERENCE_HEIGHT = 720;
|
|||||||
if (@available(iOS 13.4, *)) {
|
if (@available(iOS 13.4, *)) {
|
||||||
UITouch *touch = [touches anyObject];
|
UITouch *touch = [touches anyObject];
|
||||||
if (touch.type == UITouchTypeIndirectPointer) {
|
if (touch.type == UITouchTypeIndirectPointer) {
|
||||||
// We must handle this event to properly support
|
if (@available(iOS 14.0, *)) {
|
||||||
// drags while the middle, X1, or X2 mouse buttons are
|
// We'll handle this with GCMouse. Do nothing here.
|
||||||
// held down. For some reason, left and right buttons
|
return;
|
||||||
// don't require this, but we do it anyway for them too.
|
}
|
||||||
// Cursor movement without a button held down is handled
|
else {
|
||||||
// in pointerInteraction:regionForRequest:defaultRegion.
|
// We must handle this event to properly support
|
||||||
[self updateCursorLocation:[touch locationInView:self]];
|
// drags while the middle, X1, or X2 mouse buttons are
|
||||||
return;
|
// held down. For some reason, left and right buttons
|
||||||
|
// 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]];
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user