Fix for SDL3 3.1.2 Preview (addition)

This commit is contained in:
kanjitalk755 2024-05-26 12:25:13 +09:00
parent 5d84c6d0fc
commit 4b6beeca17
2 changed files with 14 additions and 11 deletions

View File

@ -30,7 +30,7 @@
# include <SDL.h>
# include <SDL_main.h>
#if !SDL_VERSION_ATLEAST(3, 0, 0)
#define __MACOS__ __MACOSX__
#define SDL_PLATFORM_MACOS __MACOSX__
#endif
#endif
@ -46,8 +46,8 @@
# include <sys/mman.h>
#endif
#if __MACOS__
# include "utils_macosx.h"
#if SDL_PLATFORM_MACOS
#include "utils_macosx.h"
#endif
#if !EMULATED_68K && defined(__NetBSD__)
@ -571,7 +571,7 @@ int main(int argc, char **argv)
}
atexit(SDL_Quit);
#if __MACOS__ && SDL_VERSION_ATLEAST(2,0,0)
#if SDL_PLATFORM_MACOS && SDL_VERSION_ATLEAST(2,0,0)
// On Mac OS X hosts, SDL2 will create its own menu bar. This is mostly OK,
// except that it will also install keyboard shortcuts, such as Command + Q,
// which can interfere with keyboard shortcuts in the guest OS.
@ -695,7 +695,7 @@ int main(int argc, char **argv)
ROMBaseMac = Host2MacAddr(ROMBaseHost);
#endif
#if __MACOS__
#if SDL_PLATFORM_MACOS
extern void set_current_directory();
set_current_directory();
#endif

View File

@ -125,12 +125,19 @@
#ifdef USE_SDL
#include <SDL.h>
#if !SDL_VERSION_ATLEAST(3, 0, 0)
#define SDL_PLATFORM_MACOS __MACOSX__
#endif
#endif
#ifndef USE_SDL_VIDEO
#include <X11/Xlib.h>
#endif
#if SDL_PLATFORM_MACOS
#include "utils_macosx.h"
#endif
#ifdef ENABLE_GTK
#include <gtk/gtk.h>
#if !defined(GDK_WINDOWING_QUARTZ) && !defined(GDK_WINDOWING_WAYLAND)
@ -773,8 +780,7 @@ int main(int argc, char **argv)
#endif
#endif
#if __MACOSX__
extern void set_current_directory();
#if SDL_PLATFORM_MACOS
set_current_directory();
#endif
@ -864,17 +870,14 @@ int main(int argc, char **argv)
// Read preferences
PrefsInit(vmdir, argc, argv);
#ifdef __MACOSX__
#if SDL_VERSION_ATLEAST(2,0,0)
#if SDL_PLATFORM_MACOS && SDL_VERSION_ATLEAST(2,0,0)
// On Mac OS X hosts, SDL2 will create its own menu bar. This is mostly OK,
// except that it will also install keyboard shortcuts, such as Command + Q,
// which can interfere with keyboard shortcuts in the guest OS.
//
// HACK: disable these shortcuts, while leaving all other pieces of SDL2's
// menu bar in-place.
extern void disable_SDL2_macosx_menu_bar_keyboard_shortcuts();
disable_SDL2_macosx_menu_bar_keyboard_shortcuts();
#endif
#endif
// Any command line arguments left?