Skip to content

Commit

Permalink
ui/cocoa: Honour -show-cursor command line option
Browse files Browse the repository at this point in the history
Honour the -show-cursor command line option (which forces the mouse pointer
to always be displayed even when input is grabbed) in the Cocoa UI backend.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1403516125-14568-5-git-send-email-peter.maydell@linaro.org
  • Loading branch information
pm215 committed Jun 29, 2014
1 parent f61c387 commit 13aefd3
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions ui/cocoa.m
Expand Up @@ -323,6 +323,22 @@ - (BOOL) screenContainsPoint:(NSPoint) p
return (p.x > -1 && p.x < screen.width && p.y > -1 && p.y < screen.height);
}

- (void) hideCursor
{
if (!cursor_hide) {
return;
}
[NSCursor hide];
}

- (void) unhideCursor
{
if (!cursor_hide) {
return;
}
[NSCursor unhide];
}

- (void) drawRect:(NSRect) rect
{
COCOA_DEBUG("QemuCocoaView: drawRect\n");
Expand Down Expand Up @@ -735,7 +751,7 @@ - (void) grabMouse
else
[normalWindow setTitle:@"QEMU - (Press ctrl + alt to release Mouse)"];
}
[NSCursor hide];
[self hideCursor];
if (!isAbsoluteEnabled) {
isMouseDeassociated = TRUE;
CGAssociateMouseAndMouseCursorPosition(FALSE);
Expand All @@ -753,7 +769,7 @@ - (void) ungrabMouse
else
[normalWindow setTitle:@"QEMU"];
}
[NSCursor unhide];
[self unhideCursor];
if (isMouseDeassociated) {
CGAssociateMouseAndMouseCursorPosition(TRUE);
isMouseDeassociated = FALSE;
Expand Down

0 comments on commit 13aefd3

Please sign in to comment.