Skip to content
Snippets Groups Projects
Commit 4c3fbda9 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix SDL/GDI issue with textmode() using alternate fonts

Previously, SDL and GDI modes (but not X11 mode) would return early
from textmode() if the new mode is the same as the old mode. This
would result in the font not being reset to the defaults for the
mode.

This was most noticable when using RIP to change the font to one of
a difference size since the mode remains the same, but the font and
screen dimensions change.

Should fix issue 201
parent fccf1a57
No related branches found
No related tags found
No related merge requests found
Pipeline #8844 passed
......@@ -370,19 +370,10 @@ sdl_get_bounds(int *w, int *h)
return true;
}
static int sdl_init_mode(int mode, bool init)
static int sdl_init_mode(int mode)
{
int w, h;
if (mode != CIOLIB_MODE_CUSTOM) {
assert_rwlock_rdlock(&vstatlock);
if (mode == vstat.mode && !init) {
assert_rwlock_unlock(&vstatlock);
return 0;
}
assert_rwlock_unlock(&vstatlock);
}
sdl_user_func(SDL_USEREVENT_FLUSH);
assert_pthread_mutex_lock(&win_mutex);
......@@ -434,7 +425,7 @@ int sdl_init(int mode)
_beginthread(sdl_video_event_thread, 0, NULL);
#endif
sdl_user_func_ret(SDL_USEREVENT_INIT);
sdl_init_mode(ciolib_initial_mode, true);
sdl_init_mode(ciolib_initial_mode);
if(sdl_init_good) {
cio_api.mode=fullscreen?CIOLIB_MODE_SDL_FULLSCREEN:CIOLIB_MODE_SDL;
......@@ -568,7 +559,7 @@ int sdl_getch(void)
/* Called from main thread only */
void sdl_textmode(int mode)
{
sdl_init_mode(mode, false);
sdl_init_mode(mode);
}
/* Called from main thread only (Passes Event) */
......
......@@ -1090,15 +1090,6 @@ gdi_textmode(int mode)
{
int mw, mh;
if (mode != CIOLIB_MODE_CUSTOM) {
assert_rwlock_rdlock(&vstatlock);
if (mode == vstat.mode) {
assert_rwlock_unlock(&vstatlock);
return;
}
assert_rwlock_unlock(&vstatlock);
}
assert_rwlock_wrlock(&vstatlock);
get_monitor_size_pos(&mw, &mh, NULL, NULL);
UnadjustWindowSize(&mw, &mh);
......
......@@ -10,6 +10,7 @@ Pass control key combinations in BBC Micro mode
Add support for DECSC/DECRC control codes
Fix crash when first ANSI music note played is in background
Fix binary mode tracking, which could cause issues after transfers
Fix SDL and GDI issue with textmode() when font is changed
Version 1.6
------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment