From nobody Sun May 5 23:20:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150056185501083.30771524372585; Thu, 20 Jul 2017 07:44:15 -0700 (PDT) Received: from localhost ([::1]:38358 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYCaR-0001Zg-9e for importer@patchew.org; Thu, 20 Jul 2017 10:37:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYCZ8-00012b-IQ for qemu-devel@nongnu.org; Thu, 20 Jul 2017 10:36:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYCZ4-0006oI-JP for qemu-devel@nongnu.org; Thu, 20 Jul 2017 10:36:34 -0400 Received: from mail-io0-x241.google.com ([2607:f8b0:4001:c06::241]:36743) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dYCZ4-0006nz-FE for qemu-devel@nongnu.org; Thu, 20 Jul 2017 10:36:30 -0400 Received: by mail-io0-x241.google.com with SMTP id z74so563953ioz.3 for ; Thu, 20 Jul 2017 07:36:28 -0700 (PDT) Received: from [192.168.0.10] (d199-74-164-53.col.wideopenwest.com. [74.199.53.164]) by smtp.gmail.com with ESMTPSA id p69sm1241437iod.4.2017.07.20.07.36.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jul 2017 07:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:message-id:date :cc:to; bh=zYG5NQeSxUkEfUy/yMv8FpwZsnvn1KteG9dxP1JzSm0=; b=dzkk0G7rK+//i3fHE5rIBVFfWQT/+JL4y8TgKLvPkyMNvPa19WwVgL23+wVS9vAHBf +6A/bNsiGoe0hQPw+VmHs1/FZ8fqLct6w51BLOMBPCRfd/KJrB5QgvtQwJMoTf60zu7b MHi+P+so07sRpgcxIdUtSWkPX5cCbYs+ZbtRk3grsiq1cWpjdwzuAO7SzKT2GARuR7EM laeksPNEJ10wg7r9KGZSksgiHyAk3eR0rUXwzXOoBVst+Xkg7gB48hsPHyqyvyilM3ky fZlAA8ry4w8pxpbNwuoc2Mass6P27Axg9+rX7YxHyT/lNSXjnc7ikO5S4X6dZNjXoz5L mL9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:cc:to; bh=zYG5NQeSxUkEfUy/yMv8FpwZsnvn1KteG9dxP1JzSm0=; b=QTF0icIK/MQwCCwnbliaXxVAA7auJtpF6rsdSmShZ61ZuXHVtfWiFhfPBGnrQ9PGQI cI9C/Ck0aRZwRwBK+NolT/MnuY5njj2Jfj2E1fLFri7V1oOvdCDBCE1EiDLxR9CNlssw jXr1TpPXDibjAUJWFS+l5wW4XQsEVApF4E3vWGFEplFWS1U03tjMa3t/78Kf3K6JE4bH im768tohTLjPBGqK6elZaYyqyQLrVwDK6LiyF9vizuedSffBaRKFC440mH4RxX2wVrux mmqvwDF2S+vwqq8l52+qyrIwyRvHtnUXfokyoEBZx66ZmRThCIg2Jo5JR96GBUrTRD9a TqWA== X-Gm-Message-State: AIVw112XbIureVMPmWxYFnhrH6NHPeI9eHE8AGwRoakyCcgK22ehaaYk YCZgARNy3Is8eg== X-Received: by 10.107.183.206 with SMTP id h197mr3742403iof.125.1500561387056; Thu, 20 Jul 2017 07:36:27 -0700 (PDT) From: Programmingkid Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Message-Id: <7843ECF8-2CA7-485F-B3D2-38A55D13D80D@gmail.com> Date: Thu, 20 Jul 2017 10:36:25 -0400 To: Peter Maydell , Gerd Hoffmann X-Mailer: Apple Mail (2.3273) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c06::241 Subject: [Qemu-devel] [PATCH] ui/cocoa.m: change mouse grab to control-alt-g X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "qemu-devel@nongnu.org qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The GTK interface uses Control-Alt-G to ungrab the mouse. This patch change= s the ungrab keys in the Cocoa interface to be consistent with the GTK inte= rface. This patch has the added benefit of being able to send Control-Alt k= ey combinations to the guest (like Control-Alt-Delete used in Windows). Signed-off-by: John Arbuckle --- ui/cocoa.m | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 93e56d0..d64c7b9 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -609,10 +609,6 @@ QemuCocoaView *cocoaView; } } =20 - // release Mouse grab when pressing ctrl+alt - if (([event modifierFlags] & NSEventModifierFlagControl) && ([= event modifierFlags] & NSEventModifierFlagOption)) { - [self ungrabMouse]; - } break; case NSEventTypeKeyDown: keycode =3D cocoa_keycode_to_qemu([event keyCode]); @@ -625,7 +621,7 @@ QemuCocoaView *cocoaView; =20 // default =20 - // handle control + alt Key Combos (ctrl+alt is reserved for Q= EMU) + // handle control + alt Key Combos (ctrl+alt+[1..9,g] is reser= ved for QEMU) if (([event modifierFlags] & NSEventModifierFlagControl) && ([= event modifierFlags] & NSEventModifierFlagOption)) { switch (keycode) { =20 @@ -633,6 +629,18 @@ QemuCocoaView *cocoaView; case Q_KEY_CODE_1 ... Q_KEY_CODE_9: // '1' to '9' keys console_select(keycode - 11); break; + + // release the mouse grab + case Q_KEY_CODE_G: + [self ungrabMouse]; + break; + + // send to the guest + default: + qemu_input_event_send_key_qcode(dcl->con, Q_KEY_CO= DE_CTRL, true); + qemu_input_event_send_key_qcode(dcl->con, Q_KEY_CO= DE_ALT, true); + qemu_input_event_send_key_qcode(dcl->con, keycode,= true); + break; } =20 // handle keys for graphic console @@ -806,9 +814,9 @@ QemuCocoaView *cocoaView; =20 if (!isFullscreen) { if (qemu_name) - [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - = (Press ctrl + alt to release Mouse)", qemu_name]]; + [normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s - = (Press ctrl + alt + g to release Mouse)", qemu_name]]; else - [normalWindow setTitle:@"QEMU - (Press ctrl + alt to release M= ouse)"]; + [normalWindow setTitle:@"QEMU - (Press ctrl + alt + g to relea= se Mouse)"]; } [self hideCursor]; if (!isAbsoluteEnabled) { --=20 2.7.2