Commit 3952212c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vout: remove display-level window state except on Windows and OS/2

parent 6444fb21
...@@ -189,7 +189,9 @@ enum { ...@@ -189,7 +189,9 @@ enum {
VOUT_DISPLAY_EVENT_PICTURES_INVALID, /* The buffer are now invalid and need to be changed */ VOUT_DISPLAY_EVENT_PICTURES_INVALID, /* The buffer are now invalid and need to be changed */
VOUT_DISPLAY_EVENT_FULLSCREEN, VOUT_DISPLAY_EVENT_FULLSCREEN,
#if defined(_WIN32) || defined(__OS2__)
VOUT_DISPLAY_EVENT_WINDOW_STATE, VOUT_DISPLAY_EVENT_WINDOW_STATE,
#endif
VOUT_DISPLAY_EVENT_DISPLAY_SIZE, /* The display size need to change : int i_width, int i_height */ VOUT_DISPLAY_EVENT_DISPLAY_SIZE, /* The display size need to change : int i_width, int i_height */
...@@ -360,10 +362,12 @@ static inline void vout_display_SendEventFullscreen(vout_display_t *vd, bool is_ ...@@ -360,10 +362,12 @@ static inline void vout_display_SendEventFullscreen(vout_display_t *vd, bool is_
{ {
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_FULLSCREEN, is_fullscreen); vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_FULLSCREEN, is_fullscreen);
} }
#if defined(_WIN32)
static inline void vout_display_SendWindowState(vout_display_t *vd, unsigned state) static inline void vout_display_SendWindowState(vout_display_t *vd, unsigned state)
{ {
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_WINDOW_STATE, state); vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_WINDOW_STATE, state);
} }
#endif
/* The mouse position (State and Moved event) must be expressed against vout_display_t::source unit */ /* The mouse position (State and Moved event) must be expressed against vout_display_t::source unit */
static inline void vout_display_SendEventMouseState(vout_display_t *vd, int x, int y, int button_mask) static inline void vout_display_SendEventMouseState(vout_display_t *vd, int x, int y, int button_mask)
{ {
......
...@@ -62,7 +62,9 @@ static inline void vout_display_Display(vout_display_t *vd, ...@@ -62,7 +62,9 @@ static inline void vout_display_Display(vout_display_t *vd,
*/ */
typedef struct { typedef struct {
vout_display_cfg_t cfg; vout_display_cfg_t cfg;
#if defined(_WIN32) || defined(__OS2__)
unsigned wm_state; unsigned wm_state;
#endif
struct { struct {
int num; int num;
int den; int den;
......
...@@ -337,7 +337,6 @@ struct vout_display_owner_sys_t { ...@@ -337,7 +337,6 @@ struct vout_display_owner_sys_t {
/* */ /* */
vout_display_cfg_t cfg; vout_display_cfg_t cfg;
unsigned wm_state_initial;
struct { struct {
unsigned num; unsigned num;
unsigned den; unsigned den;
...@@ -361,10 +360,11 @@ struct vout_display_owner_sys_t { ...@@ -361,10 +360,11 @@ struct vout_display_owner_sys_t {
unsigned num; unsigned num;
unsigned den; unsigned den;
} zoom; } zoom;
#if defined(_WIN32) || defined(__OS2__)
bool ch_wm_state; bool ch_wm_state;
unsigned wm_state; unsigned wm_state;
unsigned wm_state_initial;
#endif
bool ch_sar; bool ch_sar;
struct { struct {
unsigned num; unsigned num;
...@@ -681,7 +681,7 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args) ...@@ -681,7 +681,7 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
vlc_mutex_unlock(&osys->lock); vlc_mutex_unlock(&osys->lock);
break; break;
} }
#if defined(_WIN32) || defined(__OS2__)
case VOUT_DISPLAY_EVENT_WINDOW_STATE: { case VOUT_DISPLAY_EVENT_WINDOW_STATE: {
const unsigned state = va_arg(args, unsigned); const unsigned state = va_arg(args, unsigned);
...@@ -695,7 +695,7 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args) ...@@ -695,7 +695,7 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
vlc_mutex_unlock(&osys->lock); vlc_mutex_unlock(&osys->lock);
break; break;
} }
#endif
case VOUT_DISPLAY_EVENT_DISPLAY_SIZE: { case VOUT_DISPLAY_EVENT_DISPLAY_SIZE: {
const int width = (int)va_arg(args, int); const int width = (int)va_arg(args, int);
const int height = (int)va_arg(args, int); const int height = (int)va_arg(args, int);
...@@ -857,9 +857,11 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures) ...@@ -857,9 +857,11 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
bool is_fullscreen = osys->is_fullscreen; bool is_fullscreen = osys->is_fullscreen;
osys->ch_fullscreen = false; osys->ch_fullscreen = false;
#if defined(_WIN32) || defined(__OS2__)
bool ch_wm_state = osys->ch_wm_state; bool ch_wm_state = osys->ch_wm_state;
unsigned wm_state = osys->wm_state; unsigned wm_state = osys->wm_state;
osys->ch_wm_state = false; osys->ch_wm_state = false;
#endif
bool ch_display_size = osys->ch_display_size; bool ch_display_size = osys->ch_display_size;
int display_width = osys->display_width; int display_width = osys->display_width;
...@@ -881,7 +883,9 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures) ...@@ -881,7 +883,9 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
!reset_pictures && !reset_pictures &&
!osys->ch_display_filled && !osys->ch_display_filled &&
!osys->ch_zoom && !osys->ch_zoom &&
#if defined(_WIN32) || defined(__OS2__)
!ch_wm_state && !ch_wm_state &&
#endif
!osys->ch_sar && !osys->ch_sar &&
!osys->ch_crop) { !osys->ch_crop) {
...@@ -980,6 +984,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures) ...@@ -980,6 +984,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
vout_SendEventZoom(osys->vout, osys->cfg.zoom.num, osys->cfg.zoom.den); vout_SendEventZoom(osys->vout, osys->cfg.zoom.num, osys->cfg.zoom.den);
} }
#if defined(_WIN32) || defined(__OS2__)
/* */ /* */
if (ch_wm_state) { if (ch_wm_state) {
if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_WINDOW_STATE, wm_state)) { if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_WINDOW_STATE, wm_state)) {
...@@ -991,6 +996,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures) ...@@ -991,6 +996,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
/* */ /* */
vout_SendEventOnTop(osys->vout, osys->wm_state_initial); vout_SendEventOnTop(osys->vout, osys->wm_state_initial);
} }
#endif
/* */ /* */
if (osys->ch_sar) { if (osys->ch_sar) {
video_format_t source = vd->source; video_format_t source = vd->source;
...@@ -1286,7 +1292,6 @@ static vout_display_t *DisplayNew(vout_thread_t *vout, ...@@ -1286,7 +1292,6 @@ static vout_display_t *DisplayNew(vout_thread_t *vout,
vout_display_cfg_t *cfg = &osys->cfg; vout_display_cfg_t *cfg = &osys->cfg;
*cfg = state->cfg; *cfg = state->cfg;
osys->wm_state_initial = -1;
osys->sar_initial.num = state->sar.num; osys->sar_initial.num = state->sar.num;
osys->sar_initial.den = state->sar.den; osys->sar_initial.den = state->sar.den;
vout_display_GetDefaultDisplaySize(&cfg->display.width, &cfg->display.height, vout_display_GetDefaultDisplaySize(&cfg->display.width, &cfg->display.height,
...@@ -1317,9 +1322,14 @@ static vout_display_t *DisplayNew(vout_thread_t *vout, ...@@ -1317,9 +1322,14 @@ static vout_display_t *DisplayNew(vout_thread_t *vout,
&osys->height_saved, &osys->height_saved,
source, &cfg_windowed); source, &cfg_windowed);
} }
osys->zoom.num = cfg->zoom.num; osys->zoom.num = cfg->zoom.num;
osys->zoom.den = cfg->zoom.den; osys->zoom.den = cfg->zoom.den;
#if defined(_WIN32) || defined(__OS2__)
osys->wm_state_initial = VOUT_WINDOW_STATE_NORMAL;
osys->wm_state = state->wm_state; osys->wm_state = state->wm_state;
osys->ch_wm_state = true;
#endif
osys->fit_window = 0; osys->fit_window = 0;
osys->event.fifo = NULL; osys->event.fifo = NULL;
...@@ -1363,8 +1373,6 @@ static vout_display_t *DisplayNew(vout_thread_t *vout, ...@@ -1363,8 +1373,6 @@ static vout_display_t *DisplayNew(vout_thread_t *vout,
if (osys->sar.num != source->i_sar_num || if (osys->sar.num != source->i_sar_num ||
osys->sar.den != source->i_sar_den) osys->sar.den != source->i_sar_den)
osys->ch_sar = true; osys->ch_sar = true;
if (osys->wm_state != osys->wm_state_initial)
osys->ch_wm_state = true;
return p_display; return p_display;
} }
...@@ -1376,7 +1384,9 @@ void vout_DeleteDisplay(vout_display_t *vd, vout_display_state_t *state) ...@@ -1376,7 +1384,9 @@ void vout_DeleteDisplay(vout_display_t *vd, vout_display_state_t *state)
if (state) { if (state) {
if (!osys->is_wrapper ) if (!osys->is_wrapper )
state->cfg = osys->cfg; state->cfg = osys->cfg;
#if defined(_WIN32) || defined(__OS2__)
state->wm_state = osys->wm_state; state->wm_state = osys->wm_state;
#endif
state->sar.num = osys->sar_initial.num; state->sar.num = osys->sar_initial.num;
state->sar.den = osys->sar_initial.den; state->sar.den = osys->sar_initial.den;
} }
......
...@@ -1269,11 +1269,12 @@ static void ThreadChangeWindowState(vout_thread_t *vout, unsigned state) ...@@ -1269,11 +1269,12 @@ static void ThreadChangeWindowState(vout_thread_t *vout, unsigned state)
if (window != NULL) if (window != NULL)
vout_window_SetState(window, state); vout_window_SetState(window, state);
else #if defined(_WIN32) || defined(__OS2__)
else /* FIXME: remove this event */
if (vout->p->display.vd != NULL) if (vout->p->display.vd != NULL)
/* FIXME: remove this event, fix MSW and OS/2 window providers */
vout_display_SendEvent(vout->p->display.vd, vout_display_SendEvent(vout->p->display.vd,
VOUT_DISPLAY_EVENT_WINDOW_STATE, state); VOUT_DISPLAY_EVENT_WINDOW_STATE, state);
#endif
} }
static void ThreadChangeDisplayFilled(vout_thread_t *vout, bool is_filled) static void ThreadChangeDisplayFilled(vout_thread_t *vout, bool is_filled)
...@@ -1353,12 +1354,14 @@ static int ThreadStart(vout_thread_t *vout, const vout_display_state_t *state) ...@@ -1353,12 +1354,14 @@ static int ThreadStart(vout_thread_t *vout, const vout_display_state_t *state)
var_Create(vout, "video-wallpaper", VLC_VAR_BOOL|VLC_VAR_DOINHERIT); var_Create(vout, "video-wallpaper", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
VoutGetDisplayCfg(vout, &state_default.cfg, vout->p->display.title); VoutGetDisplayCfg(vout, &state_default.cfg, vout->p->display.title);
#if defined(_WIN32) || defined(__OS2__)
bool below = var_InheritBool(vout, "video-wallpaper"); bool below = var_InheritBool(vout, "video-wallpaper");
bool above = var_CreateGetBool(vout, "video-on-top"); bool above = var_CreateGetBool(vout, "video-on-top");
state_default.wm_state = below ? VOUT_WINDOW_STATE_BELOW state_default.wm_state = below ? VOUT_WINDOW_STATE_BELOW
: above ? VOUT_WINDOW_STATE_ABOVE : above ? VOUT_WINDOW_STATE_ABOVE
: VOUT_WINDOW_STATE_NORMAL; : VOUT_WINDOW_STATE_NORMAL;
#endif
state_default.sar.num = 0; state_default.sar.num = 0;
state_default.sar.den = 0; state_default.sar.den = 0;
......
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