[vlc-commits] video_output: display: Don't ignore fullscreen state changes

Thomas Guillem git at videolan.org
Thu Jun 15 16:48:59 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jun 15 14:52:28 2017 +0200| [496b4187d34b5a0b1e74bde35d0c7b7901055d2e] | committer: Hugo Beauzée-Luyssen

video_output: display: Don't ignore fullscreen state changes

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=496b4187d34b5a0b1e74bde35d0c7b7901055d2e
---

 include/vlc_vout_display.h             | 5 +++--
 modules/video_output/win32/common.c    | 2 +-
 modules/video_output/win32/direct3d9.c | 6 +++---
 src/video_output/display.c             | 8 ++++++--
 src/video_output/video_output.c        | 9 +++++----
 5 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 7c16f0c992..5cbd51481c 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -362,9 +362,10 @@ static inline void vout_display_SendEventKey(vout_display_t *vd, int key)
 {
     vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_KEY, key);
 }
-static inline void vout_display_SendEventFullscreen(vout_display_t *vd, bool is_fullscreen)
+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);
+    vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_FULLSCREEN, is_fullscreen, is_window_fullscreen);
 }
 #if defined(_WIN32)
 static inline void vout_display_SendWindowState(vout_display_t *vd, unsigned state)
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index ffd5e49a1e..c09c24d6a8 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -117,7 +117,7 @@ int CommonInit(vout_display_t *vd)
 
     if (vd->cfg->is_fullscreen) {
         if (CommonControlSetFullscreen(vd, true))
-            vout_display_SendEventFullscreen(vd, false);
+            vout_display_SendEventFullscreen(vd, false, false);
     }
 
     DisableScreensaver (vd);
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index bac1daefe4..952c44e42d 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -305,7 +305,7 @@ static int Open(vlc_object_t *object)
 
     /* Fix state in case of desktop mode */
     if (sys->sys.use_desktop && vd->cfg->is_fullscreen)
-        vout_display_SendEventFullscreen(vd, false);
+        vout_display_SendEventFullscreen(vd, false, false);
 
     return VLC_SUCCESS;
 error:
@@ -615,13 +615,13 @@ static int ControlReopenDevice(vout_display_t *vd)
     if (sys->sys.use_desktop) {
         /* Disable fullscreen/on_top while using desktop */
         if (sys->desktop_save.is_fullscreen)
-            vout_display_SendEventFullscreen(vd, false);
+            vout_display_SendEventFullscreen(vd, false, false);
         if (sys->desktop_save.is_on_top)
             vout_display_SendWindowState(vd, VOUT_WINDOW_STATE_NORMAL);
     } else {
         /* Restore fullscreen/on_top */
         if (sys->desktop_save.is_fullscreen)
-            vout_display_SendEventFullscreen(vd, true);
+            vout_display_SendEventFullscreen(vd, true, false);
         if (sys->desktop_save.is_on_top)
             vout_display_SendWindowState(vd, VOUT_WINDOW_STATE_ABOVE);
     }
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 63b94992cc..aaa24b053d 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -396,6 +396,7 @@ typedef struct {
 
     bool ch_fullscreen;
     bool is_fullscreen;
+    bool window_fullscreen;
 
     bool ch_display_size;
     int  display_width;
@@ -655,6 +656,7 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
 
     case VOUT_DISPLAY_EVENT_FULLSCREEN: {
         const int is_fullscreen = (int)va_arg(args, int);
+        const bool window_fullscreen = va_arg(args, int);
 
         msg_Dbg(vd, "VoutDisplayEvent 'fullscreen' %d", is_fullscreen);
 
@@ -662,6 +664,7 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
         if (!is_fullscreen != !osys->is_fullscreen) {
             osys->ch_fullscreen = true;
             osys->is_fullscreen = is_fullscreen;
+            osys->window_fullscreen = window_fullscreen;
         }
         vlc_mutex_unlock(&osys->lock);
         break;
@@ -860,11 +863,12 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
 
         /* */
         if (ch_fullscreen) {
-            if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_FULLSCREEN,
+            if (osys->window_fullscreen
+             || vout_display_Control(vd, VOUT_DISPLAY_CHANGE_FULLSCREEN,
                                      is_fullscreen) == VLC_SUCCESS) {
                 osys->cfg.is_fullscreen = is_fullscreen;
 
-                if (!is_fullscreen)
+                if (!is_fullscreen && !osys->window_fullscreen)
                     vout_SetDisplayWindowSize(osys->vout, osys->width_saved,
                                               osys->height_saved);
             } else {
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index c666563dba..dfd4914b1b 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1316,11 +1316,12 @@ static void ThreadChangeFullscreen(vout_thread_t *vout, bool fullscreen)
 {
     vout_window_t *window = vout->p->window;
 
-    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;
     if (vout->p->display.vd != NULL)
-        vout_display_SendEventFullscreen(vout->p->display.vd, fullscreen);
+        vout_display_SendEventFullscreen(vout->p->display.vd, fullscreen, window_fullscreen);
 }
 
 static void ThreadChangeWindowState(vout_thread_t *vout, unsigned state)



More information about the vlc-commits mailing list