SDL2: Improved Alt-Enter functionality (now works on all screens at once) and prefer upper-left placement of windowed mode windows. [R. Belmont]

This commit is contained in:
arbee 2014-12-22 23:38:25 -05:00
parent 2b510d1929
commit 57ebc93cae
4 changed files with 16 additions and 4 deletions

View File

@ -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)

View File

@ -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 )

View File

@ -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))
{

View File

@ -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)
};