Commit c1ff9978 authored by Rémi Denis-Courmont's avatar 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.
parent 27a0f487
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment