Bug 61211

Summary: Applications can't set a custom mouse cursor by subclassing WKView and overriding WM_SETCURSOR
Product: WebKit Reporter: Adam Roben (:aroben) <aroben@webkit.org>
Component: WebKit2Assignee: Nobody <webkit-unassigned@lists.webkit.org>
Status: NEW    
Severity: Normal CC: jhoneycutt@apple.com, sfalken@apple.com
Priority: P2 Keywords: InRadar, PlatformOnly
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows 7   
Bug Depends on:    
Bug Blocks: 61213    
Attachments:
Description Flags
Only call ::SetCursor in response to WM_SETCURSOR aroben: review-

Description From 2011-05-20 13:45:34 PST
WebKit2 calls ::SetCursor after every mouse move. This makes it hard for anyone else to set the cursor when the mouse is over a WKView (e.g., if the app subclassed the WKView and wants to change the mouse cursor).

We should only be calling ::SetCursor in response to WM_SETCURSOR. This matches WebKit1 and is what MSDN recommends.
------- Comment #1 From 2011-05-20 13:46:13 PST -------
<rdar://problem/9478564>
------- Comment #2 From 2011-05-20 13:53:51 PST -------
Created an attachment (id=94266) [details]
Only call ::SetCursor in response to WM_SETCURSOR
------- Comment #3 From 2011-05-20 13:55:40 PST -------
(From update of attachment 94266 [details])
How can we trigger a cursor change without moving the mouse, then? Is there some way to cause a WM_SETCURSOR message to be sent even though we are not moving the mouse?
------- Comment #4 From 2011-05-23 07:33:59 PST -------
(In reply to comment #3)
> (From update of attachment 94266 [details] [details])
> How can we trigger a cursor change without moving the mouse, then? Is there some way to cause a WM_SETCURSOR message to be sent even though we are not moving the mouse?

You're right that this is an issue with this patch. It turns out I was wrong about WebKit1 only calling ::SetCursor in response to WM_SETCURSOR; it also calls it whenever ChromeClient::setCursor is called.

I have a new patch that fixes the issue for client applications while still allowing the cursor to change without moving the mouse. I'll attach it in a moment. Thanks for reviewing carefully!