From: Programmingkid <programmingkidx@gmail.com>
To: qemu-devel qemu-devel <qemu-devel@nongnu.org>
Cc: Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] [PATCH] ui/cocoa.m: Prevent activation clicks from going to guest
Date: Sat, 21 Nov 2015 20:43:43 -0500 [thread overview]
Message-ID: <AFC490FB-08DE-4F10-A28B-115DA789FB59@gmail.com> (raw)
When QEMU is brought to the foreground, the click event that activates QEMU
should not go to the guest. Accidents happen when they do go to the guest
without giving the user a change to handle them. Buttons are clicked accidently.
Windows are closed accidently. Volumes are unmounted accidently. This patch
prevents these accidents from happening.
Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
---
ui/cocoa.m | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 1554331..b75c01e 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -669,6 +669,16 @@ QemuCocoaView *cocoaView;
mouse_event = true;
break;
case NSLeftMouseDown:
+ /*
+ * This prevents the click that activates QEMU from being sent to
+ * the guest.
+ */
+ if (!isMouseGrabbed && [self screenContainsPoint:p]) {
+ [self grabMouse];
+ [NSApp sendEvent:event];
+ return;
+ }
+
if ([event modifierFlags] & NSCommandKeyMask) {
buttons |= MOUSE_EVENT_RBUTTON;
} else {
--
1.7.5.4
next reply other threads:[~2015-11-22 1:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-22 1:43 Programmingkid [this message]
2015-11-23 16:06 ` [Qemu-devel] [PATCH] ui/cocoa.m: Prevent activation clicks from going to guest Peter Maydell
2015-11-23 17:37 ` Programmingkid
2015-11-24 3:25 ` Programmingkid
2015-11-24 8:56 ` Peter Maydell
2015-11-24 16:46 ` Programmingkid
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=AFC490FB-08DE-4F10-A28B-115DA789FB59@gmail.com \
--to=programmingkidx@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).