aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/cocoa.m24
1 files changed, 8 insertions, 16 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 3af167f071..a7848ae0a3 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -304,7 +304,6 @@ static void handleAnyDeviceErrors(Error * err)
BOOL isMouseGrabbed;
BOOL isFullscreen;
BOOL isAbsoluteEnabled;
- BOOL isMouseDeassociated;
}
- (void) switchSurface:(pixman_image_t *)image;
- (void) grabMouse;
@@ -321,14 +320,9 @@ static void handleAnyDeviceErrors(Error * err)
* isMouseGrabbed tracks whether GUI events are directed to the guest;
* it controls whether special keys like Cmd get sent to the guest,
* and whether we capture the mouse when in non-absolute mode.
- * isMouseDeassociated tracks whether we've told MacOSX to disassociate
- * the mouse and mouse cursor position by calling
- * CGAssociateMouseAndMouseCursorPosition(FALSE)
- * (which basically happens if we grab in non-absolute mode).
*/
- (BOOL) isMouseGrabbed;
- (BOOL) isAbsoluteEnabled;
-- (BOOL) isMouseDeassociated;
- (float) cdx;
- (float) cdy;
- (QEMUScreen) gscreen;
@@ -972,10 +966,7 @@ QemuCocoaView *cocoaView;
[normalWindow setTitle:@"QEMU - (Press ctrl + alt + g to release Mouse)"];
}
[self hideCursor];
- if (!isAbsoluteEnabled) {
- isMouseDeassociated = TRUE;
- CGAssociateMouseAndMouseCursorPosition(FALSE);
- }
+ CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled);
isMouseGrabbed = TRUE; // while isMouseGrabbed = TRUE, QemuCocoaApp sends all events to [cocoaView handleEvent:]
}
@@ -990,17 +981,18 @@ QemuCocoaView *cocoaView;
[normalWindow setTitle:@"QEMU"];
}
[self unhideCursor];
- if (isMouseDeassociated) {
- CGAssociateMouseAndMouseCursorPosition(TRUE);
- isMouseDeassociated = FALSE;
- }
+ CGAssociateMouseAndMouseCursorPosition(TRUE);
isMouseGrabbed = FALSE;
}
-- (void) setAbsoluteEnabled:(BOOL)tIsAbsoluteEnabled {isAbsoluteEnabled = tIsAbsoluteEnabled;}
+- (void) setAbsoluteEnabled:(BOOL)tIsAbsoluteEnabled {
+ isAbsoluteEnabled = tIsAbsoluteEnabled;
+ if (isMouseGrabbed) {
+ CGAssociateMouseAndMouseCursorPosition(isAbsoluteEnabled);
+ }
+}
- (BOOL) isMouseGrabbed {return isMouseGrabbed;}
- (BOOL) isAbsoluteEnabled {return isAbsoluteEnabled;}
-- (BOOL) isMouseDeassociated {return isMouseDeassociated;}
- (float) cdx {return cdx;}
- (float) cdy {return cdy;}
- (QEMUScreen) gscreen {return screen;}