[vlc-commits] xdg-shell: add support for unstable version 6
Rémi Denis-Courmont
git at videolan.org
Sun May 20 19:50:58 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 20 14:50:46 2018 +0300| [c1ff9978a7f542d368c1a61dc274822e3fd31fc9] | committer: Rémi Denis-Courmont
xdg-shell: add support for unstable version 6
This is a temporary compatibility hack for out-of-date window managers.
Except for naming, unstable v6 is almost identical to stable v1.
In the unlikely event that the window manager does not support either
of those, there is still the plain Wayland shell support.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c1ff9978a7f542d368c1a61dc274822e3fd31fc9
---
modules/video_output/Makefile.am | 23 +++++++++++++++++
modules/video_output/wayland/xdg-shell.c | 44 ++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+)
diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index 4a4e4da18b..7db8960336 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -233,6 +233,27 @@ video_output/wayland/server-decoration-protocol.c: \
video_output/wayland/server-decoration.xml
EXTRA_DIST += video_output/wayland/server-decoration.xml
+libxdg_shell_v6_plugin_la_SOURCES = video_output/wayland/xdg-shell.c
+nodist_libxdg_shell_v6_plugin_la_SOURCES = \
+ video_output/wayland/xdg-shell-unstable-v6-client-protocol.h \
+ video_output/wayland/xdg-shell-unstable-v6-protocol.c \
+ video_output/wayland/server-decoration-client-protocol.h \
+ video_output/wayland/server-decoration-protocol.c
+libxdg_shell_v6_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
+ -I$(builddir)/video_output/wayland -DXDG_SHELL_UNSTABLE_VERSION=6
+libxdg_shell_v6_plugin_la_CFLAGS = $(libxdg_shell_plugin_la_CFLAGS)
+libxdg_shell_v6_plugin_la_LIBADD = $(libxdg_shell_plugin_la_LIBADD)
+
+video_output/wayland/xdg-shell-unstable-v6-client-protocol.h: \
+ $(WAYLAND_PROTOCOLS)/unstable/xdg-shell/xdg-shell-unstable-v6.xml \
+ video_output/Makefile.am
+ $(AM_V_GEN)$(WAYLAND_SCANNER) client-header $< $@
+
+video_output/wayland/xdg-shell-unstable-v6-protocol.c: \
+ $(WAYLAND_PROTOCOLS)/unstable/xdg-shell/xdg-shell-unstable-v6.xml \
+ video_output/Makefile.am
+ $(AM_V_GEN)$(WAYLAND_SCANNER) private-code $< $@
+
libegl_wl_plugin_la_SOURCES = video_output/opengl/egl.c
libegl_wl_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_PLATFORM_WAYLAND=1
libegl_wl_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS) $(WAYLAND_EGL_CFLAGS)
@@ -244,6 +265,8 @@ vout_LTLIBRARIES += libwl_shm_plugin.la
vout_LTLIBRARIES += libwl_shell_plugin.la
BUILT_SOURCES += $(nodist_libxdg_shell_plugin_la_SOURCES)
vout_LTLIBRARIES += libxdg_shell_plugin.la
+BUILT_SOURCES += $(nodist_libxdg_shell_v6_plugin_la_SOURCES)
+vout_LTLIBRARIES += libxdg_shell_v6_plugin.la
if HAVE_WAYLAND_EGL
if HAVE_EGL
vout_LTLIBRARIES += libegl_wl_plugin.la
diff --git a/modules/video_output/wayland/xdg-shell.c b/modules/video_output/wayland/xdg-shell.c
index 956774a9f5..def904e1e7 100644
--- a/modules/video_output/wayland/xdg-shell.c
+++ b/modules/video_output/wayland/xdg-shell.c
@@ -31,7 +31,33 @@
#include <poll.h>
#include <wayland-client.h>
+#ifndef XDG_SHELL_UNSTABLE_VERSION
#include "xdg-shell-client-protocol.h"
+#else
+#include "xdg-shell-unstable-v6-client-protocol.h"
+# define xdg_wm_base zxdg_shell_v6
+# define xdg_wm_base_interface zxdg_shell_v6_interface
+# define xdg_wm_base_listener zxdg_shell_v6_listener
+# define xdg_wm_base_add_listener zxdg_shell_v6_add_listener
+# define xdg_wm_base_destroy zxdg_shell_v6_destroy
+# define xdg_wm_base_get_xdg_surface zxdg_shell_v6_get_xdg_surface
+# define xdg_wm_base_pong zxdg_shell_v6_pong
+# define xdg_surface zxdg_surface_v6
+# define xdg_surface_listener zxdg_surface_v6_listener
+# define xdg_surface_add_listener zxdg_surface_v6_add_listener
+# define xdg_surface_destroy zxdg_surface_v6_destroy
+# define xdg_surface_get_toplevel zxdg_surface_v6_get_toplevel
+# define xdg_surface_set_window_geometry zxdg_surface_v6_set_window_geometry
+# define xdg_surface_ack_configure zxdg_surface_v6_ack_configure
+# define xdg_toplevel zxdg_toplevel_v6
+# define xdg_toplevel_listener zxdg_toplevel_v6_listener
+# define xdg_toplevel_add_listener zxdg_toplevel_v6_add_listener
+# define xdg_toplevel_destroy zxdg_toplevel_v6_destroy
+# define xdg_toplevel_set_title zxdg_toplevel_v6_set_title
+# 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
+#endif
#include "server-decoration-client-protocol.h"
#include <vlc_common.h>
@@ -213,7 +239,11 @@ static void registry_global_cb(void *data, struct wl_registry *registry,
&wl_compositor_interface,
(vers < 2) ? vers : 2);
else
+#ifndef XDG_SHELL_UNSTABLE_VERSION
if (!strcmp(iface, "xdg_wm_base"))
+#else
+ if (!strcmp(iface, "zxdg_shell_v6"))
+#endif
sys->wm_base = wl_registry_bind(registry, name, &xdg_wm_base_interface,
1);
else
@@ -348,6 +378,11 @@ static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
if (vlc_clone(&sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW))
goto error;
+#ifdef XDG_SHELL_UNSTABLE_VERSION
+ msg_Warn(wnd, "using XDG shell unstable version %d",
+ XDG_SHELL_UNSTABLE_VERSION);
+ msg_Info(wnd, "The window manager needs an update.");
+#endif
return VLC_SUCCESS;
error:
@@ -398,11 +433,20 @@ static void Close(vout_window_t *wnd)
"If empty, the default display will be used.")
vlc_module_begin()
+#ifndef XDG_SHELL_UNSTABLE_VERSION
set_shortname(N_("XDG shell"))
set_description(N_("XDG shell surface"))
+#else
+ set_shortname(N_("XDG shell v6"))
+ set_description(N_("XDG shell (unstable version 6) surface"))
+#endif
set_category(CAT_VIDEO)
set_subcategory(SUBCAT_VIDEO_VOUT)
+#ifndef XDG_SHELL_UNSTABLE_VERSION
set_capability("vout window", 20)
+#else
+ set_capability("vout window", 19)
+#endif
set_callbacks(Open, Close)
add_string("wl-display", NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT, true)
More information about the vlc-commits
mailing list