The resize cursors look ok on my retina display (?)
The reason for using the Webkit stuff was because the cursors weren't supported in older versions of OSX, but they may have been added since then. Would still need to be careful not to use the newer ones when backwards compatibility is important.
void* MouseCursor::createStandardMouseCursor (MouseCursor::StandardCursorType type)
{
JUCE_AUTORELEASEPOOL
{
NSCursor* c = nil;
switch (type)
{
case NormalCursor:
case ParentCursor: c = [NSCursor arrowCursor]; break;
case NoCursor: return CustomMouseCursorInfo (Image (Image::ARGB, 8, 8, true), 0, 0).create();
case DraggingHandCursor: c = [NSCursor openHandCursor]; break;
case WaitCursor: c = [NSCursor arrowCursor]; break; // avoid this on the mac, let the OS provide the beachball
case IBeamCursor: c = [NSCursor IBeamCursor]; break;
case PointingHandCursor: c = [NSCursor pointingHandCursor]; break;
case LeftEdgeResizeCursor: c = [NSCursor resizeLeftCursor]; break;
case RightEdgeResizeCursor: c = [NSCursor resizeRightCursor]; break;
case CrosshairCursor: c = [NSCursor crosshairCursor]; break;
case CopyingCursor:
{
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
if (void* m = MouseCursorHelpers::fromHIServices ("copy"))
return m;
#endif
c = [NSCursor dragCopyCursor]; // added in 10.6
break;
}
case UpDownResizeCursor:
case TopEdgeResizeCursor:
case BottomEdgeResizeCursor:
return MouseCursorHelpers::fromHIServices ("resizenorthsouth");
case LeftRightResizeCursor:
if (void* m = MouseCursorHelpers::fromHIServices ("resizeeastwest"))
return m;
c = [NSCursor resizeLeftRightCursor];
break;
case TopLeftCornerResizeCursor:
case BottomRightCornerResizeCursor:
return MouseCursorHelpers::fromHIServices ("resizenorthwestsoutheast");
case TopRightCornerResizeCursor:
case BottomLeftCornerResizeCursor:
return MouseCursorHelpers::fromHIServices ("resizenortheastsouthwest");
case UpDownLeftRightResizeCursor:
return MouseCursorHelpers::fromHIServices ("move");
default:
jassertfalse;
break;
}
[c retain];
return c;
}
}
Yes, I can confirm the problem. If you programmatically create a MouseCursor::UpDownResizeCursor in JUCE, it looks wrong on Retina displays.
Yes, I can also confirm that your code fixes the problem.
One thing I am concerned about in your code is that you actually compute the scaling of the image for 4 different scales, every time a MouseCursor is created?
Also, are you sure that this file in HIServices.framework will be present on all relevant older OSX versions?
AFAIK, cursor are shared so this doesn't happen a lot though, This is probably more CPU heavy than the current code but probably not that much as it only happen one time.
Not sure about the OSX version for HIServices but at least 10.8 AFAIK, but this can be implemented like it is done LeftRightResizeCursor in the current code with a check that it exists. My code probably misssome check if it fails.
Older OSX version won't need retina assets and this doesn't require a recent version of the Base SDK to compile so we don't lose anything with this kind of code added.
This is more a proof of concept that a direct patch to commit to Juce though.
The code you posted has a lot of problems the way it's written, but it seems to be a sensible approach - I'll refactor it and post a fix shortly, thanks!