From patchwork Sun Jan 1 21:31:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 9493023 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A455460453 for ; Sun, 1 Jan 2017 21:31:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DD252621D for ; Sun, 1 Jan 2017 21:31:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DB8A267EC; Sun, 1 Jan 2017 21:31:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 174FF2621D for ; Sun, 1 Jan 2017 21:31:33 +0000 (UTC) Received: from localhost ([::1]:54575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNnj1-0004xM-CR for patchwork-qemu-devel@patchwork.kernel.org; Sun, 01 Jan 2017 16:31:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNnik-0004xF-8u for qemu-devel@nongnu.org; Sun, 01 Jan 2017 16:31:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cNnih-0004Vy-7J for qemu-devel@nongnu.org; Sun, 01 Jan 2017 16:31:14 -0500 Received: from mail-io0-x244.google.com ([2607:f8b0:4001:c06::244]:35414) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cNnih-0004Vs-1I for qemu-devel@nongnu.org; Sun, 01 Jan 2017 16:31:11 -0500 Received: by mail-io0-x244.google.com with SMTP id f73so52839840ioe.2 for ; Sun, 01 Jan 2017 13:31:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:subject:date:message-id:cc:to :mime-version; bh=FrXCAlR++U5RIpt1Tk39ik9pXLNS16UEaspXyHiuFfw=; b=hSP2/tP+VySdW1o+7+mLbXPBFiZGzRXPPlMJUEjtmOmy1uVzNlYuDK3vgoflRwcvUT Ql3Yep27s2IU5Ua1s5VMwFoczQ/Gmx4ohvAIA9qSvzjp62QwvXIMcmBNnZOQEorwhsbz /k/db9eAw+HT3760zrpFbaXo8WDh3zFZIkqrCIHUVXHVt9blMjnpe+83R+wQN2nyRotN 6uYd+EeHcufMASy85URREdtjtD++burTfCDR7L/1soA4yoiGXmeTGV2E9WY8wqu3uq+M IoGwNvGnu08kS9pXkbNynnifReFkWnJP51YDikiMgAMtAhW9x8Yh3M7nvbh1RRZuhuHw mSlQ== 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:subject:date :message-id:cc:to:mime-version; bh=FrXCAlR++U5RIpt1Tk39ik9pXLNS16UEaspXyHiuFfw=; b=IvVOKauT/vcYEOFFl2stad07txaj0Cnd03rWtIN2lFlR/1QXj2O3ag5Ekgt1KVuOEp H7M4zWiIsDEDuGUqrKCxt5gc/U8bwyJu59lP01I9klBFjwwaTLgcYJAkVWge37phzsad XaW6Lg3f6qZGUQdYRA6JWVhXgAhwXUIfByec5gCNDu+0pC5gt45NQ20J03uIbhJ/QxyP bpqVzzzaT8ivxvp4EzneeU3AOXzN+A4CVkO0ALYkwobEQbF7F9CRmif7PM/rRS7DBCAL kX9GSb2sjVmto1Q1jmC35/Q26FQ77YX0sTgcafgVIxdaOKXAnipXGdyvBN5dm3H87vlL 8A5g== X-Gm-Message-State: AIkVDXKSzL369Pgsos9UPnjy9nGAo2wNS+ukeRg9X6dV5ggcP/wG2G0L2tAMxfTkAENDHg== X-Received: by 10.107.58.195 with SMTP id h186mr48572461ioa.117.1483306270153; Sun, 01 Jan 2017 13:31:10 -0800 (PST) Received: from [192.168.0.7] (d199-74-164-53.col.wideopenwest.com. [74.199.53.164]) by smtp.gmail.com with ESMTPSA id l73sm30957863ioe.1.2017.01.01.13.31.09 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 01 Jan 2017 13:31:09 -0800 (PST) From: Programmingkid Date: Sun, 1 Jan 2017 16:31:07 -0500 Message-Id: <84C57F4C-C8F8-4FB3-804A-FC3DE0AB6408@gmail.com> To: Peter Maydell Mime-Version: 1.0 (Apple Message framework v1084) X-Mailer: Apple Mail (2.1084) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c06::244 Subject: [Qemu-devel] [PATCH v2] ui/cocoa.m: fix sending mouse event to guest 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 qemu-devel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The mouse down event should not be sent to the guest if the mouse down event causes QEMU to move the foreground from the background. This patch prevents these activation clicks from going to the guest. Signed-off-by: John Arbuckle --- v2 changes: Fix a bug that caused fullscreen mode not to receive mouse events. ui/cocoa.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 26d4a1c..ae3f5a1 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -695,13 +695,13 @@ QemuCocoaView *cocoaView; if (mouse_event) { /* Don't send button events to the guest unless we've got a - * mouse grab or window focus. If we have neither then this event - * is the user clicking on the background window to activate and - * bring us to the front, which will be done by the sendEvent - * call below. We definitely don't want to pass that click through - * to the guest. + * mouse grab, window focus, or in fullscreen mode. If we have neither + * then this event is the user clicking on the background window to + * activate and bring us to the front, which will be done by the + * sendEvent call below. We definitely don't want to pass that click + * through to the guest. */ - if ((isMouseGrabbed || [[self window] isKeyWindow]) && + if (isMouseGrabbed && ([[self window] isKeyWindow] || isFullscreen) && (last_buttons != buttons)) { static uint32_t bmap[INPUT_BUTTON__MAX] = { [INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON,