mirror of https://github.com/mpv-player/mpv
video: remove fullscreen flags chaos
There was a MPOpts fullscreen field, a mp_vo_opts.fs field, and VOFLAG_FULLSCREEN. Remove all these and introduce a mp_vo_opts.fullscreen flag instead. When VOs receive VOCTRL_FULLSCREEN, they are supposed to set the current fullscreen mode to the state in mp_vo_opts.fullscreen. They also should do this implicitly on config(). VOs which are capable of doing so can update the mp_vo_opts.fullscreen if the actual fullscreen mode changes (e.g. if the user uses the window manager controls). If fullscreen mode switching fails, they can also set mp_vo_opts.fullscreen to the actual state. Note that the X11 backend does almost none of this, and it has a private fs flag to store the fullscreen flag, instead of getting it from the WM. (Possibly because it has to deal with broken WMs.) The fullscreen option has to be checked on config() to deal with the -fs option, especially with something like: mpv --fs file1.mkv --{ --no-fs file2.mkv --} (It should start in fullscreen mode, but go to windowed mode when playing file2.mkv.) Wayland changes by: Alexander Preisinger <alexander.preisinger@gmail.com> Cocoa changes by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
This commit is contained in:
parent
05cf512dc5
commit
c4b08a9a11
|
@ -1032,12 +1032,11 @@ static int mp_property_fullscreen(m_option_t *prop,
|
|||
struct mp_vo_opts *opts = mpctx->video_out->opts;
|
||||
|
||||
if (action == M_PROPERTY_SET) {
|
||||
if (opts->fs == !!*(int *) arg)
|
||||
return M_PROPERTY_OK;
|
||||
int val = *(int *)arg;
|
||||
opts->fullscreen = val;
|
||||
if (mpctx->video_out->config_ok)
|
||||
vo_control(mpctx->video_out, VOCTRL_FULLSCREEN, 0);
|
||||
mpctx->opts.fullscreen = opts->fs;
|
||||
return M_PROPERTY_OK;
|
||||
return opts->fullscreen == val ? M_PROPERTY_OK : M_PROPERTY_ERROR;
|
||||
}
|
||||
return mp_property_generic_option(prop, action, arg, mpctx);
|
||||
}
|
||||
|
|
|
@ -553,8 +553,8 @@ const m_option_t mp_opts[] = {
|
|||
OPT_FLOATRANGE("monitoraspect", vo.force_monitor_aspect, 0, 0.0, 9.0),
|
||||
OPT_FLOATRANGE("monitorpixelaspect", vo.monitor_pixel_aspect, 0, 0.2, 9.0),
|
||||
// start in fullscreen mode:
|
||||
OPT_FLAG("fullscreen", fullscreen, 0),
|
||||
OPT_FLAG("fs", fullscreen, 0),
|
||||
OPT_FLAG("fullscreen", vo.fullscreen, 0),
|
||||
OPT_FLAG("fs", vo.fullscreen, 0),
|
||||
// set fullscreen switch method (workaround for buggy WMs)
|
||||
OPT_INTRANGE("fsmode-dontuse", vo.fsmode, 0, 31, 4096),
|
||||
OPT_INT("colorkey", vo.colorkey, 0),
|
||||
|
@ -731,7 +731,6 @@ const struct MPOpts mp_default_opts = {
|
|||
.cursor_autohide_delay = 1000,
|
||||
.monitor_pixel_aspect = 1.0,
|
||||
.panscanrange = 1.0,
|
||||
.fs = false,
|
||||
.screen_id = -1,
|
||||
.fsscreen_id = -1,
|
||||
.nomouse_input = 0,
|
||||
|
|
|
@ -11,7 +11,7 @@ typedef struct mp_vo_opts {
|
|||
int screenwidth;
|
||||
int screenheight;
|
||||
int ontop;
|
||||
bool fs;
|
||||
int fullscreen;
|
||||
int screen_id;
|
||||
int fsscreen_id;
|
||||
char *winname;
|
||||
|
@ -71,7 +71,6 @@ typedef struct MPOpts {
|
|||
int gamma_hue;
|
||||
|
||||
int stop_screensaver;
|
||||
int fullscreen;
|
||||
int requested_colorspace;
|
||||
int requested_input_range;
|
||||
int requested_output_range;
|
||||
|
|
|
@ -162,8 +162,7 @@ int mpcodecs_reconfig_vo(sh_video_t *sh, const struct mp_image_params *params)
|
|||
// Make sure the user-overrides are consistent (no RGB csp for YUV, etc.).
|
||||
mp_image_params_guess_csp(&p);
|
||||
|
||||
vocfg_flags = (opts->fullscreen ? VOFLAG_FULLSCREEN : 0) |
|
||||
(flip ? VOFLAG_FLIPPING : 0);
|
||||
vocfg_flags = (flip ? VOFLAG_FLIPPING : 0);
|
||||
|
||||
// Time to config libvo!
|
||||
mp_msg(MSGT_CPLAYER, MSGL_V,
|
||||
|
|
|
@ -45,11 +45,10 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *p, int flags
|
|||
}
|
||||
|
||||
const vo_info_t *info = video_out->driver->info;
|
||||
mp_msg(MSGT_CPLAYER, MSGL_INFO, "VO: [%s] %dx%d => %dx%d %s %s%s\n",
|
||||
mp_msg(MSGT_CPLAYER, MSGL_INFO, "VO: [%s] %dx%d => %dx%d %s %s\n",
|
||||
info->short_name,
|
||||
p->w, p->h, p->d_w, p->d_h,
|
||||
vo_format_name(p->imgfmt),
|
||||
(flags & VOFLAG_FULLSCREEN) ? " [fs]" : "",
|
||||
(flags & VOFLAG_FLIPPING) ? " [flip]" : "");
|
||||
mp_msg(MSGT_CPLAYER, MSGL_V, "VO: Description: %s\n", info->name);
|
||||
mp_msg(MSGT_CPLAYER, MSGL_V, "VO: Author: %s\n", info->author);
|
||||
|
|
|
@ -162,7 +162,7 @@ static void vo_cocoa_set_cursor_visibility(struct vo *vo, bool visible)
|
|||
if (visible) {
|
||||
// show cursor unconditionally
|
||||
CGDisplayShowCursor(kCGDirectMainDisplay);
|
||||
} else if (vo->opts->fs &&
|
||||
} else if (vo->opts->fullscreen &&
|
||||
[s->view containsCurrentMouseLocation] &&
|
||||
![s->view hasMouseDown]) {
|
||||
// only hide cursor if in fullscreen and the video view contains the
|
||||
|
@ -179,7 +179,7 @@ void vo_cocoa_uninit(struct vo *vo)
|
|||
enable_power_management(vo);
|
||||
[NSApp setPresentationOptions:NSApplicationPresentationDefault];
|
||||
|
||||
if (vo->opts->fs)
|
||||
if (vo->opts->fullscreen)
|
||||
[[s->view window] release];
|
||||
|
||||
[s->window release];
|
||||
|
@ -332,9 +332,6 @@ static void create_window(struct vo *vo, uint32_t d_width, uint32_t d_height,
|
|||
[s->window makeKeyAndOrderFront:nil];
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
if (flags & VOFLAG_FULLSCREEN)
|
||||
vo_cocoa_fullscreen(vo);
|
||||
|
||||
vo_set_level(vo, opts->ontop);
|
||||
|
||||
if (opts->native_fs) {
|
||||
|
@ -392,7 +389,7 @@ static void update_window(struct vo *vo)
|
|||
struct vo_cocoa_state *s = vo->cocoa;
|
||||
|
||||
if (!CGSizeEqualToSize(s->current_video_size, s->previous_video_size)) {
|
||||
if (vo->opts->fs) {
|
||||
if (vo->opts->fullscreen) {
|
||||
// we will resize as soon as we get out of fullscreen
|
||||
s->out_fs_resize = YES;
|
||||
} else {
|
||||
|
@ -404,7 +401,7 @@ static void update_window(struct vo *vo)
|
|||
|
||||
cocoa_set_window_title(vo, vo_get_window_title(vo));
|
||||
|
||||
resize_window(vo);
|
||||
vo_cocoa_fullscreen(vo);
|
||||
}
|
||||
|
||||
static void resize_redraw(struct vo *vo, int width, int height)
|
||||
|
@ -681,25 +678,23 @@ int vo_cocoa_cgl_color_size(struct vo *vo)
|
|||
// Go use the fullscreen API selected by the user. View-based or Mission
|
||||
// Control.
|
||||
if (opts->native_fs) {
|
||||
[self toggleMissionControlFullScreen:!opts->fs];
|
||||
[self toggleMissionControlFullScreen:opts->fullscreen];
|
||||
} else {
|
||||
[self toggleViewFullscreen:!opts->fs];
|
||||
[self toggleViewFullscreen:opts->fullscreen];
|
||||
}
|
||||
|
||||
// Do common work such as setting mouse visibility and actually setting
|
||||
// the new fullscreen state
|
||||
if (!opts->fs) {
|
||||
opts->fs = VO_TRUE;
|
||||
if (opts->fullscreen) {
|
||||
vo_cocoa_set_cursor_visibility(self.videoOutput, false);
|
||||
} else {
|
||||
opts->fs = VO_FALSE;
|
||||
vo_cocoa_set_cursor_visibility(self.videoOutput, true);
|
||||
}
|
||||
|
||||
// Change window size if the core attempted to change it while we were in
|
||||
// fullscreen. For example config() might have been called as a result of
|
||||
// a new file changing the window size.
|
||||
if (!opts->fs && s->out_fs_resize) {
|
||||
if (!opts->fullscreen && s->out_fs_resize) {
|
||||
resize_window_from_stored_size(self.videoOutput);
|
||||
s->out_fs_resize = NO;
|
||||
}
|
||||
|
@ -722,7 +717,7 @@ int vo_cocoa_cgl_color_size(struct vo *vo)
|
|||
- (BOOL)isMovableByWindowBackground
|
||||
{
|
||||
if (self.videoOutput) {
|
||||
return !self.videoOutput->opts->fs;
|
||||
return !self.videoOutput->opts->fullscreen;
|
||||
} else {
|
||||
return YES;
|
||||
}
|
||||
|
@ -736,7 +731,7 @@ int vo_cocoa_cgl_color_size(struct vo *vo)
|
|||
|
||||
- (void)mulSize:(float)multiplier
|
||||
{
|
||||
if (!self.videoOutput->opts->fs) {
|
||||
if (!self.videoOutput->opts->fullscreen) {
|
||||
NSSize size = {
|
||||
.width = self.videoOutput->cocoa->aspdat.prew * multiplier,
|
||||
.height = self.videoOutput->cocoa->aspdat.preh * multiplier
|
||||
|
|
|
@ -50,6 +50,9 @@ static void egl_resize_func(struct vo_wayland_state *wl,
|
|||
int32_t x, y;
|
||||
float temp_aspect = width / (float) MPMAX(height, 1);
|
||||
|
||||
if (!ctx->egl_window)
|
||||
return;
|
||||
|
||||
/* get the real window size of the window */
|
||||
wl_egl_window_get_attached_size(ctx->egl_window,
|
||||
&w->width,
|
||||
|
|
|
@ -118,7 +118,6 @@ struct voctrl_screenshot_args {
|
|||
#define VO_NOTAVAIL -2
|
||||
#define VO_NOTIMPL -3
|
||||
|
||||
#define VOFLAG_FULLSCREEN 0x01
|
||||
#define VOFLAG_FLIPPING 0x08
|
||||
#define VOFLAG_HIDDEN 0x10 //< Use to create a hidden window
|
||||
#define VOFLAG_STEREO 0x20 //< Use to create a stereo-capable window
|
||||
|
|
|
@ -367,19 +367,27 @@ static void check_resize(struct vo *vo)
|
|||
resize(vo, w, h);
|
||||
}
|
||||
|
||||
static void set_fullscreen(struct vo *vo, int fs)
|
||||
static void set_fullscreen(struct vo *vo)
|
||||
{
|
||||
struct priv *vc = vo->priv;
|
||||
int fs = vo->opts->fullscreen;
|
||||
|
||||
Uint32 fs_flags = 0;
|
||||
if (fs) {
|
||||
if (vc->switch_mode)
|
||||
fs_flags |= SDL_WINDOW_FULLSCREEN;
|
||||
else
|
||||
fs_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
}
|
||||
Uint32 fs_flag;
|
||||
if (vc->switch_mode)
|
||||
fs_flag = SDL_WINDOW_FULLSCREEN;
|
||||
else
|
||||
fs_flag = SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
|
||||
if (SDL_SetWindowFullscreen(vc->window, fs_flags)) {
|
||||
Uint32 old_flags = SDL_GetWindowFlags(vc->window);
|
||||
int prev_fs = !!(old_flags & fs_flag);
|
||||
if (fs == prev_fs)
|
||||
return;
|
||||
|
||||
Uint32 flags = 0;
|
||||
if (fs)
|
||||
flags |= fs_flag;
|
||||
|
||||
if (SDL_SetWindowFullscreen(vc->window, flags)) {
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "[sdl] SDL_SetWindowFullscreen failed\n");
|
||||
return;
|
||||
}
|
||||
|
@ -387,7 +395,6 @@ static void set_fullscreen(struct vo *vo, int fs)
|
|||
// toggling fullscreen might recreate the window, so better guard for this
|
||||
SDL_DisableScreenSaver();
|
||||
|
||||
vo->opts->fs = fs;
|
||||
force_resize(vo);
|
||||
}
|
||||
|
||||
|
@ -449,8 +456,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
|
|||
|
||||
SDL_DisableScreenSaver();
|
||||
|
||||
if (flags & VOFLAG_FULLSCREEN)
|
||||
set_fullscreen(vo, 1);
|
||||
set_fullscreen(vo);
|
||||
|
||||
SDL_SetWindowTitle(vc->window, vo_get_window_title(vo));
|
||||
|
||||
|
@ -946,7 +952,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
|||
check_events(vo);
|
||||
return 1;
|
||||
case VOCTRL_FULLSCREEN:
|
||||
set_fullscreen(vo, !vo->opts->fs);
|
||||
set_fullscreen(vo);
|
||||
return 1;
|
||||
case VOCTRL_REDRAW_FRAME:
|
||||
draw_image(vo, NULL);
|
||||
|
|
|
@ -376,7 +376,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->fs ?
|
||||
int flip_offset_ms = vo->opts->fullscreen ?
|
||||
vc->flip_offset_fs :
|
||||
vc->flip_offset_window;
|
||||
|
||||
|
|
|
@ -152,7 +152,9 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
|||
break;
|
||||
}
|
||||
case WM_SIZING:
|
||||
if (vo->opts->keepaspect && !vo->opts->fs && vo->opts->WinID < 0) {
|
||||
if (vo->opts->keepaspect && !vo->opts->fullscreen &&
|
||||
vo->opts->WinID < 0)
|
||||
{
|
||||
RECT *rc = (RECT*)lParam;
|
||||
// get client area of the windows if it had the rect rc
|
||||
// (subtracting the window borders)
|
||||
|
@ -260,7 +262,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
|||
int y = GET_Y_LPARAM(lParam);
|
||||
mouse_button |= mod_state(vo);
|
||||
if (mouse_button == (MP_MOUSE_BTN0 | MP_KEY_STATE_DOWN) &&
|
||||
!vo->opts->fs && !mp_input_test_dragging(vo->input_ctx, x, y))
|
||||
!vo->opts->fullscreen && !mp_input_test_dragging(vo->input_ctx, x, y))
|
||||
{
|
||||
// Window dragging hack
|
||||
ReleaseCapture();
|
||||
|
@ -353,9 +355,9 @@ static void w32_update_xinerama_info(struct vo *vo)
|
|||
{
|
||||
struct vo_w32_state *w32 = vo->w32;
|
||||
struct mp_vo_opts *opts = vo->opts;
|
||||
int screen = opts->fs ? opts->fsscreen_id : opts->screen_id;
|
||||
int screen = opts->fullscreen ? opts->fsscreen_id : opts->screen_id;
|
||||
vo->xinerama_x = vo->xinerama_y = 0;
|
||||
if (opts->fs && screen == -2) {
|
||||
if (opts->fullscreen && screen == -2) {
|
||||
int tmp;
|
||||
vo->xinerama_x = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
||||
vo->xinerama_y = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
||||
|
@ -403,7 +405,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->opts->border && !vo->opts->fs) ? FRAME : NO_FRAME;
|
||||
style |= (vo->opts->border && !vo->opts->fullscreen) ? FRAME : NO_FRAME;
|
||||
return style;
|
||||
}
|
||||
|
||||
|
@ -417,18 +419,18 @@ static int reinit_window_state(struct vo *vo)
|
|||
if (vo->opts->WinID >= 0)
|
||||
return 1;
|
||||
|
||||
bool toggle_fs = w32->current_fs != vo->opts->fs;
|
||||
w32->current_fs = vo->opts->fs;
|
||||
bool toggle_fs = w32->current_fs != vo->opts->fullscreen;
|
||||
w32->current_fs = vo->opts->fullscreen;
|
||||
|
||||
DWORD style = update_style(vo, GetWindowLong(w32->window, GWL_STYLE));
|
||||
|
||||
if (vo->opts->fs || vo->opts->ontop)
|
||||
if (vo->opts->fullscreen || vo->opts->ontop)
|
||||
layer = HWND_TOPMOST;
|
||||
|
||||
// xxx not sure if this can trigger any unwanted messages (WM_MOVE/WM_SIZE)
|
||||
updateScreenProperties(vo);
|
||||
|
||||
if (vo->opts->fs) {
|
||||
if (vo->opts->fullscreen) {
|
||||
// Save window position and size when switching to fullscreen.
|
||||
if (toggle_fs) {
|
||||
w32->prev_width = vo->dwidth;
|
||||
|
@ -554,7 +556,6 @@ int vo_w32_config(struct vo *vo, uint32_t width, uint32_t height,
|
|||
vo->dheight = r.bottom;
|
||||
}
|
||||
|
||||
vo->opts->fs = flags & VOFLAG_FULLSCREEN;
|
||||
return reinit_window_state(vo);
|
||||
}
|
||||
|
||||
|
@ -651,8 +652,8 @@ int vo_w32_init(struct vo *vo)
|
|||
|
||||
static void vo_w32_fullscreen(struct vo *vo)
|
||||
{
|
||||
vo->opts->fs = !vo->opts->fs;
|
||||
reinit_window_state(vo);
|
||||
if (vo->opts->fullscreen != vo->w32->current_fs)
|
||||
reinit_window_state(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -698,13 +698,11 @@ static void vo_wayland_ontop (struct vo *vo)
|
|||
struct vo_wayland_state *wl = vo->wayland;
|
||||
|
||||
vo->opts->ontop = !vo->opts->ontop;
|
||||
vo->opts->fullscreen = !vo->opts->fullscreen;
|
||||
|
||||
if (vo->opts->fs)
|
||||
vo_wayland_fullscreen(vo);
|
||||
/* use the already existing code to leave fullscreen mode and go into
|
||||
* toplevel mode */
|
||||
else
|
||||
wl_shell_surface_set_toplevel(wl->window->shell_surface);
|
||||
/* use the already existing code to leave fullscreen mode and go into
|
||||
* toplevel mode */
|
||||
vo_wayland_fullscreen(vo);
|
||||
}
|
||||
|
||||
static void vo_wayland_border (struct vo *vo)
|
||||
|
@ -726,22 +724,17 @@ static void vo_wayland_fullscreen (struct vo *vo)
|
|||
|
||||
struct wl_output *fs_output = wl->display->fs_output;
|
||||
|
||||
if (!vo->opts->fs) {
|
||||
if (vo->opts->fullscreen) {
|
||||
wl->window->p_width = wl->window->width;
|
||||
wl->window->p_height = wl->window->height;
|
||||
wl_shell_surface_set_fullscreen(wl->window->shell_surface,
|
||||
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
|
||||
0, fs_output);
|
||||
|
||||
wl->window->type = TYPE_FULLSCREEN;
|
||||
vo->opts->fs = true;
|
||||
}
|
||||
|
||||
else {
|
||||
wl_shell_surface_set_toplevel(wl->window->shell_surface);
|
||||
resize_window(wl, 0, wl->window->p_width, wl->window->p_height);
|
||||
wl->window->type = TYPE_TOPLEVEL;
|
||||
vo->opts->fs = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -881,11 +874,11 @@ bool vo_wayland_config (struct vo *vo, uint32_t d_width,
|
|||
|
||||
w->width = d_width;
|
||||
w->height = d_height;
|
||||
|
||||
w->p_width = d_width;
|
||||
w->p_height = d_height;
|
||||
w->aspect = w->width / (float) MPMAX(w->height, 1);
|
||||
|
||||
if ((VOFLAG_FULLSCREEN & flags) && w->type != TYPE_FULLSCREEN)
|
||||
vo_wayland_fullscreen(vo);
|
||||
vo_wayland_fullscreen(vo);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -29,11 +29,6 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
enum vo_wayland_window_type {
|
||||
TYPE_TOPLEVEL,
|
||||
TYPE_FULLSCREEN
|
||||
};
|
||||
|
||||
struct vo;
|
||||
struct vo_wayland_state;
|
||||
|
||||
|
@ -86,8 +81,6 @@ struct vo_wayland_window {
|
|||
|
||||
int events; /* mplayer events (VO_EVENT_RESIZE) */
|
||||
|
||||
enum vo_wayland_window_type type; /* is fullscreen */
|
||||
|
||||
/* Because the egl windows have a special resize windw function we have to
|
||||
* register it first before doing any resizing.
|
||||
* This makes us independet from the output driver */
|
||||
|
|
|
@ -381,7 +381,7 @@ static void vo_x11_update_screeninfo(struct vo *vo)
|
|||
{
|
||||
struct mp_vo_opts *opts = vo->opts;
|
||||
struct vo_x11_state *x11 = vo->x11;
|
||||
bool all_screens = opts->fs && opts->fsscreen_id == -2;
|
||||
bool all_screens = opts->fullscreen && opts->fsscreen_id == -2;
|
||||
vo->xinerama_x = vo->xinerama_y = 0;
|
||||
if (all_screens) {
|
||||
opts->screenwidth = x11->ws_width;
|
||||
|
@ -391,7 +391,7 @@ static void vo_x11_update_screeninfo(struct vo *vo)
|
|||
if (opts->screen_id >= -1 && XineramaIsActive(x11->display) &&
|
||||
!all_screens)
|
||||
{
|
||||
int screen = opts->fs ? opts->fsscreen_id : opts->screen_id;
|
||||
int screen = opts->fullscreen ? opts->fsscreen_id : opts->screen_id;
|
||||
XineramaScreenInfo *screens;
|
||||
int num_screens;
|
||||
|
||||
|
@ -665,7 +665,6 @@ void vo_x11_uninit(struct vo *vo)
|
|||
XDestroyIC(x11->xic);
|
||||
if (x11->colormap != None)
|
||||
XFreeColormap(vo->x11->display, x11->colormap);
|
||||
vo->opts->fs = false;
|
||||
|
||||
mp_msg(MSGT_VO, MSGL_V, "vo: uninit ...\n");
|
||||
if (x11->xim)
|
||||
|
@ -1024,7 +1023,6 @@ 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->fs = 0;
|
||||
x11->window_hidden = true;
|
||||
}
|
||||
|
||||
|
@ -1057,7 +1055,7 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
|
|||
x11->nofs_x = x;
|
||||
x11->nofs_y = y;
|
||||
}
|
||||
if (opts->fs) {
|
||||
if (opts->fullscreen) {
|
||||
x11->size_changed_during_fs = true;
|
||||
x11->pos_changed_during_fs = reset_pos;
|
||||
vo_x11_sizehint(vo, x, y, width, height, false);
|
||||
|
@ -1066,9 +1064,7 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
|
|||
}
|
||||
}
|
||||
|
||||
if (!!opts->fs != !!(flags & VOFLAG_FULLSCREEN)) {
|
||||
vo_x11_fullscreen(vo);
|
||||
}
|
||||
vo_x11_fullscreen(vo);
|
||||
|
||||
XSync(x11->display, False);
|
||||
|
||||
|
@ -1270,16 +1266,18 @@ static void vo_x11_fullscreen(struct vo *vo)
|
|||
struct vo_x11_state *x11 = vo->x11;
|
||||
int x, y, w, h;
|
||||
|
||||
if (opts->fullscreen == x11->fs)
|
||||
return;
|
||||
if (opts->WinID >= 0) {
|
||||
opts->fs = !opts->fs;
|
||||
x11->fs = opts->fullscreen;
|
||||
return;
|
||||
}
|
||||
if (x11->fs_flip)
|
||||
return;
|
||||
|
||||
if (opts->fs) {
|
||||
if (!opts->fullscreen) {
|
||||
// fs->win
|
||||
opts->fs = VO_FALSE;
|
||||
opts->fullscreen = x11->fs = 0;
|
||||
|
||||
x = x11->nofs_x;
|
||||
y = x11->nofs_y;
|
||||
|
@ -1298,7 +1296,7 @@ static void vo_x11_fullscreen(struct vo *vo)
|
|||
}
|
||||
} else {
|
||||
// win->fs
|
||||
opts->fs = true;
|
||||
opts->fullscreen = x11->fs = 1;
|
||||
|
||||
vo_x11_update_geometry(vo);
|
||||
x11->nofs_x = x11->win_x;
|
||||
|
@ -1339,15 +1337,15 @@ static void vo_x11_fullscreen(struct vo *vo)
|
|||
}
|
||||
|
||||
if (!(x11->fs_type & vo_wm_FULLSCREEN)) { // not needed with EWMH fs
|
||||
vo_x11_decoration(vo, opts->border && !opts->fs);
|
||||
vo_x11_decoration(vo, opts->border && !x11->fs);
|
||||
vo_x11_sizehint(vo, x, y, w, h, true);
|
||||
vo_x11_setlayer(vo, x11->window, opts->fs);
|
||||
vo_x11_setlayer(vo, x11->window, x11->fs);
|
||||
|
||||
|
||||
XMoveResizeWindow(x11->display, x11->window, x, y, w, h);
|
||||
}
|
||||
/* some WMs lose ontop after fullscreen */
|
||||
if ((!(opts->fs)) & opts->ontop)
|
||||
if ((!(x11->fs)) & opts->ontop)
|
||||
vo_x11_setlayer(vo, x11->window, opts->ontop);
|
||||
|
||||
XMapRaised(x11->display, x11->window);
|
||||
|
@ -1371,7 +1369,7 @@ static void vo_x11_ontop(struct vo *vo)
|
|||
static void vo_x11_border(struct vo *vo)
|
||||
{
|
||||
vo->opts->border = !vo->opts->border;
|
||||
vo_x11_decoration(vo, vo->opts->border && !vo->opts->fs);
|
||||
vo_x11_decoration(vo, vo->opts->border && !vo->x11->fs);
|
||||
}
|
||||
|
||||
int vo_x11_control(struct vo *vo, int *events, int request, void *arg)
|
||||
|
|
|
@ -55,6 +55,7 @@ struct vo_x11_state {
|
|||
bool window_hidden;
|
||||
int fs_flip;
|
||||
int fs_layer;
|
||||
int fs; // whether we assume the window is in fullscreen mode
|
||||
|
||||
XSizeHints vo_hint;
|
||||
bool mouse_cursor_hidden;
|
||||
|
|
Loading…
Reference in New Issue