mirror of
https://github.com/mpv-player/mpv
synced 2025-03-31 15:59:34 +00:00
core: move xineramascreen
to MPOpts
as vo_screen_id
This is a small cleanup in preparation for the next commit.
This commit is contained in:
parent
08952f23dd
commit
41c1749f46
@ -612,8 +612,8 @@ const m_option_t mplayer_opts[]={
|
|||||||
{"heartbeat-cmd", &heartbeat_cmd, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
{"heartbeat-cmd", &heartbeat_cmd, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||||
{"mouseinput", &vo_nomouse_input, CONF_TYPE_FLAG, 0, 1, 0, NULL},
|
{"mouseinput", &vo_nomouse_input, CONF_TYPE_FLAG, 0, 1, 0, NULL},
|
||||||
|
|
||||||
{"screen", &xinerama_screen, CONF_TYPE_CHOICE, CONF_RANGE,
|
OPT_CHOICE_OR_INT("screen", vo_screen_id, 0, 0, 32,
|
||||||
.min = 0, .max = 32, M_CHOICES(({"all", -2}, {"current", -1}))},
|
({"all", -2}, {"current", -1})),
|
||||||
|
|
||||||
OPT_INTRANGE("brightness", vo_gamma_brightness, 0, -100, 100),
|
OPT_INTRANGE("brightness", vo_gamma_brightness, 0, -100, 100),
|
||||||
OPT_INTRANGE("saturation", vo_gamma_saturation, 0, -100, 100),
|
OPT_INTRANGE("saturation", vo_gamma_saturation, 0, -100, 100),
|
||||||
|
@ -22,6 +22,7 @@ void set_default_mplayer_options(struct MPOpts *opts)
|
|||||||
.monitor_pixel_aspect = 1.0,
|
.monitor_pixel_aspect = 1.0,
|
||||||
.vo_panscanrange = 1.0,
|
.vo_panscanrange = 1.0,
|
||||||
.cursor_autohide_delay = 1000,
|
.cursor_autohide_delay = 1000,
|
||||||
|
.vo_screen_id = -1,
|
||||||
.vo_gamma_gamma = 1000,
|
.vo_gamma_gamma = 1000,
|
||||||
.vo_gamma_brightness = 1000,
|
.vo_gamma_brightness = 1000,
|
||||||
.vo_gamma_contrast = 1000,
|
.vo_gamma_contrast = 1000,
|
||||||
|
@ -18,6 +18,7 @@ typedef struct MPOpts {
|
|||||||
int ao_buffersize;
|
int ao_buffersize;
|
||||||
int vo_screenwidth;
|
int vo_screenwidth;
|
||||||
int vo_screenheight;
|
int vo_screenheight;
|
||||||
|
int vo_screen_id;
|
||||||
struct m_geometry vo_geometry;
|
struct m_geometry vo_geometry;
|
||||||
struct m_geometry vo_autofit;
|
struct m_geometry vo_autofit;
|
||||||
struct m_geometry vo_autofit_larger;
|
struct m_geometry vo_autofit_larger;
|
||||||
|
@ -256,18 +256,20 @@ static int current_screen_has_dock_or_menubar(struct vo *vo)
|
|||||||
static void update_screen_info(struct vo *vo)
|
static void update_screen_info(struct vo *vo)
|
||||||
{
|
{
|
||||||
struct vo_cocoa_state *s = vo->cocoa;
|
struct vo_cocoa_state *s = vo->cocoa;
|
||||||
|
struct MPOpts *opts = vo->opts;
|
||||||
|
int screen_id = opts->vo_screen_id;
|
||||||
s->screen_array = [NSScreen screens];
|
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, "
|
mp_msg(MSGT_VO, MSGL_INFO, "[cocoa] Device ID %d does not exist, "
|
||||||
"falling back to main device\n", xinerama_screen);
|
"falling back to main device\n", screen_id);
|
||||||
xinerama_screen = -1;
|
screen_id = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xinerama_screen < 0) { // default behaviour
|
if (screen_id < 0) { // default behaviour
|
||||||
if (! (s->screen_handle = [s->window screen]) )
|
if (! (s->screen_handle = [s->window screen]) )
|
||||||
s->screen_handle = [s->screen_array objectAtIndex:0];
|
s->screen_handle = [s->screen_array objectAtIndex:0];
|
||||||
} else {
|
} 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];
|
s->screen_frame = [s->screen_handle frame];
|
||||||
|
@ -46,7 +46,6 @@
|
|||||||
#include "x11_common.h"
|
#include "x11_common.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int xinerama_screen = -1;
|
|
||||||
int xinerama_x;
|
int xinerama_x;
|
||||||
int xinerama_y;
|
int xinerama_y;
|
||||||
|
|
||||||
|
@ -306,7 +306,6 @@ const char *vo_get_window_title(struct vo *vo);
|
|||||||
// NULL terminated array of all drivers
|
// NULL terminated array of all drivers
|
||||||
extern const struct vo_driver *video_out_drivers[];
|
extern const struct vo_driver *video_out_drivers[];
|
||||||
|
|
||||||
extern int xinerama_screen;
|
|
||||||
extern int xinerama_x;
|
extern int xinerama_x;
|
||||||
extern int xinerama_y;
|
extern int xinerama_y;
|
||||||
|
|
||||||
|
@ -312,12 +312,13 @@ static BOOL CALLBACK mon_enum(HMONITOR hmon, HDC hdc, LPRECT r, LPARAM p)
|
|||||||
{
|
{
|
||||||
struct vo *vo = (void*)p;
|
struct vo *vo = (void*)p;
|
||||||
struct vo_w32_state *w32 = vo->w32;
|
struct vo_w32_state *w32 = vo->w32;
|
||||||
|
struct MPOpts *opts = vo->opts;
|
||||||
// this defaults to the last screen if specified number does not exist
|
// this defaults to the last screen if specified number does not exist
|
||||||
xinerama_x = r->left;
|
xinerama_x = r->left;
|
||||||
xinerama_y = r->top;
|
xinerama_y = r->top;
|
||||||
vo->opts->vo_screenwidth = r->right - r->left;
|
vo->opts->vo_screenwidth = r->right - r->left;
|
||||||
vo->opts->vo_screenheight = r->bottom - r->top;
|
vo->opts->vo_screenheight = r->bottom - r->top;
|
||||||
if (w32->mon_cnt == xinerama_screen)
|
if (w32->mon_cnt == opts->vo_screen_id)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
w32->mon_cnt++;
|
w32->mon_cnt++;
|
||||||
return TRUE;
|
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)
|
void w32_update_xinerama_info(struct vo *vo)
|
||||||
{
|
{
|
||||||
struct vo_w32_state *w32 = vo->w32;
|
struct vo_w32_state *w32 = vo->w32;
|
||||||
|
struct MPOpts *opts = vo->opts;
|
||||||
xinerama_x = xinerama_y = 0;
|
xinerama_x = xinerama_y = 0;
|
||||||
if (xinerama_screen < -1) {
|
if (opts->vo_screen_id < -1) {
|
||||||
int tmp;
|
int tmp;
|
||||||
xinerama_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
xinerama_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
||||||
xinerama_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
xinerama_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
||||||
@ -349,7 +351,7 @@ void w32_update_xinerama_info(struct vo *vo)
|
|||||||
if (tmp) vo->opts->vo_screenwidth = tmp;
|
if (tmp) vo->opts->vo_screenwidth = tmp;
|
||||||
tmp = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
tmp = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
||||||
if (tmp) vo->opts->vo_screenheight = tmp;
|
if (tmp) vo->opts->vo_screenheight = tmp;
|
||||||
} else if (xinerama_screen == -1) {
|
} else if (opts->vo_screen_id == -1) {
|
||||||
MONITORINFO mi;
|
MONITORINFO mi;
|
||||||
HMONITOR m = MonitorFromWindow(w32->window, MONITOR_DEFAULTTOPRIMARY);
|
HMONITOR m = MonitorFromWindow(w32->window, MONITOR_DEFAULTTOPRIMARY);
|
||||||
mi.cbSize = sizeof(mi);
|
mi.cbSize = sizeof(mi);
|
||||||
@ -358,7 +360,7 @@ void w32_update_xinerama_info(struct vo *vo)
|
|||||||
xinerama_y = mi.rcMonitor.top;
|
xinerama_y = mi.rcMonitor.top;
|
||||||
vo->opts->vo_screenwidth = mi.rcMonitor.right - mi.rcMonitor.left;
|
vo->opts->vo_screenwidth = mi.rcMonitor.right - mi.rcMonitor.left;
|
||||||
vo->opts->vo_screenheight = mi.rcMonitor.bottom - mi.rcMonitor.top;
|
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;
|
w32->mon_cnt = 0;
|
||||||
EnumDisplayMonitors(NULL, NULL, mon_enum, (LONG_PTR)vo);
|
EnumDisplayMonitors(NULL, NULL, mon_enum, (LONG_PTR)vo);
|
||||||
}
|
}
|
||||||
|
@ -376,8 +376,8 @@ void vo_x11_update_screeninfo(struct vo *vo)
|
|||||||
struct MPOpts *opts = vo->opts;
|
struct MPOpts *opts = vo->opts;
|
||||||
xinerama_x = xinerama_y = 0;
|
xinerama_x = xinerama_y = 0;
|
||||||
#ifdef CONFIG_XINERAMA
|
#ifdef CONFIG_XINERAMA
|
||||||
if (xinerama_screen >= -1 && XineramaIsActive(vo->x11->display)) {
|
if (opts->vo_screen_id >= -1 && XineramaIsActive(vo->x11->display)) {
|
||||||
int screen = xinerama_screen;
|
int screen = opts->vo_screen_id;
|
||||||
XineramaScreenInfo *screens;
|
XineramaScreenInfo *screens;
|
||||||
int num_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 MPOpts *opts = vo->opts;
|
||||||
struct vo_x11_state *x11 = vo->x11;
|
struct vo_x11_state *x11 = vo->x11;
|
||||||
Display *mDisplay = vo->x11->display;
|
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;
|
XVisualInfo vinfo_storage;
|
||||||
if (!vis) {
|
if (!vis) {
|
||||||
vis = &vinfo_storage;
|
vis = &vinfo_storage;
|
||||||
|
Loading…
Reference in New Issue
Block a user