qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] ui/cocoa: Adding cursor support


From: Chen Zhang
Subject: Re: [Qemu-devel] [PATCH] ui/cocoa: Adding cursor support
Date: Tue, 12 Mar 2019 19:45:37 +0800

Hi,

I did try to utilize NSCursor and CGWarpMouseCursorPosition API before this 
compromise. In cocoa_mouse_set, the position of cursor should to be modified, 
but the bottom half that called it was not scheduled on main thread. UI 
operations have to be queued on main thread asynchronously thereafter. This 
introduced troubles.

One issue was that once CGWarpMouseCursorPosition(), which should not trigger 
any mouse events, was called from cocoa_mouse_set(), the cursor position 
accelerated in a positive feedback manner. This was independent from the 
association state between mouse movement and cursor.

Another issue was that the cursor moved several steps later than the Cocoa 
mouse events.

All these phenomena made me wonder if I was messing up with the host input 
source, runloop, the bottom halves and the asynchronous changes made to cursor 
positions.

On the other hand, rendering the cursor in the window frame buffer only 
introduce a few more dirty rectangles per second and this does not seem to add 
up any significant amount of overhead. At least it keeps the troubles above 
away.

Best regards,

> On Mar 12, 2019, at 3:26 PM, Gerd Hoffmann <address@hidden> wrote:
> 
>  Hi,
> 
>> +        if (cursorVisible && cursorImage && NSIntersectsRect(rect, 
>> cursorRect)) {
>> +            CGContextDrawImage (viewContextRef, cursorRect, cursorImage);
> 
> So you are rendering the cursor to the window.
> 
> Better approach would be to just set the cursor of the host window,
> like the gtk UI does, using gdk_window_set_cursor().
> 
> cheers,
>  Gerd



reply via email to

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