mirror of
https://github.com/holub/mame
synced 2025-06-23 12:58:37 +03:00
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:
parent
2b510d1929
commit
57ebc93cae
@ -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);
|
SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE);
|
||||||
|
|
||||||
// create the SDL window
|
// 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);
|
width, height, sdl->extra_flags);
|
||||||
|
|
||||||
if (window->fullscreen && video_config.switchres)
|
if (window->fullscreen && video_config.switchres)
|
||||||
|
@ -510,7 +510,7 @@ static int drawogl_window_create(sdl_window_info *window, int width, int height)
|
|||||||
//load_gl_lib(window->machine());
|
//load_gl_lib(window->machine());
|
||||||
|
|
||||||
// create the SDL window
|
// 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);
|
width, height, sdl->extra_flags);
|
||||||
|
|
||||||
if (!window->sdl_window )
|
if (!window->sdl_window )
|
||||||
|
@ -437,7 +437,7 @@ static void init_monitors(void)
|
|||||||
|
|
||||||
#if (SDLMAME_SDL2)
|
#if (SDLMAME_SDL2)
|
||||||
{
|
{
|
||||||
int i;
|
int i, monx = 0;
|
||||||
|
|
||||||
osd_printf_verbose("Enter init_monitors\n");
|
osd_printf_verbose("Enter init_monitors\n");
|
||||||
|
|
||||||
@ -456,11 +456,14 @@ static void init_monitors(void)
|
|||||||
monitor->monitor_height = dmode.h;
|
monitor->monitor_height = dmode.h;
|
||||||
monitor->center_width = dmode.w;
|
monitor->center_width = dmode.w;
|
||||||
monitor->center_height = dmode.h;
|
monitor->center_height = dmode.h;
|
||||||
|
monitor->monitor_x = monx;
|
||||||
monitor->handle = i;
|
monitor->handle = i;
|
||||||
// guess the aspect ratio assuming square pixels
|
// guess the aspect ratio assuming square pixels
|
||||||
monitor->aspect = (float)(dmode.w) / (float)(dmode.h);
|
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);
|
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
|
// save the primary monitor handle
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
primary_monitor = monitor;
|
primary_monitor = monitor;
|
||||||
@ -560,7 +563,15 @@ static void check_osd_inputs(running_machine &machine)
|
|||||||
|
|
||||||
// check for toggling fullscreen mode
|
// check for toggling fullscreen mode
|
||||||
if (ui_input_pressed(machine, IPT_OSD_1))
|
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))
|
if (ui_input_pressed(machine, IPT_OSD_2))
|
||||||
{
|
{
|
||||||
|
@ -70,6 +70,7 @@ struct sdl_monitor_info
|
|||||||
float aspect; // computed/configured aspect ratio of the physical device
|
float aspect; // computed/configured aspect ratio of the physical device
|
||||||
int center_width; // width of first physical screen for centering
|
int center_width; // width of first physical screen for centering
|
||||||
int center_height; // height 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)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user