--- hatari/src/gui-sdl/sdlgui.c 2019/04/09 08:49:45 1.1.1.10 +++ hatari/src/gui-sdl/sdlgui.c 2019/04/09 08:53:31 1.1.1.13 @@ -1,8 +1,8 @@ /* Hatari - sdlgui.c - This file is distributed under the GNU Public License, version 2 or at - your option any later version. Read the file gpl.txt for details. + This file is distributed under the GNU General Public License, version 2 + or at your option any later version. Read the file gpl.txt for details. A tiny graphical user interface for Hatari. */ @@ -25,6 +25,9 @@ static SDL_Surface *pBigFontGfx = NULL; static SDL_Surface *pFontGfx = NULL; /* The actual font graphics */ static int current_object = 0; /* Current selected object */ +int sdlgui_fontwidth; /* Width of the actual font */ +int sdlgui_fontheight; /* Height of the actual font */ + /*-----------------------------------------------------------------------*/ /** * Load an 1 plane XBM into a 8 planes SDL_Surface. @@ -147,7 +150,7 @@ int SDLGui_SetScreen(SDL_Surface *pScrn) if (pFontGfx == NULL) { - fprintf(stderr, "Error: A problem with the font occured!\n"); + fprintf(stderr, "Error: A problem with the font occurred!\n"); return -1; } @@ -188,7 +191,7 @@ void SDLGui_CenterDlg(SGOBJ *dlg) void SDLGui_Text(int x, int y, const char *txt) { int i; - char c; + unsigned char c; SDL_Rect sr, dr; for (i=0; txt[i]!=0; i++) @@ -617,6 +620,7 @@ void SDLGui_DrawDialog(const SGOBJ *dlg) /*-----------------------------------------------------------------------*/ /** * Search an object at a certain position. + * Return object index or -1 if it wasn't found. */ static int SDLGui_FindObj(const SGOBJ *dlg, int fx, int fy) { @@ -677,7 +681,7 @@ static int SDLGui_SearchFlaggedButton(co /*-----------------------------------------------------------------------*/ /** * Show and process a dialog. Returns the button number that has been - * pressed or SDLGUI_UNKNOWNEVENT if an unsupported event occured (will be + * pressed or SDLGUI_UNKNOWNEVENT if an unsupported event occurred (will be * stored in parameter pEventOut). */ int SDLGui_DoDialog(SGOBJ *dlg, SDL_Event *pEventOut) @@ -735,7 +739,7 @@ int SDLGui_DoDialog(SGOBJ *dlg, SDL_Even /* If current object is the scrollbar, and mouse is still down, we can scroll it */ /* also if the mouse pointer has left the scrollbar */ - if (dlg[current_object].type == SGSCROLLBAR) { + if (current_object >= 0 && dlg[current_object].type == SGSCROLLBAR) { if (b & SDL_BUTTON(1)) { obj = current_object; dlg[obj].state |= SG_MOUSEDOWN;