From f6d8902462ba2c745d579b34d85304d40a2f50a3 Mon Sep 17 00:00:00 2001 From: Themaister Date: Fri, 12 Oct 2012 21:15:58 +0200 Subject: [PATCH] Add monitor selection option. --- config.def.h | 1 + general.h | 1 + gfx/context/glx_ctx.c | 3 +++ gfx/context/xegl_ctx.c | 3 +++ retroarch.cfg | 4 ++++ settings.c | 2 ++ 6 files changed, 14 insertions(+) diff --git a/config.def.h b/config.def.h index b7210565e8..8ce1ae71cb 100644 --- a/config.def.h +++ b/config.def.h @@ -157,6 +157,7 @@ static const float yscale = 3.0; // Real y res = base_size * yscale // Fullscreen static const bool fullscreen = false; // To start in Fullscreen or not. static const bool windowed_fullscreen = false; // To use windowed mode or not when going fullscreen. +static const unsigned monitor_index = 0; // Which monitor to prefer. 0 is any monitor, 1 and up selects specific monitors, 1 being the first monitor. static const unsigned fullscreen_x = 0; // Fullscreen resolution. A value of 0 uses the desktop resolution. static const unsigned fullscreen_y = 0; diff --git a/general.h b/general.h index a4c38cec3c..e675fd469c 100644 --- a/general.h +++ b/general.h @@ -83,6 +83,7 @@ struct settings float yscale; bool fullscreen; bool windowed_fullscreen; + unsigned monitor_index; unsigned fullscreen_x; unsigned fullscreen_y; bool vsync; diff --git a/gfx/context/glx_ctx.c b/gfx/context/glx_ctx.c index 8046e8c12a..52ee32e023 100644 --- a/gfx/context/glx_ctx.c +++ b/gfx/context/glx_ctx.c @@ -260,6 +260,9 @@ static bool gfx_ctx_set_video_mode( } } + if (g_settings.video.monitor_index) + g_screen = g_settings.video.monitor_index - 1; + int x_off = 0; int y_off = 0; #ifdef HAVE_XINERAMA diff --git a/gfx/context/xegl_ctx.c b/gfx/context/xegl_ctx.c index 9e3e94fd00..8c6638320f 100644 --- a/gfx/context/xegl_ctx.c +++ b/gfx/context/xegl_ctx.c @@ -288,6 +288,9 @@ static bool gfx_ctx_set_video_mode( } } + if (g_settings.video.monitor_index) + g_screen = g_settings.video.monitor_index - 1; + int x_off = 0; int y_off = 0; #ifdef HAVE_XINERAMA diff --git a/retroarch.cfg b/retroarch.cfg index 7cfa4e7e16..c6e1093c28 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -57,6 +57,10 @@ # If fullscreen, prefer using a windowed fullscreen mode. # video_windowed_fullscreen = false +# Which monitor to prefer. 0 (default) means no particular monitor is preferred, 1 and up (1 being first monitor), +# suggests RetroArch to use that particular monitor. +# video_monitor_index = 0 + # Force 16-bit colors. Apparently some video cards in use today have troubles with 32-bit ... # video_force_16bit = false diff --git a/settings.c b/settings.c index 81846b7467..d3690fb2a3 100644 --- a/settings.c +++ b/settings.c @@ -145,6 +145,7 @@ void config_set_defaults(void) g_settings.video.yscale = yscale; g_settings.video.fullscreen = g_extern.force_fullscreen ? true : fullscreen; g_settings.video.windowed_fullscreen = windowed_fullscreen; + g_settings.video.monitor_index = monitor_index; g_settings.video.fullscreen_x = fullscreen_x; g_settings.video.fullscreen_y = fullscreen_y; g_settings.video.force_16bit = force_16bit; @@ -372,6 +373,7 @@ bool config_load_file(const char *path) CONFIG_GET_BOOL(video.fullscreen, "video_fullscreen"); CONFIG_GET_BOOL(video.windowed_fullscreen, "video_windowed_fullscreen"); + CONFIG_GET_BOOL(video.monitor_index, "video_monitor_index"); CONFIG_GET_BOOL(video.force_16bit, "video_force_16bit"); CONFIG_GET_BOOL(video.disable_composition, "video_disable_composition"); CONFIG_GET_BOOL(video.vsync, "video_vsync");