Re: [hatari-devel] Hatari screen dialog regression |
[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]
Hi, On 10.8.2025 12.06, Thomas Huth wrote:
Thomas, could you check the patch series too?Sorry, I currently don't have the capacity to review bigger patch series. But I noticed that the screen dialog is currently still broken when you run Hatari without borders and without status bar (e.g. in monochrome mode when disabling the status bar). Dialogs must not be bigger than 80x25 characters.
Max width is 64. I think check + error logging for the sizes are needed as it seems that even we developers get it wrong. :-)
@Nicolas, I think this should get fixed before the 2.6.1 release.
Attached are patches to fix this, and what the dialog looks with them. - EeroPS. Before release, also corresponding manual update is needed for its screen dialog section.
From 49195a744877956dd30cd0e62482106a8c9b3ffa Mon Sep 17 00:00:00 2001 From: Eero Tamminen <oak@xxxxxxxxxxxxxx> Date: Sun, 10 Aug 2025 20:34:50 +0300 Subject: [PATCH 2/2] Log errors on invalid dialog sizes To catch non-working changes to dialog contents. --- src/gui-sdl/sdlgui.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/gui-sdl/sdlgui.c b/src/gui-sdl/sdlgui.c index 107bcf10..d5238dac 100644 --- a/src/gui-sdl/sdlgui.c +++ b/src/gui-sdl/sdlgui.c @@ -30,6 +30,15 @@ const char SDLGui_fileid[] = "Hatari sdlgui.c"; # define Dprintf(a) #endif +/* sanity check for minimum size */ +#define MIN_DIALOG_WIDTH 12 +#define MIN_DIALOG_HEIGHT 5 +/* Dialogs need to fit into Hatari window. These are max sizes + * (with the current font) when both borders & statusbar are disabled. + */ +#define MAX_DIALOG_WIDTH 64 +#define MAX_DIALOG_HEIGHT 25 + static SDL_Surface *pSdlGuiScrn; /* Pointer to the actual main SDL screen surface */ static SDL_Surface *pSmallFontGfx = NULL; /* The small font graphics */ static SDL_Surface *pBigFontGfx = NULL; /* The big font graphics */ @@ -215,8 +224,19 @@ void SDLGui_GetFontSize(int *width, int *height) */ void SDLGui_CenterDlg(SGOBJ *dlg) { - dlg[0].x = (pSdlGuiScrn->w/sdlgui_fontwidth-dlg[0].w)/2; - dlg[0].y = (pSdlGuiScrn->h/sdlgui_fontheight-dlg[0].h)/2; + int w = dlg[0].w, h = dlg[0].h; + /* catch invalid changes to SDL GUI dialogs */ + if (w < MIN_DIALOG_WIDTH || h < MIN_DIALOG_HEIGHT) + { + Log_Printf(LOG_ERROR, "invalid (too small) dialog size (%dx%d)!", w, h); + } + if (w > MAX_DIALOG_WIDTH || h > MAX_DIALOG_HEIGHT) + { + Log_Printf(LOG_ERROR, "dialog too large (%dx%d), max working size is %dx%d!", + w, h, MAX_DIALOG_WIDTH, MAX_DIALOG_HEIGHT); + } + dlg[0].x = (pSdlGuiScrn->w / sdlgui_fontwidth - w) / 2; + dlg[0].y = (pSdlGuiScrn->h / sdlgui_fontheight - h) / 2; } /*-----------------------------------------------------------------------*/ -- 2.39.5
From f093ffa9db588b52f776f1a00803821bcd20dc3f Mon Sep 17 00:00:00 2001 From: Eero Tamminen <oak@xxxxxxxxxxxxxx> Date: Sun, 10 Aug 2025 20:11:23 +0300 Subject: [PATCH 1/2] Fix: fit Hatari screen dialog to smallest required size Dialogs need to fit into Hatari window also when _both_ borders & statusbar are disabled. Fixes: c0253f16eb177 --- src/gui-sdl/dlgScreen.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/gui-sdl/dlgScreen.c b/src/gui-sdl/dlgScreen.c index efc52668..08113a8f 100644 --- a/src/gui-sdl/dlgScreen.c +++ b/src/gui-sdl/dlgScreen.c @@ -111,10 +111,10 @@ static SGOBJ monitordlg[] = #define DLGSCRN_CAPTURE_DIR 32 #define DLGSCRN_RECANIM 34 #define DLGSCRN_CROP 35 -#define DLGSCRN_GPUSCALE 38 -#define DLGSCRN_RESIZABLE 39 -#define DLGSCRN_VSYNC 40 -#define DLGSCRN_EXIT_WINDOW 41 +#define DLGSCRN_GPUSCALE 37 +#define DLGSCRN_RESIZABLE 38 +#define DLGSCRN_VSYNC 39 +#define DLGSCRN_EXIT_WINDOW 40 /* needs to match Frame skip values in windowdlg[]! */ static const int skip_frames[] = { 0, 1, 2, 4, AUTO_FRAMESKIP_LIMIT }; @@ -130,7 +130,7 @@ static char sScreenShotDir[29]; /* The window dialog: */ static SGOBJ windowdlg[] = { - { SGBOX, 0, 0, 0,0, 52,27, NULL }, + { SGBOX, 0, 0, 0,0, 52,24, NULL }, { SGBOX, 0, 0, 1,1, 50,10, NULL }, { SGTEXT, 0, 0, 4,2, 20,1, "Hatari screen options" }, { SGCHECKBOX, 0, 0, 4,4, 12,1, "_Fullscreen" }, @@ -168,13 +168,12 @@ static SGOBJ windowdlg[] = { SGBUTTON, 0, 0, 4,17, 14,1, NULL }, /* Record text set later */ { SGCHECKBOX, 0, 0, 21,17, 16,1, "_Crop statusbar" }, - { SGBOX, 0, 0, 1,20, 50,4, NULL }, - { SGTEXT, 0, 0, 20,20, 12,1, "SDL2 options" }, - { SGCHECKBOX, 0, 0, 8,22, 20,1, "GPU scal_ing" }, - { SGCHECKBOX, 0, 0, 23,22, 20,1, "Resi_zable" }, - { SGCHECKBOX, 0, 0, 36,22, 11,1, "_VSync" }, - { SGBUTTON, SG_DEFAULT, 0, 17,25, 20,1, "Back to main menu" }, + { SGTEXT, 0, 0, 4,20, 12,1, "SDL2:" }, + { SGCHECKBOX, 0, 0, 12,20, 20,1, "GPU scal_ing" }, + { SGCHECKBOX, 0, 0, 27,20, 20,1, "Resi_zable" }, + { SGCHECKBOX, 0, 0, 40,20, 11,1, "_VSync" }, + { SGBUTTON, SG_DEFAULT, 0, 17,22, 20,1, "Back to main menu" }, { SGSTOP, 0, 0, 0,0, 0,0, NULL } }; -- 2.39.5
Attachment:
window-dialog.png
Description: PNG image
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |