qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] ui/cocoa.m: Prevent activation clicks from going to


From: Programmingkid
Subject: [Qemu-devel] [PATCH] ui/cocoa.m: Prevent activation clicks from going to guest
Date: Sat, 21 Nov 2015 20:43:43 -0500

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 <address@hidden>

---
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]