mirror of
https://github.com/mpv-player/mpv
synced 2025-01-03 13:32:16 +00:00
x11: extend --x11-bypass-compositor with fs-only option
The "fs-only" choice sets the _NET_WM_BYPASS_COMPOSITOR to 1 if the window is fullscreened, and 0 otherwise. (0 is specified to be the implicit default - i.e. no change is requested in windowed mode.) In particular, change the default to "fs-only". Fixes #2582.
This commit is contained in:
parent
f54e555d27
commit
8a26e139af
@ -460,7 +460,8 @@ const m_option_t mp_opts[] = {
|
||||
#if HAVE_X11
|
||||
OPT_CHOICE("x11-netwm", vo.x11_netwm, 0,
|
||||
({"auto", 0}, {"no", -1}, {"yes", 1})),
|
||||
OPT_FLAG("x11-bypass-compositor", vo.x11_bypass_compositor, 0),
|
||||
OPT_CHOICE("x11-bypass-compositor", vo.x11_bypass_compositor, 0,
|
||||
({"no", 0}, {"yes", 1}, {"fs-only", 2})),
|
||||
#endif
|
||||
#if HAVE_WIN32
|
||||
OPT_STRING("vo-mmcss-profile", vo.mmcss_profile, M_OPT_FIXED),
|
||||
@ -712,7 +713,7 @@ const struct MPOpts mp_default_opts = {
|
||||
.fit_border = 1,
|
||||
.WinID = -1,
|
||||
.window_scale = 1.0,
|
||||
.x11_bypass_compositor = 0,
|
||||
.x11_bypass_compositor = 2,
|
||||
.mmcss_profile = "Playback",
|
||||
},
|
||||
.allow_win_drag = 1,
|
||||
|
@ -950,6 +950,21 @@ static int get_mods(unsigned int state)
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
static void vo_x11_update_composition_hint(struct vo *vo)
|
||||
{
|
||||
struct vo_x11_state *x11 = vo->x11;
|
||||
|
||||
long hint = 0;
|
||||
switch (vo->opts->x11_bypass_compositor) {
|
||||
case 0: hint = 0; break; // leave default
|
||||
case 1: hint = 1; break; // always bypass
|
||||
case 2: hint = x11->fs ? 1 : 0; break; // bypass in FS
|
||||
}
|
||||
|
||||
XChangeProperty(x11->display, x11->window, XA(x11,_NET_WM_BYPASS_COMPOSITOR),
|
||||
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&hint, 1);
|
||||
}
|
||||
|
||||
static void vo_x11_check_net_wm_state_fullscreen_change(struct vo *vo)
|
||||
{
|
||||
struct vo_x11_state *x11 = vo->x11;
|
||||
@ -986,6 +1001,8 @@ static void vo_x11_check_net_wm_state_fullscreen_change(struct vo *vo)
|
||||
|
||||
x11->size_changed_during_fs = false;
|
||||
x11->pos_changed_during_fs = false;
|
||||
|
||||
vo_x11_update_composition_hint(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1437,12 +1454,7 @@ static void vo_x11_create_window(struct vo *vo, XVisualInfo *vis,
|
||||
}
|
||||
|
||||
if (!x11->parent) {
|
||||
if (vo->opts->x11_bypass_compositor) {
|
||||
long v = 1; // request disabling compositor
|
||||
XChangeProperty(x11->display, x11->window,
|
||||
XA(x11,_NET_WM_BYPASS_COMPOSITOR), XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char *)&v, 1);
|
||||
}
|
||||
vo_x11_update_composition_hint(vo);
|
||||
vo_x11_set_wm_icon(x11);
|
||||
vo_x11_update_window_title(vo);
|
||||
vo_x11_dnd_init_window(vo);
|
||||
@ -1485,6 +1497,8 @@ static void vo_x11_map_window(struct vo *vo, struct mp_rect rc)
|
||||
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&v, 1);
|
||||
}
|
||||
|
||||
vo_x11_update_composition_hint(vo);
|
||||
|
||||
// map window
|
||||
int events = StructureNotifyMask | ExposureMask | PropertyChangeMask |
|
||||
LeaveWindowMask | EnterWindowMask;
|
||||
@ -1731,6 +1745,8 @@ static void vo_x11_fullscreen(struct vo *vo)
|
||||
|
||||
x11->size_changed_during_fs = false;
|
||||
x11->pos_changed_during_fs = false;
|
||||
|
||||
vo_x11_update_composition_hint(vo);
|
||||
}
|
||||
|
||||
int vo_x11_control(struct vo *vo, int *events, int request, void *arg)
|
||||
|
Loading…
Reference in New Issue
Block a user