136 |
|
static volatile bool cursor_changed = false; // Flag: cursor changed, redraw_func must update the cursor |
137 |
|
static SDL_Color sdl_palette[256]; // Color palette to be used as CLUT and gamma table |
138 |
|
static bool sdl_palette_changed = false; // Flag: Palette changed, redraw thread must set new colors |
139 |
< |
static const int sdl_eventmask = SDL_MOUSEBUTTONDOWNMASK | SDL_MOUSEBUTTONUPMASK | SDL_MOUSEMOTIONMASK | SDL_KEYUPMASK | SDL_KEYDOWNMASK | SDL_VIDEOEXPOSEMASK | SDL_QUITMASK; |
139 |
> |
static const int sdl_eventmask = SDL_MOUSEEVENTMASK | SDL_KEYEVENTMASK | SDL_VIDEOEXPOSEMASK | SDL_QUITMASK | SDL_ACTIVEEVENTMASK; |
140 |
|
|
141 |
|
// Mutex to protect SDL events |
142 |
|
static SDL_mutex *sdl_events_lock = NULL; |
1543 |
|
#ifdef SHEEPSHAVER |
1544 |
|
bool video_can_change_cursor(void) |
1545 |
|
{ |
1546 |
< |
return (display_type == DISPLAY_WINDOW); |
1546 |
> |
static char driver[] = "Quartz?"; |
1547 |
> |
static int quartzok = -1; |
1548 |
> |
|
1549 |
> |
if (display_type != DISPLAY_WINDOW) |
1550 |
> |
return false; |
1551 |
> |
|
1552 |
> |
if (quartzok < 0) { |
1553 |
> |
if (SDL_VideoDriverName(driver, sizeof driver) == NULL || strncmp(driver, "Quartz", sizeof driver)) |
1554 |
> |
quartzok = true; |
1555 |
> |
else { |
1556 |
> |
// Quartz driver bug prevents cursor changing in SDL 1.2.11 and later |
1557 |
> |
const SDL_version *vp = SDL_Linked_Version(); |
1558 |
> |
quartzok = SDL_VERSIONNUM(vp->major, vp->minor, vp->patch) <= SDL_VERSIONNUM(1, 2, 10); |
1559 |
> |
} |
1560 |
> |
} |
1561 |
> |
|
1562 |
> |
return quartzok; |
1563 |
|
} |
1564 |
|
#endif |
1565 |
|
|
1770 |
|
// Mouse button |
1771 |
|
case SDL_MOUSEBUTTONDOWN: { |
1772 |
|
unsigned int button = event.button.button; |
1773 |
< |
if (button < 4) |
1774 |
< |
ADBMouseDown(button - 1); |
1773 |
> |
if (button == SDL_BUTTON_LEFT) |
1774 |
> |
ADBMouseDown(0); |
1775 |
> |
else if (button == SDL_BUTTON_RIGHT) |
1776 |
> |
ADBMouseDown(1); |
1777 |
> |
else if (button == SDL_BUTTON_MIDDLE) |
1778 |
> |
ADBMouseDown(2); |
1779 |
|
else if (button < 6) { // Wheel mouse |
1780 |
|
if (mouse_wheel_mode == 0) { |
1781 |
|
int key = (button == 5) ? 0x79 : 0x74; // Page up/down |
1793 |
|
} |
1794 |
|
case SDL_MOUSEBUTTONUP: { |
1795 |
|
unsigned int button = event.button.button; |
1796 |
< |
if (button < 4) |
1797 |
< |
ADBMouseUp(button - 1); |
1796 |
> |
if (button == SDL_BUTTON_LEFT) |
1797 |
> |
ADBMouseUp(0); |
1798 |
> |
else if (button == SDL_BUTTON_RIGHT) |
1799 |
> |
ADBMouseUp(1); |
1800 |
> |
else if (button == SDL_BUTTON_MIDDLE) |
1801 |
> |
ADBMouseUp(2); |
1802 |
|
break; |
1803 |
|
} |
1804 |
|
|
1882 |
|
ADBKeyDown(0x7f); // Power key |
1883 |
|
ADBKeyUp(0x7f); |
1884 |
|
break; |
1885 |
+ |
|
1886 |
+ |
// Application activate/deactivate; consume the event but otherwise ignore it |
1887 |
+ |
case SDL_ACTIVEEVENT: |
1888 |
+ |
break; |
1889 |
|
} |
1890 |
|
} |
1891 |
|
} |
2244 |
|
SDL_FreeCursor(sdl_cursor); |
2245 |
|
sdl_cursor = SDL_CreateCursor(MacCursor + 4, MacCursor + 36, 16, 16, MacCursor[2], MacCursor[3]); |
2246 |
|
if (sdl_cursor) { |
2247 |
+ |
SDL_ShowCursor(private_data == NULL || private_data->cursorVisible); |
2248 |
|
SDL_SetCursor(sdl_cursor); |
2249 |
|
#ifdef WIN32 |
2250 |
|
// XXX Windows apparently needs an extra mouse event to |