Skip to content

Commit f3f823c

Browse files
author
osy
committed
vm: updated comments
1 parent c166cd1 commit f3f823c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Views/VMDisplayMetalViewController+Touch.m

+9-4
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ - (void)moveMouse:(UIPanGestureRecognizer *)sender {
236236
}
237237

238238
- (IBAction)gesturePan:(UIPanGestureRecognizer *)sender {
239-
if (self.serverModeCursor) {
239+
if (self.serverModeCursor) { // otherwise we handle in touchesMoved
240240
[self moveMouse:sender];
241241
}
242242
}
@@ -335,7 +335,7 @@ - (void)dragCursor:(UIGestureRecognizerState)state {
335335

336336
- (IBAction)gestureTap:(UITapGestureRecognizer *)sender {
337337
if (sender.state == UIGestureRecognizerStateEnded &&
338-
self.serverModeCursor) {
338+
self.serverModeCursor) { // otherwise we handle in touchesBegan
339339
[self mouseClick:SEND_BUTTON_LEFT location:[sender locationInView:sender.view]];
340340
}
341341
}
@@ -486,6 +486,8 @@ - (BOOL)switchMouseType:(VMMouseType)type {
486486
return NO;
487487
}
488488

489+
#pragma mark - Touch event handling
490+
489491
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
490492
if (!self.vmConfiguration.inputLegacy) {
491493
for (UITouch *touch in [event touchesForView:self.mtkView]) {
@@ -505,6 +507,7 @@ - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
505507
}
506508

507509
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
510+
// move cursor in client mode, in server mode we handle in gesturePan
508511
if (!self.vmConfiguration.inputLegacy && !self.vmInput.serverModeCursor) {
509512
for (UITouch *touch in [event touchesForView:self.mtkView]) {
510513
[_cursor updateMovement:[touch locationInView:self.mtkView]];
@@ -515,14 +518,16 @@ - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
515518
}
516519

517520
- (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) {
519523
[self dragCursor:UIGestureRecognizerStateEnded];
520524
}
521525
[super touchesCancelled:touches withEvent:event];
522526
}
523527

524528
- (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) {
526531
[self dragCursor:UIGestureRecognizerStateEnded];
527532
}
528533
[super touchesEnded:touches withEvent:event];

0 commit comments

Comments
 (0)