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.h>
# include <SDL_main.h> # include <SDL_main.h>
#if !SDL_VERSION_ATLEAST(3, 0, 0) #if !SDL_VERSION_ATLEAST(3, 0, 0)
#define __MACOS__ __MACOSX__ #define SDL_PLATFORM_MACOS __MACOSX__
#endif #endif
#endif #endif
@ -46,8 +46,8 @@
# include <sys/mman.h> # include <sys/mman.h>
#endif #endif
#if __MACOS__ #if SDL_PLATFORM_MACOS
# include "utils_macosx.h" #include "utils_macosx.h"
#endif #endif
#if !EMULATED_68K && defined(__NetBSD__) #if !EMULATED_68K && defined(__NetBSD__)
@ -571,7 +571,7 @@ int main(int argc, char **argv)
} }
atexit(SDL_Quit); 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, // 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, // except that it will also install keyboard shortcuts, such as Command + Q,
// which can interfere with keyboard shortcuts in the guest OS. // which can interfere with keyboard shortcuts in the guest OS.
@ -695,7 +695,7 @@ int main(int argc, char **argv)
ROMBaseMac = Host2MacAddr(ROMBaseHost); ROMBaseMac = Host2MacAddr(ROMBaseHost);
#endif #endif
#if __MACOS__ #if SDL_PLATFORM_MACOS
extern void set_current_directory(); extern void set_current_directory();
set_current_directory(); set_current_directory();
#endif #endif

View File

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