57 |
|
|
58 |
|
// Constants |
59 |
|
const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes"; |
60 |
+ |
static const bool hw_mac_cursor_accl = true; // Flag: Enable MacOS to X11 copy of cursor? |
61 |
|
|
62 |
|
// Global variables |
63 |
|
static int32 frame_skip; |
506 |
|
XSetState(x_display, the_gc, black_pixel, white_pixel, GXcopy, AllPlanes); |
507 |
|
|
508 |
|
// Create cursor |
509 |
< |
cursor_image = XCreateImage(x_display, vis, 1, XYPixmap, 0, (char *)MacCursor + 4, 16, 16, 16, 2); |
510 |
< |
cursor_image->byte_order = MSBFirst; |
511 |
< |
cursor_image->bitmap_bit_order = MSBFirst; |
512 |
< |
cursor_mask_image = XCreateImage(x_display, vis, 1, XYPixmap, 0, (char *)MacCursor + 36, 16, 16, 16, 2); |
513 |
< |
cursor_mask_image->byte_order = MSBFirst; |
514 |
< |
cursor_mask_image->bitmap_bit_order = MSBFirst; |
515 |
< |
cursor_map = XCreatePixmap(x_display, the_win, 16, 16, 1); |
516 |
< |
cursor_mask_map = XCreatePixmap(x_display, the_win, 16, 16, 1); |
517 |
< |
cursor_gc = XCreateGC(x_display, cursor_map, 0, 0); |
518 |
< |
cursor_mask_gc = XCreateGC(x_display, cursor_mask_map, 0, 0); |
519 |
< |
mac_cursor = XCreatePixmapCursor(x_display, cursor_map, cursor_mask_map, &black, &white, 0, 0); |
520 |
< |
cursor_changed = false; |
509 |
> |
if (hw_mac_cursor_accl) { |
510 |
> |
cursor_image = XCreateImage(x_display, vis, 1, XYPixmap, 0, (char *)MacCursor + 4, 16, 16, 16, 2); |
511 |
> |
cursor_image->byte_order = MSBFirst; |
512 |
> |
cursor_image->bitmap_bit_order = MSBFirst; |
513 |
> |
cursor_mask_image = XCreateImage(x_display, vis, 1, XYPixmap, 0, (char *)MacCursor + 36, 16, 16, 16, 2); |
514 |
> |
cursor_mask_image->byte_order = MSBFirst; |
515 |
> |
cursor_mask_image->bitmap_bit_order = MSBFirst; |
516 |
> |
cursor_map = XCreatePixmap(x_display, the_win, 16, 16, 1); |
517 |
> |
cursor_mask_map = XCreatePixmap(x_display, the_win, 16, 16, 1); |
518 |
> |
cursor_gc = XCreateGC(x_display, cursor_map, 0, 0); |
519 |
> |
cursor_mask_gc = XCreateGC(x_display, cursor_mask_map, 0, 0); |
520 |
> |
mac_cursor = XCreatePixmapCursor(x_display, cursor_map, cursor_mask_map, &black, &white, 0, 0); |
521 |
> |
cursor_changed = false; |
522 |
> |
} |
523 |
> |
|
524 |
> |
// Create no_cursor |
525 |
> |
else { |
526 |
> |
mac_cursor = XCreatePixmapCursor(x_display, |
527 |
> |
XCreatePixmap(x_display, the_win, 1, 1, 1), |
528 |
> |
XCreatePixmap(x_display, the_win, 1, 1, 1), |
529 |
> |
&black, &white, 0, 0); |
530 |
> |
XDefineCursor(x_display, the_win, mac_cursor); |
531 |
> |
} |
532 |
|
|
533 |
|
// Init blitting routines |
534 |
|
bool native_byte_order; |
1708 |
|
// And perform the inversion |
1709 |
|
const int bpp = bytes_per_pixel(ReadMacInt32(p + acclDestPixelSize)); |
1710 |
|
const int dest_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes); |
1711 |
< |
uint8 *dest = (uint8 *)(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dest_row_bytes) + (dest_X * bpp)); |
1711 |
> |
uint8 *dest = Mac2HostAddr(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dest_row_bytes) + (dest_X * bpp)); |
1712 |
|
width *= bpp; |
1713 |
|
switch (bpp) { |
1714 |
|
case 1: |
1818 |
|
// And perform the fill |
1819 |
|
const int bpp = bytes_per_pixel(ReadMacInt32(p + acclDestPixelSize)); |
1820 |
|
const int dest_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes); |
1821 |
< |
uint8 *dest = (uint8 *)(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dest_row_bytes) + (dest_X * bpp)); |
1821 |
> |
uint8 *dest = Mac2HostAddr(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dest_row_bytes) + (dest_X * bpp)); |
1822 |
|
width *= bpp; |
1823 |
|
switch (bpp) { |
1824 |
|
case 1: |
1886 |
|
if ((int32)ReadMacInt32(p + acclSrcRowBytes) > 0) { |
1887 |
|
const int src_row_bytes = (int32)ReadMacInt32(p + acclSrcRowBytes); |
1888 |
|
const int dst_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes); |
1889 |
< |
uint8 *src = (uint8 *)ReadMacInt32(p + acclSrcBaseAddr) + (src_Y * src_row_bytes) + (src_X * bpp); |
1890 |
< |
uint8 *dst = (uint8 *)ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dst_row_bytes) + (dest_X * bpp); |
1889 |
> |
uint8 *src = Mac2HostAddr(ReadMacInt32(p + acclSrcBaseAddr) + (src_Y * src_row_bytes) + (src_X * bpp)); |
1890 |
> |
uint8 *dst = Mac2HostAddr(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dst_row_bytes) + (dest_X * bpp)); |
1891 |
|
for (int i = 0; i < height; i++) { |
1892 |
< |
memcpy(dst, src, width); |
1892 |
> |
memmove(dst, src, width); |
1893 |
|
src += src_row_bytes; |
1894 |
|
dst += dst_row_bytes; |
1895 |
|
} |
1897 |
|
else { |
1898 |
|
const int src_row_bytes = -(int32)ReadMacInt32(p + acclSrcRowBytes); |
1899 |
|
const int dst_row_bytes = -(int32)ReadMacInt32(p + acclDestRowBytes); |
1900 |
< |
uint8 *src = (uint8 *)ReadMacInt32(p + acclSrcBaseAddr) + ((src_Y + height - 1) * src_row_bytes) + (src_X * bpp); |
1901 |
< |
uint8 *dst = (uint8 *)ReadMacInt32(p + acclDestBaseAddr) + ((dest_Y + height - 1) * dst_row_bytes) + (dest_X * bpp); |
1900 |
> |
uint8 *src = Mac2HostAddr(ReadMacInt32(p + acclSrcBaseAddr) + ((src_Y + height - 1) * src_row_bytes) + (src_X * bpp)); |
1901 |
> |
uint8 *dst = Mac2HostAddr(ReadMacInt32(p + acclDestBaseAddr) + ((dest_Y + height - 1) * dst_row_bytes) + (dest_X * bpp)); |
1902 |
|
for (int i = height - 1; i >= 0; i--) { |
1903 |
< |
memcpy(dst, src, width); |
1903 |
> |
memmove(dst, src, width); |
1904 |
|
src -= src_row_bytes; |
1905 |
|
dst -= dst_row_bytes; |
1906 |
|
} |
2087 |
|
|
2088 |
|
|
2089 |
|
/* |
2090 |
+ |
* Can we set the MacOS cursor image into the window? |
2091 |
+ |
*/ |
2092 |
+ |
|
2093 |
+ |
bool video_can_change_cursor(void) |
2094 |
+ |
{ |
2095 |
+ |
return hw_mac_cursor_accl && (display_type != DIS_SCREEN); |
2096 |
+ |
} |
2097 |
+ |
|
2098 |
+ |
|
2099 |
+ |
/* |
2100 |
|
* Set cursor image for window |
2101 |
|
*/ |
2102 |
|
|
2341 |
|
update_display(); |
2342 |
|
|
2343 |
|
// Set new cursor image if it was changed |
2344 |
< |
if (cursor_changed) { |
2344 |
> |
if (hw_mac_cursor_accl && cursor_changed) { |
2345 |
|
cursor_changed = false; |
2346 |
|
memcpy(cursor_image->data, MacCursor + 4, 32); |
2347 |
|
memcpy(cursor_mask_image->data, MacCursor + 36, 32); |