diff mbox series

ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device

Message ID 176E53D9-50B8-405C-82FF-5247342264C1@me.com (mailing list archive)
State New, archived
Headers show
Series ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device | expand

Commit Message

Zhijian Li (Fujitsu)" via March 21, 2019, 7:10 a.m. UTC
In fullscreen mode, the window property of cocoaView may not be the key
window, and the current implementation would not grab mouse in
fullscreen mode after left clicks on relative input devices.

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

Note that this patch should be tested after applying a previous patch
which fixed event location conversion for relative input devices.

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

Comments

no-reply@patchew.org March 21, 2019, 7:22 a.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/176E53D9-50B8-405C-82FF-5247342264C1@me.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 176E53D9-50B8-405C-82FF-5247342264C1@me.com
Subject: [Qemu-devel] [PATCH] ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/176E53D9-50B8-405C-82FF-5247342264C1@me.com -> patchew/176E53D9-50B8-405C-82FF-5247342264C1@me.com
 t [tag update]            patchew/20190313065649.19067-1-yuchenlin@synology.com -> patchew/20190313065649.19067-1-yuchenlin@synology.com
 t [tag update]            patchew/20190315032629.21234-1-richard.henderson@linaro.org -> patchew/20190315032629.21234-1-richard.henderson@linaro.org
Switched to a new branch 'test'
79cb56db3d ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device

=== OUTPUT BEGIN ===
ERROR: Author email address is mangled by the mailing list
#2: 
Author: Chen Zhang via Qemu-devel <qemu-devel@nongnu.org>

total: 1 errors, 0 warnings, 13 lines checked

Commit 79cb56db3d30 (ui/cocoa: Fix mouse grabbing in fullscreen mode for relative input device) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/176E53D9-50B8-405C-82FF-5247342264C1@me.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Peter Maydell March 26, 2019, 4:20 p.m. UTC | #2
On Thu, 21 Mar 2019 at 07:10, Chen Zhang <tgfbeta@me.com> wrote:
>
> In fullscreen mode, the window property of cocoaView may not be the key
> window, and the current implementation would not grab mouse in
> fullscreen mode after left clicks on relative input devices.
>
> This patch used isFullscreen value as a short-cirtuit condition for
> relative input device grabbing.
>
> Note that this patch should be tested after applying a previous patch
> which fixed event location conversion for relative input devices.
>
> Signed-off-by: Chen Zhang <tgfbeta@me.com>

Can you explain in more detail when this patch makes a
difference, please? (for instance, a set of instructions
for reproducing the issue).

I'm confused, because in the toggleFullScreen method, when
we switch to full screen mode (which is the only place where
we set isFullscreen to true) we always do a [self grabMouse].
So if we get into the event handling function and isFullscreen
is true, I think the mouse should already be grabbed. What
am I missing ?

thanks
-- PMM
Zhijian Li (Fujitsu)" via March 27, 2019, 2 a.m. UTC | #3
> On Mar 27, 2019, at 12:20 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> 
> On Thu, 21 Mar 2019 at 07:10, Chen Zhang <tgfbeta@me.com> wrote:
>> 
>> In fullscreen mode, the window property of cocoaView may not be the key
>> window, and the current implementation would not grab mouse in
>> fullscreen mode after left clicks on relative input devices.
>> 
>> This patch used isFullscreen value as a short-cirtuit condition for
>> relative input device grabbing.
>> 
>> Note that this patch should be tested after applying a previous patch
>> which fixed event location conversion for relative input devices.
>> 
>> Signed-off-by: Chen Zhang <tgfbeta@me.com>
> 
> Can you explain in more detail when this patch makes a
> difference, please? (for instance, a set of instructions
> for reproducing the issue).
> 

> I'm confused, because in the toggleFullScreen method, when
> we switch to full screen mode (which is the only place where
> we set isFullscreen to true) we always do a [self grabMouse].
> So if we get into the event handling function and isFullscreen
> is true, I think the mouse should already be grabbed. What
> am I missing ?
Hi,

In fullscreen mode, when the mouse is un-grabbed by pressing Cmd-Opt-g, it would not be re-grabbed by clicks in the view, as the window of the view would not be key window by then.

BTW, the Ctrl-Alt-Xs in ui/cocoa.m was confusing in the context. Should they be replaced by Cmd-Opt-Xs?
> 
> thanks
> -- PMM

Best Regards,
Zhijian Li (Fujitsu)" via April 6, 2019, 3:05 a.m. UTC | #4
ping

http://patchwork.ozlabs.org/patch/1059842/

> On Mar 27, 2019, at 10:00 AM, Chen Zhang <tgfbeta@me.com> wrote:
> 
> 
> 
>> On Mar 27, 2019, at 12:20 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> 
>> On Thu, 21 Mar 2019 at 07:10, Chen Zhang <tgfbeta@me.com> wrote:
>>> 
>>> In fullscreen mode, the window property of cocoaView may not be the key
>>> window, and the current implementation would not grab mouse in
>>> fullscreen mode after left clicks on relative input devices.
>>> 
>>> This patch used isFullscreen value as a short-cirtuit condition for
>>> relative input device grabbing.
>>> 
>>> Note that this patch should be tested after applying a previous patch
>>> which fixed event location conversion for relative input devices.
>>> 
>>> Signed-off-by: Chen Zhang <tgfbeta@me.com>
>> 
>> Can you explain in more detail when this patch makes a
>> difference, please? (for instance, a set of instructions
>> for reproducing the issue).
>> 
> 
>> I'm confused, because in the toggleFullScreen method, when
>> we switch to full screen mode (which is the only place where
>> we set isFullscreen to true) we always do a [self grabMouse].
>> So if we get into the event handling function and isFullscreen
>> is true, I think the mouse should already be grabbed. What
>> am I missing ?
> Hi,
> 
> In fullscreen mode, when the mouse is un-grabbed by pressing Cmd-Opt-g, it would not be re-grabbed by clicks in the view, as the window of the view would not be key window by then.
> 
> BTW, the Ctrl-Alt-Xs in ui/cocoa.m was confusing in the context. Should they be replaced by Cmd-Opt-Xs?
>> 
>> thanks
>> -- PMM
> 
> Best Regards,
diff mbox series

Patch

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 420b2411c1..51463bb931 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -862,7 +862,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];
                 }
             }