summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-02-10 09:50:12 +0100
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-02-21 22:23:08 +0100
commit41c1749f46e0e36af39be2487ee992cbf18e6679 (patch)
treebe025ef8861bed3f6ce95685044ba45c807b971f
parent08952f23dd4b069990b027dc06b10affcb4bc361 (diff)
downloadmpv-41c1749f46e0e36af39be2487ee992cbf18e6679.tar.bz2
mpv-41c1749f46e0e36af39be2487ee992cbf18e6679.tar.xz
core: move `xineramascreen` to `MPOpts` as `vo_screen_id`
This is a small cleanup in preparation for the next commit.
-rw-r--r--core/cfg-mplayer.h4
-rw-r--r--core/defaultopts.c1
-rw-r--r--core/options.h1
-rw-r--r--video/out/cocoa_common.m12
-rw-r--r--video/out/vo.c1
-rw-r--r--video/out/vo.h1
-rw-r--r--video/out/w32_common.c10
-rw-r--r--video/out/x11_common.c6
8 files changed, 20 insertions, 16 deletions
diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h
index 621d026d0d..23c4bedee8 100644
--- a/core/cfg-mplayer.h
+++ b/core/cfg-mplayer.h
@@ -612,8 +612,8 @@ const m_option_t mplayer_opts[]={
{"heartbeat-cmd", &heartbeat_cmd, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"mouseinput", &vo_nomouse_input, CONF_TYPE_FLAG, 0, 1, 0, NULL},
- {"screen", &xinerama_screen, CONF_TYPE_CHOICE, CONF_RANGE,
- .min = 0, .max = 32, M_CHOICES(({"all", -2}, {"current", -1}))},
+ OPT_CHOICE_OR_INT("screen", vo_screen_id, 0, 0, 32,
+ ({"all", -2}, {"current", -1})),
OPT_INTRANGE("brightness", vo_gamma_brightness, 0, -100, 100),
OPT_INTRANGE("saturation", vo_gamma_saturation, 0, -100, 100),
diff --git a/core/defaultopts.c b/core/defaultopts.c
index 1119ef0633..b6e7f28524 100644
--- a/core/defaultopts.c
+++ b/core/defaultopts.c
@@ -22,6 +22,7 @@ void set_default_mplayer_options(struct MPOpts *opts)
.monitor_pixel_aspect = 1.0,
.vo_panscanrange = 1.0,
.cursor_autohide_delay = 1000,
+ .vo_screen_id = -1,
.vo_gamma_gamma = 1000,
.vo_gamma_brightness = 1000,
.vo_gamma_contrast = 1000,
diff --git a/core/options.h b/core/options.h
index 3d4e014c6e..8e64c07723 100644
--- a/core/options.h
+++ b/core/options.h
@@ -18,6 +18,7 @@ typedef struct MPOpts {
int ao_buffersize;
int vo_screenwidth;
int vo_screenheight;
+ int vo_screen_id;
struct m_geometry vo_geometry;
struct m_geometry vo_autofit;
struct m_geometry vo_autofit_larger;
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index 4d4d7f927b..77b9d0c96f 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -256,18 +256,20 @@ static int current_screen_has_dock_or_menubar(struct vo *vo)
static void update_screen_info(struct vo *vo)
{
struct vo_cocoa_state *s = vo->cocoa;
+ struct MPOpts *opts = vo->opts;
+ int screen_id = opts->vo_screen_id;
s->screen_array = [NSScreen screens];
- if (xinerama_screen >= (int)[s->screen_array count]) {
+ if (screen_id >= (int)[s->screen_array count]) {
mp_msg(MSGT_VO, MSGL_INFO, "[cocoa] Device ID %d does not exist, "
- "falling back to main device\n", xinerama_screen);
- xinerama_screen = -1;
+ "falling back to main device\n", screen_id);
+ screen_id = -1;
}
- if (xinerama_screen < 0) { // default behaviour
+ if (screen_id < 0) { // default behaviour
if (! (s->screen_handle = [s->window screen]) )
s->screen_handle = [s->screen_array objectAtIndex:0];
} else {
- s->screen_handle = [s->screen_array objectAtIndex:(xinerama_screen)];
+ s->screen_handle = [s->screen_array objectAtIndex:(screen_id)];
}
s->screen_frame = [s->screen_handle frame];
diff --git a/video/out/vo.c b/video/out/vo.c
index 9a1516930c..a2eda768e7 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -46,7 +46,6 @@
#include "x11_common.h"
#endif
-int xinerama_screen = -1;
int xinerama_x;
int xinerama_y;
diff --git a/video/out/vo.h b/video/out/vo.h
index a41b5466fb..a6b760d52f 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -306,7 +306,6 @@ const char *vo_get_window_title(struct vo *vo);
// NULL terminated array of all drivers
extern const struct vo_driver *video_out_drivers[];
-extern int xinerama_screen;
extern int xinerama_x;
extern int xinerama_y;
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index 343404abba..6b92066860 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -312,12 +312,13 @@ static BOOL CALLBACK mon_enum(HMONITOR hmon, HDC hdc, LPRECT r, LPARAM p)
{
struct vo *vo = (void*)p;
struct vo_w32_state *w32 = vo->w32;
+ struct MPOpts *opts = vo->opts;
// this defaults to the last screen if specified number does not exist
xinerama_x = r->left;
xinerama_y = r->top;
vo->opts->vo_screenwidth = r->right - r->left;
vo->opts->vo_screenheight = r->bottom - r->top;
- if (w32->mon_cnt == xinerama_screen)
+ if (w32->mon_cnt == opts->vo_screen_id)
return FALSE;
w32->mon_cnt++;
return TRUE;
@@ -340,8 +341,9 @@ static BOOL CALLBACK mon_enum(HMONITOR hmon, HDC hdc, LPRECT r, LPARAM p)
void w32_update_xinerama_info(struct vo *vo)
{
struct vo_w32_state *w32 = vo->w32;
+ struct MPOpts *opts = vo->opts;
xinerama_x = xinerama_y = 0;
- if (xinerama_screen < -1) {
+ if (opts->vo_screen_id < -1) {
int tmp;
xinerama_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
xinerama_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
@@ -349,7 +351,7 @@ void w32_update_xinerama_info(struct vo *vo)
if (tmp) vo->opts->vo_screenwidth = tmp;
tmp = GetSystemMetrics(SM_CYVIRTUALSCREEN);
if (tmp) vo->opts->vo_screenheight = tmp;
- } else if (xinerama_screen == -1) {
+ } else if (opts->vo_screen_id == -1) {
MONITORINFO mi;
HMONITOR m = MonitorFromWindow(w32->window, MONITOR_DEFAULTTOPRIMARY);
mi.cbSize = sizeof(mi);
@@ -358,7 +360,7 @@ void w32_update_xinerama_info(struct vo *vo)
xinerama_y = mi.rcMonitor.top;
vo->opts->vo_screenwidth = mi.rcMonitor.right - mi.rcMonitor.left;
vo->opts->vo_screenheight = mi.rcMonitor.bottom - mi.rcMonitor.top;
- } else if (xinerama_screen > 0) {
+ } else if (opts->vo_screen_id > 0) {
w32->mon_cnt = 0;
EnumDisplayMonitors(NULL, NULL, mon_enum, (LONG_PTR)vo);
}
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 959c0888fd..a3bf5c10cf 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -376,8 +376,8 @@ void vo_x11_update_screeninfo(struct vo *vo)
struct MPOpts *opts = vo->opts;
xinerama_x = xinerama_y = 0;
#ifdef CONFIG_XINERAMA
- if (xinerama_screen >= -1 && XineramaIsActive(vo->x11->display)) {
- int screen = xinerama_screen;
+ if (opts->vo_screen_id >= -1 && XineramaIsActive(vo->x11->display)) {
+ int screen = opts->vo_screen_id;
XineramaScreenInfo *screens;
int num_screens;
@@ -994,7 +994,7 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
struct MPOpts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
Display *mDisplay = vo->x11->display;
- bool force_change_xy = opts->vo_geometry.xy_valid || xinerama_screen >= 0;
+ bool force_change_xy = opts->vo_geometry.xy_valid || opts->vo_screen_id >= 0;
XVisualInfo vinfo_storage;
if (!vis) {
vis = &vinfo_storage;