diff options
author | wm4 <wm4@nowhere> | 2019-11-29 13:49:33 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-11-29 13:56:58 +0100 |
commit | 40c2f2eeb05f83176d325d4efd7a2e1635447f04 (patch) | |
tree | 8cd822c02ba57aac71b4e7891990f64d739cf9d6 /player/command.c | |
parent | d37e461eab16f990751d3ab9a459cad600e3b510 (diff) | |
download | mpv-40c2f2eeb05f83176d325d4efd7a2e1635447f04.tar.bz2 mpv-40c2f2eeb05f83176d325d4efd7a2e1635447f04.tar.xz |
command: change window-minimized/window-maximized to options
Unfortunately, this breaks window state reporting for all VOs which
supported it. This can be fixed later (for x11 in the next commit).
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 54 |
1 files changed, 4 insertions, 50 deletions
diff --git a/player/command.c b/player/command.c index 10359e2352..9e42b8367d 100644 --- a/player/command.c +++ b/player/command.c @@ -2289,54 +2289,6 @@ static void update_window_scale(struct MPContext *mpctx) vo_control(vo, VOCTRL_SET_UNFS_WINDOW_SIZE, s); } -static int mp_property_win_minimized(void *ctx, struct m_property *prop, - int action, void *arg) -{ - MPContext *mpctx = ctx; - struct vo *vo = mpctx->video_out; - if (!vo) - return M_PROPERTY_UNAVAILABLE; - - int state = 0; - if (vo_control(vo, VOCTRL_GET_WIN_STATE, &state) < 1) - return M_PROPERTY_UNAVAILABLE; - - switch (action) { - case M_PROPERTY_SET: - vo_control(vo, VOCTRL_MINIMIZE, 0); - return M_PROPERTY_OK; - case M_PROPERTY_GET: - case M_PROPERTY_GET_TYPE: - return m_property_flag_ro(action, arg, state & VO_WIN_STATE_MINIMIZED); - default: - return M_PROPERTY_NOT_IMPLEMENTED; - } -} - -static int mp_property_win_maximized(void *ctx, struct m_property *prop, - int action, void *arg) -{ - MPContext *mpctx = ctx; - struct vo *vo = mpctx->video_out; - if (!vo) - return M_PROPERTY_UNAVAILABLE; - - int state = 0; - if (vo_control(vo, VOCTRL_GET_WIN_STATE, &state) < 1) - return M_PROPERTY_UNAVAILABLE; - - switch (action) { - case M_PROPERTY_SET: - vo_control(vo, VOCTRL_MAXIMIZE, 0); - return M_PROPERTY_OK; - case M_PROPERTY_GET: - case M_PROPERTY_GET_TYPE: - return m_property_flag_ro(action, arg, state & VO_WIN_STATE_MAXIMIZED); - default: - return M_PROPERTY_NOT_IMPLEMENTED; - } -} - static int mp_property_display_fps(void *ctx, struct m_property *prop, int action, void *arg) { @@ -3439,8 +3391,6 @@ static const struct m_property mp_properties_base[] = { PROPERTY_BITRATE("audio-bitrate", false, STREAM_AUDIO), PROPERTY_BITRATE("sub-bitrate", false, STREAM_SUB), - {"window-minimized", mp_property_win_minimized}, - {"window-maximized", mp_property_win_maximized}, {"display-names", mp_property_display_names}, {"display-fps", mp_property_display_fps}, {"estimated-display-fps", mp_property_estimated_display_fps}, @@ -6220,6 +6170,10 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags, vo_control(mpctx->video_out, VOCTRL_BORDER, 0); if (opt_ptr == &opts->vo->all_workspaces) vo_control(mpctx->video_out, VOCTRL_ALL_WORKSPACES, 0); + if (opt_ptr == &opts->vo->window_minimized) + vo_control(mpctx->video_out, VOCTRL_MINIMIZE, 0); + if (opt_ptr == &opts->vo->window_maximized) + vo_control(mpctx->video_out, VOCTRL_MAXIMIZE, 0); } if (opt_ptr == &opts->vo->taskbar_progress) |