Fix more problems with OS X mouse cursor

Don’t hide native cursor or show custom cursor if the mouse is outside
the main view.
This commit is contained in:
David Capello 2015-01-26 09:31:10 -03:00
parent 72e2040c58
commit 3745f563d0
2 changed files with 10 additions and 3 deletions

View File

@ -345,6 +345,9 @@ int osx_mouse_set_sprite(BITMAP *sprite, int x, int y)
*/
int osx_mouse_show(BITMAP *bmp, int x, int y)
{
if (!_mouse_on)
return -1;
/* Only draw on screen */
if (!is_same_bitmap(bmp, screen))
return -1;
@ -363,6 +366,9 @@ int osx_mouse_show(BITMAP *bmp, int x, int y)
*/
void osx_mouse_hide(void)
{
if (!_mouse_on)
return;
osx_change_cursor(osx_blank_cursor);
osx_using_native_cursor = FALSE;

View File

@ -258,7 +258,8 @@ void osx_event_handler()
case NSRightMouseDown:
/* App is regaining focus */
if (![NSApp isActive]) {
handle_mouse_enter();
if ([view mouse:point inRect:[view frame]])
handle_mouse_enter();
if (osx_window)
[osx_window invalidateCursorRectsForView:view];
@ -283,7 +284,7 @@ void osx_event_handler()
case NSLeftMouseUp:
case NSOtherMouseUp:
case NSRightMouseUp:
if ([NSApp isActive])
if ([NSApp isActive] && [view mouse:point inRect:[view frame]])
handle_mouse_enter();
if (_mouse_on) {
@ -327,7 +328,7 @@ void osx_event_handler()
case NSMouseEntered:
if ([event window] == osx_window &&
[event trackingNumber] == osx_mouse_tracking_rect) {
[view mouse:point inRect:[view frame]]) {
handle_mouse_enter();
if (_mouse_on) {