vout_display: remove/deprecate fullscreen state
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 5 Aug 2017 20:04:57 +0000 (23:04 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 6 Aug 2017 18:26:12 +0000 (21:26 +0300)
Live window state, this was moved from display to window eight years
ago (minus one week). When the fullscreen state changes, the window
plugin emits a resize event, which triggers any necessary updates in
the display. The display does not need to know about fullscreen state
as such. But it is retained on HWND platforms due to legacy code, just
like window state before.

include/vlc_vout_display.h
modules/codec/omxil/vout.c
modules/hw/mmal/vout.c
modules/video_output/android/display.c
modules/video_output/caopengllayer.m
modules/video_output/evas.c
modules/video_output/flaschen.c
modules/video_output/ios.m
src/video_output/display.c
src/video_output/video_output.c

index 1723a5b..bbe2e9a 100644 (file)
@@ -81,7 +81,9 @@ enum {
  * Initial/Current configuration for a vout_display_t
  */
 typedef struct {
-    bool is_fullscreen;  /* Is the display fullscreen */
+#if defined(_WIN32) || defined(__OS2__)
+    bool is_fullscreen VLC_DEPRECATED;  /* Is the display fullscreen */
+#endif
 
     /* Display properties */
     struct {
@@ -145,10 +147,10 @@ enum {
      */
     VOUT_DISPLAY_RESET_PICTURES,
 
+#if defined(_WIN32) || defined(__OS2__)
     /* Ask the module to acknowledge/refuse the fullscreen state change after
      * being requested (externally or by VOUT_DISPLAY_EVENT_FULLSCREEN */
-    VOUT_DISPLAY_CHANGE_FULLSCREEN,     /* bool fs */
-#if defined(_WIN32) || defined(__OS2__)
+    VOUT_DISPLAY_CHANGE_FULLSCREEN VLC_DEPRECATED,     /* bool fs */
     /* Ask the module to acknowledge/refuse the window management state change
      * after being requested externally or by VOUT_DISPLAY_WINDOW_STATE */
     VOUT_DISPLAY_CHANGE_WINDOW_STATE VLC_DEPRECATED,   /* unsigned state */
@@ -193,8 +195,8 @@ enum {
     /* */
     VOUT_DISPLAY_EVENT_PICTURES_INVALID,    /* The buffer are now invalid and need to be changed */
 
-    VOUT_DISPLAY_EVENT_FULLSCREEN,
 #if defined(_WIN32) || defined(__OS2__)
+    VOUT_DISPLAY_EVENT_FULLSCREEN,
     VOUT_DISPLAY_EVENT_WINDOW_STATE,
 #endif
 
@@ -366,12 +368,12 @@ static inline void vout_display_SendEventKey(vout_display_t *vd, int key)
 {
     vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_KEY, key);
 }
+#if defined(_WIN32) || defined(__OS2__)
 static inline void vout_display_SendEventFullscreen(vout_display_t *vd, bool is_fullscreen,
                                                     bool is_window_fullscreen)
 {
     vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_FULLSCREEN, is_fullscreen, is_window_fullscreen);
 }
-#if defined(_WIN32) || defined(__OS2__)
 static inline void vout_display_SendWindowState(vout_display_t *vd, unsigned state)
 {
     vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_WINDOW_STATE, state);
index ffbe4f5..84d79ac 100644 (file)
@@ -457,7 +457,6 @@ static int Control(vout_display_t *vd, int query, va_list args)
         UpdateDisplaySize(vd, cfg);
         return VLC_SUCCESS;
     }
-    case VOUT_DISPLAY_CHANGE_FULLSCREEN:
     case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
     case VOUT_DISPLAY_CHANGE_ZOOM:
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
index 94f3180..1d378e3 100644 (file)
@@ -637,7 +637,6 @@ static int vd_control(vout_display_t *vd, int query, va_list args)
 
         case VOUT_DISPLAY_RESET_PICTURES:
             vlc_assert_unreachable();
-        case VOUT_DISPLAY_CHANGE_FULLSCREEN:
         case VOUT_DISPLAY_CHANGE_ZOOM:
             msg_Warn(vd, "Unsupported control query %d", query);
             break;
index eb4d89f..6757299 100644 (file)
@@ -1179,7 +1179,6 @@ static int Control(vout_display_t *vd, int query, va_list args)
 
     switch (query) {
     case VOUT_DISPLAY_HIDE_MOUSE:
-    case VOUT_DISPLAY_CHANGE_FULLSCREEN:
         return VLC_SUCCESS;
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
index a9777c6..7d129a9 100644 (file)
@@ -388,7 +388,6 @@ static int Control (vout_display_t *vd, int query, va_list ap)
             vlc_assert_unreachable ();
         default:
             msg_Err (vd, "Unhandled request %d", query);
-        case VOUT_DISPLAY_CHANGE_FULLSCREEN:
             return VLC_EGENERIC;
     }
 
index a6116af..66daaea 100644 (file)
@@ -765,8 +765,6 @@ Control( vout_display_t *vd, int i_query, va_list ap )
         }
         return VLC_SUCCESS;
     }
-    case VOUT_DISPLAY_CHANGE_FULLSCREEN:
-        return VLC_SUCCESS;
     case VOUT_DISPLAY_RESET_PICTURES:
         msg_Dbg( vd, "VOUT_DISPLAY_RESET_PICTURES" );
 
index 5e2d3ed..4ae5022 100644 (file)
@@ -238,7 +238,6 @@ static int Control(vout_display_t *vd, int query, va_list args)
     case VOUT_DISPLAY_CHANGE_ZOOM:
     case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
-    case VOUT_DISPLAY_CHANGE_FULLSCREEN:
         return VLC_EGENERIC;
 
     case VOUT_DISPLAY_HIDE_MOUSE:
index 192c99e..e4a56cb 100644 (file)
@@ -350,7 +350,6 @@ static int Control(vout_display_t *vd, int query, va_list ap)
             vlc_assert_unreachable ();
         default:
             msg_Err(vd, "Unknown request %d", query);
-        case VOUT_DISPLAY_CHANGE_FULLSCREEN:
             return VLC_EGENERIC;
     }
 }
index a629423..79b419c 100644 (file)
@@ -339,16 +339,17 @@ typedef struct {
     vlc_rational_t sar_initial;
 
     /* */
-    unsigned width_saved;
-    unsigned height_saved;
-
-    /* */
     bool ch_display_filled;
     bool is_display_filled;
 
     bool ch_zoom;
     vlc_rational_t zoom;
 #if defined(_WIN32) || defined(__OS2__)
+    unsigned width_saved;
+    unsigned height_saved;
+    bool ch_fullscreen;
+    bool is_fullscreen;
+    bool window_fullscreen;
     bool ch_wm_state;
     unsigned wm_state;
     unsigned wm_state_initial;
@@ -394,9 +395,6 @@ typedef struct {
 
     bool reset_pictures;
 
-    bool ch_fullscreen;
-    bool is_fullscreen;
-    bool window_fullscreen;
     signed char fit_window;
 
     bool ch_display_size;
@@ -655,6 +653,7 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
                                      va_arg(args, const vlc_viewpoint_t *));
         break;
 
+#if defined(_WIN32) || defined(__OS2__)
     case VOUT_DISPLAY_EVENT_FULLSCREEN: {
         const int is_fullscreen = (int)va_arg(args, int);
         const bool window_fullscreen = va_arg(args, int);
@@ -670,7 +669,7 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
         vlc_mutex_unlock(&osys->lock);
         break;
     }
-#if defined(_WIN32) || defined(__OS2__)
+
     case VOUT_DISPLAY_EVENT_WINDOW_STATE: {
         const unsigned state = va_arg(args, unsigned);
 
@@ -815,12 +814,11 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
     for (;;) {
 
         vlc_mutex_lock(&osys->lock);
-
+#if defined(_WIN32) || defined(__OS2__)
         bool ch_fullscreen  = osys->ch_fullscreen;
         bool is_fullscreen  = osys->is_fullscreen;
         osys->ch_fullscreen = false;
 
-#if defined(_WIN32) || defined(__OS2__)
         bool ch_wm_state  = osys->ch_wm_state;
         unsigned wm_state  = osys->wm_state;
         osys->ch_wm_state = false;
@@ -841,19 +839,19 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
 
         vlc_mutex_unlock(&osys->lock);
 
-        if (!ch_fullscreen &&
-            !ch_display_size &&
+        if (!ch_display_size &&
             !reset_pictures &&
             !osys->ch_display_filled &&
             !osys->ch_zoom &&
 #if defined(_WIN32) || defined(__OS2__)
+            !ch_fullscreen &&
             !ch_wm_state &&
 #endif
             !osys->ch_sar &&
             !osys->ch_crop &&
             !osys->ch_viewpoint) {
 
-            if (!osys->cfg.is_fullscreen && osys->fit_window != 0) {
+            if (osys->fit_window != 0) {
                 VoutDisplayFitWindow(vd, osys->fit_window == -1);
                 osys->fit_window = 0;
                 continue;
@@ -862,6 +860,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
         }
 
         /* */
+#if defined(_WIN32) || defined(__OS2__)
         if (ch_fullscreen) {
             if (osys->window_fullscreen
              || vout_display_Control(vd, VOUT_DISPLAY_CHANGE_FULLSCREEN,
@@ -877,15 +876,17 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
                 msg_Err(vd, "Failed to set fullscreen");
             }
         }
+#endif
 
         /* */
         if (ch_display_size) {
             vout_display_cfg_t cfg = osys->cfg;
             cfg.display.width  = display_width;
             cfg.display.height = display_height;
-
+#if defined(_WIN32) || defined(__OS2__)
             osys->width_saved  = osys->cfg.display.width;
             osys->height_saved = osys->cfg.display.height;
+#endif
 
             vout_display_Control(vd, VOUT_DISPLAY_CHANGE_DISPLAY_SIZE, &cfg);
 
@@ -1242,13 +1243,17 @@ static vout_display_t *DisplayNew(vout_thread_t *vout,
     osys->mouse.last_moved = mdate();
     osys->mouse.double_click_timeout = double_click_timeout;
     osys->mouse.hide_timeout = hide_timeout;
-    osys->is_fullscreen  = cfg->is_fullscreen;
     osys->display_width  = cfg->display.width;
     osys->display_height = cfg->display.height;
     osys->is_display_filled = cfg->is_display_filled;
+    osys->viewpoint      = cfg->viewpoint;
+
+    osys->zoom.num = cfg->zoom.num;
+    osys->zoom.den = cfg->zoom.den;
+#if defined(_WIN32) || defined(__OS2__)
+    osys->is_fullscreen  = cfg->is_fullscreen;
     osys->width_saved    = cfg->display.width;
     osys->height_saved   = cfg->display.height;
-    osys->viewpoint      = cfg->viewpoint;
     if (osys->is_fullscreen) {
         vout_display_cfg_t cfg_windowed = *cfg;
         cfg_windowed.is_fullscreen  = false;
@@ -1259,9 +1264,6 @@ static vout_display_t *DisplayNew(vout_thread_t *vout,
                                            source, &cfg_windowed);
     }
 
-    osys->zoom.num = cfg->zoom.num;
-    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->ch_wm_state = true;
@@ -1414,7 +1416,6 @@ static void SplitterEvent(vout_display_t *vd, int event, va_list args)
     case VOUT_DISPLAY_EVENT_MOUSE_DOUBLE_CLICK:
     case VOUT_DISPLAY_EVENT_KEY:
     case VOUT_DISPLAY_EVENT_CLOSE:
-    case VOUT_DISPLAY_EVENT_FULLSCREEN:
     case VOUT_DISPLAY_EVENT_DISPLAY_SIZE:
     case VOUT_DISPLAY_EVENT_PICTURES_INVALID:
         VoutDisplayEvent(vd, event, args);
@@ -1584,7 +1585,6 @@ vout_display_t *vout_NewSplitter(vout_thread_t *vout,
         vout_display_state_t ostate;
 
         memset(&ostate, 0, sizeof(ostate));
-        ostate.cfg.is_fullscreen = false;
         ostate.cfg.display = state->cfg.display;
         ostate.cfg.align.horizontal = 0; /* TODO */
         ostate.cfg.align.vertical = 0; /* TODO */
index 640232a..6b6dc8e 100644 (file)
@@ -166,7 +166,9 @@ static vout_thread_t *VoutCreate(vlc_object_t *object,
     if (vout->p->splitter_name == NULL) {
         vout_window_cfg_t wcfg = {
             .is_standalone = !var_InheritBool(vout, "embedded-video"),
+#if !defined(_WIN32) && !defined(__OS2__)
             .is_fullscreen = var_GetBool(vout, "fullscreen"),
+#endif
             .type = VOUT_WINDOW_TYPE_INVALID,
             // TODO: take pixel A/R, crop and zoom into account
 #ifdef __APPLE__
@@ -560,9 +562,10 @@ void vout_ControlChangeViewpoint(vout_thread_t *vout,
 static void VoutGetDisplayCfg(vout_thread_t *vout, vout_display_cfg_t *cfg, const char *title)
 {
     /* Load configuration */
+#if defined(_WIN32) || defined(__OS2__)
     cfg->is_fullscreen = var_GetBool(vout, "fullscreen")
                          || var_GetBool(vout, "video-wallpaper");
-
+#endif
     cfg->viewpoint = vout->p->original.pose;
 
     cfg->display.title = title;
@@ -1270,12 +1273,18 @@ static void ThreadChangeFullscreen(vout_thread_t *vout, bool fullscreen)
 {
     vout_window_t *window = vout->p->window;
 
+#if !defined(_WIN32) && !defined(__OS2__)
+    if (window != NULL)
+        vout_window_SetFullScreen(window, fullscreen);
+#else
     bool window_fullscreen = false;
     if (window != NULL
      && vout_window_SetFullScreen(window, fullscreen) == VLC_SUCCESS)
         window_fullscreen = true;
+    /* FIXME: remove this event */
     if (vout->p->display.vd != NULL)
         vout_display_SendEventFullscreen(vout->p->display.vd, fullscreen, window_fullscreen);
+#endif
 }
 
 static void ThreadChangeWindowState(vout_thread_t *vout, unsigned state)
@@ -1539,7 +1548,10 @@ static int ThreadReinit(vout_thread_t *vout,
 
     vout_ReinitInterlacingSupport(vout);
 
-    if (!state.cfg.is_fullscreen) {
+#if defined(_WIN32) || defined(__OS2__)
+    if (!state.cfg.is_fullscreen)
+#endif
+    {
         state.cfg.display.width  = 0;
         state.cfg.display.height = 0;
     }