mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 16:33:02 +00:00
x11: fix external fullscreen update
On x11, you can change the fullscreen via the window manager and without mpv's involvement. In these cases, the internal fullscreen flag has to be updated. The hack used for this didn't really work properly. Change it accordingly. The important thing is that the shadow copy of the option is updated. This is still not really ideal. Fixes #3570.
This commit is contained in:
parent
3a43682355
commit
caa14e3d45
@ -28,6 +28,7 @@
|
|||||||
#include "options/options.h"
|
#include "options/options.h"
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
#include "common/encode.h"
|
#include "common/encode.h"
|
||||||
|
#include "options/m_config.h"
|
||||||
#include "options/m_property.h"
|
#include "options/m_property.h"
|
||||||
#include "common/playlist.h"
|
#include "common/playlist.h"
|
||||||
#include "input/input.h"
|
#include "input/input.h"
|
||||||
@ -722,6 +723,14 @@ static void handle_vo_events(struct MPContext *mpctx)
|
|||||||
mp_notify(mpctx, MP_EVENT_WIN_RESIZE, NULL);
|
mp_notify(mpctx, MP_EVENT_WIN_RESIZE, NULL);
|
||||||
if (events & VO_EVENT_WIN_STATE)
|
if (events & VO_EVENT_WIN_STATE)
|
||||||
mp_notify(mpctx, MP_EVENT_WIN_STATE, NULL);
|
mp_notify(mpctx, MP_EVENT_WIN_STATE, NULL);
|
||||||
|
if (events & VO_EVENT_FULLSCREEN_STATE) {
|
||||||
|
// The only purpose of this is to update the fullscreen flag on the
|
||||||
|
// playloop side if it changes "from outside" on the VO.
|
||||||
|
int fs = mpctx->opts->vo->fullscreen;
|
||||||
|
vo_control(vo, VOCTRL_GET_FULLSCREEN, &fs);
|
||||||
|
m_config_set_option_raw_direct(mpctx->mconfig,
|
||||||
|
m_config_get_co(mpctx->mconfig, bstr0("fullscreen")), &fs, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_sstep(struct MPContext *mpctx)
|
static void handle_sstep(struct MPContext *mpctx)
|
||||||
|
@ -43,9 +43,12 @@ enum {
|
|||||||
VO_EVENT_AMBIENT_LIGHTING_CHANGED = 1 << 4,
|
VO_EVENT_AMBIENT_LIGHTING_CHANGED = 1 << 4,
|
||||||
// Special mechanism for making resizing with Cocoa react faster
|
// Special mechanism for making resizing with Cocoa react faster
|
||||||
VO_EVENT_LIVE_RESIZING = 1 << 5,
|
VO_EVENT_LIVE_RESIZING = 1 << 5,
|
||||||
|
// Window fullscreen state changed via external influence.
|
||||||
|
VO_EVENT_FULLSCREEN_STATE = 1 << 6,
|
||||||
|
|
||||||
// Set of events the player core may be interested in.
|
// Set of events the player core may be interested in.
|
||||||
VO_EVENTS_USER = (VO_EVENT_RESIZE | VO_EVENT_WIN_STATE),
|
VO_EVENTS_USER = VO_EVENT_RESIZE | VO_EVENT_WIN_STATE |
|
||||||
|
VO_EVENT_FULLSCREEN_STATE,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum mp_voctrl {
|
enum mp_voctrl {
|
||||||
@ -75,6 +78,8 @@ enum mp_voctrl {
|
|||||||
VOCTRL_BORDER,
|
VOCTRL_BORDER,
|
||||||
VOCTRL_ALL_WORKSPACES,
|
VOCTRL_ALL_WORKSPACES,
|
||||||
|
|
||||||
|
VOCTRL_GET_FULLSCREEN,
|
||||||
|
|
||||||
VOCTRL_UPDATE_WINDOW_TITLE, // char*
|
VOCTRL_UPDATE_WINDOW_TITLE, // char*
|
||||||
VOCTRL_UPDATE_PLAYBACK_STATE, // struct voctrl_playback_state*
|
VOCTRL_UPDATE_PLAYBACK_STATE, // struct voctrl_playback_state*
|
||||||
|
|
||||||
|
@ -977,17 +977,6 @@ static void vo_x11_update_composition_hint(struct vo *vo)
|
|||||||
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&hint, 1);
|
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&hint, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maximally awful hack to get MPOpts.vo.fullscreen set. The awful part is that
|
|
||||||
// this sets a variable which is accessed by command.c without synchronization
|
|
||||||
// (and which isn't supposed to need any). The need for this is that there's no
|
|
||||||
// way to update this flag in any other way at all.
|
|
||||||
static void set_global_fs_flag(struct vo *vo, int fs)
|
|
||||||
{
|
|
||||||
struct m_config *rootconfig = mp_get_root_config(vo->global);
|
|
||||||
struct MPOpts *opts = rootconfig->optstruct;
|
|
||||||
opts->vo->fullscreen = fs;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void vo_x11_check_net_wm_state_fullscreen_change(struct vo *vo)
|
static void vo_x11_check_net_wm_state_fullscreen_change(struct vo *vo)
|
||||||
{
|
{
|
||||||
struct vo_x11_state *x11 = vo->x11;
|
struct vo_x11_state *x11 = vo->x11;
|
||||||
@ -1013,7 +1002,7 @@ static void vo_x11_check_net_wm_state_fullscreen_change(struct vo *vo)
|
|||||||
{
|
{
|
||||||
vo->opts->fullscreen = is_fullscreen;
|
vo->opts->fullscreen = is_fullscreen;
|
||||||
x11->fs = is_fullscreen;
|
x11->fs = is_fullscreen;
|
||||||
set_global_fs_flag(vo, is_fullscreen);
|
x11->pending_vo_events |= VO_EVENT_FULLSCREEN_STATE;
|
||||||
|
|
||||||
if (!is_fullscreen && (x11->pos_changed_during_fs ||
|
if (!is_fullscreen && (x11->pos_changed_during_fs ||
|
||||||
x11->size_changed_during_fs))
|
x11->size_changed_during_fs))
|
||||||
@ -1815,6 +1804,9 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg)
|
|||||||
case VOCTRL_FULLSCREEN:
|
case VOCTRL_FULLSCREEN:
|
||||||
vo_x11_fullscreen(vo);
|
vo_x11_fullscreen(vo);
|
||||||
return VO_TRUE;
|
return VO_TRUE;
|
||||||
|
case VOCTRL_GET_FULLSCREEN:
|
||||||
|
*(int *)arg = x11->fs;
|
||||||
|
return VO_TRUE;
|
||||||
case VOCTRL_ONTOP:
|
case VOCTRL_ONTOP:
|
||||||
vo_x11_setlayer(vo, opts->ontop);
|
vo_x11_setlayer(vo, opts->ontop);
|
||||||
return VO_TRUE;
|
return VO_TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user