From patchwork Thu Oct 5 14:55:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 821867 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MZmdUgT0"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y7G7z3V1gz9t2m for ; Fri, 6 Oct 2017 01:57:03 +1100 (AEDT) Received: from localhost ([::1]:40321 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e07a9-0000iS-Hy for incoming@patchwork.ozlabs.org; Thu, 05 Oct 2017 10:57:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e07ZX-0000fj-F2 for qemu-devel@nongnu.org; Thu, 05 Oct 2017 10:56:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e07ZS-0002bC-WE for qemu-devel@nongnu.org; Thu, 05 Oct 2017 10:56:23 -0400 Received: from mail-it0-x243.google.com ([2607:f8b0:4001:c0b::243]:50894) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e07ZS-0002aD-Rc for qemu-devel@nongnu.org; Thu, 05 Oct 2017 10:56:18 -0400 Received: by mail-it0-x243.google.com with SMTP id y138so1690691itc.5 for ; Thu, 05 Oct 2017 07:56:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hF1wGiEpMhO0WPFEJSDttVzz0byUniInfs1WorhomIs=; b=MZmdUgT04EELmaUU2/ECwWjC+GNc/S25s14KzCSwV4vIlZdb7zJREAZhlRH+hMlj7U DpvOqW3nZoEDuSPknIr6Jw58d61XXp91FssvaLF9gXBhmFd4ZDhxJqUEqDMVNF254xsT qc88FEtLBbjBSmLjCxdfOKPSVPF3CXCyo4FjTG8gob38NndkuXxBZdsSY45Pcw7dIJRT CCxTKuzgeJ+2LbIO5ptnHjxihyKIEKVoIIQGlXsY1eqa8IftpJMmIrrRHoDicLTzRURf 0JEQHDzv9PEzWSZ++nyQZK9PK7/myK9DA5PfbhK3zTsHzb9OOFRqgkhQ3Ap2aO+4Z0EV o3ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hF1wGiEpMhO0WPFEJSDttVzz0byUniInfs1WorhomIs=; b=qysZbHFrXsgeRV02dzr2cpkWwPDYP+4a7k2b39QrIXM+K6og1hR/RalSkGZFqyK5lx 6ibo9MjwE5foX6/fnOES0oWkJqCApuJll2J6DQBuTHf04wSmU/dmmTwnfBbpRUsYvYwB IHmTcHnUKDrqIX7k4XiKnLh3IltIqQym0WJQ3WYsdPVharPOEu3lYnB8Eh5TOjC/87bS Wae7kI9+NsAee7lIZHgDQBb9mZpjj3thOVvr5RQ/6ueLlMn5sKO4DEX63SjPNerjaKSc Wep1kSskKNNLYSnLCtB0UEtA2QhdRAbVk5qF6OIXdEwb/0TjZF/09JEeIvtjTcwgoCrI YFyQ== X-Gm-Message-State: AMCzsaWzDHzzoj//6HAc33BUUIKp6uZatrn2Z6oTCjCO2O49FJgCLvQP i0RFAhNaCbLKse+n2F9E7UI= X-Google-Smtp-Source: AOwi7QCvP72x/zC/gsNYvfwKQAhehCNWXoCaG0+IuV/U8EhxBwyj46Tu61QOHg4lAtiOyoaEnEY/Dg== X-Received: by 10.36.153.69 with SMTP id a66mr31790411ite.132.1507215378111; Thu, 05 Oct 2017 07:56:18 -0700 (PDT) Received: from localhost.localdomain (d199-74-164-53.col.wideopenwest.com. [74.199.53.164]) by smtp.gmail.com with ESMTPSA id v65sm8414488itf.38.2017.10.05.07.56.17 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 05 Oct 2017 07:56:17 -0700 (PDT) From: John Arbuckle To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Thu, 5 Oct 2017 10:55:56 -0400 Message-Id: <20171005145557.5746-2-programmingkidx@gmail.com> X-Mailer: git-send-email 2.13.5 (Apple Git-94) In-Reply-To: <20171005145557.5746-1-programmingkidx@gmail.com> References: <20171005145557.5746-1-programmingkidx@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::243 Subject: [Qemu-devel] [PATCH v2 1/2] ui/cocoa.m: move ungrab to ctrl-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: John Arbuckle Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Currently the cocoa user interface relys on the user pushing control-alt to ungrab the mouse. This is patch changes the key combination to control-alt-g to be in line with the GTK user interface. signed-off-by: John Arbuckle --- ui/cocoa.m | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 93e56d0518..d3e7907103 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -609,10 +609,6 @@ - (void) handleEvent:(NSEvent *)event } } - // release Mouse grab when pressing ctrl+alt - if (([event modifierFlags] & NSEventModifierFlagControl) && ([event modifierFlags] & NSEventModifierFlagOption)) { - [self ungrabMouse]; - } break; case NSEventTypeKeyDown: keycode = cocoa_keycode_to_qemu([event keyCode]); @@ -625,7 +621,7 @@ - (void) handleEvent:(NSEvent *)event // default - // handle control + alt Key Combos (ctrl+alt is reserved for QEMU) + // handle control + alt Key Combos (ctrl+alt+[1..9,g] is reserved for QEMU) if (([event modifierFlags] & NSEventModifierFlagControl) && ([event modifierFlags] & NSEventModifierFlagOption)) { switch (keycode) { @@ -633,6 +629,11 @@ - (void) handleEvent:(NSEvent *)event 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; } // handle keys for graphic console @@ -806,9 +807,9 @@ - (void) grabMouse 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 Mouse)"]; + [normalWindow setTitle:@"QEMU - (Press ctrl + alt + g to release Mouse)"]; } [self hideCursor]; if (!isAbsoluteEnabled) { From patchwork Thu Oct 5 14:55:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 821866 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="j23e0/Nf"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y7G7y3BPNz9sRm for ; Fri, 6 Oct 2017 01:57:02 +1100 (AEDT) Received: from localhost ([::1]:40320 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e07a8-0000hg-Hf for incoming@patchwork.ozlabs.org; Thu, 05 Oct 2017 10:57:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e07ZX-0000fi-Ey for qemu-devel@nongnu.org; Thu, 05 Oct 2017 10:56:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e07ZT-0002dn-Ss for qemu-devel@nongnu.org; Thu, 05 Oct 2017 10:56:23 -0400 Received: from mail-it0-x22e.google.com ([2607:f8b0:4001:c0b::22e]:46861) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e07ZT-0002cR-OW for qemu-devel@nongnu.org; Thu, 05 Oct 2017 10:56:19 -0400 Received: by mail-it0-x22e.google.com with SMTP id v62so1707577itd.1 for ; Thu, 05 Oct 2017 07:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GLdawn07nszS239Rm78TyVLZTNvNCho9NUHmnuqaQtw=; b=j23e0/Nf+dYVt4g41WZQWetyE5CQkIO6j4leBCvTyDlvudsc8xuG2LBSNJyynp5Dsj JBLqL4NXebvvAtXVXTkq3hsgRTwCXuGAJ7tIqukCdza8Oz1GkcR0GUJ0ma04Xy9cbjj/ ghaZ2bxiA95rSK05uT5g+PythnRwVhHfh02qjQy/v19uhhXjGSfR9b/iitb4YeYgffQA vnsQzLhfuyf2blPlxvkH3SIUiZ8UUIXLCiDDkvi83zzsbqQQioVKyFa8cXvAEvSqRfbJ /r9PezOv+WWADtyt5eejzXyh3gGHudYXd86wJT/DIMhgUBPq9246zrdX4nraA58l2yuv sIOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GLdawn07nszS239Rm78TyVLZTNvNCho9NUHmnuqaQtw=; b=Kyltl9FUkuKVYO+/339ug+/l83LlEe4aCWS5SEhTAM6Du9pxjnWExVY8EKRQbQpRkn J/Hss4jyj6BkG+xi1X5FxNdD5qyR/7c8JWZ6CuwZBpwVlbFKJPpSfy0v2KbNdWfU0Mm1 JCVGongzTsWRZaez+XvLhch6M9XSnZQYuobmc2H6Wq5D+Vr0vNLXg96/+UkL/7I2HN4E 7R73gxPUUeSzRiftrcuTZK6nOq34SIUuXHkbV3/6KOAE3F7LogNvQv2wamszOMVHBE/1 DLlxRAVnmGzSw0a1bj23Tduwn8B4OKVTyCeSPeDTJkEPNwVYv0Pmg+iJWRseMRNeOWxP y2UA== X-Gm-Message-State: AMCzsaUE6KEV48pK4nGjIBv8w6oFBNT3lzbVJEkHDVzgF3CXnpnt3zob MWUfDz5zAUmPhMpZibe7EJo= X-Google-Smtp-Source: AOwi7QDcBrxuPtxOGqqrsvs7dNZ7yKhQTBv/27Pf4YAmCGmTExnT6rwXXkFK7zu5SQnwsKZGaDOg1Q== X-Received: by 10.36.29.137 with SMTP id 131mr34484075itj.91.1507215379076; Thu, 05 Oct 2017 07:56:19 -0700 (PDT) Received: from localhost.localdomain (d199-74-164-53.col.wideopenwest.com. [74.199.53.164]) by smtp.gmail.com with ESMTPSA id v65sm8414488itf.38.2017.10.05.07.56.18 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 05 Oct 2017 07:56:18 -0700 (PDT) From: John Arbuckle To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Thu, 5 Oct 2017 10:55:57 -0400 Message-Id: <20171005145557.5746-3-programmingkidx@gmail.com> X-Mailer: git-send-email 2.13.5 (Apple Git-94) In-Reply-To: <20171005145557.5746-1-programmingkidx@gmail.com> References: <20171005145557.5746-1-programmingkidx@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::22e Subject: [Qemu-devel] [PATCH v2 2/2] ui/cocoa.m: send ctrl-alt key combinations to guest if not used by QEMU 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: John Arbuckle Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Send control-alt key combinations to the guest if not used by the user interface. --- v2 changes: - changed logic to use existing if case ui/cocoa.m | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index d3e7907103..828d507d57 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -619,25 +619,22 @@ - (void) handleEvent:(NSEvent *)event return; } - // default - - // handle control + alt Key Combos (ctrl+alt+[1..9,g] is reserved for QEMU) - if (([event modifierFlags] & NSEventModifierFlagControl) && ([event modifierFlags] & NSEventModifierFlagOption)) { - switch (keycode) { - - // enable graphic console - case Q_KEY_CODE_1 ... Q_KEY_CODE_9: // '1' to '9' keys - console_select(keycode - 11); - break; + // console selection + if (([event modifierFlags] & NSEventModifierFlagControl) && + ([event modifierFlags] & NSEventModifierFlagOption) && + (keycode >= Q_KEY_CODE_1 && keycode <= Q_KEY_CODE_9)) { + console_select(keycode - 11); + } - // release the mouse grab - case Q_KEY_CODE_G: - [self ungrabMouse]; - break; - } + // mouse ungrab + else if (([event modifierFlags] & NSEventModifierFlagControl) && + ([event modifierFlags] & NSEventModifierFlagOption) && + (keycode == Q_KEY_CODE_G)) { + [self ungrabMouse]; + } - // handle keys for graphic console - } else if (qemu_console_is_graphic(NULL)) { + // send to guest + else if (qemu_console_is_graphic(NULL)) { qemu_input_event_send_key_qcode(dcl->con, keycode, true); // handlekeys for Monitor