[vlc-commits] xdg-shell: implement fullscreen/windowed events

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


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 20 15:05:34 2018 +0300| [5dbf0751f02c97547687a174bef39c7265270fcd] | committer: Rémi Denis-Courmont

xdg-shell: implement fullscreen/windowed events

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

 modules/video_output/wayland/xdg-shell.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/wayland/xdg-shell.c b/modules/video_output/wayland/xdg-shell.c
index 5b16f28504..2554e83368 100644
--- a/modules/video_output/wayland/xdg-shell.c
+++ b/modules/video_output/wayland/xdg-shell.c
@@ -57,6 +57,7 @@
 # define xdg_toplevel_set_app_id zxdg_toplevel_v6_set_app_id
 # define xdg_toplevel_set_fullscreen zxdg_toplevel_v6_set_fullscreen
 # define xdg_toplevel_unset_fullscreen zxdg_toplevel_v6_unset_fullscreen
+# define XDG_TOPLEVEL_STATE_FULLSCREEN ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN
 #endif
 #include "server-decoration-client-protocol.h"
 
@@ -75,6 +76,7 @@ struct vout_window_sys_t
 
     unsigned width;
     unsigned height;
+    bool fullscreen;
 
     vlc_thread_t thread;
 };
@@ -174,9 +176,18 @@ static void xdg_toplevel_configure_cb(void *data,
     const uint32_t *state;
 
     msg_Dbg(wnd, "new configuration: %"PRId32"x%"PRId32, width, height);
+
+    sys->fullscreen = false;
     wl_array_for_each(state, states)
     {
         msg_Dbg(wnd, " - state 0x%04"PRIX32, *state);
+
+        switch (*state)
+        {
+            case XDG_TOPLEVEL_STATE_FULLSCREEN:
+                sys->fullscreen = true;
+                break;
+        }
     }
 
     /* Zero width or zero height means client (we) should choose.
@@ -186,8 +197,6 @@ static void xdg_toplevel_configure_cb(void *data,
     if (height != 0)
         sys->height = height;
 
-    /* TODO: report fullscreen/minimized/maximized state
-     * not implemented in VLC vout_window_t yet though */
     (void) toplevel;
 }
 
@@ -212,6 +221,12 @@ static void xdg_surface_configure_cb(void *data, struct xdg_surface *surface,
     vout_window_sys_t *sys = wnd->sys;
 
     vout_window_ReportSize(wnd, sys->width, sys->height);
+
+    if (sys->fullscreen)
+        vout_window_ReportFullscreen(wnd, NULL);
+    else
+        vout_window_ReportWindowed(wnd);
+
     xdg_surface_set_window_geometry(surface, 0, 0, sys->width, sys->height);
     xdg_surface_ack_configure(surface, serial);
 }
@@ -291,6 +306,7 @@ static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
     sys->deco = NULL;
     sys->width = cfg->width;
     sys->height = cfg->height;
+    sys->fullscreen = false;
     wnd->sys = sys;
 
     /* Connect to the display server */



More information about the vlc-commits mailing list