From e302609470e939aa940a7acf2cbd755cc2b27ab6 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 27 Nov 2025 09:06:00 -0800
Subject: [PATCH] Make windowed mode a little easier to see
---
screenlib/SDL_FrameBuf.cpp | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/screenlib/SDL_FrameBuf.cpp b/screenlib/SDL_FrameBuf.cpp
index 5370ca57..7d47756f 100644
--- a/screenlib/SDL_FrameBuf.cpp
+++ b/screenlib/SDL_FrameBuf.cpp
@@ -39,8 +39,22 @@ FrameBuf::FrameBuf() : ErrorBase()
int
FrameBuf::Init(int width, int height, Uint32 window_flags, SDL_Surface *icon)
{
+ int window_width = width;
+ int window_height = height;
+
+ // Enlarge the window so it's easy to see
+ if (!(window_flags & SDL_WINDOW_FULLSCREEN)) {
+ const SDL_DisplayMode *mode = SDL_GetDesktopDisplayMode(SDL_GetPrimaryDisplay());
+ if (mode) {
+ while ((window_width * 3) < mode->w && (window_height * 3) < mode->h) {
+ window_width *= 2;
+ window_height *= 2;
+ }
+ }
+ }
+
/* Create the window */
- window = SDL_CreateWindow(NULL, width, height, window_flags);
+ window = SDL_CreateWindow(NULL, window_width, window_height, window_flags);
if (!window) {
SetError("Couldn't create %dx%d window: %s",
width, height, SDL_GetError());