summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author couriersud <couriersud@arcor.de>2015-02-23 02:33:44 +0100
committer couriersud <couriersud@arcor.de>2015-02-23 02:33:44 +0100
commited4d846b775e096359f925f60ec3158e8af55a2e (patch)
tree49b01029cacee4b9479eb1c3f1b7a96556bb9365 /src/osd
parentc2c3a819a59998b351a76415b2c5a7853a07da85 (diff)
Fixed fullscreen toggling (SDL2) on OSX. Simplified multithreading
code-paths (via defines). (nw)
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/sdl/input.c2
-rw-r--r--src/osd/sdl/osdsdl.h13
-rw-r--r--src/osd/sdl/sdlmain.c4
-rw-r--r--src/osd/sdl/window.c23
4 files changed, 29 insertions, 13 deletions
diff --git a/src/osd/sdl/input.c b/src/osd/sdl/input.c
index 9e1b511299b..3eacca2e01d 100644
--- a/src/osd/sdl/input.c
+++ b/src/osd/sdl/input.c
@@ -1583,6 +1583,8 @@ void sdlinput_process_events_buf()
}
osd_lock_release(input_lock);
}
+ else
+ SDL_PumpEvents();
}
diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h
index 4cc29ca1fa0..dac044669d4 100644
--- a/src/osd/sdl/osdsdl.h
+++ b/src/osd/sdl/osdsdl.h
@@ -13,22 +13,19 @@
// System dependent defines
//============================================================
-// Process events in worker thread
-#if defined(SDLMAME_WIN32) || ((SDLMAME_SDL2) && (!defined(SDLMAME_EMSCRIPTEN)) && (!defined(SDLMAME_MACOSX)))
-#define SDLMAME_EVENTS_IN_WORKER_THREAD (1)
-#else
-#define SDLMAME_EVENTS_IN_WORKER_THREAD (0)
-#endif
#if defined(SDLMAME_WIN32)
#if (SDLMAME_SDL2)
- #define SDLMAME_INIT_IN_WORKER_THREAD (0) //FIXME: breaks mt
- #define SDL13_COMBINE_RESIZE (1)
+ #define SDLMAME_EVENTS_IN_WORKER_THREAD (0)
+ #define SDLMAME_INIT_IN_WORKER_THREAD (0)
+ #define SDL13_COMBINE_RESIZE (0) //(1) no longer needed
#else
+ #define SDLMAME_EVENTS_IN_WORKER_THREAD (0)
#define SDLMAME_INIT_IN_WORKER_THREAD (1)
#define SDL13_COMBINE_RESIZE (0)
#endif
#else
+ #define SDLMAME_EVENTS_IN_WORKER_THREAD (0)
#define SDLMAME_INIT_IN_WORKER_THREAD (0)
#define SDL13_COMBINE_RESIZE (0)
#endif
diff --git a/src/osd/sdl/sdlmain.c b/src/osd/sdl/sdlmain.c
index 5dc3c4c924d..d171c7ace78 100644
--- a/src/osd/sdl/sdlmain.c
+++ b/src/osd/sdl/sdlmain.c
@@ -263,6 +263,10 @@ int main(int argc, char *argv[])
{
int res = 0;
+#if defined(SDLMAME_X11) && !(SDLMAME_SDL2)
+ XInitThreads();
+#endif
+
#if defined(SDLMAME_WIN32)
#if !(SDLMAME_SDL2)
/* Load SDL dynamic link library */
diff --git a/src/osd/sdl/window.c b/src/osd/sdl/window.c
index 3ec98f5787d..dae4ef5dc18 100644
--- a/src/osd/sdl/window.c
+++ b/src/osd/sdl/window.c
@@ -561,7 +561,12 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt )
window->renderer().destroy();
#if (SDLMAME_SDL2)
- if (window->fullscreen() && video_config.switchres)
+ bool is_osx = false;
+#ifdef SDLMAME_MACOSX
+ // FIXME: This is weird behaviour and certainly a bug in SDL
+ is_osx = true;
+#endif
+ if (window->fullscreen() && (video_config.switchres || is_osx))
{
SDL_SetWindowFullscreen(window->sdl_window(), 0); // Try to set mode
SDL_SetWindowDisplayMode(window->sdl_window(), &window->m_original_mode); // Try to set mode
@@ -1224,27 +1229,35 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt )
window->m_extra_flags |= SDL_ASYNCBLIT;
if (window->renderer().has_flags(osd_renderer::FLAG_NEEDS_OPENGL))
- {
+ {
window->m_extra_flags |= SDL_DOUBLEBUF | SDL_OPENGL;
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
#if (SDL_VERSION_ATLEAST(1,2,10)) && (!defined(SDLMAME_EMSCRIPTEN))
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, video_config.waitvsync ? 1 : 0);
#endif
- //load_gl_lib(window->machine());
- }
+ // load_gl_lib(window->machine());
+ }
// create the SDL surface (which creates the window in windowed mode)
+#if 0
+ window->m_sdlsurf = SDL_SetVideoMode(tempwidth, tempheight,
+ 0, SDL_OPENGL | SDL_FULLSCREEN);// | window->m_extra_flags);
+ if (!window->m_sdlsurf)
+ printf("completely failed\n");
+#endif
window->m_sdlsurf = SDL_SetVideoMode(tempwidth, tempheight,
0, SDL_SWSURFACE | SDL_ANYFORMAT | window->m_extra_flags);
if (!window->m_sdlsurf)
+ {
+ osd_printf_error("SDL Error: %s\n", SDL_GetError());
return (void *) &result[1];
+ }
if ( (video_config.mode == VIDEO_MODE_OPENGL) && !(window->m_sdlsurf->flags & SDL_OPENGL) )
{
osd_printf_error("OpenGL not supported on this driver!\n");
return (void *) &result[1];
}
-
// set the window title
SDL_WM_SetCaption(window->m_title, "SDLMAME");
#endif