mirror of
https://github.com/utmapp/UTM.git
synced 2026-10-12 02:24:01 +00:00
In the touch modes the left button goes down the moment a finger lands, because the touch itself is the drag. Every other gesture starts with a finger landing too, so a two finger tap, scroll or pinch first clicked and dragged whatever was under the first finger until the gesture was recognized, and a long press held the left button for half a second before its right click. Add "Touch mode (drag to scroll)" as a third touch mode that behaves like a touch screen and never presses a button on touch down. A tap is a left click, a long press runs the long press action, and dragging one finger scrolls the mouse wheel so that the content follows the finger. Since a touch no longer drags, a long press that moves turns into a left button drag so windows and selections can still be moved with one finger. A ring is shown when the long press is recognized because nothing in the guest reacts until the finger lifts. A finger never lands on the same spot twice, and a guest only counts two clicks on the same spot as a double click, so a second tap that follows quickly and close by clicks where the first one did. The existing touch modes are unchanged. Reworked from #7697. Assisted-by: Claude:claude-fable-5-1
61 lines
1.8 KiB
Objective-C
61 lines
1.8 KiB
Objective-C
//
|
|
// Copyright © 2020 osy. All rights reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
//
|
|
|
|
#import "VMDisplayMetalViewController.h"
|
|
#import "CSInput.h"
|
|
|
|
typedef NS_ENUM(NSInteger, VMGestureType) {
|
|
VMGestureTypeNone,
|
|
VMGestureTypeDragCursor,
|
|
VMGestureTypeRightClick,
|
|
VMGestureTypeMoveScreen,
|
|
VMGestureTypeMouseWheel,
|
|
VMGestureTypeMiddleClick,
|
|
VMGestureTypeRightDrag,
|
|
VMGestureTypeMiddleDrag,
|
|
VMGestureTypeMax
|
|
};
|
|
|
|
typedef NS_ENUM(NSInteger, VMMouseType) {
|
|
VMMouseTypeRelative,
|
|
VMMouseTypeAbsolute,
|
|
VMMouseTypeAbsoluteHideCursor,
|
|
VMMouseTypeAbsoluteScroll,
|
|
VMMouseTypeMax
|
|
};
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@interface VMDisplayMetalViewController (Gestures) <UIGestureRecognizerDelegate>
|
|
|
|
@property (nonatomic, readonly) CSInputButton mouseButtonDown;
|
|
@property (nonatomic, readonly) VMMouseType touchMouseType;
|
|
@property (nonatomic, readonly) VMMouseType pencilMouseType;
|
|
@property (nonatomic, readonly) VMMouseType indirectMouseType;
|
|
|
|
- (void)initTouch;
|
|
|
|
- (CGPoint)clipCursorToDisplay:(CGPoint)pos;
|
|
- (CGPoint)moveMouseAbsolute:(CGPoint)location;
|
|
- (CGPoint)moveMouseRelative:(CGPoint)translation;
|
|
- (CGPoint)moveMouseScroll:(CGPoint)translation;
|
|
- (void)scrollWithInertia:(UIPanGestureRecognizer *)sender;
|
|
- (void)mouseClick:(CSInputButton)button location:(CGPoint)location;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|