Merge branch '1.0'

This commit is contained in:
David Capello 2015-01-26 10:58:56 -03:00
commit b57445c2b1
3 changed files with 36 additions and 24 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

@ -121,28 +121,33 @@ static void prepare_window_for_animation(int refresh_view)
int pitch, y, x;
_unix_lock_mutex(osx_window_mutex);
while (![qd_view lockFocusIfCanDraw]);
while (!QDDone([qd_view qdPort]));
LockPortBits([qd_view qdPort]);
pitch = GetPixRowBytes(GetPortPixMap([qd_view qdPort])) / 4;
addr = (unsigned int *)GetPixBaseAddr(GetPortPixMap([qd_view qdPort])) +
((int)([osx_window frame].size.height) - gfx_quartz_window.h) * pitch;
if (refresh_view && colorconv_blitter) {
src_gfx_rect.width = gfx_quartz_window.w;
src_gfx_rect.height = gfx_quartz_window.h;
src_gfx_rect.pitch = pseudo_screen_pitch;
src_gfx_rect.data = pseudo_screen_addr;
dest_gfx_rect.pitch = pitch * 4;
dest_gfx_rect.data = addr;
colorconv_blitter(&src_gfx_rect, &dest_gfx_rect);
if ([qd_view lockFocusIfCanDraw] == YES) {
while (!QDDone([qd_view qdPort]));
LockPortBits([qd_view qdPort]);
pitch = GetPixRowBytes(GetPortPixMap([qd_view qdPort])) / 4;
addr = (unsigned int *)GetPixBaseAddr(GetPortPixMap([qd_view qdPort])) +
((int)([osx_window frame].size.height) - gfx_quartz_window.h) * pitch;
if (refresh_view && colorconv_blitter) {
src_gfx_rect.width = gfx_quartz_window.w;
src_gfx_rect.height = gfx_quartz_window.h;
src_gfx_rect.pitch = pseudo_screen_pitch;
src_gfx_rect.data = pseudo_screen_addr;
dest_gfx_rect.pitch = pitch * 4;
dest_gfx_rect.data = addr;
colorconv_blitter(&src_gfx_rect, &dest_gfx_rect);
}
for (y = gfx_quartz_window.h; y; y--) {
for (x = 0; x < gfx_quartz_window.w; x++)
*(addr + x) |= 0xff000000;
addr += pitch;
}
QDFlushPortBuffer([qd_view qdPort], update_region);
UnlockPortBits([qd_view qdPort]);
[qd_view unlockFocus];
}
for (y = gfx_quartz_window.h; y; y--) {
for (x = 0; x < gfx_quartz_window.w; x++)
*(addr + x) |= 0xff000000;
addr += pitch;
}
UnlockPortBits([qd_view qdPort]);
[qd_view unlockFocus];
_unix_unlock_mutex(osx_window_mutex);
}

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) {