Keep existing cursor type if requested type fails
This commit is contained in:
parent
f4844c11f8
commit
b29cb44fad
@ -89,27 +89,23 @@ bool CursorImpl::loadFromPixels(const Uint8* pixels, Vector2u size, Vector2u hot
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool CursorImpl::loadFromSystem(Cursor::Type type)
|
bool CursorImpl::loadFromSystem(Cursor::Type type)
|
||||||
{
|
{
|
||||||
if (m_cursor)
|
NSCursor* newCursor = nil;
|
||||||
{
|
|
||||||
[m_cursor release];
|
|
||||||
m_cursor = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
default: return false;
|
default: return false;
|
||||||
|
|
||||||
case Cursor::Arrow: m_cursor = [NSCursor arrowCursor]; break;
|
case Cursor::Arrow: newCursor = [NSCursor arrowCursor]; break;
|
||||||
case Cursor::Text: m_cursor = [NSCursor IBeamCursor]; break;
|
case Cursor::Text: newCursor = [NSCursor IBeamCursor]; break;
|
||||||
case Cursor::Hand: m_cursor = [NSCursor pointingHandCursor]; break;
|
case Cursor::Hand: newCursor = [NSCursor pointingHandCursor]; break;
|
||||||
case Cursor::SizeHorizontal: m_cursor = [NSCursor resizeLeftRightCursor]; break;
|
case Cursor::SizeHorizontal: newCursor = [NSCursor resizeLeftRightCursor]; break;
|
||||||
case Cursor::SizeVertical: m_cursor = [NSCursor resizeUpDownCursor]; break;
|
case Cursor::SizeVertical: newCursor = [NSCursor resizeUpDownCursor]; break;
|
||||||
case Cursor::Cross: m_cursor = [NSCursor crosshairCursor]; break;
|
case Cursor::Cross: newCursor = [NSCursor crosshairCursor]; break;
|
||||||
case Cursor::NotAllowed: m_cursor = [NSCursor operationNotAllowedCursor]; break;
|
case Cursor::NotAllowed: newCursor = [NSCursor operationNotAllowedCursor]; break;
|
||||||
case Cursor::SizeLeft: m_cursor = [NSCursor resizeLeftRightCursor]; break;
|
case Cursor::SizeLeft: newCursor = [NSCursor resizeLeftRightCursor]; break;
|
||||||
case Cursor::SizeRight: m_cursor = [NSCursor resizeLeftRightCursor]; break;
|
case Cursor::SizeRight: newCursor = [NSCursor resizeLeftRightCursor]; break;
|
||||||
case Cursor::SizeTop: m_cursor = [NSCursor resizeUpDownCursor]; break;
|
case Cursor::SizeTop: newCursor = [NSCursor resizeUpDownCursor]; break;
|
||||||
case Cursor::SizeBottom: m_cursor = [NSCursor resizeUpDownCursor]; break;
|
case Cursor::SizeBottom: newCursor = [NSCursor resizeUpDownCursor]; break;
|
||||||
|
|
||||||
// These cursor types are undocumented, may not be available on some platforms
|
// These cursor types are undocumented, may not be available on some platforms
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
@ -117,25 +113,29 @@ bool CursorImpl::loadFromSystem(Cursor::Type type)
|
|||||||
case Cursor::SizeTopRight:
|
case Cursor::SizeTopRight:
|
||||||
case Cursor::SizeBottomLeft:
|
case Cursor::SizeBottomLeft:
|
||||||
case Cursor::SizeBottomLeftTopRight:
|
case Cursor::SizeBottomLeftTopRight:
|
||||||
m_cursor = loadFromSelector(@selector(_windowResizeNorthEastSouthWestCursor));
|
newCursor = loadFromSelector(@selector(_windowResizeNorthEastSouthWestCursor));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Cursor::SizeTopLeft:
|
case Cursor::SizeTopLeft:
|
||||||
case Cursor::SizeBottomRight:
|
case Cursor::SizeBottomRight:
|
||||||
case Cursor::SizeTopLeftBottomRight:
|
case Cursor::SizeTopLeftBottomRight:
|
||||||
m_cursor = loadFromSelector(@selector(_windowResizeNorthWestSouthEastCursor));
|
newCursor = loadFromSelector(@selector(_windowResizeNorthWestSouthEastCursor));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Cursor::Help:
|
case Cursor::Help:
|
||||||
m_cursor = loadFromSelector(@selector(_helpCursor));
|
newCursor = loadFromSelector(@selector(_helpCursor));
|
||||||
break;
|
break;
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_cursor)
|
if (newCursor)
|
||||||
|
{
|
||||||
|
[m_cursor release];
|
||||||
|
m_cursor = newCursor;
|
||||||
[m_cursor retain];
|
[m_cursor retain];
|
||||||
|
}
|
||||||
|
|
||||||
return m_cursor != nil;
|
return newCursor != nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user