mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-25 02:29:49 +00:00
fixed issue #31, "on multi-monitor OS X host: cursor can get locked to fullscreen display for guest OS"
This commit is contained in:
parent
7a36983f11
commit
573ffee8b1
@ -56,3 +56,8 @@ bool is_fullscreen_osx(SDL_Window * window)
|
|||||||
const NSWindowStyleMask styleMask = [wmInfo.info.cocoa.window styleMask];
|
const NSWindowStyleMask styleMask = [wmInfo.info.cocoa.window styleMask];
|
||||||
return (styleMask & NSWindowStyleMaskFullScreen) != 0;
|
return (styleMask & NSWindowStyleMaskFullScreen) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_menu_bar_visible_osx(bool visible)
|
||||||
|
{
|
||||||
|
[NSMenu setMenuBarVisible:(visible ? YES : NO)];
|
||||||
|
}
|
||||||
|
@ -1062,7 +1062,7 @@ void driver_base::toggle_mouse_grab(void)
|
|||||||
|
|
||||||
static void update_mouse_grab()
|
static void update_mouse_grab()
|
||||||
{
|
{
|
||||||
if (mouse_grabbed || is_fullscreen(sdl_window)) {
|
if (mouse_grabbed) {
|
||||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||||
} else {
|
} else {
|
||||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||||
@ -2015,14 +2015,16 @@ static int SDLCALL on_sdl_event_generated(void *userdata, SDL_Event * event)
|
|||||||
if (adjust_fullscreen) {
|
if (adjust_fullscreen) {
|
||||||
do_toggle_fullscreen();
|
do_toggle_fullscreen();
|
||||||
|
|
||||||
// Utilizing SDL2's 'relative mouse mode', when in fullscreen,
|
#if __MACOSX__
|
||||||
// fixes an issue on OSX hosts whereby a fullscreen window
|
// HACK-FIX: on OSX hosts, make sure that the OSX menu
|
||||||
// can, in some cases, be dragged around.
|
// bar does not show up in fullscreen mode, when the
|
||||||
// ( https://github.com/DavidLudwig/macemu/issues/19 )
|
// cursor is near the top of the screen, lest the
|
||||||
//
|
// guest OS' menu bar be obscured.
|
||||||
// Calling update_mouse_grab() will lead to SDL_SetRelativeMouseMode()
|
if (is_full) {
|
||||||
// being called, as appropriate.
|
extern void set_menu_bar_visible_osx(bool);
|
||||||
update_mouse_grab();
|
set_menu_bar_visible_osx(false);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user