From 26d5f6b7f2b99f6dc822c5d88509288d5f9ce6f8 Mon Sep 17 00:00:00 2001 From: Dave Vasilevsky Date: Fri, 19 Apr 2013 00:18:14 -0400 Subject: [PATCH] SDL: Allow fullscreen toggle in BasiliskII --- BasiliskII/src/SDL/video_sdl.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/BasiliskII/src/SDL/video_sdl.cpp b/BasiliskII/src/SDL/video_sdl.cpp index 7882a7bb..720b8dc2 100644 --- a/BasiliskII/src/SDL/video_sdl.cpp +++ b/BasiliskII/src/SDL/video_sdl.cpp @@ -106,11 +106,9 @@ static bool redraw_thread_active = false; // Flag: Redraw thread installed #ifndef USE_CPU_EMUL_SERVICES static volatile bool redraw_thread_cancel; // Flag: Cancel Redraw thread static SDL_Thread *redraw_thread = NULL; // Redraw thread -#ifdef SHEEPSHAVER static volatile bool thread_stop_req = false; static volatile bool thread_stop_ack = false; // Acknowledge for thread_stop_req #endif -#endif #ifdef ENABLE_VOSF static bool use_vosf = false; // Flag: VOSF enabled @@ -1216,13 +1214,14 @@ void VideoQuitFullScreen(void) quit_full_screen = true; } -#ifdef SHEEPSHAVER static void do_toggle_fullscreen(void) { +#ifndef USE_CPU_EMUL_SERVICES // pause redraw thread thread_stop_ack = false; thread_stop_req = true; while (!thread_stop_ack) ; +#endif // save the mouse position int x, y; @@ -1239,7 +1238,9 @@ static void do_toggle_fullscreen(void) drv->adapt_to_video_mode(); // reset the palette +#ifdef SHEEPSHAVER video_set_palette(); +#endif drv->update_palette(); // restore the screen contents @@ -1258,9 +1259,10 @@ static void do_toggle_fullscreen(void) // resume redraw thread toggle_fullscreen = false; +#ifndef USE_CPU_EMUL_SERVICES thread_stop_req = false; -} #endif +} /* * Mac VBL interrupt @@ -1299,6 +1301,9 @@ void VideoInterrupt(void) if (emerg_quit) QuitEmulator(); + if (toggle_fullscreen) + do_toggle_fullscreen(); + // Temporarily give up frame buffer lock (this is the point where // we are suspended when the user presses Ctrl-Tab) UNLOCK_FRAME_BUFFER; @@ -2209,13 +2214,11 @@ static int redraw_func(void *arg) next = GetTicks_usec(); ticks++; -#ifdef SHEEPSHAVER // Pause if requested (during video mode switches) if (thread_stop_req) { thread_stop_ack = true; continue; } -#endif // Process pending events and update display do_video_refresh();