From 57ebc93caedd9551fc7190ad8b9b84012cbb6bcd Mon Sep 17 00:00:00 2001 From: arbee Date: Mon, 22 Dec 2014 23:38:25 -0500 Subject: SDL2: Improved Alt-Enter functionality (now works on all screens at once) and prefer upper-left placement of windowed mode windows. [R. Belmont] --- src/osd/sdl/draw13.c | 2 +- src/osd/sdl/drawogl.c | 2 +- src/osd/sdl/video.c | 15 +++++++++++++-- src/osd/sdl/video.h | 1 + 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/osd/sdl/draw13.c b/src/osd/sdl/draw13.c index 01dc42c43e6..9dcff9de9eb 100644 --- a/src/osd/sdl/draw13.c +++ b/src/osd/sdl/draw13.c @@ -555,7 +555,7 @@ static int drawsdl2_window_create(sdl_window_info *window, int width, int height SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE); // create the SDL window - window->sdl_window = SDL_CreateWindow(window->title, SDL_WINDOWPOS_UNDEFINED_DISPLAY(window->monitor->handle), SDL_WINDOWPOS_UNDEFINED, + window->sdl_window = SDL_CreateWindow(window->title, window->monitor->monitor_x, 0, width, height, sdl->extra_flags); if (window->fullscreen && video_config.switchres) diff --git a/src/osd/sdl/drawogl.c b/src/osd/sdl/drawogl.c index e039057cb70..43f455f4118 100644 --- a/src/osd/sdl/drawogl.c +++ b/src/osd/sdl/drawogl.c @@ -510,7 +510,7 @@ static int drawogl_window_create(sdl_window_info *window, int width, int height) //load_gl_lib(window->machine()); // create the SDL window - window->sdl_window = SDL_CreateWindow(window->title, SDL_WINDOWPOS_UNDEFINED_DISPLAY(window->monitor->handle), SDL_WINDOWPOS_UNDEFINED, + window->sdl_window = SDL_CreateWindow(window->title, window->monitor->monitor_x, 0, width, height, sdl->extra_flags); if (!window->sdl_window ) diff --git a/src/osd/sdl/video.c b/src/osd/sdl/video.c index a5b130cd87f..d6b2af0b465 100644 --- a/src/osd/sdl/video.c +++ b/src/osd/sdl/video.c @@ -437,7 +437,7 @@ static void init_monitors(void) #if (SDLMAME_SDL2) { - int i; + int i, monx = 0; osd_printf_verbose("Enter init_monitors\n"); @@ -456,11 +456,14 @@ static void init_monitors(void) monitor->monitor_height = dmode.h; monitor->center_width = dmode.w; monitor->center_height = dmode.h; + monitor->monitor_x = monx; monitor->handle = i; // guess the aspect ratio assuming square pixels monitor->aspect = (float)(dmode.w) / (float)(dmode.h); osd_printf_verbose("Adding monitor %s (%d x %d)\n", monitor->monitor_device, dmode.w, dmode.h); + monx += dmode.w; + // save the primary monitor handle if (i == 0) primary_monitor = monitor; @@ -560,7 +563,15 @@ static void check_osd_inputs(running_machine &machine) // check for toggling fullscreen mode if (ui_input_pressed(machine, IPT_OSD_1)) - sdlwindow_toggle_full_screen(machine, window); + { + sdl_window_info *curwin = sdl_window_list; + + while (curwin != (sdl_window_info *)NULL) + { + sdlwindow_toggle_full_screen(machine, curwin); + curwin = curwin->next; + } + } if (ui_input_pressed(machine, IPT_OSD_2)) { diff --git a/src/osd/sdl/video.h b/src/osd/sdl/video.h index 8cccf59e471..843583a8a06 100644 --- a/src/osd/sdl/video.h +++ b/src/osd/sdl/video.h @@ -70,6 +70,7 @@ struct sdl_monitor_info float aspect; // computed/configured aspect ratio of the physical device int center_width; // width of first physical screen for centering int center_height; // height of first physical screen for centering + int monitor_x; // X position of this monitor in virtual desktop space (SDL virtual space has them all horizontally stacked, not real geometry) }; -- cgit v1.2.3-70-g09d2