All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Programmingkid <programmingkidx@gmail.com>
Cc: qemu-devel qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] ui/cocoa.m: fix sending mouse event to guest
Date: Sat, 2 Apr 2016 18:35:12 +0100	[thread overview]
Message-ID: <CAFEAcA9KunA1FZxcxTfre7hYPBQ=du+_f_QkrQzH93kNeoanOg@mail.gmail.com> (raw)
In-Reply-To: <81C47134-3F2D-4867-894B-777B286194AC@gmail.com>

On 2 April 2016 at 18:25, Programmingkid <programmingkidx@gmail.com> wrote:
>
> On Apr 2, 2016, at 1:07 PM, Peter Maydell wrote:
>
>> On 2 April 2016 at 17:56, Programmingkid <programmingkidx@gmail.com> wrote:
>>> The mouse down event should not be sent to the guest if the mouse down event
>>> causes an activation of QEMU. This patch prevents activation clicks from going
>>> to the guest.
>>>
>>> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
>>> ---
>>> ui/cocoa.m | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/ui/cocoa.m b/ui/cocoa.m
>>> index 60a7c07..07d9c86 100644
>>> --- a/ui/cocoa.m
>>> +++ b/ui/cocoa.m
>>> @@ -698,7 +698,7 @@ QemuCocoaView *cocoaView;
>>>          * 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]) &&
>>>             (last_buttons != buttons)) {
>>>             static uint32_t bmap[INPUT_BUTTON__MAX] = {
>>>                 [INPUT_BUTTON_LEFT]       = MOUSE_EVENT_LBUTTON,
>>> --
>>> 2.7.2
>>
>> I'm afraid I don't really understand why you think this
>> should change. On the face of it the current code looks right:
>> we pass through the mouse button if:
>>   (1) we've got the mouse grab
>> or (2) our window has the focus, even if it's not grabbed
>>
>> I would expect the "activation click" to be "we don't have
>> the mouse grab, and we don't have focus either (some other
>> app is foreground)".
>
> When QEMU's main window is in the background and the user clicks on it,
> the NSLeftMouseUp case in the handleEvent: method will set the
> isMouseGrabbed variable to true. This means the
> "if ((isMouseGrabbed || [[self window] isKeyWindow]) &&
> (last_buttons != buttons))" code will always be true for a left
> mouse button click. The mouse event will be sent to the guest
> when it shouldn't be.

OK, that sounds like a bug, but this doesn't look like the
right way to fix it, because with your change we won't
pass through the click if this is a click on the window
when it's not in the background.

thanks
-- PMM

  reply	other threads:[~2016-04-02 17:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-02 16:56 [Qemu-devel] [PATCH] ui/cocoa.m: fix sending mouse event to guest Programmingkid
2016-04-02 17:07 ` Peter Maydell
2016-04-02 17:25   ` Programmingkid
2016-04-02 17:35     ` Peter Maydell [this message]
2016-04-02 17:53       ` Programmingkid
2016-04-03 12:21         ` Peter Maydell
2016-04-03 16:05           ` Programmingkid

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='CAFEAcA9KunA1FZxcxTfre7hYPBQ=du+_f_QkrQzH93kNeoanOg@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /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.