From: Carwyn Ellis <carwynellis@gmail.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, qemu-trivial@nongnu.org,
Carwyn Ellis <carwynellis@gmail.com>
Subject: [PATCH 2/2] ui/cocoa: release mouse when user switches away from QEMU window
Date: Sun, 2 Jan 2022 17:41:53 +0000 [thread overview]
Message-ID: <20220102174153.70043-3-carwynellis@gmail.com> (raw)
In-Reply-To: <20220102174153.70043-1-carwynellis@gmail.com>
This resolves an issue where using command-tab to switch between QEMU
and other windows on the host can leave the mouse pointer visible.
By releasing the mouse when the user switches away, the user must left
click on the QEMU window when switching back in order to hide the
pointer and return control to the guest.
This appraoch ensures that the calls to NSCursor hide and unhide are
always balanced and thus work correctly when invoked.
Signed-off-by: Carwyn Ellis <carwynellis@gmail.com>
---
ui/cocoa.m | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 01045d6698..3f7af4a8fa 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1243,6 +1243,7 @@ QemuCocoaView *cocoaView;
- (void) applicationWillResignActive: (NSNotification *)aNotification
{
COCOA_DEBUG("QemuCocoaAppController: applicationWillResignActive\n");
+ [cocoaView ungrabMouse];
[cocoaView raiseAllKeys];
}
@@ -2052,6 +2053,7 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
[(QemuCocoaAppController *)[[NSApplication sharedApplication] delegate] toggleFullScreen: nil];
});
}
+
if (opts->has_show_cursor && opts->show_cursor) {
cursor_hide = 0;
}
--
2.34.1
WARNING: multiple messages have this Message-ID (diff)
From: Carwyn Ellis <carwynellis@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, peter.maydell@linaro.org,
Carwyn Ellis <carwynellis@gmail.com>
Subject: [PATCH 2/2] ui/cocoa: release mouse when user switches away from QEMU window
Date: Sun, 2 Jan 2022 17:41:53 +0000 [thread overview]
Message-ID: <20220102174153.70043-3-carwynellis@gmail.com> (raw)
In-Reply-To: <20220102174153.70043-1-carwynellis@gmail.com>
This resolves an issue where using command-tab to switch between QEMU
and other windows on the host can leave the mouse pointer visible.
By releasing the mouse when the user switches away, the user must left
click on the QEMU window when switching back in order to hide the
pointer and return control to the guest.
This appraoch ensures that the calls to NSCursor hide and unhide are
always balanced and thus work correctly when invoked.
Signed-off-by: Carwyn Ellis <carwynellis@gmail.com>
---
ui/cocoa.m | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 01045d6698..3f7af4a8fa 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1243,6 +1243,7 @@ QemuCocoaView *cocoaView;
- (void) applicationWillResignActive: (NSNotification *)aNotification
{
COCOA_DEBUG("QemuCocoaAppController: applicationWillResignActive\n");
+ [cocoaView ungrabMouse];
[cocoaView raiseAllKeys];
}
@@ -2052,6 +2053,7 @@ static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts)
[(QemuCocoaAppController *)[[NSApplication sharedApplication] delegate] toggleFullScreen: nil];
});
}
+
if (opts->has_show_cursor && opts->show_cursor) {
cursor_hide = 0;
}
--
2.34.1
next prev parent reply other threads:[~2022-01-02 17:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-02 17:41 [PATCH 0/2] ui/cocoa: Add option to disable left command and hide cursor on click Carwyn Ellis
2022-01-02 17:41 ` Carwyn Ellis
2022-01-02 17:41 ` [PATCH 1/2] ui/cocoa: add option to disable left-command forwarding to guest Carwyn Ellis
2022-01-02 17:41 ` Carwyn Ellis
2022-02-18 18:33 ` Akihiko Odaki
2022-02-18 18:55 ` Peter Maydell
2022-02-18 18:55 ` Peter Maydell
2022-02-18 20:21 ` Philippe Mathieu-Daudé
2022-02-18 20:21 ` Philippe Mathieu-Daudé via
2022-03-11 12:46 ` Markus Armbruster
2022-03-11 12:46 ` Markus Armbruster
2022-01-02 17:41 ` Carwyn Ellis [this message]
2022-01-02 17:41 ` [PATCH 2/2] ui/cocoa: release mouse when user switches away from QEMU window Carwyn Ellis
2022-02-18 18:33 ` Akihiko Odaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220102174153.70043-3-carwynellis@gmail.com \
--to=carwynellis@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.