diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c index 14261bb96b9cd85b34c121c4f7d4f8228ea37946..a9eac5e1018016affc03534d1b3e0ced91a8a244 100644 --- a/src/conio/bitmap_con.c +++ b/src/conio/bitmap_con.c @@ -298,10 +298,12 @@ set_vmem_cell(struct vstat_vmem *vmem_ptr, size_t pos, uint16_t cell, uint32_t f bitmap_attr2palette_locked(cell>>8, fg == 0xffffff ? &fg : NULL, bg == 0xffffff ? &bg : NULL); altfont = (cell>>11 & 0x01) | ((cell>>14) & 0x02); + pthread_mutex_lock(&vstatlock); if (!vstat.bright_altcharset) altfont &= ~0x01; if (!vstat.blink_altcharset) altfont &= ~0x02; + pthread_mutex_unlock(&vstatlock); font=current_font[altfont]; if (font == -99) font = default_font; @@ -565,8 +567,9 @@ static int bitmap_draw_one_char(unsigned int xpos, unsigned int ypos) } } } - if (this_font == NULL) + if (this_font == NULL) { this_font = font[0]; + } fdw = charwidth - (flags & VIDMODES_FLAG_EXPAND) ? 1 : 0; fontoffset=(sch) * (charheight * ((fdw + 7) / 8)); diff --git a/src/conio/sdl_con.c b/src/conio/sdl_con.c index 83815ae99b01611395e67c955ca283817901fd54..5f1f4e15fd8723d66f6bba94f07e7521feb828a7 100644 --- a/src/conio/sdl_con.c +++ b/src/conio/sdl_con.c @@ -454,11 +454,22 @@ int sdl_init(int mode) return(-1); } +static void +update_cvstat(struct video_stats *vs) +{ + if (vs != NULL && vs != &vstat) { + pthread_mutex_lock(&vstatlock); + *vs = vstat; + pthread_mutex_unlock(&vstatlock); + } +} + static void internal_setwinsize(struct video_stats *vs, bool force) { int w, h; bool changed = true; + update_cvstat(vs); w = vs->winwidth; h = vs->winheight; if (w > 16384) @@ -671,7 +682,8 @@ static void setup_surfaces_locked(struct video_stats *vs) } if (vs != &vstat) { pthread_mutex_lock(&vstatlock); - vstat = *vs; + vstat.winwidth = vs->winwidth; + vstat.winheight = vs->winheight; pthread_mutex_unlock(&vstatlock); } sdl.SetWindowMinimumSize(win, idealmw, idealmh); @@ -694,6 +706,7 @@ static void sdl_add_key(unsigned int keyval, struct video_stats *vs) fullscreen=!fullscreen; cio_api.mode=fullscreen?CIOLIB_MODE_SDL_FULLSCREEN:CIOLIB_MODE_SDL; sdl.SetWindowFullscreen(win, fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0); + update_cvstat(vs); setup_surfaces_locked(vs); return; } @@ -885,6 +898,8 @@ void sdl_video_event_thread(void *data) // Don't allow ALT-DIR to change size when maximized... if ((sdl.GetWindowFlags(win) & SDL_WINDOW_MAXIMIZED) == 0) { bool wc; + + update_cvstat(&cvstat); w = cvstat.winwidth; h = cvstat.winheight; aspect_fix(&w, &h, cvstat.aspect_width, cvstat.aspect_height); @@ -1061,6 +1076,7 @@ void sdl_video_event_thread(void *data) sem_post(&sdl_ufunc_ret); return; case SDL_USEREVENT_FLUSH: + update_cvstat(&cvstat); pthread_mutex_lock(&win_mutex); if (win != NULL) { pthread_mutex_unlock(&win_mutex); @@ -1200,9 +1216,6 @@ void sdl_video_event_thread(void *data) sdl_mode = false; pthread_mutex_unlock(&sdl_mode_mutex); - pthread_mutex_lock(&vstatlock); - cvstat = vstat; - pthread_mutex_unlock(&vstatlock); internal_setwinsize(&cvstat, true); sdl_ufunc_retval=0; sem_post(&sdl_ufunc_ret);