[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] ui/cocoa.m: fix sending mouse event to guest
From: |
Programmingkid |
Subject: |
Re: [Qemu-devel] [PATCH] ui/cocoa.m: fix sending mouse event to guest |
Date: |
Sat, 2 Apr 2016 13:25:36 -0400 |
On Apr 2, 2016, at 1:07 PM, Peter Maydell wrote:
> On 2 April 2016 at 17:56, Programmingkid <address@hidden> 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 <address@hidden>
>> ---
>> 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.