From patchwork Fri Aug 16 12:04:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 267627 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A07932C00FF for ; Fri, 16 Aug 2013 22:05:21 +1000 (EST) Received: from localhost ([::1]:58405 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VAImN-0000W1-Pc for incoming@patchwork.ozlabs.org; Fri, 16 Aug 2013 08:05:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VAIlz-0000Vg-2y for qemu-devel@nongnu.org; Fri, 16 Aug 2013 08:04:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VAIlw-0004JT-Vs for qemu-devel@nongnu.org; Fri, 16 Aug 2013 08:04:55 -0400 Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]:59363) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VAIlw-0004Ix-Mv; Fri, 16 Aug 2013 08:04:52 -0400 Received: by mail-wi0-f174.google.com with SMTP id j17so729035wiw.1 for ; Fri, 16 Aug 2013 05:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=KHX1D8EBrUwXdQ+KIIoXTGQTLXSUCIKkoKCIJCKEQxU=; b=Rd6mEPI076Msj3ncvmAWreUcjlgKi9Y7MpYWSvbSEHkGCgIQoDVueH+m7iUn3oEL+a jOrjLmFfD3PYXgnISKx0kS/IdmcBABueeJSA2SlME10VF/WuOIUlEwnfe52soyAlEPUe yIisuTYQIMm9yy20OGpUn+3dZ8oY/XJeJzPC5zGyI6ui56G26RLB86b5TUrmTOZkwsbL XOYOBVMNfZF0jZR7RsBKWSSgqv0qwQZt7ChgxXHsaJEo5OgaqsoG1E1a+sn71pTqIjbD yudAxilwa0JMRhlA/jajNe3WSZMpwWV3J7E+AVZkGhRKJS7B6pxUMt0xu5NaoyG79j9f Jrjg== MIME-Version: 1.0 X-Received: by 10.180.187.17 with SMTP id fo17mr759253wic.60.1376654691475; Fri, 16 Aug 2013 05:04:51 -0700 (PDT) Received: by 10.194.81.100 with HTTP; Fri, 16 Aug 2013 05:04:51 -0700 (PDT) Date: Fri, 16 Aug 2013 08:04:51 -0400 Message-ID: From: G 3 To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, afaerber@suse.de, Peter Maydell X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::22e Subject: [Qemu-devel] [PATCH again] Adds the ability to use the command key in the guest operating system. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Resent to fix wrapping that took place. Signed-off-by: John Arbuckle Deciding when and how to send the command key has not been easy. A simple protocol that this patch implements is send the command key to the guest operating system when the mouse is grabbed. Otherwise send the command key to QEMU. --- ui/cocoa.m | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) - // handle control + alt Key Combos (ctrl+alt is reserved for QEMU) if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) { switch (keycode) { diff --git a/ui/cocoa.m b/ui/cocoa.m index be49179..9a57f57 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -129,8 +129,8 @@ int keymap[] = 14, // 51 0x33 0x0e BKSP QZ_BACKSPACE 0, // 52 0x34 Undefined 1, // 53 0x35 0x01 ESC QZ_ESCAPE - 0, // 54 0x36 QZ_RMETA - 0, // 55 0x37 QZ_LMETA + 219,// 54 0x36 QZ_RMETA + 219,// 55 0x37 QZ_LMETA 42, // 56 0x38 0x2a L SHFT QZ_LSHIFT 58, // 57 0x39 0x3a CAPS QZ_CAPSLOCK 56, // 58 0x3A 0x38 L ALT QZ_LALT @@ -512,21 +512,24 @@ QemuCocoaView *cocoaView; } // release Mouse grab when pressing ctrl+alt - if (!isFullscreen && ([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) { + if (([event modifierFlags] & NSControlKeyMask) && ([event modifierFlags] & NSAlternateKeyMask)) { [self ungrabMouse]; } break; case NSKeyDown: + keycode = cocoa_keycode_to_qemu([event keyCode]); - // forward command Key Combos + // if command key is down if ([event modifierFlags] & NSCommandKeyMask) { - [NSApp sendEvent:event]; - return; + if (isMouseGrabed == YES) { // if sending the command key to the guest + kbd_put_keycode(219); // send command key + kbd_put_keycode(keycode); // send any other key + } else { // if sending the command key to QEMU + [NSApp sendEvent:event]; + return; + } } - // default - keycode = cocoa_keycode_to_qemu([event keyCode]);