We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 240 - System cursor always 16 x 16 pixels?
Summary: System cursor always 16 x 16 pixels?
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 1.2.9
Hardware: PowerPC Mac OS X (All)
: P2 normal
Assignee: Christian Walther
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-25 14:42 UTC by Jakob Frandsen
Modified: 2006-06-24 14:10 UTC (History)
1 user (show)

See Also:


Attachments
patch (4.81 KB, patch)
2006-06-24 11:16 UTC, Christian Walther
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakob Frandsen 2006-05-25 14:42:46 UTC
I've developed an application that makes use of changing hardware cursors/system pointers.  The program works fine under Windows and Linux and I was porting it to Mac OS X when I stumbled into this problem.

I was using 32x32 pixels cursors, as per this code:

http://docs.mandragor.org/files/Common_libs_documentation/SDL/SDL_Documentation_project_en/sdlcreatecursor.html

which as I mentioned works fine under Windows and Linux, but under Mac OS X, the cursor is corrupted and refuses (I found out after much experimenting) to be larger than 16x16 pixels.
Comment 1 Christian Walther 2006-06-20 04:59:34 UTC
You're right - the QuickDraw calls that are used in the current implementation of SDL_SetCursor() only support 16x16 cursors. This should be reimplemented in Cocoa (like all the other uses of QuickDraw, which is deprecated in 10.4).

I may or may not have time to code up a fix in the next two weeks.
Comment 2 Christian Walther 2006-06-24 11:16:11 UTC
Created attachment 141 [details]
patch

OK, here's a patch that replaces the QuickDraw implementation of SDL_CreateCursor() and companions with a Cocoa implementation (interestingly, there doesn't seem to be a modern Carbon way of achieving this).

Tested on 10.4.6 (PPC), 10.3.9, and 10.2.8 using the 'testcursor' example (to which I added a third test cursor).

On 10.2, cursors must be 16x16, therefore bigger cursors are scaled down. In that case, for some reason that I didn't investigate any further, they flicker when held over the SDL window.

On 10.3 and later, bigger cursors work now (up to 64x64, I believe).

One feature that gets lost in the translation is that pixels with value 1 (black) and mask 0 (transparent) would invert the background color. In accordance with the spec (http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fCreateCursor), they now simply appear black. This feature is an artifact of the way cursor drawing was done in QuickDraw days and can't be reproduced using Cocoa's alpha-blended cursors.
Comment 3 Sam Lantinga 2006-06-24 13:36:20 UTC
Do all cursors flicker on 10.2, or just the scaled ones?
Comment 4 Sam Lantinga 2006-06-24 13:36:48 UTC
Your patch is in subversion, thanks!
Comment 5 Christian Walther 2006-06-24 14:10:19 UTC
(In reply to comment #3)
> Do all cursors flicker on 10.2, or just the scaled ones?

Just the scaled ones. It may have something to do with them having semi-transparent pixels (in contrast to the non-scaled ones that only have completely transparent and completely opaque pixels). Maybe this takes cursor rendering from hardware to software on the Wallstreet powerbook I was testing it on.

And as I mentioned, it only flickers if the cursor is above the SDL window, not on other parts of the screen.