[vlc-commits] window: separate set-fullscreen and unset-fullscreen controls

Rémi Denis-Courmont git at videolan.org
Sun May 20 19:52:24 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat May 19 21:18:44 2018 +0300| [954d2d2c033dae85fea6c82c83cff6b660d9b50f] | committer: Rémi Denis-Courmont

window: separate set-fullscreen and unset-fullscreen controls

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

 include/vlc_vout_window.h                    |  7 ++++--
 modules/gui/macosx/VLCVoutWindowController.m |  3 ++-
 modules/gui/minimal_macosx/intf.m            |  3 ++-
 modules/gui/qt/main_interface.cpp            |  9 +++----
 modules/gui/skins2/src/skin_main.cpp         |  7 +++---
 modules/video_output/wayland/shell.c         | 37 +++++++++++-----------------
 modules/video_output/wayland/xdg-shell.c     | 11 +++------
 modules/video_output/wdummy.c                |  1 +
 modules/video_output/xcb/window.c            |  7 +++---
 9 files changed, 39 insertions(+), 46 deletions(-)

diff --git a/include/vlc_vout_window.h b/include/vlc_vout_window.h
index ff3b2db581..accd8b5787 100644
--- a/include/vlc_vout_window.h
+++ b/include/vlc_vout_window.h
@@ -62,7 +62,8 @@ enum vout_window_type {
 enum vout_window_control {
     VOUT_WINDOW_SET_STATE, /* unsigned state */
     VOUT_WINDOW_SET_SIZE,   /* unsigned i_width, unsigned i_height */
-    VOUT_WINDOW_SET_FULLSCREEN, /* int b_fullscreen */
+    VOUT_WINDOW_SET_FULLSCREEN, /* void */
+    VOUT_WINDOW_UNSET_FULLSCREEN, /* void */
     VOUT_WINDOW_HIDE_MOUSE VLC_DEPRECATED_ENUM,
 };
 
@@ -282,7 +283,9 @@ static inline int vout_window_SetSize(vout_window_t *window,
  */
 static inline int vout_window_SetFullScreen(vout_window_t *window, bool full)
 {
-    return vout_window_Control(window, VOUT_WINDOW_SET_FULLSCREEN, full);
+    return vout_window_Control(window,
+                               full ? VOUT_WINDOW_SET_FULLSCREEN
+                                    : VOUT_WINDOW_UNSET_FULLSCREEN);
 }
 
 /**
diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
index 82164e53d5..ecbe3b59f4 100644
--- a/modules/gui/macosx/VLCVoutWindowController.m
+++ b/modules/gui/macosx/VLCVoutWindowController.m
@@ -122,13 +122,14 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
                 break;
             }
             case VOUT_WINDOW_SET_FULLSCREEN:
+            case VOUT_WINDOW_UNSET_FULLSCREEN:
             {
                 if (var_InheritBool(getIntf(), "video-wallpaper")) {
                     msg_Dbg(p_wnd, "Ignore fullscreen event as video-wallpaper is on");
                     goto out;
                 }
 
-                int i_full = va_arg(args, int);
+                int i_full = i_query == VOUT_WINDOW_SET_FULLSCREEN;
                 BOOL b_animation = YES;
 
                 dispatch_async(dispatch_get_main_queue(), ^{
diff --git a/modules/gui/minimal_macosx/intf.m b/modules/gui/minimal_macosx/intf.m
index 3ac6345a19..bbc39fbd16 100644
--- a/modules/gui/minimal_macosx/intf.m
+++ b/modules/gui/minimal_macosx/intf.m
@@ -158,8 +158,9 @@ static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
             return VLC_SUCCESS;
         }
         case VOUT_WINDOW_SET_FULLSCREEN:
+        case VOUT_WINDOW_UNSET_FULLSCREEN:
         {
-            int i_full = va_arg(args, int);
+            int i_full = i_query == VOUT_WINDOW_SET_FULLSCREEN;
             @autoreleasepool {
                 dispatch_sync(dispatch_get_main_queue(), ^{
                     if (i_full)
diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index 1b005a7690..6d141dac91 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -987,12 +987,11 @@ int MainInterface::controlVideo( int i_query, va_list args )
         return VLC_SUCCESS;
     }
     case VOUT_WINDOW_SET_FULLSCREEN:
-    {
-        bool b_fs = va_arg( args, int );
-
-        emit askVideoSetFullScreen( b_fs );
+        emit askVideoSetFullScreen( true );
+        return VLC_SUCCESS;
+    case VOUT_WINDOW_UNSET_FULLSCREEN:
+        emit askVideoSetFullScreen( false );
         return VLC_SUCCESS;
-    }
     default:
         msg_Warn( p_intf, "unsupported control query" );
         return VLC_EGENERIC;
diff --git a/modules/gui/skins2/src/skin_main.cpp b/modules/gui/skins2/src/skin_main.cpp
index b528ad4fd7..1327ad1cea 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -443,12 +443,11 @@ static int WindowControl( vout_window_t *pWnd, int query, va_list args )
         }
 
         case VOUT_WINDOW_SET_FULLSCREEN:
+        case VOUT_WINDOW_UNSET_FULLSCREEN:
         {
-            bool b_fullscreen = va_arg( args, int );
-
             // Post a set fullscreen command
-            CmdSetFullscreen* pCmd =
-                new CmdSetFullscreen( pIntf, pWnd, b_fullscreen );
+            CmdSetFullscreen* pCmd = new CmdSetFullscreen( pIntf, pWnd,
+                query == VOUT_WINDOW_SET_FULLSCREEN );
             pQueue->push( CmdGenericPtr( pCmd ) );
             return VLC_SUCCESS;
         }
diff --git a/modules/video_output/wayland/shell.c b/modules/video_output/wayland/shell.c
index 5f006a81aa..5a7ffda166 100644
--- a/modules/video_output/wayland/shell.c
+++ b/modules/video_output/wayland/shell.c
@@ -116,29 +116,22 @@ static int Control(vout_window_t *wnd, int cmd, va_list ap)
             break;
         }
         case VOUT_WINDOW_SET_FULLSCREEN:
-        {
-            bool fs = va_arg(ap, int);
-
-            if (fs)
-            {
-                wl_shell_surface_set_fullscreen(sys->shell_surface, 1, 0,
-                                                NULL);
-                vlc_mutex_lock(&sys->lock);
-                sys->fullscreen = true;
-                vout_window_ReportSize(wnd, sys->fs_width, sys->fs_height);
-                vlc_mutex_unlock(&sys->lock);
-            }
-            else
-            {
-                wl_shell_surface_set_toplevel(sys->shell_surface);
-
-                vlc_mutex_lock(&sys->lock);
-                sys->fullscreen = false;
-                vout_window_ReportSize(wnd, sys->top_width, sys->top_height);
-                vlc_mutex_unlock(&sys->lock);
-            }
+            wl_shell_surface_set_fullscreen(sys->shell_surface, 1, 0, NULL);
+
+            vlc_mutex_lock(&sys->lock);
+            sys->fullscreen = true;
+            vout_window_ReportSize(wnd, sys->fs_width, sys->fs_height);
+            vlc_mutex_unlock(&sys->lock);
+            break;
+
+        case VOUT_WINDOW_UNSET_FULLSCREEN:
+            wl_shell_surface_set_toplevel(sys->shell_surface);
+
+            vlc_mutex_lock(&sys->lock);
+            sys->fullscreen = false;
+            vout_window_ReportSize(wnd, sys->top_width, sys->top_height);
+            vlc_mutex_unlock(&sys->lock);
             break;
-        }
 
         default:
             msg_Err(wnd, "request %d not implemented", cmd);
diff --git a/modules/video_output/wayland/xdg-shell.c b/modules/video_output/wayland/xdg-shell.c
index a0d64e7981..a1e400de8c 100644
--- a/modules/video_output/wayland/xdg-shell.c
+++ b/modules/video_output/wayland/xdg-shell.c
@@ -148,15 +148,12 @@ static int Control(vout_window_t *wnd, int cmd, va_list ap)
         }
 
         case VOUT_WINDOW_SET_FULLSCREEN:
-        {
-            bool fs = va_arg(ap, int);
+            xdg_toplevel_set_fullscreen(sys->toplevel, NULL);
+            break;
 
-            if (fs)
-                xdg_toplevel_set_fullscreen(sys->toplevel, NULL);
-            else
-                xdg_toplevel_unset_fullscreen(sys->toplevel);
+        case VOUT_WINDOW_UNSET_FULLSCREEN:
+            xdg_toplevel_unset_fullscreen(sys->toplevel);
             break;
-        }
 
         default:
             msg_Err(wnd, "request %d not implemented", cmd);
diff --git a/modules/video_output/wdummy.c b/modules/video_output/wdummy.c
index 90e4571259..a6c9d929ad 100644
--- a/modules/video_output/wdummy.c
+++ b/modules/video_output/wdummy.c
@@ -45,6 +45,7 @@ static int Control(vout_window_t *wnd, int query, va_list ap)
 
         case VOUT_WINDOW_SET_STATE:
         case VOUT_WINDOW_SET_FULLSCREEN:
+        case VOUT_WINDOW_UNSET_FULLSCREEN:
             /* These controls deserve a proper window provider. Move along. */
             return VLC_EGENERIC;
 
diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c
index bf202c4ae5..4648a24741 100644
--- a/modules/video_output/xcb/window.c
+++ b/modules/video_output/xcb/window.c
@@ -272,11 +272,10 @@ static int Control (vout_window_t *wnd, int cmd, va_list ap)
         }
 
         case VOUT_WINDOW_SET_FULLSCREEN:
-        {
-            bool fs = va_arg (ap, int);
-            change_wm_state (wnd, fs, p_sys->wm_state_fullscreen);
+        case VOUT_WINDOW_UNSET_FULLSCREEN:
+            change_wm_state (wnd, cmd == VOUT_WINDOW_SET_FULLSCREEN,
+                             p_sys->wm_state_fullscreen);
             break;
-        }
 
         default:
             msg_Err (wnd, "request %d not implemented", cmd);



More information about the vlc-commits mailing list