Previous 199869 Revisions Next

r36065 Monday 23rd February, 2015 at 01:33:44 UTC by Couriersud
Fixed fullscreen toggling (SDL2) on OSX. Simplified multithreading
code-paths (via defines). (nw)
[/branches/kale/src/osd/sdl]input.c osdsdl.h sdlmain.c window.c

branches/kale/src/osd/sdl/input.c
r244576r244577
15831583      }
15841584      osd_lock_release(input_lock);
15851585   }
1586   else
1587      SDL_PumpEvents();
15861588}
15871589
15881590
branches/kale/src/osd/sdl/osdsdl.h
r244576r244577
1313//  System dependent defines
1414//============================================================
1515
16// Process events in worker thread
17#if defined(SDLMAME_WIN32) || ((SDLMAME_SDL2) && (!defined(SDLMAME_EMSCRIPTEN)) && (!defined(SDLMAME_MACOSX)))
18#define SDLMAME_EVENTS_IN_WORKER_THREAD (1)
19#else
20#define SDLMAME_EVENTS_IN_WORKER_THREAD (0)
21#endif
2216
2317#if defined(SDLMAME_WIN32)
2418   #if (SDLMAME_SDL2)
25      #define SDLMAME_INIT_IN_WORKER_THREAD   (0) //FIXME: breaks mt
26      #define SDL13_COMBINE_RESIZE (1)
19      #define SDLMAME_EVENTS_IN_WORKER_THREAD (0)
20      #define SDLMAME_INIT_IN_WORKER_THREAD   (0)
21      #define SDL13_COMBINE_RESIZE (0) //(1) no longer needed
2722   #else
23      #define SDLMAME_EVENTS_IN_WORKER_THREAD (0)
2824      #define SDLMAME_INIT_IN_WORKER_THREAD   (1)
2925      #define SDL13_COMBINE_RESIZE (0)
3026   #endif
3127#else
28   #define SDLMAME_EVENTS_IN_WORKER_THREAD (0)
3229   #define SDLMAME_INIT_IN_WORKER_THREAD   (0)
3330   #define SDL13_COMBINE_RESIZE (0)
3431#endif
branches/kale/src/osd/sdl/sdlmain.c
r244576r244577
263263{
264264   int res = 0;
265265
266#if defined(SDLMAME_X11) && !(SDLMAME_SDL2)
267   XInitThreads();
268#endif
269
266270#if defined(SDLMAME_WIN32)
267271#if !(SDLMAME_SDL2)
268272   /* Load SDL dynamic link library */
branches/kale/src/osd/sdl/window.c
r244576r244577
561561   window->renderer().destroy();
562562
563563#if (SDLMAME_SDL2)
564   if (window->fullscreen() && video_config.switchres)
564   bool is_osx = false;
565#ifdef SDLMAME_MACOSX
566   // FIXME: This is weird behaviour and certainly a bug in SDL
567   is_osx = true;
568#endif
569   if (window->fullscreen() && (video_config.switchres || is_osx))
565570   {
566571      SDL_SetWindowFullscreen(window->sdl_window(), 0);    // Try to set mode
567572      SDL_SetWindowDisplayMode(window->sdl_window(), &window->m_original_mode);    // Try to set mode
r244576r244577
12241229      window->m_extra_flags |= SDL_ASYNCBLIT;
12251230
12261231   if (window->renderer().has_flags(osd_renderer::FLAG_NEEDS_OPENGL))
1227 {
1232   {
12281233      window->m_extra_flags |= SDL_DOUBLEBUF | SDL_OPENGL;
12291234      SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
12301235      #if (SDL_VERSION_ATLEAST(1,2,10)) && (!defined(SDLMAME_EMSCRIPTEN))
12311236      SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, video_config.waitvsync ? 1 : 0);
12321237      #endif
1233         //load_gl_lib(window->machine());
1234 }
1238      //   load_gl_lib(window->machine());
1239   }
12351240
12361241   // create the SDL surface (which creates the window in windowed mode)
1242#if 0
12371243   window->m_sdlsurf = SDL_SetVideoMode(tempwidth, tempheight,
1244                     0, SDL_OPENGL | SDL_FULLSCREEN);// | window->m_extra_flags);
1245   if (!window->m_sdlsurf)
1246      printf("completely failed\n");
1247#endif
1248   window->m_sdlsurf = SDL_SetVideoMode(tempwidth, tempheight,
12381249                     0, SDL_SWSURFACE  | SDL_ANYFORMAT | window->m_extra_flags);
12391250
12401251   if (!window->m_sdlsurf)
1252   {
1253      osd_printf_error("SDL Error: %s\n", SDL_GetError());
12411254      return (void *) &result[1];
1255   }
12421256   if ( (video_config.mode  == VIDEO_MODE_OPENGL) && !(window->m_sdlsurf->flags & SDL_OPENGL) )
12431257   {
12441258      osd_printf_error("OpenGL not supported on this driver!\n");
12451259      return (void *) &result[1];
12461260   }
1247
12481261   // set the window title
12491262   SDL_WM_SetCaption(window->m_title, "SDLMAME");
12501263#endif


Previous 199869 Revisions Next


© 1997-2024 The MAME Team