After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 749178 - quartz: Support css cursor names
quartz: Support css cursor names
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Quartz
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-quartz maintainers
gtk-bugs
Depends on:
Blocks: 652085
 
 
Reported: 2015-05-10 03:54 UTC by Matthias Clasen
Modified: 2015-05-16 21:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
quartz: Support css cursor names (2.79 KB, patch)
2015-05-10 03:54 UTC, Matthias Clasen
none Details | Review
Patch to implement most of the named cursors. (6.69 KB, patch)
2015-05-14 20:55 UTC, Pietro Gagliardi (andlabs)
accepted-commit_now Details | Review

Description Matthias Clasen 2015-05-10 03:54:55 UTC
We want these to work across platforms, so do a best-effort
approximation. We could do much better here by copying what
webkit does.
Comment 1 Matthias Clasen 2015-05-10 03:54:59 UTC
Created attachment 303169 [details] [review]
quartz: Support css cursor names
Comment 2 Pietro Gagliardi (andlabs) 2015-05-14 20:55:11 UTC
Created attachment 303396 [details] [review]
Patch to implement most of the named cursors.

Wrote up a patch to handle all but two of them. This was a fun one.

The only two that are not handled are "busy" and "all-scroll". OS X doesn't provide these in their public or private APIs for some reason (and I wonder if OS X even has scrolling cursors at all). "busy" right now is equivalent to "progress"; "all-scroll" equivalent to "move" (since it looks alike).

Note that according to WebKit the zoom cursors and one or two others are only available as of OS X 10.7.3.

Hopefully this will work.
Comment 3 Matthias Clasen 2015-05-15 02:04:40 UTC
Review of attachment 303396 [details] [review]:

Very cool, thanks a lot for doing this.
Comment 4 Matthias Clasen 2015-05-15 02:05:37 UTC
From what I figure from information on the net, the only way to trigger the official wait cursor on os x is to block the mainloop...
Comment 5 Kristian Rietveld 2015-05-15 09:05:53 UTC
(In reply to Matthias Clasen from comment #4)
> From what I figure from information on the net, the only way to trigger the
> official wait cursor on os x is to block the mainloop...

Do you mean the spinning beach ball?  A way around that is to use another cursor as wait cursor, I have seen other applications do this (most notably LibreOffice).
Comment 6 Matthias Clasen 2015-05-15 17:41:30 UTC
yes, the beach ball. and yes, of course we can use another cursor (provided we can figure out how os x loads animated cursors)
Comment 7 Pietro Gagliardi (andlabs) 2015-05-16 03:39:22 UTC
Potential entry point: CGSForceWaitCursorActive()
Comment 8 Kristian Rietveld 2015-05-16 12:04:19 UTC
(In reply to Pietro Gagliardi (andlabs) from comment #7)
> Potential entry point: CGSForceWaitCursorActive()

I am not sure if you should be going down that path.

It's actually quite a tricky issue. Mac OS X does actually not have the notion of a "wait cursor" and therefore no such cursor is defined in the Cocoa API. In the user interface guidelines Apple strongly recommends to use UI elements like for example progress bars to indicate "waiting time" instead of using a wait cursor.

The spinning beach ball is set by the window server in case an application cannot keep up with the event stream and or is not responding. Some people argue that the spinning beach ball often indicates "something is wrong".

So there's not a cursor or method in the Apple APIs to which a wait cursor can be mapped. I think the best solution is to introduce our own wait cursor. As far as I can see, LibreOffice is doing exactly the same:

http://cgit.freedesktop.org/libreoffice/core/tree/vcl/osx/saldata.cxx

See for instance line 117 at time of this writing.
Comment 9 Matthias Clasen 2015-05-16 14:35:49 UTC
I agree with Kristian. If OS X treats the beach ball as special, we should respect that and bring our own wait cursor.
Comment 10 Matthias Clasen 2015-05-16 14:36:37 UTC
I agree with Kristian. If OS X treats the beach ball as special, we should respect that and bring our own wait cursor.
Comment 11 Pietro Gagliardi (andlabs) 2015-05-16 18:27:56 UTC
Very well. You can decide what to use as a wait cursor; if you apply the patch as is it will be equivalent to the "progress" cursor.

Later I'll do a quick look into scrolling cursors; we might have to provide that one ourselves as well though :/ Not sure what WebKit does for that.
Comment 12 Matthias Clasen 2015-05-16 21:13:03 UTC
Thanks, pushed