qemu-devel.nongnu.org archive mirror
 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 v2] ui/cocoa.m: fix sending mouse event to guest
Date: Fri, 6 Jan 2017 16:19:43 +0000	[thread overview]
Message-ID: <CAFEAcA_pNp39dUxG4ZLGJgsApEpKXB_cf9vmUpH1Gva=pnH1yg@mail.gmail.com> (raw)
In-Reply-To: <37C57425-158F-4544-89EF-CC8053476EB6@gmail.com>

On 6 January 2017 at 15:44, Programmingkid <programmingkidx@gmail.com> wrote:
>
> On Jan 6, 2017, at 8:48 AM, Peter Maydell wrote:
>
>> On 1 January 2017 at 21:31, Programmingkid <programmingkidx@gmail.com> wrote:
>>> 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.

>>>     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,
>>
>> Comment doesn't match code. The comment says "mouse grab, full screen
>> or focus", but the code is doing "mouse grab and (full screen or focus)".
>>
>> Which is correct?
>
>
> This sounds more accurate:
>
> (mouse grab and main window is the front window) or QEMU is in fullscreen.

That's not what your code does either.

What is the actual situation which we currently get wrong and need
to get right? Your commit message says "if the event causes QEMU
to move to the foreground", but my expectation was that if we
weren't in the foreground then we would not have the mouse grabbed,
and in any case your patch adds a check on isFullscreen but your
commit message doesn't say anything about full-screen or not being
relevant to the problem.

thanks
-- PMM

  reply	other threads:[~2017-01-06 16:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-01 21:31 [Qemu-devel] [PATCH v2] ui/cocoa.m: fix sending mouse event to guest Programmingkid
2017-01-06 13:48 ` Peter Maydell
2017-01-06 15:44   ` Programmingkid
2017-01-06 16:19     ` Peter Maydell [this message]
2017-01-06 16:34       ` 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='CAFEAcA_pNp39dUxG4ZLGJgsApEpKXB_cf9vmUpH1Gva=pnH1yg@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).