qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] ui/cocoa: Fix absolute input device grabbing


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2] ui/cocoa: Fix absolute input device grabbing issues on Mojave
Date: Tue, 26 Mar 2019 16:15:58 +0000

On Tue, 19 Mar 2019 at 03:51, Chen Zhang <address@hidden> wrote:
>
> On Mojave, absolute input device, i.e. tablet, had trouble re-grabbing
> the cursor in re-entry into the virtual screen area. In some cases,
> the `window` property of NSEvent object is nil, after exit of cursor,
> meaning that the `-locationInWindow` method would return value in screen
> coordinates. Current implementation used raw locations from NSEvent
> without considering whether the value was for the window coordinates or
> the macOS screen coordinates, nor was the zooming factor for Zoom-to-Fit
> included for fullscreen mode.
>
> In fullscreen mode, the fullscreen cocoa window might not be the key
> window, therefore location of event in virtual coordinates should suffice
> for the condition of grabbing.
>
> This patch fixed boundary check methods for cursor in normal and fullscreen
> with/without Zoom-to-Fit on macOS Mojave.
>
> Signed-off-by: Chen Zhang <address@hidden>
> ---
>  ui/cocoa.m | 39 +++++++++++++++++++++++++++++++++++++--
>  1 file changed, 37 insertions(+), 2 deletions(-)
>

Hi; this doesn't compile for me, I'm afraid. I've appended the full
compiler error log, but the problem seems to be that
the convertPointFromScreen method of NSWindow doesn't exist.
I'm not entirely sure why, since the API docs say that method
was introduced in OSX 10.12 and I'm running 10.13.6, but
at least at the moment our minimum OSX version is 10.10,
so we need something to handle that anyway.

(http://codeworkshop.net/objc-diff/sdkdiffs/macos/10.14/AppKit.html
suggests that maybe the docs are wrong and this method
was only added in 10.14; that would certainly fit the symptoms.)


/Users/pm215/src/qemu/ui/cocoa.m:414:35: warning: instance method
'-convertPointFromScreen:' not found
      (return type defaults to 'id') [-Wobjc-method-access]
            return [[self window] convertPointFromScreen:[ev locationInWindow]];
                                  ^~~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:191:12:
note: receiver is instance of class declared here
@interface NSWindow : NSResponder <NSAnimatablePropertyContainer,
NSUserInterfaceValidations, NSUserInterfaceItemIdenti...
           ^
/Users/pm215/src/qemu/ui/cocoa.m:414:20: error: returning 'id' from a
function with incompatible result type 'CGPoint'
      (aka 'struct CGPoint')
            return [[self window] convertPointFromScreen:[ev locationInWindow]];
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pm215/src/qemu/ui/cocoa.m:416:61: warning: instance method
'-convertPointFromScreen:' not found
      (return type defaults to 'id') [-Wobjc-method-access]
            CGPoint loc = [self convertPoint:[[self window]
convertPointFromScreen:[ev locationInWindow]] fromView:nil];

^~~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:191:12:
note: receiver is instance of class declared here
@interface NSWindow : NSResponder <NSAnimatablePropertyContainer,
NSUserInterfaceValidations, NSUserInterfaceItemIdenti...
           ^
/Users/pm215/src/qemu/ui/cocoa.m:416:46: error: sending 'id' to
parameter of incompatible type 'NSPoint' (aka 'struct CGPoint')
            CGPoint loc = [self convertPoint:[[self window]
convertPointFromScreen:[ev locationInWindow]] fromView:nil];

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/AppKit.framework/Headers/NSView.h:196:34:
note: passing argument to parameter 'point' here
- (NSPoint)convertPoint:(NSPoint)point fromView:(nullable NSView *)view;
                                 ^
/Users/pm215/src/qemu/ui/cocoa.m:435:67: warning: instance method
'-convertPointToScreen:' not found
      (return type defaults to 'id') [-Wobjc-method-access]
        return [[self window] convertPointFromScreen:[eventWindow
convertPointToScreen:[ev locationInWindow]]];

^~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:191:12:
note: receiver is instance of class declared here
@interface NSWindow : NSResponder <NSAnimatablePropertyContainer,
NSUserInterfaceValidations, NSUserInterfaceItemIdenti...
           ^
/Users/pm215/src/qemu/ui/cocoa.m:435:31: warning: instance method
'-convertPointFromScreen:' not found
      (return type defaults to 'id') [-Wobjc-method-access]
        return [[self window] convertPointFromScreen:[eventWindow
convertPointToScreen:[ev locationInWindow]]];
                              ^~~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:191:12:
note: receiver is instance of class declared here
@interface NSWindow : NSResponder <NSAnimatablePropertyContainer,
NSUserInterfaceValidations, NSUserInterfaceItemIdenti...
           ^
/Users/pm215/src/qemu/ui/cocoa.m:435:16: error: returning 'id' from a
function with incompatible result type 'CGPoint'
      (aka 'struct CGPoint')
        return [[self window] convertPointFromScreen:[eventWindow
convertPointToScreen:[ev locationInWindow]]];
               
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 warnings and 3 errors generated.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]