1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-02 21:12:23 +00:00

vo: Separate vo options from MPOpts

Separate the video output options from the big MPOpts structure and also only
pass the new mp_vo_opts structure to the vo backend.

Move video_driver_list into mp_vo_opts
This commit is contained in:
Alexander Preisinger 2013-03-04 22:41:27 +01:00
parent 4949992264
commit 1198c031e4
19 changed files with 253 additions and 250 deletions

View File

@ -527,7 +527,7 @@ const m_option_t mplayer_opts[]={
/* name, pointer, type, flags, min, max */
//---------------------- libao/libvo options ------------------------
OPT_STRINGLIST("vo", video_driver_list, 0),
OPT_STRINGLIST("vo", vo.video_driver_list, 0),
OPT_STRINGLIST("ao", audio_driver_list, 0),
OPT_FLAG("fixed-vo", fixed_vo, CONF_GLOBAL),
OPT_FLAG("ontop", vo.ontop, 0),

View File

@ -850,16 +850,16 @@ static int mp_property_fullscreen(m_option_t *prop,
void *arg,
MPContext *mpctx)
{
struct MPOpts *opts = mpctx->video_out->opts;
struct mp_vo_opts *opts = mpctx->video_out->opts;
if (!mpctx->video_out)
return M_PROPERTY_UNAVAILABLE;
if (action == M_PROPERTY_SET) {
if (opts->vo.fs == !!*(int *) arg)
if (opts->fs == !!*(int *) arg)
return M_PROPERTY_OK;
if (mpctx->video_out->config_ok)
vo_control(mpctx->video_out, VOCTRL_FULLSCREEN, 0);
mpctx->opts.fullscreen = opts->vo.fs;
mpctx->opts.fullscreen = opts->fs;
return M_PROPERTY_OK;
}
return mp_property_generic_option(prop, action, arg, mpctx);

View File

@ -9,7 +9,6 @@ void set_default_mplayer_options(struct MPOpts *opts)
{
*opts = (const struct MPOpts){
.audio_driver_list = NULL,
.video_driver_list = NULL,
.audio_decoders = "-spdif:*", // never select spdif by default
.video_decoders = NULL,
.fixed_vo = 1,
@ -19,6 +18,7 @@ void set_default_mplayer_options(struct MPOpts *opts)
.mixer_init_mute = -1,
.ao_buffersize = -1,
.vo = {
.video_driver_list = NULL,
.cursor_autohide_delay = 1000,
.monitor_pixel_aspect = 1.0,
.panscanrange = 1.0,

View File

@ -2359,7 +2359,7 @@ int reinit_video_chain(struct MPContext *mpctx)
//================== Init VIDEO (codec & libvo) ==========================
if (!opts->fixed_vo || !(mpctx->initialized_flags & INITIALIZED_VO)) {
mpctx->video_out
= init_best_video_out(opts, mpctx->key_fifo, mpctx->input,
= init_best_video_out(&opts->vo, mpctx->key_fifo, mpctx->input,
mpctx->encode_lavc_ctx);
if (!mpctx->video_out) {
mp_tmsg(MSGT_CPLAYER, MSGL_FATAL, "Error opening/initializing "
@ -3850,9 +3850,9 @@ static void play_current_file(struct MPContext *mpctx)
load_per_extension_config(mpctx->mconfig, mpctx->filename);
load_per_file_config(mpctx->mconfig, mpctx->filename);
if (opts->video_driver_list)
if (opts->vo.video_driver_list)
load_per_output_config(mpctx->mconfig, PROFILE_CFG_VO,
opts->video_driver_list[0]);
opts->vo.video_driver_list[0]);
if (opts->audio_driver_list)
load_per_output_config(mpctx->mconfig, PROFILE_CFG_AO,
opts->audio_driver_list[0]);
@ -4242,8 +4242,8 @@ static bool handle_help_options(struct MPContext *mpctx)
{
struct MPOpts *opts = &mpctx->opts;
int opt_exit = 0;
if (opts->video_driver_list &&
strcmp(opts->video_driver_list[0], "help") == 0) {
if (opts->vo.video_driver_list &&
strcmp(opts->vo.video_driver_list[0], "help") == 0) {
list_video_out();
opt_exit = 1;
}

View File

@ -4,8 +4,45 @@
#include <stdbool.h>
#include "core/m_option.h"
typedef struct MPOpts {
typedef struct mp_vo_opts {
char **video_driver_list;
int screenwidth;
int screenheight;
int ontop;
bool fs;
int vsync;
int screen_id;
int fsscreen_id;
int stop_screensaver;
char *winname;
char** fstype_list;
float panscan;
float panscanrange;
struct m_geometry geometry;
struct m_geometry autofit;
struct m_geometry autofit_larger;
int fsmode;
int keepaspect;
int border;
int colorkey;
int nomouse_input;
int enable_mouse_movements;
int cursor_autohide_delay;
int64_t WinID;
float force_monitor_aspect;
float monitor_pixel_aspect;
int force_window_position;
} mp_vo_opts;
typedef struct MPOpts {
char **audio_driver_list;
int fixed_vo;
char *mixer_device;
@ -17,41 +54,7 @@ typedef struct MPOpts {
int gapless_audio;
int ao_buffersize;
struct output_conf {
int screenwidth;
int screenheight;
int ontop;
bool fs;
int vsync;
int screen_id;
int fsscreen_id;
int stop_screensaver;
char *winname;
char** fstype_list;
float panscan;
float panscanrange;
struct m_geometry geometry;
struct m_geometry autofit;
struct m_geometry autofit_larger;
int fsmode;
int keepaspect;
int border;
int colorkey;
int nomouse_input;
int enable_mouse_movements;
int cursor_autohide_delay;
int64_t WinID;
float force_monitor_aspect;
float monitor_pixel_aspect;
int force_window_position;
} vo;
mp_vo_opts vo;
char *wintitle;
int force_rgba_osd;

View File

@ -36,7 +36,7 @@ void aspect_save_videores(struct vo *vo, int w, int h, int d_w, int d_h)
void aspect_save_screenres(struct vo *vo, int scrw, int scrh)
{
mp_msg(MSGT_VO, MSGL_DBG2, "aspect_save_screenres %dx%d\n", scrw, scrh);
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
if (scrw <= 0 && scrh <= 0)
scrw = 1024;
if (scrh <= 0)
@ -45,10 +45,10 @@ void aspect_save_screenres(struct vo *vo, int scrw, int scrh)
scrw = (scrh * 4 + 2) / 3;
vo->aspdat.scrw = scrw;
vo->aspdat.scrh = scrh;
if (opts->vo.force_monitor_aspect)
vo->monitor_par = opts->vo.force_monitor_aspect * scrh / scrw;
if (opts->force_monitor_aspect)
vo->monitor_par = opts->force_monitor_aspect * scrh / scrw;
else
vo->monitor_par = 1.0 / opts->vo.monitor_pixel_aspect;
vo->monitor_par = 1.0 / opts->monitor_pixel_aspect;
}
/* aspect is called with the source resolution and the
@ -88,7 +88,7 @@ static void get_max_dims(struct vo *vo, int *w, int *h, int zoom)
struct aspect_data *aspdat = &vo->aspdat;
*w = zoom ? aspdat->scrw : aspdat->prew;
*h = zoom ? aspdat->scrh : aspdat->preh;
if (zoom && vo->opts->vo.WinID >= 0)
if (zoom && vo->opts->WinID >= 0)
zoom = A_WINZOOM;
if (zoom == A_WINZOOM) {
*w = vo->dwidth;
@ -101,7 +101,7 @@ void aspect(struct vo *vo, int *srcw, int *srch, int zoom)
int fitw;
int fith;
get_max_dims(vo, &fitw, &fith, zoom);
if (!zoom && vo->opts->vo.geometry.wh_valid) {
if (!zoom && vo->opts->geometry.wh_valid) {
mp_msg(MSGT_VO, MSGL_DBG2, "aspect(0) no aspect forced!\n");
return; // the user doesn't want to fix aspect
}
@ -121,18 +121,18 @@ static void panscan_calc_internal(struct vo *vo, int zoom)
int vo_panscan_area;
int max_w, max_h;
get_max_dims(vo, &max_w, &max_h, zoom);
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
if (opts->vo.panscanrange > 0) {
if (opts->panscanrange > 0) {
aspect(vo, &fwidth, &fheight, zoom);
vo_panscan_area = max_h - fheight;
if (!vo_panscan_area)
vo_panscan_area = max_w - fwidth;
vo_panscan_area *= opts->vo.panscanrange;
vo_panscan_area *= opts->panscanrange;
} else
vo_panscan_area = -opts->vo.panscanrange * max_h;
vo_panscan_area = -opts->panscanrange * max_h;
vo->panscan_amount = opts->vo.fs || zoom == A_WINZOOM ? opts->vo.panscan : 0;
vo->panscan_amount = opts->fs || zoom == A_WINZOOM ? opts->panscan : 0;
vo->panscan_x = vo_panscan_area * vo->panscan_amount * vo->aspdat.asp;
vo->panscan_y = vo_panscan_area * vo->panscan_amount;
}

View File

@ -150,11 +150,11 @@ static struct vo_cocoa_state *vo_cocoa_init_state(struct vo *vo)
.windowed_frame = {{0,0},{0,0}},
.out_fs_resize = NO,
.display_cursor = 1,
.vo_cursor_autohide_delay = vo->opts->vo.cursor_autohide_delay,
.vo_cursor_autohide_delay = vo->opts->cursor_autohide_delay,
.power_mgmt_assertion = kIOPMNullAssertionID,
.accumulated_scroll = 0,
};
if (!vo->opts->vo.border) s->windowed_mask = NSBorderlessWindowMask;
if (!vo->opts->border) s->windowed_mask = NSBorderlessWindowMask;
return s;
}
@ -278,26 +278,26 @@ static int get_screen_handle(int identifier, NSWindow *window, NSScreen **screen
static void update_screen_info(struct vo *vo)
{
struct vo_cocoa_state *s = vo->cocoa;
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
NSScreen *ws, *fss;
get_screen_handle(opts->vo.screen_id, s->window, &ws);
get_screen_handle(opts->screen_id, s->window, &ws);
s->screen_frame = [ws frame];
get_screen_handle(opts->vo.fsscreen_id, s->window, &fss);
get_screen_handle(opts->fsscreen_id, s->window, &fss);
s->fsscreen_frame = [fss frame];
}
void vo_cocoa_update_xinerama_info(struct vo *vo)
{
struct vo_cocoa_state *s = vo->cocoa;
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
update_screen_info(vo);
aspect_save_screenres(vo, s->screen_frame.size.width,
s->screen_frame.size.height);
opts->vo.screenwidth = s->screen_frame.size.width;
opts->vo.screenheight = s->screen_frame.size.height;
opts->screenwidth = s->screen_frame.size.width;
opts->screenheight = s->screen_frame.size.height;
vo->xinerama_x = s->screen_frame.origin.x;
vo->xinerama_y = s->screen_frame.origin.y;
}
@ -338,9 +338,9 @@ static void vo_set_level(struct vo *vo, int ontop)
void vo_cocoa_ontop(struct vo *vo)
{
struct MPOpts *opts = vo->opts;
opts->vo.ontop = !opts->vo.ontop;
vo_set_level(vo, opts->vo.ontop);
struct mp_vo_opts *opts = vo->opts;
opts->ontop = !opts->ontop;
vo_set_level(vo, opts->ontop);
}
static void update_state_sizes(struct vo_cocoa_state *s,
@ -418,7 +418,7 @@ static void update_window(struct vo *vo)
if (s->current_video_size.width != s->previous_video_size.width ||
s->current_video_size.height != s->previous_video_size.height) {
if (vo->opts->vo.fs) {
if (vo->opts->fs) {
// we will resize as soon as we get out of fullscreen
s->out_fs_resize = YES;
} else {
@ -436,7 +436,7 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
int gl3profile)
{
struct vo_cocoa_state *s = vo->cocoa;
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
if (vo->config_count > 0) {
NSPoint origin = [s->window frame].origin;
@ -463,7 +463,7 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
if (flags & VOFLAG_FULLSCREEN)
vo_cocoa_fullscreen(vo);
vo_set_level(vo, opts->vo.ontop);
vo_set_level(vo, opts->ontop);
[s->window setContentSize:s->current_video_size];
[s->window setContentAspectRatio:s->current_video_size];
@ -491,7 +491,7 @@ static void vo_cocoa_display_cursor(struct vo *vo, int requested_state)
{
struct vo_cocoa_state *s = vo->cocoa;
if (requested_state) {
if (!vo->opts->vo.fs || s->vo_cursor_autohide_delay > -2) {
if (!vo->opts->fs || s->vo_cursor_autohide_delay > -2) {
s->display_cursor = requested_state;
CGDisplayShowCursor(kCGDirectMainDisplay);
}
@ -510,7 +510,7 @@ int vo_cocoa_check_events(struct vo *vo)
int ms_time = (int) ([[NSProcessInfo processInfo] systemUptime] * 1000);
// automatically hide mouse cursor
if (vo->opts->vo.fs && s->display_cursor &&
if (vo->opts->fs && s->display_cursor &&
(ms_time - s->cursor_timer >= s->vo_cursor_autohide_delay)) {
vo_cocoa_display_cursor(vo, 0);
s->cursor_timer = ms_time;
@ -648,8 +648,8 @@ void create_menu()
- (void)fullscreen
{
struct vo_cocoa_state *s = _vo->cocoa;
struct MPOpts *opts = _vo->opts;
if (!opts->vo.fs) {
struct mp_vo_opts *opts = _vo->opts;
if (!opts->fs) {
update_screen_info(_vo);
if (current_screen_has_dock_or_menubar(_vo))
[NSApp setPresentationOptions:NSApplicationPresentationHideDock|
@ -658,7 +658,7 @@ void create_menu()
[self setHasShadow:NO];
[self setStyleMask:s->fullscreen_mask];
[self setFrame:s->fsscreen_frame display:YES animate:NO];
opts->vo.fs = true;
opts->fs = true;
vo_cocoa_display_cursor(_vo, 0);
[self setMovableByWindowBackground: NO];
} else {
@ -672,7 +672,7 @@ void create_menu()
s->out_fs_resize = NO;
}
[self setContentAspectRatio:s->current_video_size];
opts->vo.fs = false;
opts->fs = false;
vo_cocoa_display_cursor(_vo, 1);
[self setMovableByWindowBackground: YES];
}
@ -697,7 +697,7 @@ void create_menu()
// this is only valid as a starting value. it will be rewritten in the
// -fullscreen method.
if (_vo) {
return !_vo->opts->vo.fs;
return !_vo->opts->fs;
} else {
return NO;
}
@ -735,7 +735,7 @@ void create_menu()
- (void)mouseMoved: (NSEvent *) theEvent
{
if (_vo->opts->vo.fs)
if (_vo->opts->fs)
vo_cocoa_display_cursor(_vo, 1);
}
@ -856,7 +856,7 @@ void create_menu()
- (void)applicationWillBecomeActive:(NSNotification *)aNotification
{
if (_vo->opts->vo.fs && current_screen_has_dock_or_menubar(_vo)) {
if (_vo->opts->fs && current_screen_has_dock_or_menubar(_vo)) {
struct vo_cocoa_state *s = _vo->cocoa;
[self setLevel:s->window_level];
[NSApp setPresentationOptions:NSApplicationPresentationHideDock|
@ -866,7 +866,7 @@ void create_menu()
- (void)applicationWillResignActive:(NSNotification *)aNotification
{
if (_vo->opts->vo.fs) {
if (_vo->opts->fs) {
[self setLevel:NSNormalWindowLevel];
[NSApp setPresentationOptions:NSApplicationPresentationDefault];
}
@ -893,7 +893,7 @@ void create_menu()
- (void)mulSize:(float)multiplier
{
if (!_vo->opts->vo.fs) {
if (!_vo->opts->fs) {
NSSize size = {
.width = _vo->aspdat.prew * multiplier,
.height = _vo->aspdat.preh * multiplier

View File

@ -293,7 +293,7 @@ static void replace_legacy_vo_name(bstr *name)
*name = new;
}
struct vo *init_best_video_out(struct MPOpts *opts,
struct vo *init_best_video_out(struct mp_vo_opts *opts,
struct mp_fifo *key_fifo,
struct input_ctx *input_ctx,
struct encode_lavc_context *encode_lavc_ctx)
@ -386,21 +386,21 @@ static void apply_autofit(int *w, int *h, int scr_w, int scr_h,
// multi-monitor stuff, and possibly more.
static void determine_window_geometry(struct vo *vo, int d_w, int d_h)
{
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
int scr_w = opts->vo.screenwidth;
int scr_h = opts->vo.screenheight;
int scr_w = opts->screenwidth;
int scr_h = opts->screenheight;
// This is only for applying monitor pixel aspect
aspect(vo, &d_w, &d_h, A_NOZOOM);
apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->vo.autofit, true);
apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->vo.autofit_larger, false);
apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->autofit, true);
apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->autofit_larger, false);
vo->dx = (int)(opts->vo.screenwidth - d_w) / 2;
vo->dy = (int)(opts->vo.screenheight - d_h) / 2;
vo->dx = (int)(opts->screenwidth - d_w) / 2;
vo->dy = (int)(opts->screenheight - d_h) / 2;
m_geometry_apply(&vo->dx, &vo->dy, &d_w, &d_h, scr_w, scr_h,
&opts->vo.geometry);
&opts->geometry);
vo->dx += vo->xinerama_x;
vo->dy += vo->xinerama_y;
@ -562,7 +562,7 @@ const char *vo_get_window_title(struct vo *vo)
void vo_mouse_movement(struct vo *vo, int posx, int posy)
{
char cmd_str[40];
if (!vo->opts->vo.enable_mouse_movements)
if (!vo->opts->enable_mouse_movements)
return;
snprintf(cmd_str, sizeof(cmd_str), "set_mouse_pos %i %i", posx, posy);
mp_input_queue_cmd(vo->input_ctx, mp_input_parse_cmd(bstr0(cmd_str), ""));

View File

@ -244,7 +244,7 @@ struct vo {
const struct vo_driver *driver;
void *priv;
struct MPOpts *opts;
struct mp_vo_opts *opts;
struct vo_x11_state *x11;
struct vo_w32_state *w32;
struct vo_cocoa_state *cocoa;
@ -282,7 +282,7 @@ struct vo {
char *window_title;
};
struct vo *init_best_video_out(struct MPOpts *opts,
struct vo *init_best_video_out(struct mp_vo_opts *opts,
struct mp_fifo *key_fifo,
struct input_ctx *input_ctx,
struct encode_lavc_context *encode_lavc_ctx);
@ -324,7 +324,7 @@ void vo_get_src_dst_rects(struct vo *vo, struct mp_rect *out_src,
static inline int aspect_scaling(struct vo *vo)
{
return vo->opts->vo.keepaspect || vo->opts->vo.fs;
return vo->opts->keepaspect || vo->opts->fs;
}
#endif /* MPLAYER_VIDEO_OUT_H */

View File

@ -175,12 +175,12 @@ static void check_events(struct vo *vo)
vo_mouse_movement(vo, cev.data.mouse.x, cev.data.mouse.y);
break;
case CACA_EVENT_MOUSE_PRESS:
if (!vo->opts->vo.nomouse_input)
if (!vo->opts->nomouse_input)
mplayer_put_key(vo->key_fifo,
(MP_MOUSE_BTN0 + cev.data.mouse.button - 1) | MP_KEY_STATE_DOWN);
break;
case CACA_EVENT_MOUSE_RELEASE:
if (!vo->opts->vo.nomouse_input)
if (!vo->opts->nomouse_input)
mplayer_put_key(vo->key_fifo,
MP_MOUSE_BTN0 + cev.data.mouse.button - 1);
break;

View File

@ -1794,7 +1794,7 @@ static struct bstr load_file(struct gl_priv *p, void *talloc_ctx,
const char *filename)
{
struct bstr res = {0};
stream_t *s = open_stream(filename, p->vo->opts, NULL);
stream_t *s = open_stream(filename, NULL, NULL);
if (s) {
res = stream_read_complete(s, talloc_ctx, 1000000000, 0);
free_stream(s);
@ -2085,7 +2085,7 @@ static int preinit(struct vo *vo, const char *arg)
.colorspace = MP_CSP_DETAILS_DEFAULTS,
.use_npot = 1,
.use_pbo = hq,
.swap_interval = vo->opts->vo.vsync,
.swap_interval = vo->opts->vsync,
.dither_depth = hq ? 0 : -1,
.fbo_format = hq ? GL_RGB16 : GL_RGB,
.use_scale_sep = 1,

View File

@ -2113,7 +2113,7 @@ static int preinit(struct vo *vo, const char *arg)
.use_rectangle = -1,
.ati_hack = -1,
.force_pbo = -1,
.swap_interval = vo->opts->vo.vsync,
.swap_interval = vo->opts->vsync,
.custom_prog = NULL,
.custom_tex = NULL,
.custom_tlin = 1,

View File

@ -271,7 +271,7 @@ static bool try_create_renderer(struct vo *vo, int i, const char *driver,
if (!is_good_renderer(&ri, driver, vc->allow_sw, NULL))
return false;
bool xy_valid = vo->opts->vo.geometry.xy_valid;
bool xy_valid = vo->opts->geometry.xy_valid;
// then actually try
vc->window = SDL_CreateWindow("MPV",
@ -387,7 +387,7 @@ static void set_fullscreen(struct vo *vo, int fs)
// toggling fullscreen might recreate the window, so better guard for this
SDL_DisableScreenSaver();
vo->opts->vo.fs = fs;
vo->opts->fs = fs;
force_resize(vo);
}
@ -470,21 +470,21 @@ static void flip_page(struct vo *vo)
static void check_events(struct vo *vo)
{
struct priv *vc = vo->priv;
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
SDL_Event ev;
if (opts->vo.cursor_autohide_delay >= 0) {
if (opts->cursor_autohide_delay >= 0) {
if (!vc->mouse_hidden &&
(GetTimerMS() - vc->mouse_timer >= opts->vo.cursor_autohide_delay)) {
(GetTimerMS() - vc->mouse_timer >= opts->cursor_autohide_delay)) {
SDL_ShowCursor(0);
vc->mouse_hidden = 1;
}
} else if (opts->vo.cursor_autohide_delay == -1) {
} else if (opts->cursor_autohide_delay == -1) {
if (vc->mouse_hidden) {
SDL_ShowCursor(1);
vc->mouse_hidden = 0;
}
} else if (opts->vo.cursor_autohide_delay == -2) {
} else if (opts->cursor_autohide_delay == -2) {
if (!vc->mouse_hidden) {
SDL_ShowCursor(0);
vc->mouse_hidden = 1;
@ -553,7 +553,7 @@ static void check_events(struct vo *vo)
break;
}
case SDL_MOUSEMOTION:
if (opts->vo.cursor_autohide_delay >= 0) {
if (opts->cursor_autohide_delay >= 0) {
SDL_ShowCursor(1);
vc->mouse_hidden = 0;
vc->mouse_timer = GetTimerMS();
@ -561,7 +561,7 @@ static void check_events(struct vo *vo)
vo_mouse_movement(vo, ev.motion.x, ev.motion.y);
break;
case SDL_MOUSEBUTTONDOWN:
if (opts->vo.cursor_autohide_delay >= 0) {
if (opts->cursor_autohide_delay >= 0) {
SDL_ShowCursor(1);
vc->mouse_hidden = 0;
vc->mouse_timer = GetTimerMS();
@ -570,7 +570,7 @@ static void check_events(struct vo *vo)
(MP_MOUSE_BTN0 + ev.button.button - 1) | MP_KEY_STATE_DOWN);
break;
case SDL_MOUSEBUTTONUP:
if (opts->vo.cursor_autohide_delay >= 0) {
if (opts->cursor_autohide_delay >= 0) {
SDL_ShowCursor(1);
vc->mouse_hidden = 0;
vc->mouse_timer = GetTimerMS();
@ -771,7 +771,7 @@ static int preinit(struct vo *vo, const char *arg)
SDL_HINT_DEFAULT);
// predefine MPV options (SDL env vars shall be overridden)
if (vo->opts->vo.vsync)
if (vo->opts->vsync)
SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC, "1",
SDL_HINT_OVERRIDE);
else
@ -921,10 +921,10 @@ static void update_screeninfo(struct vo *vo)
mp_msg(MSGT_VO, MSGL_ERR, "[sdl] SDL_GetCurrentDisplayMode failed\n");
return;
}
struct MPOpts *opts = vo->opts;
opts->vo.screenwidth = mode.w;
opts->vo.screenheight = mode.h;
aspect_save_screenres(vo, opts->vo.screenwidth, opts->vo.screenheight);
struct mp_vo_opts *opts = vo->opts;
opts->screenwidth = mode.w;
opts->screenheight = mode.h;
aspect_save_screenres(vo, opts->screenwidth, opts->screenheight);
}
static struct mp_image *get_screenshot(struct vo *vo)
@ -981,7 +981,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
{
switch (request) {
case VOCTRL_FULLSCREEN:
set_fullscreen(vo, !vo->opts->vo.fs);
set_fullscreen(vo, !vo->opts->fs);
return 1;
case VOCTRL_REDRAW_FRAME:
draw_image(vo, NULL);

View File

@ -377,7 +377,7 @@ static void resize(struct vo *vo)
vc->src_rect_vid.y0 = vc->flip ? src_rect.y1 : src_rect.y0;
vc->src_rect_vid.y1 = vc->flip ? src_rect.y0 : src_rect.y1;
int flip_offset_ms = vo->opts->vo.fs ?
int flip_offset_ms = vo->opts->fs ?
vc->flip_offset_fs :
vc->flip_offset_window;

View File

@ -349,7 +349,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
}
if (!XMatchVisualInfo(vo->x11->display, vo->x11->screen, p->depth,
DirectColor, &p->vinfo)
|| (vo->opts->vo.WinID > 0
|| (vo->opts->WinID > 0
&& p->vinfo.visualid != XVisualIDFromVisual(p->attribs.visual)))
{
XMatchVisualInfo(vo->x11->display, vo->x11->screen, p->depth, TrueColor,
@ -366,7 +366,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
vo_x11_config_vo_window(vo, &p->vinfo, vo->dx, vo->dy, vo->dwidth,
vo->dheight, flags, "x11");
if (vo->opts->vo.WinID > 0) {
if (vo->opts->WinID > 0) {
unsigned depth, dummy_uint;
int dummy_int;
Window dummy_win;
@ -445,7 +445,7 @@ static void Display_Image(struct priv *p, XImage *myximage, uint8_t *ImageData)
p->old_vo_dheight != vo->dheight) && p->zoomFlag)
return;
if (vo->opts->vo.WinID == 0) {
if (vo->opts->WinID == 0) {
x = vo->dx;
y = vo->dy;
}
@ -539,7 +539,7 @@ static void flip_page(struct vo *vo)
static void draw_image(struct vo *vo, mp_image_t *mpi)
{
struct priv *p = vo->priv;
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
uint8_t *dst[MP_MAX_PLANES] = {NULL};
int dstStride[MP_MAX_PLANES] = {0};
@ -555,7 +555,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
p->old_vo_dwidth = vo->dwidth;
p->old_vo_dheight = vo->dheight;
if (opts->vo.fs)
if (opts->fs)
aspect(vo, &newW, &newH, A_ZOOM);
if (sws_flags == 0)
newW &= (~31); // not needed but, if the user wants the FAST_BILINEAR SCALER, then its needed

View File

@ -328,7 +328,7 @@ static int xv_init_colorkey(struct vo *vo)
/* check if colorkeying is needed */
xv_atom = xv_intern_atom_if_exists(vo, "XV_COLORKEY");
if (xv_atom != None && !(vo->opts->vo.colorkey & 0xFF000000)) {
if (xv_atom != None && !(vo->opts->colorkey & 0xFF000000)) {
if (ctx->xv_ck_info.source == CK_SRC_CUR) {
int colorkey_ret;
@ -342,14 +342,14 @@ static int xv_init_colorkey(struct vo *vo)
return 0; // error getting colorkey
}
} else {
ctx->xv_colorkey = vo->opts->vo.colorkey;
ctx->xv_colorkey = vo->opts->colorkey;
/* check if we have to set the colorkey too */
if (ctx->xv_ck_info.source == CK_SRC_SET) {
xv_atom = XInternAtom(display, "XV_COLORKEY", False);
rez = XvSetPortAttribute(display, ctx->xv_port, xv_atom,
vo->opts->vo.colorkey);
vo->opts->colorkey);
if (rez != Success) {
mp_msg(MSGT_VO, MSGL_FATAL, "[xv] Couldn't set colorkey!\n");
return 0; // error setting colorkey

View File

@ -150,7 +150,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
break;
}
case WM_SIZING:
if (vo_keepaspect && !vo->opts->vo.fs && vo->otps->vo.WinID < 0) {
if (vo_keepaspect && !vo->opts->fs && vo->otps->vo.WinID < 0) {
RECT *rc = (RECT*)lParam;
// get client area of the windows if it had the rect rc
// (subtracting the window borders)
@ -215,11 +215,11 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
break;
}
case WM_LBUTTONDOWN:
if (!vo_nomouse_input && (vo->opts->vo.fs || (wParam & MK_CONTROL))) {
if (!vo_nomouse_input && (vo->opts->fs || (wParam & MK_CONTROL))) {
mplayer_put_key(vo->key_fifo, MP_MOUSE_BTN0 | mod_state(vo));
break;
}
if (!vo->opts->vo.fs) {
if (!vo->opts->fs) {
ReleaseCapture();
SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
return 0;
@ -281,7 +281,7 @@ int vo_w32_check_events(struct vo *vo)
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
if (vo->opts->vo.WinID >= 0) {
if (vo->opts->WinID >= 0) {
BOOL res;
RECT r;
POINT p;
@ -295,7 +295,7 @@ int vo_w32_check_events(struct vo *vo)
if (p.x != w32->window_x || p.y != w32->window_y) {
w32->window_x = p.x; w32->window_y = p.y;
}
res = GetClientRect(WIN_ID_TO_HWND(vo->opts->vo.WinID), &r);
res = GetClientRect(WIN_ID_TO_HWND(vo->opts->WinID), &r);
if (res && (r.right != vo->dwidth || r.bottom != vo->dheight))
MoveWindow(w32->window, 0, 0, r.right, r.bottom, FALSE);
if (!IsWindow(WIN_ID_TO_HWND(vo->otps->vo.WinID)))
@ -313,8 +313,8 @@ static BOOL CALLBACK mon_enum(HMONITOR hmon, HDC hdc, LPRECT r, LPARAM p)
// this defaults to the last screen if specified number does not exist
vo->xinerama_x = r->left;
vo->xinerama_y = r->top;
vo->opts->vo.screenwidth = r->right - r->left;
vo->opts->vo.screenheight = r->bottom - r->top;
vo->opts->screenwidth = r->right - r->left;
vo->opts->screenheight = r->bottom - r->top;
if (w32->mon_cnt == w32->mon_id)
return FALSE;
w32->mon_cnt++;
@ -338,17 +338,17 @@ 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;
int screen = opts->vo.fs ? opts->vo.fsscreen_id : opts->vo.screen_id;
struct mp_vo_opts *opts = vo->opts;
int screen = opts->fs ? opts->fsscreen_id : opts->screen_id;
vo->xinerama_x = vo->xinerama_y = 0;
if (opts->vo.fs && screen == -2) {
if (opts->fs && screen == -2) {
int tmp;
vo->xinerama_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
vo->xinerama_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
tmp = GetSystemMetrics(SM_CXVIRTUALSCREEN);
if (tmp) vo->opts->vo.screenwidth = tmp;
if (tmp) vo->opts->screenwidth = tmp;
tmp = GetSystemMetrics(SM_CYVIRTUALSCREEN);
if (tmp) vo->opts->vo.screenheight = tmp;
if (tmp) vo->opts->screenheight = tmp;
} else if (screen == -1) {
MONITORINFO mi;
HMONITOR m = MonitorFromWindow(w32->window, MONITOR_DEFAULTTOPRIMARY);
@ -356,15 +356,15 @@ void w32_update_xinerama_info(struct vo *vo)
GetMonitorInfoW(m, &mi);
vo->xinerama_x = mi.rcMonitor.left;
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;
vo->opts->screenwidth = mi.rcMonitor.right - mi.rcMonitor.left;
vo->opts->screenheight = mi.rcMonitor.bottom - mi.rcMonitor.top;
} else if (screen >= 0) {
w32->mon_cnt = 0;
w32->mon_id = screen;
EnumDisplayMonitors(NULL, NULL, mon_enum, (LONG_PTR)vo);
}
aspect_save_screenres(vo, vo->opts->vo.screenwidth,
vo->opts->vo.screenheight);
aspect_save_screenres(vo, vo->opts->screenwidth,
vo->opts->screenheight);
}
static void updateScreenProperties(struct vo *vo)
@ -380,8 +380,8 @@ static void updateScreenProperties(struct vo *vo)
return;
}
vo->opts->vo.screenwidth = dm.dmPelsWidth;
vo->opts->vo.screenheight = dm.dmPelsHeight;
vo->opts->screenwidth = dm.dmPelsWidth;
vo->opts->screenheight = dm.dmPelsHeight;
w32_update_xinerama_info(vo);
}
@ -390,7 +390,7 @@ static DWORD update_style(struct vo *vo, DWORD style)
const DWORD NO_FRAME = WS_POPUP;
const DWORD FRAME = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
style &= ~(NO_FRAME | FRAME);
style |= (vo_border && !vo->opts->vo.fs) ? FRAME : NO_FRAME;
style |= (vo_border && !vo->opts->fs) ? FRAME : NO_FRAME;
return style;
}
@ -401,30 +401,30 @@ static int reinit_window_state(struct vo *vo)
HWND layer = HWND_NOTOPMOST;
RECT r;
if (vo->opts->vo.WinID >= 0)
if (vo->opts->WinID >= 0)
return 1;
wchar_t *title = mp_from_utf8(NULL, vo_get_window_title(vo));
SetWindowTextW(w32->window, title);
talloc_free(title);
bool toggle_fs = w32->current_fs != vo->opts->vo.fs;
w32->current_fs = vo->opts->vo.fs;
bool toggle_fs = w32->current_fs != vo->opts->fs;
w32->current_fs = vo->opts->fs;
DWORD style = update_style(vo, GetWindowLong(w32->window, GWL_STYLE));
if (vo->opts->vo.fs || vo->opts->vo.ontop)
if (vo->opts->fs || vo->opts->ontop)
layer = HWND_TOPMOST;
// xxx not sure if this can trigger any unwanted messages (WM_MOVE/WM_SIZE)
if (vo->opts->vo.fs) {
if (vo->opts->fs) {
while (ShowCursor(0) >= 0) /**/ ;
} else {
while (ShowCursor(1) < 0) /**/ ;
}
updateScreenProperties(vo);
if (vo->opts->vo.fs) {
if (vo->opts->fs) {
// Save window position and size when switching to fullscreen.
if (toggle_fs) {
w32->prev_width = vo->dwidth;
@ -434,8 +434,8 @@ static int reinit_window_state(struct vo *vo)
mp_msg(MSGT_VO, MSGL_V, "[vo] save window bounds: %d:%d:%d:%d\n",
w32->prev_x, w32->prev_y, w32->prev_width, w32->prev_height);
}
vo->dwidth = vo->opts->vo.screenwidth;
vo->dheight = vo->opts->vo.screenheight;
vo->dwidth = vo->opts->screenwidth;
vo->dheight = vo->opts->screenheight;
w32->window_x = vo->xinerama_x;
w32->window_y = vo->xinerama_y;
} else {
@ -519,7 +519,7 @@ int vo_w32_config(struct vo *vo, uint32_t width, uint32_t height,
w32->o_dheight = height;
// the desired size is ignored in wid mode, it always matches the window size.
if (vo->opts->vo.WinID < 0) {
if (vo->opts->WinID < 0) {
if (w32->window_bounds_initialized) {
// restore vo_dwidth/vo_dheight, which are reset against our will
// in vo_config()
@ -544,7 +544,7 @@ int vo_w32_config(struct vo *vo, uint32_t width, uint32_t height,
}
}
vo->opts->vo.fs = flags & VOFLAG_FULLSCREEN;
vo->opts->fs = flags & VOFLAG_FULLSCREEN;
return reinit_window_state(vo);
}
@ -594,15 +594,15 @@ int vo_w32_init(struct vo *vo)
return 0;
}
if (vo->opts->vo.WinID >= 0) {
if (vo->opts->WinID >= 0) {
RECT r;
GetClientRect(WIN_ID_TO_HWND(vo->opts->vo.WinID), &r);
GetClientRect(WIN_ID_TO_HWND(vo->opts->WinID), &r);
vo->dwidth = r.right; vo->dheight = r.bottom;
w32->window = CreateWindowExW(WS_EX_NOPARENTNOTIFY, classname,
classname,
WS_CHILD | WS_VISIBLE,
0, 0, vo->dwidth, vo->dheight,
WIN_ID_TO_HWND(vo->opts->vo.WinID),
WIN_ID_TO_HWND(vo->opts->WinID),
0, hInstance, vo);
} else {
w32->window = CreateWindowExW(0, classname,
@ -617,7 +617,7 @@ int vo_w32_init(struct vo *vo)
return 0;
}
if (vo->opts->vo.WinID >= 0)
if (vo->opts->WinID >= 0)
EnableWindow(w32->window, 0);
// we don't have proper event handling
@ -626,7 +626,7 @@ int vo_w32_init(struct vo *vo)
updateScreenProperties(vo);
mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d\n",
vo->opts->vo.screenwidth, vo->opts->vo.screenheight);
vo->opts->screenwidth, vo->opts->screenheight);
return 1;
}
@ -643,7 +643,7 @@ int vo_w32_init(struct vo *vo)
void vo_w32_fullscreen(struct vo *vo)
{
vo->opts->vo.fs = !vo->opts->vo.fs;
vo->opts->fs = !vo->opts->fs;
reinit_window_state(vo);
}
@ -665,7 +665,7 @@ void vo_w32_border(struct vo *vo)
*/
void vo_w32_ontop(struct vo *vo)
{
vo->opts->vo.ontop = !vo->opts->vo.ontop;
vo->opts->ontop = !vo->opts->ontop;
reinit_window_state(vo);
}

View File

@ -889,9 +889,9 @@ void vo_wayland_ontop (struct vo *vo)
{
struct vo_wayland_state *wl = vo->wayland;
vo->opts->vo.ontop = !vo->opts->vo.ontop;
vo->opts->ontop = !vo->opts->ontop;
if (vo->opts->vo.fs)
if (vo->opts->fs)
vo_wayland_fullscreen(vo);
/* use the already existing code to leave fullscreen mode and go into
* toplevel mode */
@ -918,7 +918,7 @@ void vo_wayland_fullscreen (struct vo *vo)
struct wl_output *fs_output = wl->display->fs_output;
if (!vo->opts->vo.fs) {
if (!vo->opts->fs) {
wl->window->p_width = wl->window->width;
wl->window->p_height = wl->window->height;
wl_shell_surface_set_fullscreen(wl->window->shell_surface,
@ -926,7 +926,7 @@ void vo_wayland_fullscreen (struct vo *vo)
0, fs_output);
wl->window->type = TYPE_FULLSCREEN;
vo->opts->vo.fs = true;
vo->opts->fs = true;
hide_cursor(wl->display);
}
@ -936,7 +936,7 @@ void vo_wayland_fullscreen (struct vo *vo)
ssurface_schedule_resize(wl->window, wl->window->p_width,
wl->window->p_height);
wl->window->type = TYPE_TOPLEVEL;
vo->opts->vo.fs = false;
vo->opts->fs = false;
show_cursor(wl->display);
}
@ -981,7 +981,7 @@ int vo_wayland_check_events (struct vo *vo)
void vo_wayland_update_screeninfo (struct vo *vo)
{
struct vo_wayland_state *wl = vo->wayland;
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
wl_display_roundtrip(wl->display->display);
if (!wl->display->output_mode_received)
@ -996,7 +996,7 @@ void vo_wayland_update_screeninfo (struct vo *vo)
struct vo_wayland_output *fsscreen_output = NULL;
wl_list_for_each_reverse(output, &wl->display->output_list, link) {
if (opts->vo.fsscreen_id == screen_id)
if (opts->fsscreen_id == screen_id)
fsscreen_output = output;
if (!first_output)
@ -1007,19 +1007,19 @@ void vo_wayland_update_screeninfo (struct vo *vo)
if (fsscreen_output) {
wl->display->fs_output = fsscreen_output->output;
opts->vo.screenwidth = fsscreen_output->width;
opts->vo.screenheight = fsscreen_output->height;
opts->screenwidth = fsscreen_output->width;
opts->screenheight = fsscreen_output->height;
}
else {
wl->display->fs_output = NULL; /* current output is always 0 */
if (first_output) {
opts->vo.screenwidth = first_output->width;
opts->vo.screenheight = first_output->height;
opts->screenwidth = first_output->width;
opts->screenheight = first_output->height;
}
}
aspect_save_screenres(vo, opts->vo.screenwidth, opts->vo.screenheight);
aspect_save_screenres(vo, opts->screenwidth, opts->screenheight);
}
void vo_wayland_update_window_title(struct vo *vo)

View File

@ -183,7 +183,7 @@ static void vo_hidecursor(struct vo *vo, Display *disp, Window win)
Colormap colormap;
const char bm_no_data[] = {0, 0, 0, 0, 0, 0, 0, 0};
if (vo->opts->vo.WinID == 0)
if (vo->opts->WinID == 0)
return; // do not hide if playing on the root window
colormap = DefaultColormap(disp, DefaultScreen(disp));
@ -200,7 +200,7 @@ static void vo_hidecursor(struct vo *vo, Display *disp, Window win)
static void vo_showcursor(struct vo *vo, Display *disp, Window win)
{
if (vo->opts->vo.WinID == 0)
if (vo->opts->WinID == 0)
return;
XDefineCursor(disp, win, 0);
}
@ -308,7 +308,7 @@ static int vo_wm_detect(struct vo *vo)
unsigned long nitems;
Atom *args = NULL;
if (vo->opts->vo.WinID >= 0)
if (vo->opts->WinID >= 0)
return 0;
// -- supports layers
@ -372,19 +372,19 @@ static void init_atoms(struct vo_x11_state *x11)
void vo_x11_update_screeninfo(struct vo *vo)
{
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
bool all_screens = opts->vo.fs && opts->vo.fsscreen_id == -2;
bool all_screens = opts->fs && opts->fsscreen_id == -2;
vo->xinerama_x = vo->xinerama_y = 0;
if (all_screens) {
opts->vo.screenwidth = x11->ws_width;
opts->vo.screenheight = x11->ws_height;
opts->screenwidth = x11->ws_width;
opts->screenheight = x11->ws_height;
}
#ifdef CONFIG_XINERAMA
if (opts->vo.screen_id >= -1 && XineramaIsActive(x11->display) &&
if (opts->screen_id >= -1 && XineramaIsActive(x11->display) &&
!all_screens)
{
int screen = opts->vo.fs ? opts->vo.fsscreen_id : opts->vo.screen_id;
int screen = opts->fs ? opts->fsscreen_id : opts->screen_id;
XineramaScreenInfo *screens;
int num_screens;
@ -405,20 +405,20 @@ void vo_x11_update_screeninfo(struct vo *vo)
}
if (screen < 0)
screen = 0;
opts->vo.screenwidth = screens[screen].width;
opts->vo.screenheight = screens[screen].height;
opts->screenwidth = screens[screen].width;
opts->screenheight = screens[screen].height;
vo->xinerama_x = screens[screen].x_org;
vo->xinerama_y = screens[screen].y_org;
XFree(screens);
}
#endif
aspect_save_screenres(vo, opts->vo.screenwidth, opts->vo.screenheight);
aspect_save_screenres(vo, opts->screenwidth, opts->screenheight);
}
int vo_x11_init(struct vo *vo)
{
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
char *dispName;
assert(!vo->x11);
@ -454,16 +454,16 @@ int vo_x11_init(struct vo *vo)
init_atoms(vo->x11);
x11->ws_width = opts->vo.screenwidth;
x11->ws_height = opts->vo.screenheight;
x11->ws_width = opts->screenwidth;
x11->ws_height = opts->screenheight;
if (!x11->ws_width)
x11->ws_width = DisplayWidth(x11->display, x11->screen);
if (!x11->ws_height)
x11->ws_height = DisplayHeight(x11->display, x11->screen);
opts->vo.screenwidth = x11->ws_width;
opts->vo.screenheight = x11->ws_height;
opts->screenwidth = x11->ws_width;
opts->screenheight = x11->ws_height;
if (strncmp(dispName, "unix:", 5) == 0)
dispName += 4;
@ -474,7 +474,7 @@ int vo_x11_init(struct vo *vo)
else
x11->display_is_local = 0;
mp_msg(MSGT_VO, MSGL_V, "vo: X11 running at %dx%d (\"%s\" => %s display)\n",
opts->vo.screenwidth, opts->vo.screenheight, dispName,
opts->screenwidth, opts->screenheight, dispName,
x11->display_is_local ? "local" : "remote");
x11->wm_type = vo_wm_detect(vo);
@ -483,7 +483,7 @@ int vo_x11_init(struct vo *vo)
fstype_dump(x11->fs_type);
if (opts->vo.stop_screensaver)
if (opts->stop_screensaver)
saver_off(x11);
vo->event_fd = ConnectionNumber(x11->display);
@ -567,10 +567,10 @@ static void vo_x11_decoration(struct vo *vo, int d)
Atom vo_MotifHints;
MotifWmHints vo_MotifWmHints;
if (!vo->opts->vo.WinID)
if (!vo->opts->WinID)
return;
if (vo->opts->vo.fsmode & 8) {
if (vo->opts->fsmode & 8) {
XSetTransientForHint(x11->display, x11->window,
RootWindow(x11->display, x11->screen));
}
@ -601,23 +601,23 @@ static void vo_x11_decoration(struct vo *vo, int d)
d = x11->olddecor;
}
vo_MotifWmHints.decorations =
d | ((vo->opts->vo.fsmode & 2) ? MWM_DECOR_MENU : 0);
d | ((vo->opts->fsmode & 2) ? MWM_DECOR_MENU : 0);
XChangeProperty(x11->display, x11->window, vo_MotifHints,
vo_MotifHints, 32,
PropModeReplace,
(unsigned char *) &vo_MotifWmHints,
(vo->opts->vo.fsmode & 4) ? 4 : 5);
(vo->opts->fsmode & 4) ? 4 : 5);
}
}
static void vo_x11_classhint(struct vo *vo, Window window, const char *name)
{
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
XClassHint wmClass;
pid_t pid = getpid();
wmClass.res_name = opts->vo.winname ? opts->vo.winname : (char *)name;
wmClass.res_name = opts->winname ? opts->winname : (char *)name;
wmClass.res_class = "mpv";
XSetClassHint(x11->display, window, &wmClass);
XChangeProperty(x11->display, window, x11->XA_NET_WM_PID, XA_CARDINAL,
@ -653,7 +653,7 @@ void vo_x11_uninit(struct vo *vo)
XDestroyIC(x11->xic);
if (x11->colormap != None)
XFreeColormap(vo->x11->display, x11->colormap);
vo->opts->vo.fs = false;
vo->opts->fs = false;
mp_msg(MSGT_VO, MSGL_V, "vo: uninit ...\n");
if (x11->xim)
@ -668,13 +668,13 @@ void vo_x11_uninit(struct vo *vo)
static void vo_x11_unhide_cursor(struct vo *vo)
{
struct vo_x11_state *x11 = vo->x11;
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
if (opts->vo.cursor_autohide_delay > -2) {
if (opts->cursor_autohide_delay > -2) {
vo_showcursor(vo, x11->display, x11->window);
if (opts->vo.cursor_autohide_delay >= 0) {
if (opts->cursor_autohide_delay >= 0) {
x11->mouse_waiting_hide = 1;
x11->mouse_timer = GetTimerMS() + opts->vo.cursor_autohide_delay;
x11->mouse_timer = GetTimerMS() + opts->cursor_autohide_delay;
}
}
}
@ -703,7 +703,7 @@ int vo_x11_check_events(struct vo *vo)
xscreensaver_heartbeat(vo->x11);
if (vo->opts->vo.WinID > 0)
if (vo->opts->WinID > 0)
vo_x11_update_geometry(vo);
while (XPending(display)) {
XNextEvent(display, &Event);
@ -798,7 +798,7 @@ int vo_x11_check_events(struct vo *vo)
vo->next_wakeup_time = FFMIN(vo->next_wakeup_time, x11->mouse_timer);
update_vo_size(vo);
if (vo->opts->vo.WinID >= 0 && (x11->pending_vo_events & VO_EVENT_RESIZE)) {
if (vo->opts->WinID >= 0 && (x11->pending_vo_events & VO_EVENT_RESIZE)) {
int x = x11->win_x, y = x11->win_y;
unsigned int w = x11->win_width, h = x11->win_height;
XMoveResizeWindow(x11->display, x11->window, x, y, w, h);
@ -811,17 +811,17 @@ int vo_x11_check_events(struct vo *vo)
static void vo_x11_sizehint(struct vo *vo, int x, int y, int width, int height,
bool override_pos)
{
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
bool force_pos = opts->vo.geometry.xy_valid || // explicitly forced by user
opts->vo.force_window_position || // resize -> reset position
opts->vo.screen_id >= 0 || // force onto screen area
vo->opts->vo.WinID >= 0 || // force to fill parent
override_pos; // for fullscreen and such
bool force_pos = opts->geometry.xy_valid || // explicitly forced by user
opts->force_window_position || // resize -> reset position
opts->screen_id >= 0 || // force onto screen area
opts->WinID >= 0 || // force to fill parent
override_pos; // for fullscreen and such
x11->vo_hint.flags = 0;
if (vo->opts->vo.keepaspect) {
if (opts->keepaspect) {
x11->vo_hint.flags |= PAspect;
x11->vo_hint.min_aspect.x = width;
x11->vo_hint.min_aspect.y = height;
@ -960,7 +960,7 @@ static void vo_x11_create_window(struct vo *vo, XVisualInfo *vis, int x, int y,
XSetWindowAttributes xswa;
setup_window_params(x11, vis, &xswamask, &xswa);
Window parent = vo->opts->vo.WinID >= 0 ? vo->opts->vo.WinID : x11->rootwin;
Window parent = vo->opts->WinID >= 0 ? vo->opts->WinID : x11->rootwin;
x11->window =
XCreateWindow(x11->display, parent, x, y, w, h, 0, vis->depth,
@ -984,7 +984,7 @@ static void vo_x11_map_window(struct vo *vo, int x, int y, int w, int h)
x11->window_hidden = false;
vo_x11_move_resize(vo, true, true, x, y, w, h);
if (!vo->opts->vo.border)
if (!vo->opts->border)
vo_x11_decoration(vo, 0);
// map window
vo_x11_selectinput_witherr(vo, x11->display, x11->window,
@ -1008,11 +1008,11 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
unsigned int width, unsigned int height, int flags,
const char *classname)
{
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
if (opts->vo.WinID >= 0) {
XSelectInput(x11->display, opts->vo.WinID, StructureNotifyMask);
if (opts->WinID >= 0) {
XSelectInput(x11->display, opts->WinID, StructureNotifyMask);
vo_x11_update_geometry(vo);
x = x11->win_x; y = x11->win_y;
width = x11->win_width; height = x11->win_height;
@ -1020,7 +1020,7 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
if (x11->window == None) {
vo_x11_create_window(vo, vis, x, y, width, height);
vo_x11_classhint(vo, x11->window, classname);
opts->vo.fs = 0;
opts->fs = 0;
x11->window_hidden = true;
}
@ -1028,8 +1028,8 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
return;
vo_x11_update_window_title(vo);
if (opts->vo.ontop)
vo_x11_setlayer(vo, x11->window, opts->vo.ontop);
if (opts->ontop)
vo_x11_setlayer(vo, x11->window, opts->ontop);
bool reset_size = !(x11->old_dwidth == width && x11->old_dheight == height);
if (x11->window_hidden) {
@ -1049,12 +1049,12 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
if (x11->window_hidden) {
vo_x11_map_window(vo, x, y, width, height);
} else if (reset_size) {
bool reset_pos = opts->vo.force_window_position;
bool reset_pos = opts->force_window_position;
if (reset_pos) {
x11->nofs_x = x;
x11->nofs_y = y;
}
if (opts->vo.fs) {
if (opts->fs) {
x11->size_changed_during_fs = true;
x11->pos_changed_during_fs = reset_pos;
vo_x11_sizehint(vo, x, y, width, height, false);
@ -1063,7 +1063,7 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
}
}
if (!!opts->vo.fs != !!(flags & VOFLAG_FULLSCREEN)) {
if (!!opts->fs != !!(flags & VOFLAG_FULLSCREEN)) {
vo_x11_fullscreen(vo);
}
@ -1109,11 +1109,11 @@ void vo_x11_clearwindow_part(struct vo *vo, Window vo_window,
void vo_x11_clearwindow(struct vo *vo, Window vo_window)
{
struct vo_x11_state *x11 = vo->x11;
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
if (x11->f_gc == None)
return;
XFillRectangle(x11->display, vo_window, x11->f_gc, 0, 0,
opts->vo.screenwidth, opts->vo.screenheight);
opts->screenwidth, opts->screenheight);
XFlush(x11->display);
}
@ -1121,7 +1121,7 @@ void vo_x11_clearwindow(struct vo *vo, Window vo_window)
static void vo_x11_setlayer(struct vo *vo, Window vo_window, int layer)
{
struct vo_x11_state *x11 = vo->x11;
if (vo->opts->vo.WinID >= 0)
if (vo->opts->WinID >= 0)
return;
if (x11->fs_type & vo_wm_LAYER) {
@ -1181,7 +1181,7 @@ static int vo_x11_get_fs_type(struct vo *vo)
{
struct vo_x11_state *x11 = vo->x11;
int type = x11->wm_type;
char **fstype_list = vo->opts->vo.fstype_list;
char **fstype_list = vo->opts->fstype_list;
int i;
if (fstype_list) {
@ -1247,14 +1247,14 @@ static void vo_x11_update_geometry(struct vo *vo)
unsigned w, h, dummy_uint;
int dummy_int;
Window dummy_win;
Window win = vo->opts->vo.WinID >= 0 ? vo->opts->vo.WinID : x11->window;
Window win = vo->opts->WinID >= 0 ? vo->opts->WinID : x11->window;
XGetGeometry(x11->display, win, &dummy_win, &dummy_int, &dummy_int,
&w, &h, &dummy_int, &dummy_uint);
if (w <= INT_MAX && h <= INT_MAX) {
x11->win_width = w;
x11->win_height = h;
}
if (vo->opts->vo.WinID >= 0) {
if (vo->opts->WinID >= 0) {
x11->win_x = 0;
x11->win_y = 0;
} else {
@ -1265,20 +1265,20 @@ static void vo_x11_update_geometry(struct vo *vo)
void vo_x11_fullscreen(struct vo *vo)
{
struct MPOpts *opts = vo->opts;
struct mp_vo_opts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
int x, y, w, h;
if (opts->vo.WinID >= 0) {
opts->vo.fs = !opts->vo.fs;
if (opts->WinID >= 0) {
opts->fs = !opts->fs;
return;
}
if (x11->fs_flip)
return;
if (opts->vo.fs) {
if (opts->fs) {
// fs->win
opts->vo.fs = VO_FALSE;
opts->fs = VO_FALSE;
x = x11->nofs_x;
y = x11->nofs_y;
@ -1286,7 +1286,7 @@ void vo_x11_fullscreen(struct vo *vo)
h = x11->nofs_height;
vo_x11_ewmh_fullscreen(x11, _NET_WM_STATE_REMOVE); // removes fullscreen state if wm supports EWMH
if ((x11->fs_type & vo_wm_FULLSCREEN) && opts->vo.fsscreen_id != -1) {
if ((x11->fs_type & vo_wm_FULLSCREEN) && opts->fsscreen_id != -1) {
x11->size_changed_during_fs = true;
x11->pos_changed_during_fs = true;
}
@ -1297,7 +1297,7 @@ void vo_x11_fullscreen(struct vo *vo)
}
} else {
// win->fs
opts->vo.fs = true;
opts->fs = true;
vo_x11_update_geometry(vo);
x11->nofs_x = x11->win_x;
@ -1309,10 +1309,10 @@ void vo_x11_fullscreen(struct vo *vo)
x = vo->xinerama_x;
y = vo->xinerama_y;
w = opts->vo.screenwidth;
h = opts->vo.screenheight;
w = opts->screenwidth;
h = opts->screenheight;
if ((x11->fs_type & vo_wm_FULLSCREEN) && opts->vo.fsscreen_id != -1) {
if ((x11->fs_type & vo_wm_FULLSCREEN) && opts->fsscreen_id != -1) {
// The EWMH fullscreen hint always works on the current screen, so
// change the current screen forcibly.
// This was observed to work under IceWM, but not Unity/Compiz and
@ -1331,23 +1331,23 @@ void vo_x11_fullscreen(struct vo *vo)
else
x11->old_gravity = x11->vo_hint.win_gravity;
}
if (x11->wm_type == 0 && !(vo->opts->vo.fsmode & 16)) {
if (x11->wm_type == 0 && !(vo->opts->fsmode & 16)) {
XUnmapWindow(x11->display, x11->window); // required for MWM
XWithdrawWindow(x11->display, x11->window, x11->screen);
x11->fs_flip = 1;
}
if (!(x11->fs_type & vo_wm_FULLSCREEN)) { // not needed with EWMH fs
vo_x11_decoration(vo, opts->vo.border && !opts->vo.fs);
vo_x11_decoration(vo, opts->border && !opts->fs);
vo_x11_sizehint(vo, x, y, w, h, true);
vo_x11_setlayer(vo, x11->window, opts->vo.fs);
vo_x11_setlayer(vo, x11->window, opts->fs);
XMoveResizeWindow(x11->display, x11->window, x, y, w, h);
}
/* some WMs lose ontop after fullscreen */
if ((!(opts->vo.fs)) & opts->vo.ontop)
vo_x11_setlayer(vo, x11->window, opts->vo.ontop);
if ((!(opts->fs)) & opts->ontop)
vo_x11_setlayer(vo, x11->window, opts->ontop);
XMapRaised(x11->display, x11->window);
if (!(x11->fs_type & vo_wm_FULLSCREEN)) // some WMs change window pos on map
@ -1361,16 +1361,16 @@ void vo_x11_fullscreen(struct vo *vo)
void vo_x11_ontop(struct vo *vo)
{
struct MPOpts *opts = vo->opts;
opts->vo.ontop = !opts->vo.ontop;
struct mp_vo_opts *opts = vo->opts;
opts->ontop = !opts->ontop;
vo_x11_setlayer(vo, vo->x11->window, opts->vo.ontop);
vo_x11_setlayer(vo, vo->x11->window, opts->ontop);
}
void vo_x11_border(struct vo *vo)
{
vo->opts->vo.border = !vo->opts->vo.border;
vo_x11_decoration(vo, vo->opts->vo.border && !vo->opts->vo.fs);
vo->opts->border = !vo->opts->border;
vo_x11_decoration(vo, vo->opts->border && !vo->opts->fs);
}
static void xscreensaver_heartbeat(struct vo_x11_state *x11)
@ -1468,7 +1468,7 @@ static void vo_x11_selectinput_witherr(struct vo *vo,
Window w,
long event_mask)
{
if (vo->opts->vo.nomouse_input)
if (vo->opts->nomouse_input)
event_mask &= ~(ButtonPressMask | ButtonReleaseMask);
XSelectInput(display, w, NoEventMask);