mirror of
https://github.com/mpv-player/mpv
synced 2025-01-11 17:39:38 +00:00
vo_sdl: use new fullscreen change mechanism
Like the other backends. (Looks relatively convoluted, because it only uses the fullscreen legacy VOCTRL, none of the others.)
This commit is contained in:
parent
c84460f61f
commit
b6fa63b01e
@ -34,6 +34,7 @@
|
|||||||
#include "input/keycodes.h"
|
#include "input/keycodes.h"
|
||||||
#include "input/input.h"
|
#include "input/input.h"
|
||||||
#include "common/msg.h"
|
#include "common/msg.h"
|
||||||
|
#include "options/m_config.h"
|
||||||
#include "options/options.h"
|
#include "options/options.h"
|
||||||
|
|
||||||
#include "osdep/timer.h"
|
#include "osdep/timer.h"
|
||||||
@ -189,6 +190,7 @@ struct priv {
|
|||||||
double osd_pts;
|
double osd_pts;
|
||||||
Uint32 wakeup_event;
|
Uint32 wakeup_event;
|
||||||
bool screensaver_enabled;
|
bool screensaver_enabled;
|
||||||
|
struct m_config_cache *opts_cache;
|
||||||
|
|
||||||
// options
|
// options
|
||||||
int allow_sw;
|
int allow_sw;
|
||||||
@ -399,7 +401,8 @@ static inline void set_screensaver(bool enabled)
|
|||||||
static void set_fullscreen(struct vo *vo)
|
static void set_fullscreen(struct vo *vo)
|
||||||
{
|
{
|
||||||
struct priv *vc = vo->priv;
|
struct priv *vc = vo->priv;
|
||||||
int fs = vo->opts->fullscreen;
|
struct mp_vo_opts *opts = vc->opts_cache->opts;
|
||||||
|
int fs = opts->fullscreen;
|
||||||
SDL_bool prev_screensaver_state = SDL_IsScreenSaverEnabled();
|
SDL_bool prev_screensaver_state = SDL_IsScreenSaverEnabled();
|
||||||
|
|
||||||
Uint32 fs_flag;
|
Uint32 fs_flag;
|
||||||
@ -812,6 +815,8 @@ static int preinit(struct vo *vo)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vc->opts_cache = m_config_cache_alloc(vc, vo->global, &vo_sub_opts);
|
||||||
|
|
||||||
// predefine SDL defaults (SDL env vars shall override)
|
// predefine SDL defaults (SDL env vars shall override)
|
||||||
SDL_SetHintWithPriority(SDL_HINT_RENDER_SCALE_QUALITY, "1",
|
SDL_SetHintWithPriority(SDL_HINT_RENDER_SCALE_QUALITY, "1",
|
||||||
SDL_HINT_DEFAULT);
|
SDL_HINT_DEFAULT);
|
||||||
@ -927,9 +932,15 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
|||||||
struct priv *vc = vo->priv;
|
struct priv *vc = vo->priv;
|
||||||
|
|
||||||
switch (request) {
|
switch (request) {
|
||||||
case VOCTRL_FULLSCREEN:
|
case VOCTRL_VO_OPTS_CHANGED: {
|
||||||
set_fullscreen(vo);
|
void *opt;
|
||||||
|
while (m_config_cache_get_next_changed(vc->opts_cache, &opt)) {
|
||||||
|
struct mp_vo_opts *opts = vc->opts_cache->opts;
|
||||||
|
if (&opts->fullscreen == opt)
|
||||||
|
set_fullscreen(vo);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
case VOCTRL_REDRAW_FRAME:
|
case VOCTRL_REDRAW_FRAME:
|
||||||
draw_image(vo, NULL);
|
draw_image(vo, NULL);
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user