Commit 49db3f70 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

vout: win32: CommonControl: Allow some controls on UWP/WinRT

parent f19d1c8d
......@@ -607,11 +607,67 @@ static int CommonControlSetFullscreen(vout_display_t *vd, bool is_fullscreen)
return VLC_SUCCESS;
}
static void DisableScreensaver(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
/* disable screensaver by temporarily changing system settings */
sys->i_spi_screensaveactive = 0;
if (var_GetBool(vd, "disable-screensaver")) {
msg_Dbg(vd, "disabling screen saver");
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0,
&sys->i_spi_screensaveactive, 0);
if (FALSE != sys->i_spi_screensaveactive) {
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, NULL, 0);
}
}
}
static void RestoreScreensaver(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
/* restore screensaver system settings */
if (0 != sys->i_spi_screensaveactive) {
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,
sys->i_spi_screensaveactive, NULL, 0);
}
}
#else
void CommonManage(vout_display_t *vd) {
UpdateRects(vd, NULL, NULL, false);
}
void CommonClean(vout_display_t *vd) {}
void CommonDisplay(vout_display_t *vd) {}
void CommonChangeThumbnailClip(vout_display_t *vd, bool show) {}
#endif
int CommonControl(vout_display_t *vd, int query, va_list args)
{
vout_display_sys_t *sys = vd->sys;
switch (query) {
case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: /* const vout_display_cfg_t *p_cfg */
case VOUT_DISPLAY_CHANGE_ZOOM: /* const vout_display_cfg_t *p_cfg */
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: /* const video_format_t *p_source */
case VOUT_DISPLAY_CHANGE_SOURCE_CROP: { /* const video_format_t *p_source */
const vout_display_cfg_t *cfg;
if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP ||
query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT) {
const video_format_t *source = va_arg(args, const video_format_t *);
cfg = vd->cfg;
UpdateRects(vd, cfg, source, true);
} else {
cfg = va_arg(args, const vout_display_cfg_t *);
UpdateRects(vd, cfg, NULL, true);
}
return VLC_SUCCESS;
}
#if !VLC_WINSTORE_APP
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: /* const vout_display_cfg_t *p_cfg */
{ /* Update dimensions */
const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *);
......@@ -631,23 +687,6 @@ int CommonControl(vout_display_t *vd, int query, va_list args)
UpdateRects(vd, cfg, NULL, false);
return VLC_SUCCESS;
}
case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: /* const vout_display_cfg_t *p_cfg */
case VOUT_DISPLAY_CHANGE_ZOOM: /* const vout_display_cfg_t *p_cfg */
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: /* const video_format_t *p_source */
case VOUT_DISPLAY_CHANGE_SOURCE_CROP: { /* const video_format_t *p_source */
const vout_display_cfg_t *cfg;
if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP ||
query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT) {
const video_format_t *source = va_arg(args, const video_format_t *);
cfg = vd->cfg;
UpdateRects(vd, cfg, source, true);
} else {
cfg = va_arg(args, const vout_display_cfg_t *);
UpdateRects(vd, cfg, NULL, true);
}
return VLC_SUCCESS;
}
case VOUT_DISPLAY_CHANGE_WINDOW_STATE: { /* unsigned state */
const unsigned state = va_arg(args, unsigned);
const bool is_on_top = (state & VOUT_WINDOW_STATE_ABOVE) != 0;
......@@ -680,53 +719,8 @@ int CommonControl(vout_display_t *vd, int query, va_list args)
return VLC_SUCCESS;
case VOUT_DISPLAY_RESET_PICTURES:
vlc_assert_unreachable();
#endif
default:
return VLC_EGENERIC;
}
}
static void DisableScreensaver(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
/* disable screensaver by temporarily changing system settings */
sys->i_spi_screensaveactive = 0;
if (var_GetBool(vd, "disable-screensaver")) {
msg_Dbg(vd, "disabling screen saver");
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0,
&sys->i_spi_screensaveactive, 0);
if (FALSE != sys->i_spi_screensaveactive) {
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, NULL, 0);
}
}
}
static void RestoreScreensaver(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
/* restore screensaver system settings */
if (0 != sys->i_spi_screensaveactive) {
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,
sys->i_spi_screensaveactive, NULL, 0);
}
}
#else
int CommonControl(vout_display_t *vd, int query, va_list args)
{
switch (query) {
default:
return VLC_EGENERIC;
}
}
void CommonManage(vout_display_t *vd) {
UpdateRects(vd, NULL, NULL, false);
}
void CommonClean(vout_display_t *vd) {}
void CommonDisplay(vout_display_t *vd) {}
void CommonChangeThumbnailClip(vout_display_t *vd, bool show) {}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment