Skip to content

Commit

Permalink
Update for SDL3
Browse files Browse the repository at this point in the history
  • Loading branch information
kanjitalk755 committed Nov 26, 2023
1 parent 1930813 commit 3d49e97
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
13 changes: 5 additions & 8 deletions BasiliskII/src/MacOSX/utils_macosx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,16 @@ bool is_fullscreen_osx(SDL_Window * window)
return false;
}

SDL_SysWMinfo wmInfo;
#if SDL_VERSION_ATLEAST(3, 0, 0)
if (!SDL_GetWindowWMInfo(window, &wmInfo, SDL_SYSWM_CURRENT_VERSION)) {
return false;
}
SDL_PropertiesID props = SDL_GetWindowProperties(window);
NSWindow *nswindow = (NSWindow *)SDL_GetProperty(props, "SDL.window.cocoa.window", NULL);
#else
SDL_SysWMinfo wmInfo;
SDL_VERSION(&wmInfo.version);
if (!SDL_GetWindowWMInfo(window, &wmInfo)) {
return false;
}
NSWindow *nswindow = SDL_GetWindowWMInfo(window, &wmInfo) ? wmInfo.info.cocoa.window : nil;
#endif

const NSWindowStyleMask styleMask = [wmInfo.info.cocoa.window styleMask];
const NSWindowStyleMask styleMask = [nswindow styleMask];
return (styleMask & NSWindowStyleMaskFullScreen) != 0;
}
#endif
Expand Down
3 changes: 1 addition & 2 deletions BasiliskII/src/SDL/video_sdl3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2394,8 +2394,7 @@ static void handle_events(void)
break;

case SDL_EVENT_DROP_FILE:
CDROMDrop(event.drop.file);
SDL_free(event.drop.file);
CDROMDrop(event.drop.data);
break;

// Window "close" widget clicked
Expand Down
10 changes: 7 additions & 3 deletions SheepShaver/src/Unix/main_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,17 +719,21 @@ static bool init_sdl()
atexit(SDL_Quit);

#if SDL_VERSION_ATLEAST(2, 0, 0)
#if !SDL_VERSION_ATLEAST(3, 0, 0)
#define SDL_EVENT_DROP_FILE SDL_DROPFILE
#endif
const int SDL_EVENT_TIMEOUT = 100;
for (int i = 0; i < SDL_EVENT_TIMEOUT; i++) {
SDL_Event event;
SDL_PollEvent(&event);
#if SDL_VERSION_ATLEAST(3, 0, 0)
if (event.type == SDL_EVENT_DROP_FILE) {
sdl_vmdir = event.drop.data;
break;
}
#else
if (event.type == SDL_DROPFILE) {
sdl_vmdir = event.drop.file;
break;
}
#endif
SDL_Delay(1);
}
#endif
Expand Down

0 comments on commit 3d49e97

Please sign in to comment.