mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-24 10:32:32 +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];
|
||||
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()
|
||||
{
|
||||
if (mouse_grabbed || is_fullscreen(sdl_window)) {
|
||||
if (mouse_grabbed) {
|
||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
} else {
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
@ -2015,14 +2015,16 @@ static int SDLCALL on_sdl_event_generated(void *userdata, SDL_Event * event)
|
||||
if (adjust_fullscreen) {
|
||||
do_toggle_fullscreen();
|
||||
|
||||
// Utilizing SDL2's 'relative mouse mode', when in fullscreen,
|
||||
// fixes an issue on OSX hosts whereby a fullscreen window
|
||||
// can, in some cases, be dragged around.
|
||||
// ( https://github.com/DavidLudwig/macemu/issues/19 )
|
||||
//
|
||||
// Calling update_mouse_grab() will lead to SDL_SetRelativeMouseMode()
|
||||
// being called, as appropriate.
|
||||
update_mouse_grab();
|
||||
#if __MACOSX__
|
||||
// HACK-FIX: on OSX hosts, make sure that the OSX menu
|
||||
// bar does not show up in fullscreen mode, when the
|
||||
// cursor is near the top of the screen, lest the
|
||||
// guest OS' menu bar be obscured.
|
||||
if (is_full) {
|
||||
extern void set_menu_bar_visible_osx(bool);
|
||||
set_menu_bar_visible_osx(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user