From b9f0b9b72102cbde134b0931d534d792e9c5e708 Mon Sep 17 00:00:00 2001 From: Pedro Beirao Date: Fri, 29 Nov 2024 22:48:24 +0000 Subject: [PATCH 1/2] Allow window to be resizable on macOS --- prboom2/src/SDL/i_video.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/prboom2/src/SDL/i_video.c b/prboom2/src/SDL/i_video.c index ac8fae201..88700e432 100644 --- a/prboom2/src/SDL/i_video.c +++ b/prboom2/src/SDL/i_video.c @@ -1275,13 +1275,7 @@ void I_UpdateVideoMode(void) init_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; } - // In windowed mode, the window can be resized while the game is - // running. This feature is disabled on OS X, as it adds an ugly - // scroll handle to the corner of the screen. -#ifndef __APPLE__ - if (!desired_fullscreen) init_flags |= SDL_WINDOW_RESIZABLE; -#endif if (V_IsOpenGLMode()) { From a74d2da57c528d7e61a9cbf59b9222b61f671f79 Mon Sep 17 00:00:00 2001 From: Pedro Beirao Date: Fri, 29 Nov 2024 23:26:32 +0000 Subject: [PATCH 2/2] Make sure initial window size is always >= 640x480 (OpenGL) Only software used to have this behaviour --- prboom2/src/SDL/i_video.c | 53 ++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/prboom2/src/SDL/i_video.c b/prboom2/src/SDL/i_video.c index 88700e432..87e6e2823 100644 --- a/prboom2/src/SDL/i_video.c +++ b/prboom2/src/SDL/i_video.c @@ -1267,6 +1267,16 @@ void I_UpdateVideoMode(void) init_flags |= SDL_WINDOW_OPENGL; } + // [FG] aspect ratio correction for the canonical video modes + if (SCREENHEIGHT == 200 || SCREENHEIGHT == 400) + { + actualheight = 6*SCREENHEIGHT/5; + } + else + { + actualheight = SCREENHEIGHT; + } + if (desired_fullscreen) { if (exclusive_fullscreen) @@ -1274,9 +1284,17 @@ void I_UpdateVideoMode(void) else init_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; } - + else + { init_flags |= SDL_WINDOW_RESIZABLE; + // [FG] make sure initial window size is always >= 640x480 + while (screen_multiply*SCREENWIDTH < 640 || screen_multiply*actualheight < 480) + { + screen_multiply++; + } + } + if (V_IsOpenGLMode()) { SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 0 ); @@ -1299,10 +1317,10 @@ void I_UpdateVideoMode(void) sdl_window = SDL_CreateWindow( PACKAGE_NAME " " PACKAGE_VERSION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - SCREENWIDTH * screen_multiply, SCREENHEIGHT * screen_multiply, + SCREENWIDTH * screen_multiply, actualheight * screen_multiply, init_flags); sdl_glcontext = SDL_GL_CreateContext(sdl_window); - SDL_SetWindowMinimumSize(sdl_window, SCREENWIDTH, SCREENHEIGHT); + SDL_SetWindowMinimumSize(sdl_window, SCREENWIDTH, actualheight); } else { @@ -1314,35 +1332,13 @@ void I_UpdateVideoMode(void) sdl_window = SDL_CreateWindow( PACKAGE_NAME " " PACKAGE_VERSION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - SCREENWIDTH, SCREENHEIGHT, + SCREENWIDTH * screen_multiply, actualheight * screen_multiply, init_flags); sdl_renderer = SDL_CreateRenderer(sdl_window, -1, flags); - // [FG] aspect ratio correction for the canonical video modes - if (SCREENHEIGHT == 200 || SCREENHEIGHT == 400) - { - actualheight = 6*SCREENHEIGHT/5; - } - else - { - actualheight = SCREENHEIGHT; - } - SDL_SetWindowMinimumSize(sdl_window, SCREENWIDTH, actualheight); SDL_RenderSetLogicalSize(sdl_renderer, SCREENWIDTH, actualheight); - // [FG] make sure initial window size is always >= 640x480 - while (screen_multiply*SCREENWIDTH < 640 || screen_multiply*actualheight < 480) - { - screen_multiply++; - } - - // [FG] apply screen_multiply to initial window size - if (!desired_fullscreen) - { - SDL_SetWindowSize(sdl_window, screen_multiply*SCREENWIDTH, screen_multiply*actualheight); - } - // [FG] force integer scales SDL_RenderSetIntegerScale(sdl_renderer, integer_scaling); @@ -1550,6 +1546,11 @@ static dboolean MouseShouldBeGrabbed() if (!window_focused) return false; + // always grab the mouse when full screen (dont want to + // see the mouse pointer) + if (desired_fullscreen) + return true; + // if we specify not to grab the mouse, never grab if (!mouse_enabled) return false;