--- 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:52:16 1.1.1.12 @@ -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. @@ -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) { @@ -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;