All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Zhang via Qemu-devel <qemu-devel@nongnu.org>
To: Gerd Hoffmann <kraxel@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/2] ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device
Date: Tue, 4 Jun 2019 17:36:48 +0800	[thread overview]
Message-ID: <2D2F1191-E82F-4B54-A6E7-73FFB953DE93@me.com> (raw)
In-Reply-To: <B3540B0C-9A71-4733-8109-11B0DC7A17D2@me.com>

In fullscreen mode, the window property of cocoaView may not be the key
window, and the current implementation would not re-grab cursor by left click
in fullscreen mode after ungrabbed in fullscreen mode with hot-key ctrl-opt-g.

This patch used value of isFullscreen as a short-cirtuit condition for
relative input device grabbing.

Signed-off-by: Chen Zhang <tgfbeta@me.com>
---
 ui/cocoa.m | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 474d44cb9f..aa7cf07368 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -901,7 +901,12 @@ QemuCocoaView *cocoaView;
         case NSEventTypeLeftMouseUp:
             mouse_event = true;
             if (!isMouseGrabbed && [self screenContainsPoint:p]) {
-                if([[self window] isKeyWindow]) {
+                /*
+                 * In fullscreen mode, the window of cocoaView may not be the
+                 * key window, therefore the position relative to the virtual
+                 * screen alone will be sufficient.
+                 */
+                if(isFullscreen || [[self window] isKeyWindow]) {
                     [self grabMouse];
                 }
             }
-- 
2.21.0




  parent reply	other threads:[~2019-06-04  9:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04  9:34 [Qemu-devel] [PATCH 0/2] ui/cocoa: Fix input device issues on Mojave Chen Zhang via Qemu-devel
2019-06-04  9:36 ` [Qemu-devel] [PATCH 1/2] ui/cocoa: Fix absolute input device grabbing issue " Chen Zhang via Qemu-devel
2019-06-07 17:04   ` Peter Maydell
2019-06-04  9:36 ` Chen Zhang via Qemu-devel [this message]
2019-06-04  9:42 ` [Qemu-devel] [PATCH 0/2] ui/cocoa: Fix input device issues " no-reply
2019-06-12 10:39 ` Peter Maydell
2019-06-12 10:47   ` Chen Zhang via Qemu-devel
2019-06-13 10:57   ` Peter Maydell
2019-06-13 10:58 ` [Qemu-devel] A patch has been merged in QEMU: " no-reply
2019-06-13 10:58 ` no-reply
  -- strict thread matches above, loose matches on Subject: below --
2019-06-04  9:12 [Qemu-devel] " Chen Zhang via Qemu-devel
2019-06-04  9:12 ` [Qemu-devel] [PATCH 2/2] ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device Chen Zhang via Qemu-devel
2019-04-08  2:04 [Qemu-devel] [PATCH 0/2] ui/cocoa: Fix absolute and relative input issues on Mojave Chen Zhang
2019-04-08  2:09 ` [Qemu-devel] [PATCH 2/2] ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device Chen Zhang
2019-04-08  2:09   ` Chen Zhang via Qemu-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2D2F1191-E82F-4B54-A6E7-73FFB953DE93@me.com \
    --to=qemu-devel@nongnu.org \
    --cc=kraxel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=tgfbeta@me.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.