@@ -236,7 +236,7 @@ - (void)moveMouse:(UIPanGestureRecognizer *)sender {
236
236
}
237
237
238
238
- (IBAction )gesturePan : (UIPanGestureRecognizer *)sender {
239
- if (self.serverModeCursor ) {
239
+ if (self.serverModeCursor ) { // otherwise we handle in touchesMoved
240
240
[self moveMouse: sender];
241
241
}
242
242
}
@@ -335,7 +335,7 @@ - (void)dragCursor:(UIGestureRecognizerState)state {
335
335
336
336
- (IBAction )gestureTap : (UITapGestureRecognizer *)sender {
337
337
if (sender.state == UIGestureRecognizerStateEnded &&
338
- self.serverModeCursor ) {
338
+ self.serverModeCursor ) { // otherwise we handle in touchesBegan
339
339
[self mouseClick: SEND_BUTTON_LEFT location: [sender locationInView: sender.view]];
340
340
}
341
341
}
@@ -486,6 +486,8 @@ - (BOOL)switchMouseType:(VMMouseType)type {
486
486
return NO ;
487
487
}
488
488
489
+ #pragma mark - Touch event handling
490
+
489
491
- (void )touchesBegan : (NSSet <UITouch *> *)touches withEvent : (UIEvent *)event {
490
492
if (!self.vmConfiguration .inputLegacy ) {
491
493
for (UITouch *touch in [event touchesForView: self .mtkView]) {
@@ -505,6 +507,7 @@ - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
505
507
}
506
508
507
509
- (void )touchesMoved : (NSSet <UITouch *> *)touches withEvent : (UIEvent *)event {
510
+ // move cursor in client mode, in server mode we handle in gesturePan
508
511
if (!self.vmConfiguration .inputLegacy && !self.vmInput .serverModeCursor ) {
509
512
for (UITouch *touch in [event touchesForView: self .mtkView]) {
510
513
[_cursor updateMovement: [touch locationInView: self .mtkView]];
@@ -515,14 +518,16 @@ - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
515
518
}
516
519
517
520
- (void )touchesCancelled : (NSSet <UITouch *> *)touches withEvent : (UIEvent *)event {
518
- if (!self.vmConfiguration .inputLegacy && !self.vmInput .serverModeCursor ) { // finish click for client mode
521
+ // release click in client mode, in server mode we handle in gesturePan
522
+ if (!self.vmConfiguration .inputLegacy && !self.vmInput .serverModeCursor ) {
519
523
[self dragCursor: UIGestureRecognizerStateEnded];
520
524
}
521
525
[super touchesCancelled: touches withEvent: event];
522
526
}
523
527
524
528
- (void )touchesEnded : (NSSet <UITouch *> *)touches withEvent : (UIEvent *)event {
525
- if (!self.vmConfiguration .inputLegacy && !self.vmInput .serverModeCursor ) { // finish click for client mode
529
+ // release click in client mode, in server mode we handle in gesturePan
530
+ if (!self.vmConfiguration .inputLegacy && !self.vmInput .serverModeCursor ) {
526
531
[self dragCursor: UIGestureRecognizerStateEnded];
527
532
}
528
533
[super touchesEnded: touches withEvent: event];
0 commit comments