From 41c1749f46e0e36af39be2487ee992cbf18e6679 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 10 Feb 2013 09:50:12 +0100 Subject: core: move `xineramascreen` to `MPOpts` as `vo_screen_id` This is a small cleanup in preparation for the next commit. --- video/out/cocoa_common.m | 12 +++++++----- video/out/vo.c | 1 - video/out/vo.h | 1 - video/out/w32_common.c | 10 ++++++---- video/out/x11_common.c | 6 +++--- 5 files changed, 16 insertions(+), 14 deletions(-) (limited to 'video') 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; -- cgit v1.2.3