Received: from eggs.gnu.org ([2001:4830:134:3::10]:38748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0Jh0-00028j-Rz for qemu-devel@nongnu.org; Sat, 21 Nov 2015 20:43:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0Jgv-0003IH-Sh for qemu-devel@nongnu.org; Sat, 21 Nov 2015 20:43:50 -0500 Received: from mail-qg0-x229.google.com ([2607:f8b0:400d:c04::229]:33379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0Jgv-0003ID-Ok for qemu-devel@nongnu.org; Sat, 21 Nov 2015 20:43:45 -0500 Received: by qgea14 with SMTP id a14so95906999qge.0 for ; Sat, 21 Nov 2015 17:43:45 -0800 (PST) From: Programmingkid Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Sat, 21 Nov 2015 20:43:43 -0500 Message-Id: Mime-Version: 1.0 (Apple Message framework v1084) Subject: [Qemu-devel] [PATCH] ui/cocoa.m: Prevent activation clicks from going to guest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel qemu-devel Cc: Peter Maydell 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.=20 Signed-off-by: John Arbuckle --- 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 =3D 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 |=3D MOUSE_EVENT_RBUTTON; } else { --=20 1.7.5.4