Commit ff000c5c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

xdg-shell: merge stable and unstable-v6 plugins

The two version of the protocol are almost binary compatible, except
for a few requests that VLC does not use (set_anchor, set_gravity and
get_popup). The only meaningful difference is the name of the global
interface.
parent a0f4ae67
...@@ -240,27 +240,6 @@ video_output/wayland/server-decoration-protocol.c: \ ...@@ -240,27 +240,6 @@ video_output/wayland/server-decoration-protocol.c: \
video_output/wayland/server-decoration.xml video_output/wayland/server-decoration.xml
EXTRA_DIST += video_output/wayland/server-decoration.xml EXTRA_DIST += video_output/wayland/server-decoration.xml
libxdg_shell_v6_plugin_la_SOURCES = $(libxdg_shell_plugin_la_SOURCES)
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) -DXDG_SHELL \
-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_SOURCES = video_output/opengl/egl.c
libegl_wl_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_PLATFORM_WAYLAND=1 libegl_wl_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_PLATFORM_WAYLAND=1
libegl_wl_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS) $(WAYLAND_EGL_CFLAGS) libegl_wl_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS) $(WAYLAND_EGL_CFLAGS)
...@@ -272,8 +251,6 @@ vout_LTLIBRARIES += libwl_shm_plugin.la ...@@ -272,8 +251,6 @@ vout_LTLIBRARIES += libwl_shm_plugin.la
vout_LTLIBRARIES += libwl_shell_plugin.la vout_LTLIBRARIES += libwl_shell_plugin.la
BUILT_SOURCES += $(nodist_libxdg_shell_plugin_la_SOURCES) BUILT_SOURCES += $(nodist_libxdg_shell_plugin_la_SOURCES)
vout_LTLIBRARIES += libxdg_shell_plugin.la 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_WAYLAND_EGL
if HAVE_EGL if HAVE_EGL
vout_LTLIBRARIES += libegl_wl_plugin.la vout_LTLIBRARIES += libegl_wl_plugin.la
......
...@@ -34,37 +34,11 @@ ...@@ -34,37 +34,11 @@
#include <wayland-client.h> #include <wayland-client.h>
#ifdef XDG_SHELL #ifdef XDG_SHELL
#ifndef XDG_SHELL_UNSTABLE_VERSION
#include "xdg-shell-client-protocol.h" #include "xdg-shell-client-protocol.h"
#else /** Temporary backward compatibility hack for XDG shell unstable v6 */
#include "xdg-shell-unstable-v6-client-protocol.h" # define XDG_SHELL_UNSTABLE
# 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
# define XDG_TOPLEVEL_STATE_FULLSCREEN ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN
#endif
#else #else
# define xdg_wm_base wl_shell # define xdg_wm_base wl_shell
# define xdg_wm_base_interface wl_shell_interface
# define xdg_wm_base_add_listener(s, l, q) (void)0 # define xdg_wm_base_add_listener(s, l, q) (void)0
# define xdg_wm_base_destroy wl_shell_destroy # define xdg_wm_base_destroy wl_shell_destroy
# define xdg_wm_base_get_xdg_surface wl_shell_get_shell_surface # define xdg_wm_base_get_xdg_surface wl_shell_get_shell_surface
...@@ -107,6 +81,9 @@ struct vout_window_sys_t ...@@ -107,6 +81,9 @@ struct vout_window_sys_t
unsigned width; unsigned width;
unsigned height; unsigned height;
bool fullscreen; bool fullscreen;
# ifdef XDG_SHELL_UNSTABLE
bool unstable;
#endif
struct wl_list seats; struct wl_list seats;
...@@ -432,16 +409,29 @@ static void registry_global_cb(void *data, struct wl_registry *registry, ...@@ -432,16 +409,29 @@ static void registry_global_cb(void *data, struct wl_registry *registry,
} }
else else
#ifdef XDG_SHELL #ifdef XDG_SHELL
# ifndef XDG_SHELL_UNSTABLE_VERSION # ifdef XDG_SHELL_UNSTABLE
if (!strcmp(iface, "zxdg_shell_v6") && sys->wm_base == NULL)
sys->wm_base = wl_registry_bind(registry, name, &xdg_wm_base_interface,
1);
else
if (!strcmp(iface, "xdg_wm_base")) if (!strcmp(iface, "xdg_wm_base"))
{
if (sys->wm_base != NULL)
xdg_wm_base_destroy(sys->wm_base);
sys->unstable = false;
sys->wm_base = wl_registry_bind(registry, name, &xdg_wm_base_interface,
1);
}
# else # else
if (!strcmp(iface, "zxdg_shell_v6")) if (!strcmp(iface, "xdg_wm_base"))
sys->wm_base = wl_registry_bind(registry, name, &xdg_wm_base_interface,
1);
# endif # endif
#else #else
if (!strcmp(iface, "wl_shell")) if (!strcmp(iface, "wl_shell"))
#endif sys->wm_base = wl_registry_bind(registry, name, &wl_shell_interface,
sys->wm_base = wl_registry_bind(registry, name, &xdg_wm_base_interface,
1); 1);
#endif
else else
if (!strcmp(iface, "wl_seat")) if (!strcmp(iface, "wl_seat"))
seat_create(wnd, registry, name, vers, &sys->seats); seat_create(wnd, registry, name, vers, &sys->seats);
...@@ -511,6 +501,9 @@ static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg) ...@@ -511,6 +501,9 @@ static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
if (sys->registry == NULL) if (sys->registry == NULL)
goto error; goto error;
#ifdef XDG_SHELL_UNSTABLE
sys->unstable = true;
#endif
wl_registry_add_listener(sys->registry, &registry_cbs, wnd); wl_registry_add_listener(sys->registry, &registry_cbs, wnd);
wl_display_roundtrip(display); /* complete registry enumeration */ wl_display_roundtrip(display); /* complete registry enumeration */
wl_display_roundtrip(display); /* complete devices enumeration */ wl_display_roundtrip(display); /* complete devices enumeration */
...@@ -589,10 +582,12 @@ static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg) ...@@ -589,10 +582,12 @@ static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
if (vlc_clone(&sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW)) if (vlc_clone(&sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW))
goto error; goto error;
#ifdef XDG_SHELL_UNSTABLE_VERSION #ifdef XDG_SHELL_UNSTABLE
msg_Warn(wnd, "using XDG shell unstable version %d", if (sys->unstable)
XDG_SHELL_UNSTABLE_VERSION); {
msg_Warn(wnd, "using XDG shell unstable version");
msg_Info(wnd, "The window manager needs an update."); msg_Info(wnd, "The window manager needs an update.");
}
#endif #endif
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -654,13 +649,8 @@ static void Close(vout_window_t *wnd) ...@@ -654,13 +649,8 @@ static void Close(vout_window_t *wnd)
vlc_module_begin() vlc_module_begin()
#ifdef XDG_SHELL #ifdef XDG_SHELL
# ifndef XDG_SHELL_UNSTABLE_VERSION
set_shortname(N_("XDG shell")) set_shortname(N_("XDG shell"))
set_description(N_("XDG shell surface")) set_description(N_("XDG shell surface"))
# else
set_shortname(N_("XDG shell v6"))
set_description(N_("XDG shell (unstable version 6) surface"))
# endif
#else #else
set_shortname(N_("WL shell")) set_shortname(N_("WL shell"))
set_description(N_("Wayland shell surface")) set_description(N_("Wayland shell surface"))
...@@ -668,11 +658,7 @@ vlc_module_begin() ...@@ -668,11 +658,7 @@ vlc_module_begin()
set_category(CAT_VIDEO) set_category(CAT_VIDEO)
set_subcategory(SUBCAT_VIDEO_VOUT) set_subcategory(SUBCAT_VIDEO_VOUT)
#ifdef XDG_SHELL #ifdef XDG_SHELL
# ifndef XDG_SHELL_UNSTABLE_VERSION
set_capability("vout window", 20) set_capability("vout window", 20)
# else
set_capability("vout window", 19)
# endif
#else #else
set_capability("vout window", 10) set_capability("vout window", 10)
#endif #endif
......
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