Commit 8e23e34d authored by Chen Zhang's avatar Chen Zhang Committed by Peter Maydell
Browse files

ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device



In fullscreen mode, the window property of cocoaView may not be the key
window, and the current implementation would not re-grab cursor by left click
in fullscreen mode after ungrabbed in fullscreen mode with hot-key ctrl-opt-g.

This patch used value of isFullscreen as a short-cirtuit condition for
relative input device grabbing.

Signed-off-by: default avatarChen Zhang <tgfbeta@me.com>
Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Message-id: 2D2F1191-E82F-4B54-A6E7-73FFB953DE93@me.com
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parent 2044dff8
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -902,7 +902,12 @@ QemuCocoaView *cocoaView;
        case NSEventTypeLeftMouseUp:
            mouse_event = true;
            if (!isMouseGrabbed && [self screenContainsPoint:p]) {
                if([[self window] isKeyWindow]) {
                /*
                 * In fullscreen mode, the window of cocoaView may not be the
                 * key window, therefore the position relative to the virtual
                 * screen alone will be sufficient.
                 */
                if(isFullscreen || [[self window] isKeyWindow]) {
                    [self grabMouse];
                }
            }