interactive-wayland: Port to stable xdg-shell (#100) xdg_shell v6 was pretty close to the finalised stable version of xdg-shell. We can now just use the stable version, which is supported everywhere (Enlightenment, KWin, Mutter, Weston, wlroots). This requires bumping the wayland-protocols dependency. Signed-off-by: Daniel Stone <daniels@collabora.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
diff --git a/Makefile.am b/Makefile.am
index ac6d909..4711cb8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -299,8 +299,8 @@ endef
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < $< > $@
INTERACTIVE_WL_XDG_SHELL_SRCS = \
- xdg-shell-unstable-v6-protocol.c \
- xdg-shell-unstable-v6-client-protocol.h
+ xdg-shell-protocol.c \
+ xdg-shell-client-protocol.h
test_interactive_wayland_SOURCES = \
test/interactive-wayland.c \
diff --git a/configure.ac b/configure.ac
index cd958b0..c32600d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -174,7 +174,7 @@ You can disable X11 support with --disable-x11.])])
], [enable_x11=no])
AM_CONDITIONAL([ENABLE_X11], [test "x$enable_x11" = xyes])
-WAYLAND_PKGS="wayland-client >= 1.2.0 wayland-protocols >= 1.7 wayland-scanner"
+WAYLAND_PKGS="wayland-client >= 1.2.0 wayland-protocols >= 1.12 wayland-scanner"
AC_ARG_ENABLE([wayland],
[AS_HELP_STRING([--disable-wayland],
[Disable support for Wayland utility programs (default: auto)])],
diff --git a/meson.build b/meson.build
index 61ba681..43a5a98 100644
--- a/meson.build
+++ b/meson.build
@@ -407,7 +407,7 @@ if get_option('enable-x11')
endif
if get_option('enable-wayland')
wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: false)
- wayland_protocols_dep = dependency('wayland-protocols', version: '>=1.7', required: false)
+ wayland_protocols_dep = dependency('wayland-protocols', version: '>=1.12', required: false)
wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)
if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()
error('''The Wayland demo programs require wayland-client >= 1.2.0, wayland-protocols >= 1.7 which were not found.
@@ -426,7 +426,7 @@ You can disable the Wayland demo programs with -Denable-wayland=false.''')
arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
)
wayland_protocols_datadir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir')
- xdg_shell_xml = join_paths(wayland_protocols_datadir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml')
+ xdg_shell_xml = join_paths(wayland_protocols_datadir, 'stable/xdg-shell/xdg-shell.xml')
xdg_shell_sources = [
wayland_scanner_code_gen.process(xdg_shell_xml),
wayland_scanner_client_header_gen.process(xdg_shell_xml),
diff --git a/test/interactive-wayland.c b/test/interactive-wayland.c
index f9bcc3d..e033728 100644
--- a/test/interactive-wayland.c
+++ b/test/interactive-wayland.c
@@ -34,21 +34,21 @@
#include "test.h"
#include <wayland-client.h>
-#include "xdg-shell-unstable-v6-client-protocol.h"
+#include "xdg-shell-client-protocol.h"
#include <wayland-util.h>
struct interactive_dpy {
struct wl_display *dpy;
struct wl_compositor *compositor;
- struct zxdg_shell_v6 *shell;
+ struct xdg_wm_base *shell;
struct wl_shm *shm;
uint32_t shm_format;
struct xkb_context *ctx;
struct wl_surface *wl_surf;
- struct zxdg_surface_v6 *xdg_surf;
- struct zxdg_toplevel_v6 *xdg_top;
+ struct xdg_surface *xdg_surf;
+ struct xdg_toplevel *xdg_top;
struct wl_list seats;
};
@@ -261,21 +261,21 @@ buffer_create(struct interactive_dpy *inter, uint32_t width, uint32_t height)
}
static void
-surface_configure(void *data, struct zxdg_surface_v6 *surface,
+surface_configure(void *data, struct xdg_surface *surface,
uint32_t serial)
{
struct interactive_dpy *inter = data;
- zxdg_surface_v6_ack_configure(inter->xdg_surf, serial);
+ xdg_surface_ack_configure(inter->xdg_surf, serial);
wl_surface_commit(inter->wl_surf);
}
-static const struct zxdg_surface_v6_listener surface_listener = {
+static const struct xdg_surface_listener surface_listener = {
surface_configure,
};
static void
-toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
+toplevel_configure(void *data, struct xdg_toplevel *toplevel,
int32_t width, int32_t height, struct wl_array *states)
{
struct interactive_dpy *inter = data;
@@ -289,12 +289,12 @@ toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
}
static void
-toplevel_close(void *data, struct zxdg_toplevel_v6 *toplevel)
+toplevel_close(void *data, struct xdg_toplevel *toplevel)
{
terminate = true;
}
-static const struct zxdg_toplevel_v6_listener toplevel_listener = {
+static const struct xdg_toplevel_listener toplevel_listener = {
toplevel_configure,
toplevel_close
};
@@ -302,24 +302,23 @@ static const struct zxdg_toplevel_v6_listener toplevel_listener = {
static void surface_create(struct interactive_dpy *inter)
{
inter->wl_surf = wl_compositor_create_surface(inter->compositor);
- inter->xdg_surf = zxdg_shell_v6_get_xdg_surface(inter->shell,
- inter->wl_surf);
- zxdg_surface_v6_add_listener(inter->xdg_surf, &surface_listener, inter);
- inter->xdg_top = zxdg_surface_v6_get_toplevel(inter->xdg_surf);
- zxdg_toplevel_v6_add_listener(inter->xdg_top, &toplevel_listener, inter);
- zxdg_toplevel_v6_set_title(inter->xdg_top, "xkbcommon event tester");
- zxdg_toplevel_v6_set_app_id(inter->xdg_top,
- "org.xkbcommon.test.interactive-wayland");
+ inter->xdg_surf = xdg_wm_base_get_xdg_surface(inter->shell, inter->wl_surf);
+ xdg_surface_add_listener(inter->xdg_surf, &surface_listener, inter);
+ inter->xdg_top = xdg_surface_get_toplevel(inter->xdg_surf);
+ xdg_toplevel_add_listener(inter->xdg_top, &toplevel_listener, inter);
+ xdg_toplevel_set_title(inter->xdg_top, "xkbcommon event tester");
+ xdg_toplevel_set_app_id(inter->xdg_top,
+ "org.xkbcommon.test.interactive-wayland");
wl_surface_commit(inter->wl_surf);
}
static void
-shell_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial)
+shell_ping(void *data, struct xdg_wm_base *shell, uint32_t serial)
{
- zxdg_shell_v6_pong(shell, serial);
+ xdg_wm_base_pong(shell, serial);
}
-static const struct zxdg_shell_v6_listener shell_listener = {
+static const struct xdg_wm_base_listener shell_listener = {
shell_ping
};
@@ -433,7 +432,7 @@ pointer_button(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
{
struct interactive_seat *seat = data;
- zxdg_toplevel_v6_move(seat->inter->xdg_top, seat->wl_seat, serial);
+ xdg_toplevel_move(seat->inter->xdg_top, seat->wl_seat, serial);
}
static void
@@ -584,11 +583,11 @@ registry_global(void *data, struct wl_registry *registry, uint32_t name,
if (strcmp(interface, "wl_seat") == 0) {
seat_create(inter, registry, name, version);
}
- else if (strcmp(interface, "zxdg_shell_v6") == 0) {
+ else if (strcmp(interface, "xdg_wm_base") == 0) {
inter->shell = wl_registry_bind(registry, name,
- &zxdg_shell_v6_interface,
- MAX(version, 1));
- zxdg_shell_v6_add_listener(inter->shell, &shell_listener, inter);
+ &xdg_wm_base_interface,
+ MAX(version, 2));
+ xdg_wm_base_add_listener(inter->shell, &shell_listener, inter);
}
else if (strcmp(interface, "wl_compositor") == 0) {
inter->compositor = wl_registry_bind(registry, name,
@@ -629,13 +628,13 @@ dpy_disconnect(struct interactive_dpy *inter)
seat_destroy(seat);
if (inter->xdg_surf)
- zxdg_surface_v6_destroy(inter->xdg_surf);
+ xdg_surface_destroy(inter->xdg_surf);
if (inter->xdg_top)
- zxdg_toplevel_v6_destroy(inter->xdg_top);
+ xdg_toplevel_destroy(inter->xdg_top);
if (inter->wl_surf)
wl_surface_destroy(inter->wl_surf);
if (inter->shell)
- zxdg_shell_v6_destroy(inter->shell);
+ xdg_wm_base_destroy(inter->shell);
if (inter->compositor)
wl_compositor_destroy(inter->compositor);
if (inter->shm)