Skip to content

Commit

Permalink
Untangle SDL_WINDOWEVENT
Browse files Browse the repository at this point in the history
  • Loading branch information
Spodi committed Dec 15, 2024
1 parent 33c97e7 commit ba56a97
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/graphic/Fast3D/gfx_sdl2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,17 @@ static void gfx_sdl_handle_single_event(SDL_Event& event) {
break;
#endif
case SDL_WINDOWEVENT:
if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
SDL_GL_GetDrawableSize(wnd, &window_width, &window_height);
} else if (event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(wnd)) {
// We listen specifically for main window close because closing main window
// on macOS does not trigger SDL_Quit.
gfx_sdl_close();
switch (event.window.event) {
case SDL_WINDOWEVENT_SIZE_CHANGED:
SDL_GL_GetDrawableSize(wnd, &window_width, &window_height);
break;
case SDL_WINDOWEVENT_CLOSE:
if (event.window.windowID == SDL_GetWindowID(wnd)) {
// We listen specifically for main window close because closing main window
// on macOS does not trigger SDL_Quit.
gfx_sdl_close();
}
break;
}
break;
case SDL_DROPFILE:
Expand Down

0 comments on commit ba56a97

Please sign in to comment.