mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-26 16:31:11 +00:00
Disable MacOS -> X11 copying of cursor in windowed mode too. You can
recompile with "mac_cursor_enabled" constant set to true. Disabling it causes a better looking cursor that is not "disappearing" sometimes with e.g. Microsoft Internet Explorer.
This commit is contained in:
parent
21607e19ad
commit
6c0e2a9f2a
@ -758,6 +758,16 @@ void video_set_palette(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Can we set the MacOS cursor image into the window?
|
||||
*/
|
||||
|
||||
bool video_can_change_cursor(void)
|
||||
{
|
||||
return (display_type != DIS_SCREEN);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set cursor image for window
|
||||
*/
|
||||
|
@ -57,6 +57,7 @@ using std::sort;
|
||||
|
||||
// Constants
|
||||
const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes";
|
||||
static const bool mac_cursor_enabled = false; // Flag: Enable MacOS to X11 copy of cursor?
|
||||
|
||||
// Global variables
|
||||
static int32 frame_skip;
|
||||
@ -505,18 +506,29 @@ static bool open_window(int width, int height)
|
||||
XSetState(x_display, the_gc, black_pixel, white_pixel, GXcopy, AllPlanes);
|
||||
|
||||
// Create cursor
|
||||
cursor_image = XCreateImage(x_display, vis, 1, XYPixmap, 0, (char *)MacCursor + 4, 16, 16, 16, 2);
|
||||
cursor_image->byte_order = MSBFirst;
|
||||
cursor_image->bitmap_bit_order = MSBFirst;
|
||||
cursor_mask_image = XCreateImage(x_display, vis, 1, XYPixmap, 0, (char *)MacCursor + 36, 16, 16, 16, 2);
|
||||
cursor_mask_image->byte_order = MSBFirst;
|
||||
cursor_mask_image->bitmap_bit_order = MSBFirst;
|
||||
cursor_map = XCreatePixmap(x_display, the_win, 16, 16, 1);
|
||||
cursor_mask_map = XCreatePixmap(x_display, the_win, 16, 16, 1);
|
||||
cursor_gc = XCreateGC(x_display, cursor_map, 0, 0);
|
||||
cursor_mask_gc = XCreateGC(x_display, cursor_mask_map, 0, 0);
|
||||
mac_cursor = XCreatePixmapCursor(x_display, cursor_map, cursor_mask_map, &black, &white, 0, 0);
|
||||
cursor_changed = false;
|
||||
if (mac_cursor_enabled) {
|
||||
cursor_image = XCreateImage(x_display, vis, 1, XYPixmap, 0, (char *)MacCursor + 4, 16, 16, 16, 2);
|
||||
cursor_image->byte_order = MSBFirst;
|
||||
cursor_image->bitmap_bit_order = MSBFirst;
|
||||
cursor_mask_image = XCreateImage(x_display, vis, 1, XYPixmap, 0, (char *)MacCursor + 36, 16, 16, 16, 2);
|
||||
cursor_mask_image->byte_order = MSBFirst;
|
||||
cursor_mask_image->bitmap_bit_order = MSBFirst;
|
||||
cursor_map = XCreatePixmap(x_display, the_win, 16, 16, 1);
|
||||
cursor_mask_map = XCreatePixmap(x_display, the_win, 16, 16, 1);
|
||||
cursor_gc = XCreateGC(x_display, cursor_map, 0, 0);
|
||||
cursor_mask_gc = XCreateGC(x_display, cursor_mask_map, 0, 0);
|
||||
mac_cursor = XCreatePixmapCursor(x_display, cursor_map, cursor_mask_map, &black, &white, 0, 0);
|
||||
cursor_changed = false;
|
||||
}
|
||||
|
||||
// Create no_cursor
|
||||
else {
|
||||
mac_cursor = XCreatePixmapCursor(x_display,
|
||||
XCreatePixmap(x_display, the_win, 1, 1, 1),
|
||||
XCreatePixmap(x_display, the_win, 1, 1, 1),
|
||||
&black, &white, 0, 0);
|
||||
XDefineCursor(x_display, the_win, mac_cursor);
|
||||
}
|
||||
|
||||
// Init blitting routines
|
||||
bool native_byte_order;
|
||||
@ -2074,6 +2086,16 @@ void video_set_palette(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Can we set the MacOS cursor image into the window?
|
||||
*/
|
||||
|
||||
bool video_can_change_cursor(void)
|
||||
{
|
||||
return mac_cursor_enabled && (display_type != DIS_SCREEN);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set cursor image for window
|
||||
*/
|
||||
@ -2319,7 +2341,7 @@ static void *redraw_func(void *arg)
|
||||
update_display();
|
||||
|
||||
// Set new cursor image if it was changed
|
||||
if (cursor_changed) {
|
||||
if (mac_cursor_enabled && cursor_changed) {
|
||||
cursor_changed = false;
|
||||
memcpy(cursor_image->data, MacCursor + 4, 32);
|
||||
memcpy(cursor_mask_image->data, MacCursor + 36, 32);
|
||||
|
@ -138,6 +138,7 @@ extern void VideoQuitFullScreen(void);
|
||||
|
||||
extern void video_set_palette(void);
|
||||
extern void video_set_cursor(void);
|
||||
extern bool video_can_change_cursor(void);
|
||||
extern int16 video_mode_change(VidLocals *csSave, uint32 ParamPtr);
|
||||
|
||||
extern int16 VSLDoInterruptService(uint32 arg1);
|
||||
|
@ -448,7 +448,7 @@ static int16 VideoControl(uint32 pb, VidLocals *csSave)
|
||||
MacCursor[3] = ReadMacInt8(0x887);
|
||||
|
||||
// Set new cursor image
|
||||
if (display_type == DIS_SCREEN)
|
||||
if (!video_can_change_cursor())
|
||||
return controlErr;
|
||||
if (changed)
|
||||
video_set_cursor();
|
||||
|
Loading…
x
Reference in New Issue
Block a user