Return false if the native cursor cannot be change on SkiaWindow::setNativeMouseCursor

This commit is contained in:
David Capello 2015-10-14 19:31:38 -03:00
parent 0900019b1e
commit 8cba37e36b
6 changed files with 13 additions and 10 deletions

View File

@ -47,7 +47,7 @@ public:
- (gfx::Size)clientSize; - (gfx::Size)clientSize;
- (gfx::Size)restoredSize; - (gfx::Size)restoredSize;
- (void)setMousePosition:(const gfx::Point&)position; - (void)setMousePosition:(const gfx::Point&)position;
- (void)setNativeMouseCursor:(she::NativeCursor)cursor; - (BOOL)setNativeMouseCursor:(she::NativeCursor)cursor;
@end @end
#endif #endif

View File

@ -104,7 +104,7 @@ using namespace she;
CFRelease(event); CFRelease(event);
} }
- (void)setNativeMouseCursor:(NativeCursor)cursor - (BOOL)setNativeMouseCursor:(NativeCursor)cursor
{ {
NSCursor* nsCursor = nil; NSCursor* nsCursor = nil;
@ -154,6 +154,7 @@ using namespace she;
} }
[self.contentView setCursor:nsCursor]; [self.contentView setCursor:nsCursor];
return (nsCursor != nil ? YES: NO);
} }
@end @end

View File

@ -122,8 +122,7 @@ NativeCursor SkiaDisplay::nativeMouseCursor()
bool SkiaDisplay::setNativeMouseCursor(NativeCursor cursor) bool SkiaDisplay::setNativeMouseCursor(NativeCursor cursor)
{ {
m_nativeCursor = cursor; m_nativeCursor = cursor;
m_window.setNativeMouseCursor(cursor); return m_window.setNativeMouseCursor(cursor);
return true;
} }
void SkiaDisplay::setMousePosition(const gfx::Point& position) void SkiaDisplay::setMousePosition(const gfx::Point& position)

View File

@ -37,7 +37,7 @@ public:
void captureMouse(); void captureMouse();
void releaseMouse(); void releaseMouse();
void setMousePosition(const gfx::Point& position); void setMousePosition(const gfx::Point& position);
void setNativeMouseCursor(NativeCursor cursor); bool setNativeMouseCursor(NativeCursor cursor);
void updateWindow(const gfx::Rect& bounds); void updateWindow(const gfx::Rect& bounds);
void* handle(); void* handle();

View File

@ -94,8 +94,8 @@ public:
[m_window setMousePosition:position]; [m_window setMousePosition:position];
} }
void setNativeMouseCursor(NativeCursor cursor) { bool setNativeMouseCursor(NativeCursor cursor) {
[m_window setNativeMouseCursor:cursor]; return ([m_window setNativeMouseCursor:cursor] ? true: false);
} }
void updateWindow(const gfx::Rect& bounds) { void updateWindow(const gfx::Rect& bounds) {
@ -378,10 +378,12 @@ void SkiaWindow::setMousePosition(const gfx::Point& position)
m_impl->setMousePosition(position); m_impl->setMousePosition(position);
} }
void SkiaWindow::setNativeMouseCursor(NativeCursor cursor) bool SkiaWindow::setNativeMouseCursor(NativeCursor cursor)
{ {
if (m_impl) if (m_impl)
m_impl->setNativeMouseCursor(cursor); return m_impl->setNativeMouseCursor(cursor);
else
return false;
} }
void SkiaWindow::updateWindow(const gfx::Rect& bounds) void SkiaWindow::updateWindow(const gfx::Rect& bounds)

View File

@ -100,7 +100,7 @@ namespace she {
SetCursorPos(pos.x, pos.y); SetCursorPos(pos.x, pos.y);
} }
void setNativeMouseCursor(NativeCursor cursor) { bool setNativeMouseCursor(NativeCursor cursor) {
HCURSOR hcursor = NULL; HCURSOR hcursor = NULL;
switch (cursor) { switch (cursor) {
@ -150,6 +150,7 @@ namespace she {
SetCursor(hcursor); SetCursor(hcursor);
m_hcursor = hcursor; m_hcursor = hcursor;
return (m_hcursor ? true: false);
} }
void updateWindow(const gfx::Rect& bounds) { void updateWindow(const gfx::Rect& bounds) {