Browse Source

CocoaSpice: update mouse position in tablet mode

pull/195/head
osy 5 years ago
parent
commit
c166cd1ce1
  1. 1
      CocoaSpice/CSInput.h
  2. 4
      CocoaSpice/CSInput.m
  3. 1
      Views/VMDisplayMetalViewController+Touch.m

1
CocoaSpice/CSInput.h

@ -60,6 +60,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)sendMouseScroll:(SendScrollType)type button:(SendButtonType)button dy:(CGFloat)dy;
- (void)sendMouseButton:(SendButtonType)button pressed:(BOOL)pressed point:(CGPoint)point;
- (void)requestMouseMode:(BOOL)server;
- (void)forceCursorPosition:(CGPoint)pos;
- (id)initWithSession:(nonnull SpiceSession *)session channelID:(NSInteger)channelID monitorID:(NSInteger)monitorID;

4
CocoaSpice/CSInput.m

@ -403,6 +403,10 @@ static int cs_button_to_spice(SendButtonType button)
}
}
- (void)forceCursorPosition:(CGPoint)pos {
_mouse_guest = pos;
}
#pragma mark - Initializers
- (id)init {

1
Views/VMDisplayMetalViewController+Touch.m

@ -292,6 +292,7 @@ static CGFloat CGPointToPixel(CGFloat point) {
translated = [self clipCursorToDisplay:translated];
if (!self.vmInput.serverModeCursor) {
[self.vmInput sendMouseMotion:(_mouseDown ? SEND_BUTTON_LEFT : SEND_BUTTON_NONE) point:translated];
[self.vmInput forceCursorPosition:translated]; // required to show cursor on screen
} else {
NSLog(@"Warning: ignored mouse set (%f, %f) while mouse is in server mode", translated.x, translated.y);
}

Loading…
Cancel
Save