clients: use xdg_shell stable instead of v6

Now that Weston supports the stable revision, use it. Better to excercise the
current rather than outdated protocol.

Pekka:
- split the patch, rewrote commit message
- rename xdg_shell_ping to xdg_wm_base_ping
- rename xdg_shell_listener to wm_base_listener
- rename shell to wm_base
- fix continued line alignment
- drop unrelated change of adding parentheses around bit-wise and

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
ant8me 6 years ago committed by Daniel Stone
parent d8d9f5e6e1
commit f99fac22ab
  1. 26
      Makefile.am
  2. 24
      clients/meson.build
  3. 62
      clients/simple-damage.c
  4. 62
      clients/simple-dmabuf-drm.c
  5. 64
      clients/simple-dmabuf-v4l.c
  6. 83
      clients/simple-egl.c
  7. 62
      clients/simple-shm.c
  8. 162
      clients/window.c

@ -607,8 +607,8 @@ demo_clients += \
weston_simple_shm_SOURCES = clients/simple-shm.c weston_simple_shm_SOURCES = clients/simple-shm.c
nodist_weston_simple_shm_SOURCES = \ nodist_weston_simple_shm_SOURCES = \
protocol/xdg-shell-unstable-v6-protocol.c \ protocol/xdg-shell-protocol.c \
protocol/xdg-shell-unstable-v6-client-protocol.h \ protocol/xdg-shell-client-protocol.h \
protocol/fullscreen-shell-unstable-v1-protocol.c \ protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h protocol/fullscreen-shell-unstable-v1-client-protocol.h
weston_simple_shm_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS) weston_simple_shm_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
@ -618,8 +618,8 @@ weston_simple_damage_SOURCES = clients/simple-damage.c
nodist_weston_simple_damage_SOURCES = \ nodist_weston_simple_damage_SOURCES = \
protocol/viewporter-protocol.c \ protocol/viewporter-protocol.c \
protocol/viewporter-client-protocol.h \ protocol/viewporter-client-protocol.h \
protocol/xdg-shell-unstable-v6-protocol.c \ protocol/xdg-shell-protocol.c \
protocol/xdg-shell-unstable-v6-client-protocol.h \ protocol/xdg-shell-client-protocol.h \
protocol/fullscreen-shell-unstable-v1-protocol.c \ protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h protocol/fullscreen-shell-unstable-v1-client-protocol.h
weston_simple_damage_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS) weston_simple_damage_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
@ -649,8 +649,8 @@ if BUILD_SIMPLE_EGL_CLIENTS
demo_clients += weston-simple-egl demo_clients += weston-simple-egl
weston_simple_egl_SOURCES = clients/simple-egl.c weston_simple_egl_SOURCES = clients/simple-egl.c
nodist_weston_simple_egl_SOURCES = \ nodist_weston_simple_egl_SOURCES = \
protocol/xdg-shell-unstable-v6-protocol.c \ protocol/xdg-shell-protocol.c \
protocol/xdg-shell-unstable-v6-client-protocol.h protocol/xdg-shell-client-protocol.h
weston_simple_egl_CFLAGS = $(AM_CFLAGS) $(SIMPLE_EGL_CLIENT_CFLAGS) weston_simple_egl_CFLAGS = $(AM_CFLAGS) $(SIMPLE_EGL_CLIENT_CFLAGS)
weston_simple_egl_LDADD = $(SIMPLE_EGL_CLIENT_LIBS) -lm weston_simple_egl_LDADD = $(SIMPLE_EGL_CLIENT_LIBS) -lm
endif endif
@ -661,8 +661,8 @@ weston_simple_dmabuf_drm_SOURCES = \
clients/simple-dmabuf-drm.c \ clients/simple-dmabuf-drm.c \
clients/simple-dmabuf-drm-data.h clients/simple-dmabuf-drm-data.h
nodist_weston_simple_dmabuf_drm_SOURCES = \ nodist_weston_simple_dmabuf_drm_SOURCES = \
protocol/xdg-shell-unstable-v6-protocol.c \ protocol/xdg-shell-protocol.c \
protocol/xdg-shell-unstable-v6-client-protocol.h \ protocol/xdg-shell-client-protocol.h \
protocol/fullscreen-shell-unstable-v1-protocol.c \ protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \ protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/linux-dmabuf-unstable-v1-protocol.c \ protocol/linux-dmabuf-unstable-v1-protocol.c \
@ -679,8 +679,8 @@ if BUILD_SIMPLE_DMABUF_V4L_CLIENT
demo_clients += weston-simple-dmabuf-v4l demo_clients += weston-simple-dmabuf-v4l
weston_simple_dmabuf_v4l_SOURCES = clients/simple-dmabuf-v4l.c weston_simple_dmabuf_v4l_SOURCES = clients/simple-dmabuf-v4l.c
nodist_weston_simple_dmabuf_v4l_SOURCES = \ nodist_weston_simple_dmabuf_v4l_SOURCES = \
protocol/xdg-shell-unstable-v6-protocol.c \ protocol/xdg-shell-protocol.c \
protocol/xdg-shell-unstable-v6-client-protocol.h \ protocol/xdg-shell-client-protocol.h \
protocol/fullscreen-shell-unstable-v1-protocol.c \ protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \ protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/linux-dmabuf-unstable-v1-protocol.c \ protocol/linux-dmabuf-unstable-v1-protocol.c \
@ -717,8 +717,8 @@ nodist_libtoytoolkit_la_SOURCES = \
protocol/text-cursor-position-client-protocol.h \ protocol/text-cursor-position-client-protocol.h \
protocol/viewporter-protocol.c \ protocol/viewporter-protocol.c \
protocol/viewporter-client-protocol.h \ protocol/viewporter-client-protocol.h \
protocol/xdg-shell-unstable-v6-protocol.c \ protocol/xdg-shell-protocol.c \
protocol/xdg-shell-unstable-v6-client-protocol.h \ protocol/xdg-shell-client-protocol.h \
protocol/pointer-constraints-unstable-v1-protocol.c \ protocol/pointer-constraints-unstable-v1-protocol.c \
protocol/pointer-constraints-unstable-v1-client-protocol.h \ protocol/pointer-constraints-unstable-v1-client-protocol.h \
protocol/relative-pointer-unstable-v1-protocol.c \ protocol/relative-pointer-unstable-v1-protocol.c \
@ -966,6 +966,8 @@ BUILT_SOURCES += \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \ protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/xdg-shell-unstable-v6-protocol.c \ protocol/xdg-shell-unstable-v6-protocol.c \
protocol/xdg-shell-unstable-v6-client-protocol.h \ protocol/xdg-shell-unstable-v6-client-protocol.h \
protocol/xdg-shell-protocol.c \
protocol/xdg-shell-client-protocol.h \
protocol/ivi-hmi-controller-protocol.c \ protocol/ivi-hmi-controller-protocol.c \
protocol/ivi-hmi-controller-client-protocol.h \ protocol/ivi-hmi-controller-client-protocol.h \
protocol/ivi-application-protocol.c \ protocol/ivi-application-protocol.c \

@ -4,8 +4,8 @@ endif
srcs_toytoolkit = [ srcs_toytoolkit = [
'window.c', 'window.c',
xdg_shell_unstable_v6_client_protocol_h, xdg_shell_client_protocol_h,
xdg_shell_unstable_v6_protocol_c, xdg_shell_protocol_c,
text_cursor_position_client_protocol_h, text_cursor_position_client_protocol_h,
text_cursor_position_protocol_c, text_cursor_position_protocol_c,
relative_pointer_unstable_v1_client_protocol_h, relative_pointer_unstable_v1_client_protocol_h,
@ -41,8 +41,8 @@ simple_clients = [
'simple-damage.c', 'simple-damage.c',
viewporter_client_protocol_h, viewporter_client_protocol_h,
viewporter_protocol_c, viewporter_protocol_c,
xdg_shell_unstable_v6_client_protocol_h, xdg_shell_client_protocol_h,
xdg_shell_unstable_v6_protocol_c, xdg_shell_protocol_c,
fullscreen_shell_unstable_v1_client_protocol_h, fullscreen_shell_unstable_v1_client_protocol_h,
fullscreen_shell_unstable_v1_protocol_c, fullscreen_shell_unstable_v1_protocol_c,
], ],
@ -74,8 +74,8 @@ simple_clients = [
'simple-dmabuf-v4l.c', 'simple-dmabuf-v4l.c',
linux_dmabuf_unstable_v1_client_protocol_h, linux_dmabuf_unstable_v1_client_protocol_h,
linux_dmabuf_unstable_v1_protocol_c, linux_dmabuf_unstable_v1_protocol_c,
xdg_shell_unstable_v6_client_protocol_h, xdg_shell_client_protocol_h,
xdg_shell_unstable_v6_protocol_c, xdg_shell_protocol_c,
fullscreen_shell_unstable_v1_client_protocol_h, fullscreen_shell_unstable_v1_client_protocol_h,
fullscreen_shell_unstable_v1_protocol_c, fullscreen_shell_unstable_v1_protocol_c,
], ],
@ -85,8 +85,8 @@ simple_clients = [
'name': 'egl', 'name': 'egl',
'sources': [ 'sources': [
'simple-egl.c', 'simple-egl.c',
xdg_shell_unstable_v6_client_protocol_h, xdg_shell_client_protocol_h,
xdg_shell_unstable_v6_protocol_c, xdg_shell_protocol_c,
ivi_application_client_protocol_h, ivi_application_client_protocol_h,
ivi_application_protocol_c, ivi_application_protocol_c,
], ],
@ -98,8 +98,8 @@ simple_clients = [
'name': 'shm', 'name': 'shm',
'sources': [ 'sources': [
'simple-shm.c', 'simple-shm.c',
xdg_shell_unstable_v6_client_protocol_h, xdg_shell_client_protocol_h,
xdg_shell_unstable_v6_protocol_c, xdg_shell_protocol_c,
fullscreen_shell_unstable_v1_client_protocol_h, fullscreen_shell_unstable_v1_client_protocol_h,
fullscreen_shell_unstable_v1_protocol_c, fullscreen_shell_unstable_v1_protocol_c,
ivi_application_client_protocol_h, ivi_application_client_protocol_h,
@ -322,8 +322,8 @@ if simple_dmabuf_drm_deps.length() > 0
executable( executable(
'weston-simple-dmabuf-drm', 'weston-simple-dmabuf-drm',
'simple-dmabuf-drm.c', 'simple-dmabuf-drm.c',
xdg_shell_unstable_v6_client_protocol_h, xdg_shell_client_protocol_h,
xdg_shell_unstable_v6_protocol_c, xdg_shell_protocol_c,
fullscreen_shell_unstable_v1_client_protocol_h, fullscreen_shell_unstable_v1_client_protocol_h,
fullscreen_shell_unstable_v1_protocol_c, fullscreen_shell_unstable_v1_protocol_c,
linux_dmabuf_unstable_v1_client_protocol_h, linux_dmabuf_unstable_v1_client_protocol_h,

@ -39,7 +39,7 @@
#include <wayland-client.h> #include <wayland-client.h>
#include "shared/os-compatibility.h" #include "shared/os-compatibility.h"
#include "shared/zalloc.h" #include "shared/zalloc.h"
#include "xdg-shell-unstable-v6-client-protocol.h" #include "xdg-shell-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h" #include "fullscreen-shell-unstable-v1-client-protocol.h"
#include "viewporter-client-protocol.h" #include "viewporter-client-protocol.h"
@ -51,7 +51,7 @@ struct display {
int compositor_version; int compositor_version;
struct wl_compositor *compositor; struct wl_compositor *compositor;
struct wp_viewporter *viewporter; struct wp_viewporter *viewporter;
struct zxdg_shell_v6 *shell; struct xdg_wm_base *wm_base;
struct zwp_fullscreen_shell_v1 *fshell; struct zwp_fullscreen_shell_v1 *fshell;
struct wl_shm *shm; struct wl_shm *shm;
uint32_t formats; uint32_t formats;
@ -74,8 +74,8 @@ struct window {
int width, height, border; int width, height, border;
struct wl_surface *surface; struct wl_surface *surface;
struct wp_viewport *viewport; struct wp_viewport *viewport;
struct zxdg_surface_v6 *xdg_surface; struct xdg_surface *xdg_surface;
struct zxdg_toplevel_v6 *xdg_toplevel; struct xdg_toplevel *xdg_toplevel;
struct wl_callback *callback; struct wl_callback *callback;
struct buffer buffers[2]; struct buffer buffers[2];
struct buffer *prev_buffer; struct buffer *prev_buffer;
@ -149,12 +149,12 @@ create_shm_buffer(struct display *display, struct buffer *buffer,
} }
static void static void
xdg_surface_handle_configure(void *data, struct zxdg_surface_v6 *surface, xdg_surface_handle_configure(void *data, struct xdg_surface *surface,
uint32_t serial) uint32_t serial)
{ {
struct window *window = data; struct window *window = data;
zxdg_surface_v6_ack_configure(surface, serial); xdg_surface_ack_configure(surface, serial);
if (window->wait_for_configure) { if (window->wait_for_configure) {
redraw(window, NULL, 0); redraw(window, NULL, 0);
@ -162,24 +162,24 @@ xdg_surface_handle_configure(void *data, struct zxdg_surface_v6 *surface,
} }
} }
static const struct zxdg_surface_v6_listener xdg_surface_listener = { static const struct xdg_surface_listener xdg_surface_listener = {
xdg_surface_handle_configure, xdg_surface_handle_configure,
}; };
static void static void
xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *toplevel, xdg_toplevel_handle_configure(void *data, struct xdg_toplevel *toplevel,
int32_t width, int32_t height, int32_t width, int32_t height,
struct wl_array *states) struct wl_array *states)
{ {
} }
static void static void
xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel) xdg_toplevel_handle_close(void *data, struct xdg_toplevel *xdg_toplevel)
{ {
running = 0; running = 0;
} }
static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = { static const struct xdg_toplevel_listener xdg_toplevel_listener = {
xdg_toplevel_handle_configure, xdg_toplevel_handle_configure,
xdg_toplevel_handle_close, xdg_toplevel_handle_close,
}; };
@ -317,25 +317,25 @@ create_window(struct display *display, int width, int height,
window->viewport = wp_viewporter_get_viewport(display->viewporter, window->viewport = wp_viewporter_get_viewport(display->viewporter,
window->surface); window->surface);
if (display->shell) { if (display->wm_base) {
window->xdg_surface = window->xdg_surface =
zxdg_shell_v6_get_xdg_surface(display->shell, xdg_wm_base_get_xdg_surface(display->wm_base,
window->surface); window->surface);
assert(window->xdg_surface); assert(window->xdg_surface);
zxdg_surface_v6_add_listener(window->xdg_surface, xdg_surface_add_listener(window->xdg_surface,
&xdg_surface_listener, window); &xdg_surface_listener, window);
window->xdg_toplevel = window->xdg_toplevel =
zxdg_surface_v6_get_toplevel(window->xdg_surface); xdg_surface_get_toplevel(window->xdg_surface);
assert(window->xdg_toplevel); assert(window->xdg_toplevel);
zxdg_toplevel_v6_add_listener(window->xdg_toplevel, xdg_toplevel_add_listener(window->xdg_toplevel,
&xdg_toplevel_listener, window); &xdg_toplevel_listener, window);
zxdg_toplevel_v6_set_title(window->xdg_toplevel, "simple-damage"); xdg_toplevel_set_title(window->xdg_toplevel, "simple-damage");
window->wait_for_configure = true; window->wait_for_configure = true;
wl_surface_commit(window->surface); wl_surface_commit(window->surface);
@ -370,9 +370,9 @@ destroy_window(struct window *window)
wl_buffer_destroy(window->buffers[1].buffer); wl_buffer_destroy(window->buffers[1].buffer);
if (window->xdg_toplevel) if (window->xdg_toplevel)
zxdg_toplevel_v6_destroy(window->xdg_toplevel); xdg_toplevel_destroy(window->xdg_toplevel);
if (window->xdg_surface) if (window->xdg_surface)
zxdg_surface_v6_destroy(window->xdg_surface); xdg_surface_destroy(window->xdg_surface);
if (window->viewport) if (window->viewport)
wp_viewport_destroy(window->viewport); wp_viewport_destroy(window->viewport);
wl_surface_destroy(window->surface); wl_surface_destroy(window->surface);
@ -711,13 +711,13 @@ struct wl_shm_listener shm_listener = {
}; };
static void static void
xdg_shell_ping(void *data, struct zxdg_shell_v6*shell, uint32_t serial) xdg_wm_base_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 xdg_shell_listener = { static const struct xdg_wm_base_listener wm_base_listener = {
xdg_shell_ping, xdg_wm_base_ping,
}; };
static void static void
@ -743,10 +743,10 @@ registry_handle_global(void *data, struct wl_registry *registry,
} else if (strcmp(interface, "wp_viewporter") == 0) { } else if (strcmp(interface, "wp_viewporter") == 0) {
d->viewporter = wl_registry_bind(registry, id, d->viewporter = wl_registry_bind(registry, id,
&wp_viewporter_interface, 1); &wp_viewporter_interface, 1);
} else if (strcmp(interface, "zxdg_shell_v6") == 0) { } else if (strcmp(interface, "xdg_wm_base") == 0) {
d->shell = wl_registry_bind(registry, d->wm_base = wl_registry_bind(registry,
id, &zxdg_shell_v6_interface, 1); id, &xdg_wm_base_interface, 1);
zxdg_shell_v6_add_listener(d->shell, &xdg_shell_listener, d); xdg_wm_base_add_listener(d->wm_base, &wm_base_listener, d);
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) { } else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
d->fshell = wl_registry_bind(registry, d->fshell = wl_registry_bind(registry,
id, &zwp_fullscreen_shell_v1_interface, 1); id, &zwp_fullscreen_shell_v1_interface, 1);
@ -808,8 +808,8 @@ destroy_display(struct display *display)
if (display->shm) if (display->shm)
wl_shm_destroy(display->shm); wl_shm_destroy(display->shm);
if (display->shell) if (display->wm_base)
zxdg_shell_v6_destroy(display->shell); xdg_wm_base_destroy(display->wm_base);
if (display->fshell) if (display->fshell)
zwp_fullscreen_shell_v1_release(display->fshell); zwp_fullscreen_shell_v1_release(display->fshell);

@ -57,7 +57,7 @@
#include <wayland-client.h> #include <wayland-client.h>
#include "shared/zalloc.h" #include "shared/zalloc.h"
#include "xdg-shell-unstable-v6-client-protocol.h" #include "xdg-shell-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h" #include "fullscreen-shell-unstable-v1-client-protocol.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h" #include "linux-dmabuf-unstable-v1-client-protocol.h"
@ -77,7 +77,7 @@ struct display {
struct wl_display *display; struct wl_display *display;
struct wl_registry *registry; struct wl_registry *registry;
struct wl_compositor *compositor; struct wl_compositor *compositor;
struct zxdg_shell_v6 *shell; struct xdg_wm_base *wm_base;
struct zwp_fullscreen_shell_v1 *fshell; struct zwp_fullscreen_shell_v1 *fshell;
struct zwp_linux_dmabuf_v1 *dmabuf; struct zwp_linux_dmabuf_v1 *dmabuf;
int xrgb8888_format_found; int xrgb8888_format_found;
@ -135,8 +135,8 @@ struct window {
struct display *display; struct display *display;
int width, height; int width, height;
struct wl_surface *surface; struct wl_surface *surface;
struct zxdg_surface_v6 *xdg_surface; struct xdg_surface *xdg_surface;
struct zxdg_toplevel_v6 *xdg_toplevel; struct xdg_toplevel *xdg_toplevel;
struct buffer buffers[NUM_BUFFERS]; struct buffer buffers[NUM_BUFFERS];
struct buffer *prev_buffer; struct buffer *prev_buffer;
struct wl_callback *callback; struct wl_callback *callback;
@ -592,36 +592,36 @@ error:
} }
static void static void
xdg_surface_handle_configure(void *data, struct zxdg_surface_v6 *surface, xdg_surface_handle_configure(void *data, struct xdg_surface *surface,
uint32_t serial) uint32_t serial)
{ {
struct window *window = data; struct window *window = data;
zxdg_surface_v6_ack_configure(surface, serial); xdg_surface_ack_configure(surface, serial);
if (window->initialized && window->wait_for_configure) if (window->initialized && window->wait_for_configure)
redraw(window, NULL, 0); redraw(window, NULL, 0);
window->wait_for_configure = false; window->wait_for_configure = false;
} }
static const struct zxdg_surface_v6_listener xdg_surface_listener = { static const struct xdg_surface_listener xdg_surface_listener = {
xdg_surface_handle_configure, xdg_surface_handle_configure,
}; };
static void static void
xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *toplevel, xdg_toplevel_handle_configure(void *data, struct xdg_toplevel *toplevel,
int32_t width, int32_t height, int32_t width, int32_t height,
struct wl_array *states) struct wl_array *states)
{ {
} }
static void static void
xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel) xdg_toplevel_handle_close(void *data, struct xdg_toplevel *xdg_toplevel)
{ {
running = 0; running = 0;
} }
static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = { static const struct xdg_toplevel_listener xdg_toplevel_listener = {
xdg_toplevel_handle_configure, xdg_toplevel_handle_configure,
xdg_toplevel_handle_close, xdg_toplevel_handle_close,
}; };
@ -644,25 +644,25 @@ create_window(struct display *display, int width, int height, int format,
window->height = height; window->height = height;
window->surface = wl_compositor_create_surface(display->compositor); window->surface = wl_compositor_create_surface(display->compositor);
if (display->shell) { if (display->wm_base) {
window->xdg_surface = window->xdg_surface =
zxdg_shell_v6_get_xdg_surface(display->shell, xdg_wm_base_get_xdg_surface(display->wm_base,
window->surface); window->surface);
assert(window->xdg_surface); assert(window->xdg_surface);
zxdg_surface_v6_add_listener(window->xdg_surface, xdg_surface_add_listener(window->xdg_surface,
&xdg_surface_listener, window); &xdg_surface_listener, window);
window->xdg_toplevel = window->xdg_toplevel =
zxdg_surface_v6_get_toplevel(window->xdg_surface); xdg_surface_get_toplevel(window->xdg_surface);
assert(window->xdg_toplevel); assert(window->xdg_toplevel);
zxdg_toplevel_v6_add_listener(window->xdg_toplevel, xdg_toplevel_add_listener(window->xdg_toplevel,
&xdg_toplevel_listener, window); &xdg_toplevel_listener, window);
zxdg_toplevel_v6_set_title(window->xdg_toplevel, "simple-dmabuf"); xdg_toplevel_set_title(window->xdg_toplevel, "simple-dmabuf");
window->wait_for_configure = true; window->wait_for_configure = true;
wl_surface_commit(window->surface); wl_surface_commit(window->surface);
@ -707,9 +707,9 @@ destroy_window(struct window *window)
} }
if (window->xdg_toplevel) if (window->xdg_toplevel)
zxdg_toplevel_v6_destroy(window->xdg_toplevel); xdg_toplevel_destroy(window->xdg_toplevel);
if (window->xdg_surface) if (window->xdg_surface)
zxdg_surface_v6_destroy(window->xdg_surface); xdg_surface_destroy(window->xdg_surface);
wl_surface_destroy(window->surface); wl_surface_destroy(window->surface);
free(window); free(window);
} }
@ -796,13 +796,13 @@ static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = {
}; };
static void static void
xdg_shell_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial) xdg_wm_base_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 xdg_shell_listener = { static const struct xdg_wm_base_listener wm_base_listener = {
xdg_shell_ping, xdg_wm_base_ping,
}; };
static void static void
@ -815,10 +815,10 @@ registry_handle_global(void *data, struct wl_registry *registry,
d->compositor = d->compositor =
wl_registry_bind(registry, wl_registry_bind(registry,
id, &wl_compositor_interface, 1); id, &wl_compositor_interface, 1);
} else if (strcmp(interface, "zxdg_shell_v6") == 0) { } else if (strcmp(interface, "xdg_wm_base") == 0) {
d->shell = wl_registry_bind(registry, d->wm_base = wl_registry_bind(registry,
id, &zxdg_shell_v6_interface, 1); id, &xdg_wm_base_interface, 1);
zxdg_shell_v6_add_listener(d->shell, &xdg_shell_listener, d); xdg_wm_base_add_listener(d->wm_base, &wm_base_listener, d);
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) { } else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
d->fshell = wl_registry_bind(registry, d->fshell = wl_registry_bind(registry,
id, &zwp_fullscreen_shell_v1_interface, 1); id, &zwp_fullscreen_shell_v1_interface, 1);
@ -882,8 +882,8 @@ destroy_display(struct display *display)
if (display->dmabuf) if (display->dmabuf)
zwp_linux_dmabuf_v1_destroy(display->dmabuf); zwp_linux_dmabuf_v1_destroy(display->dmabuf);
if (display->shell) if (display->wm_base)
zxdg_shell_v6_destroy(display->shell); xdg_wm_base_destroy(display->wm_base);
if (display->fshell) if (display->fshell)
zwp_fullscreen_shell_v1_release(display->fshell); zwp_fullscreen_shell_v1_release(display->fshell);

@ -47,7 +47,7 @@
#include <wayland-client.h> #include <wayland-client.h>
#include "shared/zalloc.h" #include "shared/zalloc.h"
#include "xdg-shell-unstable-v6-client-protocol.h" #include "xdg-shell-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h" #include "fullscreen-shell-unstable-v1-client-protocol.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h" #include "linux-dmabuf-unstable-v1-client-protocol.h"
@ -100,7 +100,7 @@ struct display {
struct wl_compositor *compositor; struct wl_compositor *compositor;
struct wl_seat *seat; struct wl_seat *seat;
struct wl_keyboard *keyboard; struct wl_keyboard *keyboard;
struct zxdg_shell_v6 *shell; struct xdg_wm_base *wm_base;
struct zwp_fullscreen_shell_v1 *fshell; struct zwp_fullscreen_shell_v1 *fshell;
struct zwp_linux_dmabuf_v1 *dmabuf; struct zwp_linux_dmabuf_v1 *dmabuf;
bool requested_format_found; bool requested_format_found;
@ -125,8 +125,8 @@ struct buffer {
struct window { struct window {
struct display *display; struct display *display;
struct wl_surface *surface; struct wl_surface *surface;
struct zxdg_surface_v6 *xdg_surface; struct xdg_surface *xdg_surface;
struct zxdg_toplevel_v6 *xdg_toplevel; struct xdg_toplevel *xdg_toplevel;
struct buffer buffers[NUM_BUFFERS]; struct buffer buffers[NUM_BUFFERS];
struct wl_callback *callback; struct wl_callback *callback;
bool wait_for_configure; bool wait_for_configure;
@ -536,36 +536,36 @@ start_capture(struct display *display)
} }
static void static void
xdg_surface_handle_configure(void *data, struct zxdg_surface_v6 *surface, xdg_surface_handle_configure(void *data, struct xdg_surface *surface,
uint32_t serial) uint32_t serial)
{ {
struct window *window = data; struct window *window = data;
zxdg_surface_v6_ack_configure(surface, serial); xdg_surface_ack_configure(surface, serial);
if (window->initialized && window->wait_for_configure) if (window->initialized && window->wait_for_configure)
redraw(window, NULL, 0); redraw(window, NULL, 0);
window->wait_for_configure = false; window->wait_for_configure = false;
} }
static const struct zxdg_surface_v6_listener xdg_surface_listener = { static const struct xdg_surface_listener xdg_surface_listener = {
xdg_surface_handle_configure, xdg_surface_handle_configure,
}; };
static void static void
xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *toplevel, xdg_toplevel_handle_configure(void *data, struct xdg_toplevel *toplevel,
int32_t width, int32_t height, int32_t width, int32_t height,
struct wl_array *states) struct wl_array *states)
{ {
} }
static void static void
xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel) xdg_toplevel_handle_close(void *data, struct xdg_toplevel *xdg_toplevel)
{ {
running = 0; running = 0;
} }
static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = { static const struct xdg_toplevel_listener xdg_toplevel_listener = {
xdg_toplevel_handle_configure, xdg_toplevel_handle_configure,
xdg_toplevel_handle_close, xdg_toplevel_handle_close,
}; };
@ -583,25 +583,25 @@ create_window(struct display *display)
window->display = display; window->display = display;
window->surface = wl_compositor_create_surface(display->compositor); window->surface = wl_compositor_create_surface(display->compositor);
if (display->shell) { if (display->wm_base) {
window->xdg_surface = window->xdg_surface =
zxdg_shell_v6_get_xdg_surface(display->shell, xdg_wm_base_get_xdg_surface(display->wm_base,
window->surface); window->surface);
assert(window->xdg_surface); assert(window->xdg_surface);
zxdg_surface_v6_add_listener(window->xdg_surface, xdg_surface_add_listener(window->xdg_surface,
&xdg_surface_listener, window); &xdg_surface_listener, window);
window->xdg_toplevel = window->xdg_toplevel =
zxdg_surface_v6_get_toplevel(window->xdg_surface); xdg_surface_get_toplevel(window->xdg_surface);
assert(window->xdg_toplevel); assert(window->xdg_toplevel);
zxdg_toplevel_v6_add_listener(window->xdg_toplevel, xdg_toplevel_add_listener(window->xdg_toplevel,
&xdg_toplevel_listener, window); &xdg_toplevel_listener, window);
zxdg_toplevel_v6_set_title(window->xdg_toplevel, "simple-dmabuf-v4l"); xdg_toplevel_set_title(window->xdg_toplevel, "simple-dmabuf-v4l");
window->wait_for_configure = true; window->wait_for_configure = true;
wl_surface_commit(window->surface); wl_surface_commit(window->surface);
@ -627,9 +627,9 @@ destroy_window(struct window *window)
wl_callback_destroy(window->callback); wl_callback_destroy(window->callback);
if (window->xdg_toplevel) if (window->xdg_toplevel)
zxdg_toplevel_v6_destroy(window->xdg_toplevel); xdg_toplevel_destroy(window->xdg_toplevel);
if (window->xdg_surface) if (window->xdg_surface)
zxdg_surface_v6_destroy(window->xdg_surface); xdg_surface_destroy(window->xdg_surface);
wl_surface_destroy(window->surface); wl_surface_destroy(window->surface);
for (i = 0; i < NUM_BUFFERS; i++) { for (i = 0; i < NUM_BUFFERS; i++) {
@ -737,7 +737,7 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
{ {
struct display *d = data; struct display *d = data;
if (!d->shell) if (!d->wm_base)
return; return;
if (key == KEY_ESC && state) if (key == KEY_ESC && state)
@ -780,13 +780,13 @@ static const struct wl_seat_listener seat_listener = {
}; };
static void static void
xdg_shell_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial) xdg_wm_base_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 xdg_shell_listener = { static const struct xdg_wm_base_listener wm_base_listener = {
xdg_shell_ping, xdg_wm_base_ping,
}; };
static void static void
@ -803,10 +803,10 @@ registry_handle_global(void *data, struct wl_registry *registry,
d->seat = wl_registry_bind(registry, d->seat = wl_registry_bind(registry,
id, &wl_seat_interface, 1); id, &wl_seat_interface, 1);
wl_seat_add_listener(d->seat, &seat_listener, d); wl_seat_add_listener(d->seat, &seat_listener, d);
} else if (strcmp(interface, "zxdg_shell_v6") == 0) { } else if (strcmp(interface, "xdg_wm_base") == 0) {
d->shell = wl_registry_bind(registry, d->wm_base = wl_registry_bind(registry,
id, &zxdg_shell_v6_interface, 1); id, &xdg_wm_base_interface, 1);
zxdg_shell_v6_add_listener(d->shell, &xdg_shell_listener, d); xdg_wm_base_add_listener(d->wm_base, &wm_base_listener, d);
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) { } else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
d->fshell = wl_registry_bind(registry, d->fshell = wl_registry_bind(registry,
id, &zwp_fullscreen_shell_v1_interface, id, &zwp_fullscreen_shell_v1_interface,
@ -874,8 +874,8 @@ destroy_display(struct display *display)
if (display->dmabuf) if (display->dmabuf)
zwp_linux_dmabuf_v1_destroy(display->dmabuf); zwp_linux_dmabuf_v1_destroy(display->dmabuf);
if (display->shell) if (display->wm_base)
zxdg_shell_v6_destroy(display->shell); xdg_wm_base_destroy(display->wm_base);
if (display->fshell) if (display->fshell)
zwp_fullscreen_shell_v1_release(display->fshell); zwp_fullscreen_shell_v1_release(display->fshell);

@ -42,7 +42,7 @@
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
#include "xdg-shell-unstable-v6-client-protocol.h" #include "xdg-shell-client-protocol.h"
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
@ -57,7 +57,7 @@ struct display {
struct wl_display *display; struct wl_display *display;
struct wl_registry *registry; struct wl_registry *registry;
struct wl_compositor *compositor; struct wl_compositor *compositor;
struct zxdg_shell_v6 *shell; struct xdg_wm_base *wm_base;
struct wl_seat *seat; struct wl_seat *seat;
struct wl_pointer *pointer; struct wl_pointer *pointer;
struct wl_touch *touch; struct wl_touch *touch;
@ -92,8 +92,8 @@ struct window {
uint32_t benchmark_time, frames; uint32_t benchmark_time, frames;
struct wl_egl_window *native; struct wl_egl_window *native;
struct wl_surface *surface; struct wl_surface *surface;
struct zxdg_surface_v6 *xdg_surface; struct xdg_surface *xdg_surface;
struct zxdg_toplevel_v6 *xdg_toplevel; struct xdg_toplevel *xdg_toplevel;
EGLSurface egl_surface; EGLSurface egl_surface;
struct wl_callback *callback; struct wl_callback *callback;
int fullscreen, maximized, opaque, buffer_size, frame_sync, delay; int fullscreen, maximized, opaque, buffer_size, frame_sync, delay;
@ -290,22 +290,22 @@ init_gl(struct window *window)
} }
static void static void
handle_surface_configure(void *data, struct zxdg_surface_v6 *surface, handle_surface_configure(void *data, struct xdg_surface *surface,
uint32_t serial) uint32_t serial)
{ {
struct window *window = data; struct window *window = data;
zxdg_surface_v6_ack_configure(surface, serial); xdg_surface_ack_configure(surface, serial);
window->wait_for_configure = false; window->wait_for_configure = false;
} }
static const struct zxdg_surface_v6_listener xdg_surface_listener = { static const struct xdg_surface_listener xdg_surface_listener = {
handle_surface_configure handle_surface_configure
}; };
static void static void
handle_toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel, handle_toplevel_configure(void *data, struct xdg_toplevel *toplevel,
int32_t width, int32_t height, int32_t width, int32_t height,
struct wl_array *states) struct wl_array *states)
{ {
@ -317,10 +317,10 @@ handle_toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
wl_array_for_each(p, states) { wl_array_for_each(p, states) {
uint32_t state = *p; uint32_t state = *p;
switch (state) { switch (state) {
case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN: case XDG_TOPLEVEL_STATE_FULLSCREEN:
window->fullscreen = 1; window->fullscreen = 1;
break; break;
case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED: case XDG_TOPLEVEL_STATE_MAXIMIZED:
window->maximized = 1; window->maximized = 1;
break; break;
} }
@ -344,12 +344,12 @@ handle_toplevel_configure(void *data, struct zxdg_toplevel_v6 *toplevel,
} }
static void static void
handle_toplevel_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel) handle_toplevel_close(void *data, struct xdg_toplevel *xdg_toplevel)
{ {
running = 0; running = 0;
} }
static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = { static const struct xdg_toplevel_listener xdg_toplevel_listener = {
handle_toplevel_configure, handle_toplevel_configure,
handle_toplevel_close, handle_toplevel_close,
}; };
@ -371,17 +371,17 @@ create_surface(struct window *window)
display->egl.conf, display->egl.conf,
window->native, NULL); window->native, NULL);
window->xdg_surface = zxdg_shell_v6_get_xdg_surface(display->shell, window->xdg_surface = xdg_wm_base_get_xdg_surface(display->wm_base,
window->surface); window->surface);
zxdg_surface_v6_add_listener(window->xdg_surface, xdg_surface_add_listener(window->xdg_surface,
&xdg_surface_listener, window); &xdg_surface_listener, window);
window->xdg_toplevel = window->xdg_toplevel =
zxdg_surface_v6_get_toplevel(window->xdg_surface); xdg_surface_get_toplevel(window->xdg_surface);
zxdg_toplevel_v6_add_listener(window->xdg_toplevel, xdg_toplevel_add_listener(window->xdg_toplevel,
&xdg_toplevel_listener, window); &xdg_toplevel_listener, window);
zxdg_toplevel_v6_set_title(window->xdg_toplevel, "simple-egl"); xdg_toplevel_set_title(window->xdg_toplevel, "simple-egl");
window->wait_for_configure = true; window->wait_for_configure = true;
wl_surface_commit(window->surface); wl_surface_commit(window->surface);
@ -393,11 +393,11 @@ create_surface(struct window *window)
if (!window->frame_sync) if (!window->frame_sync)
eglSwapInterval(display->egl.dpy, 0); eglSwapInterval(display->egl.dpy, 0);
if (!display->shell) if (!display->wm_base)
return; return;
if (window->fullscreen) if (window->fullscreen)
zxdg_toplevel_v6_set_fullscreen(window->xdg_toplevel, NULL); xdg_toplevel_set_fullscreen(window->xdg_toplevel, NULL);
} }
static void static void
@ -413,9 +413,9 @@ destroy_surface(struct window *window)
wl_egl_window_destroy(window->native); wl_egl_window_destroy(window->native);
if (window->xdg_toplevel) if (window->xdg_toplevel)
zxdg_toplevel_v6_destroy(window->xdg_toplevel); xdg_toplevel_destroy(window->xdg_toplevel);
if (window->xdg_surface) if (window->xdg_surface)
zxdg_surface_v6_destroy(window->xdg_surface); xdg_surface_destroy(window->xdg_surface);
wl_surface_destroy(window->surface); wl_surface_destroy(window->surface);
if (window->callback) if (window->callback)
@ -575,8 +575,8 @@ pointer_handle_button(void *data, struct wl_pointer *wl_pointer,
return; return;
if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED) if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED)
zxdg_toplevel_v6_move(display->window->xdg_toplevel, xdg_toplevel_move(display->window->xdg_toplevel,
display->seat, serial); display->seat, serial);
} }
static void static void
@ -600,10 +600,10 @@ touch_handle_down(void *data, struct wl_touch *wl_touch,
{ {
struct display *d = (struct display *)data; struct display *d = (struct display *)data;
if (!d->shell) if (!d->wm_base)
return; return;
zxdg_toplevel_v6_move(d->window->xdg_toplevel, d->seat, serial); xdg_toplevel_move(d->window->xdg_toplevel, d->seat, serial);
} }
static void static void
@ -662,15 +662,14 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
{ {
struct display *d = data; struct display *d = data;
if (!d->shell) if (!d->wm_base)
return; return;
if (key == KEY_F11 && state) { if (key == KEY_F11 && state) {
if (d->window->fullscreen) if (d->window->fullscreen)
zxdg_toplevel_v6_unset_fullscreen(d->window->xdg_toplevel); xdg_toplevel_unset_fullscreen(d->window->xdg_toplevel);
else else
zxdg_toplevel_v6_set_fullscreen(d->window->xdg_toplevel, xdg_toplevel_set_fullscreen(d->window->xdg_toplevel, NULL);
NULL);
} else if (key == KEY_ESC && state) } else if (key == KEY_ESC && state)
running = 0; running = 0;
} }
@ -728,13 +727,13 @@ static const struct wl_seat_listener seat_listener = {
}; };
static void static void
xdg_shell_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial) xdg_wm_base_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 xdg_shell_listener = { static const struct xdg_wm_base_listener wm_base_listener = {
xdg_shell_ping, xdg_wm_base_ping,
}; };
static void static void
@ -748,10 +747,10 @@ registry_handle_global(void *data, struct wl_registry *registry,
wl_registry_bind(registry, name, wl_registry_bind(registry, name,
&wl_compositor_interface, &wl_compositor_interface,
MIN(version, 4)); MIN(version, 4));
} else if (strcmp(interface, "zxdg_shell_v6") == 0) { } else if (strcmp(interface, "xdg_wm_base") == 0) {
d->shell = wl_registry_bind(registry, name, d->wm_base = wl_registry_bind(registry, name,
&zxdg_shell_v6_interface, 1); &xdg_wm_base_interface, 1);
zxdg_shell_v6_add_listener(d->shell, &xdg_shell_listener, d); xdg_wm_base_add_listener(d->wm_base, &wm_base_listener, d);
} else if (strcmp(interface, "wl_seat") == 0) { } else if (strcmp(interface, "wl_seat") == 0) {
d->seat = wl_registry_bind(registry, name, d->seat = wl_registry_bind(registry, name,
&wl_seat_interface, 1); &wl_seat_interface, 1);
@ -881,8 +880,8 @@ main(int argc, char **argv)
if (display.cursor_theme) if (display.cursor_theme)
wl_cursor_theme_destroy(display.cursor_theme); wl_cursor_theme_destroy(display.cursor_theme);
if (display.shell) if (display.wm_base)
zxdg_shell_v6_destroy(display.shell); xdg_wm_base_destroy(display.wm_base);
if (display.compositor) if (display.compositor)
wl_compositor_destroy(display.compositor); wl_compositor_destroy(display.compositor);

@ -37,14 +37,14 @@
#include <wayland-client.h> #include <wayland-client.h>
#include "shared/os-compatibility.h" #include "shared/os-compatibility.h"
#include "shared/zalloc.h" #include "shared/zalloc.h"
#include "xdg-shell-unstable-v6-client-protocol.h" #include "xdg-shell-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h" #include "fullscreen-shell-unstable-v1-client-protocol.h"
struct display { struct display {
struct wl_display *display; struct wl_display *display;
struct wl_registry *registry; struct wl_registry *registry;
struct wl_compositor *compositor; struct wl_compositor *compositor;
struct zxdg_shell_v6 *shell; struct xdg_wm_base *wm_base;
struct zwp_fullscreen_shell_v1 *fshell; struct zwp_fullscreen_shell_v1 *fshell;
struct wl_shm *shm; struct wl_shm *shm;
bool has_xrgb; bool has_xrgb;
@ -60,8 +60,8 @@ struct window {
struct display *display; struct display *display;
int width, height; int width, height;
struct wl_surface *surface; struct wl_surface *surface;
struct zxdg_surface_v6 *xdg_surface; struct xdg_surface *xdg_surface;
struct zxdg_toplevel_v6 *xdg_toplevel; struct xdg_toplevel *xdg_toplevel;
struct buffer buffers[2]; struct buffer buffers[2];
struct buffer *prev_buffer; struct buffer *prev_buffer;
struct wl_callback *callback; struct wl_callback *callback;
@ -124,12 +124,12 @@ create_shm_buffer(struct display *display, struct buffer *buffer,
} }
static void static void
handle_xdg_surface_configure(void *data, struct zxdg_surface_v6 *surface, handle_xdg_surface_configure(void *data, struct xdg_surface *surface,
uint32_t serial) uint32_t serial)
{ {
struct window *window = data; struct window *window = data;
zxdg_surface_v6_ack_configure(surface, serial); xdg_surface_ack_configure(surface, serial);
if (window->wait_for_configure) { if (window->wait_for_configure) {
redraw(window, NULL, 0); redraw(window, NULL, 0);
@ -137,24 +137,24 @@ handle_xdg_surface_configure(void *data, struct zxdg_surface_v6 *surface,
} }
} }
static const struct zxdg_surface_v6_listener xdg_surface_listener = { static const struct xdg_surface_listener xdg_surface_listener = {
handle_xdg_surface_configure, handle_xdg_surface_configure,
}; };
static void static void
handle_xdg_toplevel_configure(void *data, struct zxdg_toplevel_v6 *xdg_toplevel, handle_xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel,
int32_t width, int32_t height, int32_t width, int32_t height,
struct wl_array *state) struct wl_array *state)
{ {
} }
static void static void
handle_xdg_toplevel_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel) handle_xdg_toplevel_close(void *data, struct xdg_toplevel *xdg_toplevel)
{ {
running = 0; running = 0;
} }
static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = { static const struct xdg_toplevel_listener xdg_toplevel_listener = {
handle_xdg_toplevel_configure, handle_xdg_toplevel_configure,
handle_xdg_toplevel_close, handle_xdg_toplevel_close,
}; };
@ -174,21 +174,21 @@ create_window(struct display *display, int width, int height)
window->height = height; window->height = height;
window->surface = wl_compositor_create_surface(display->compositor); window->surface = wl_compositor_create_surface(display->compositor);
if (display->shell) { if (display->wm_base) {
window->xdg_surface = window->xdg_surface =
zxdg_shell_v6_get_xdg_surface(display->shell, xdg_wm_base_get_xdg_surface(display->wm_base,
window->surface); window->surface);
assert(window->xdg_surface); assert(window->xdg_surface);
zxdg_surface_v6_add_listener(window->xdg_surface, xdg_surface_add_listener(window->xdg_surface,
&xdg_surface_listener, window); &xdg_surface_listener, window);
window->xdg_toplevel = window->xdg_toplevel =
zxdg_surface_v6_get_toplevel(window->xdg_surface); xdg_surface_get_toplevel(window->xdg_surface);
assert(window->xdg_toplevel); assert(window->xdg_toplevel);
zxdg_toplevel_v6_add_listener(window->xdg_toplevel, xdg_toplevel_add_listener(window->xdg_toplevel,
&xdg_toplevel_listener, window); &xdg_toplevel_listener, window);
zxdg_toplevel_v6_set_title(window->xdg_toplevel, "simple-shm"); xdg_toplevel_set_title(window->xdg_toplevel, "simple-shm");
wl_surface_commit(window->surface); wl_surface_commit(window->surface);
window->wait_for_configure = true; window->wait_for_configure = true;
} else if (display->fshell) { } else if (display->fshell) {
@ -215,9 +215,9 @@ destroy_window(struct window *window)
wl_buffer_destroy(window->buffers[1].buffer); wl_buffer_destroy(window->buffers[1].buffer);
if (window->xdg_toplevel) if (window->xdg_toplevel)
zxdg_toplevel_v6_destroy(window->xdg_toplevel); xdg_toplevel_destroy(window->xdg_toplevel);
if (window->xdg_surface) if (window->xdg_surface)
zxdg_surface_v6_destroy(window->xdg_surface); xdg_surface_destroy(window->xdg_surface);
wl_surface_destroy(window->surface); wl_surface_destroy(window->surface);
free(window); free(window);
} }
@ -346,13 +346,13 @@ struct wl_shm_listener shm_listener = {
}; };
static void static void
xdg_shell_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial) xdg_wm_base_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 xdg_shell_listener = { static const struct xdg_wm_base_listener xdg_wm_base_listener = {
xdg_shell_ping, xdg_wm_base_ping,
}; };
static void static void
@ -365,10 +365,10 @@ registry_handle_global(void *data, struct wl_registry *registry,
d->compositor = d->compositor =
wl_registry_bind(registry, wl_registry_bind(registry,
id, &wl_compositor_interface, 1); id, &wl_compositor_interface, 1);
} else if (strcmp(interface, "zxdg_shell_v6") == 0) { } else if (strcmp(interface, "xdg_wm_base") == 0) {
d->shell = wl_registry_bind(registry, d->wm_base = wl_registry_bind(registry,
id, &zxdg_shell_v6_interface, 1); id, &xdg_wm_base_interface, 1);
zxdg_shell_v6_add_listener(d->shell, &xdg_shell_listener, d); xdg_wm_base_add_listener(d->wm_base, &xdg_wm_base_listener, d);
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) { } else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
d->fshell = wl_registry_bind(registry, d->fshell = wl_registry_bind(registry,
id, &zwp_fullscreen_shell_v1_interface, 1); id, &zwp_fullscreen_shell_v1_interface, 1);
@ -469,8 +469,8 @@ destroy_display(struct display *display)
if (display->shm) if (display->shm)
wl_shm_destroy(display->shm); wl_shm_destroy(display->shm);
if (display->shell) if (display->wm_base)
zxdg_shell_v6_destroy(display->shell); xdg_wm_base_destroy(display->wm_base);
if (display->fshell) if (display->fshell)
zwp_fullscreen_shell_v1_release(display->fshell); zwp_fullscreen_shell_v1_release(display->fshell);

@ -74,7 +74,7 @@ typedef void *EGLContext;
#include "shared/helpers.h" #include "shared/helpers.h"
#include "shared/xalloc.h" #include "shared/xalloc.h"
#include "shared/zalloc.h" #include "shared/zalloc.h"
#include "xdg-shell-unstable-v6-client-protocol.h" #include "xdg-shell-client-protocol.h"
#include "text-cursor-position-client-protocol.h" #include "text-cursor-position-client-protocol.h"
#include "pointer-constraints-unstable-v1-client-protocol.h" #include "pointer-constraints-unstable-v1-client-protocol.h"
#include "relative-pointer-unstable-v1-client-protocol.h" #include "relative-pointer-unstable-v1-client-protocol.h"
@ -105,7 +105,7 @@ struct display {
struct wl_shm *shm; struct wl_shm *shm;
struct wl_data_device_manager *data_device_manager; struct wl_data_device_manager *data_device_manager;
struct text_cursor_position *text_cursor_position; struct text_cursor_position *text_cursor_position;
struct zxdg_shell_v6 *xdg_shell; struct xdg_wm_base *xdg_shell;
struct zwp_relative_pointer_manager_v1 *relative_pointer_manager; struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
struct zwp_pointer_constraints_v1 *pointer_constraints; struct zwp_pointer_constraints_v1 *pointer_constraints;
EGLDisplay dpy; EGLDisplay dpy;
@ -260,9 +260,9 @@ struct window {
window_locked_pointer_motion_handler_t locked_pointer_motion_handler; window_locked_pointer_motion_handler_t locked_pointer_motion_handler;
struct surface *main_surface; struct surface *main_surface;
struct zxdg_surface_v6 *xdg_surface; struct xdg_surface *xdg_surface;
struct zxdg_toplevel_v6 *xdg_toplevel; struct xdg_toplevel *xdg_toplevel;
struct zxdg_popup_v6 *xdg_popup; struct xdg_popup *xdg_popup;
struct window *parent; struct window *parent;
struct window *last_parent; struct window *last_parent;
@ -1592,11 +1592,11 @@ window_destroy(struct window *window)
window_frame_destroy(window->frame); window_frame_destroy(window->frame);
if (window->xdg_toplevel) if (window->xdg_toplevel)
zxdg_toplevel_v6_destroy(window->xdg_toplevel); xdg_toplevel_destroy(window->xdg_toplevel);
if (window->xdg_popup) if (window->xdg_popup)
zxdg_popup_v6_destroy(window->xdg_popup); xdg_popup_destroy(window->xdg_popup);
if (window->xdg_surface) if (window->xdg_surface)
zxdg_surface_v6_destroy(window->xdg_surface); xdg_surface_destroy(window->xdg_surface);
surface_destroy(window->main_surface); surface_destroy(window->main_surface);
@ -2406,9 +2406,9 @@ frame_handle_status(struct window_frame *frame, struct input *input,
if ((status & FRAME_STATUS_MOVE) && window->xdg_toplevel) { if ((status & FRAME_STATUS_MOVE) && window->xdg_toplevel) {
input_ungrab(input); input_ungrab(input);
zxdg_toplevel_v6_move(window->xdg_toplevel, xdg_toplevel_move(window->xdg_toplevel,
input_get_seat(input), input_get_seat(input),
window->display->serial); window->display->serial);
frame_status_clear(frame->frame, FRAME_STATUS_MOVE); frame_status_clear(frame->frame, FRAME_STATUS_MOVE);
} }
@ -2416,10 +2416,10 @@ frame_handle_status(struct window_frame *frame, struct input *input,
if ((status & FRAME_STATUS_RESIZE) && window->xdg_toplevel) { if ((status & FRAME_STATUS_RESIZE) && window->xdg_toplevel) {
input_ungrab(input); input_ungrab(input);
zxdg_toplevel_v6_resize(window->xdg_toplevel, xdg_toplevel_resize(window->xdg_toplevel,
input_get_seat(input), input_get_seat(input),
window->display->serial, window->display->serial,
location); location);
frame_status_clear(frame->frame, FRAME_STATUS_RESIZE); frame_status_clear(frame->frame, FRAME_STATUS_RESIZE);
} }
@ -4009,7 +4009,7 @@ window_move(struct window *window, struct input *input, uint32_t serial)
if (!window->xdg_toplevel) if (!window->xdg_toplevel)
return; return;
zxdg_toplevel_v6_move(window->xdg_toplevel, input->seat, serial); xdg_toplevel_move(window->xdg_toplevel, input->seat, serial);
} }
static void static void
@ -4232,12 +4232,12 @@ window_uninhibit_redraw(struct window *window)
static void static void
xdg_surface_handle_configure(void *data, xdg_surface_handle_configure(void *data,
struct zxdg_surface_v6 *zxdg_surface_v6, struct xdg_surface *xdg_surface,
uint32_t serial) uint32_t serial)
{ {
struct window *window = data; struct window *window = data;
zxdg_surface_v6_ack_configure(window->xdg_surface, serial); xdg_surface_ack_configure(window->xdg_surface, serial);
if (window->state_changed_handler) if (window->state_changed_handler)
window->state_changed_handler(window, window->user_data); window->state_changed_handler(window, window->user_data);
@ -4245,12 +4245,12 @@ xdg_surface_handle_configure(void *data,
window_uninhibit_redraw(window); window_uninhibit_redraw(window);
} }
static const struct zxdg_surface_v6_listener xdg_surface_listener = { static const struct xdg_surface_listener xdg_surface_listener = {
xdg_surface_handle_configure xdg_surface_handle_configure
}; };
static void static void
xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *xdg_toplevel, xdg_toplevel_handle_configure(void *data, struct xdg_toplevel *xdg_toplevel,
int32_t width, int32_t height, int32_t width, int32_t height,
struct wl_array *states) struct wl_array *states)
{ {
@ -4265,16 +4265,16 @@ xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *xdg_toplevel,
wl_array_for_each(p, states) { wl_array_for_each(p, states) {
uint32_t state = *p; uint32_t state = *p;
switch (state) { switch (state) {
case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED: case XDG_TOPLEVEL_STATE_MAXIMIZED:
window->maximized = 1; window->maximized = 1;
break; break;
case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN: case XDG_TOPLEVEL_STATE_FULLSCREEN:
window->fullscreen = 1; window->fullscreen = 1;
break; break;
case ZXDG_TOPLEVEL_V6_STATE_RESIZING: case XDG_TOPLEVEL_STATE_RESIZING:
window->resizing = 1; window->resizing = 1;
break; break;
case ZXDG_TOPLEVEL_V6_STATE_ACTIVATED: case XDG_TOPLEVEL_STATE_ACTIVATED:
window->focused = 1; window->focused = 1;
break; break;
default: default:
@ -4315,13 +4315,13 @@ xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *xdg_toplevel,
} }
static void static void
xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_surface) xdg_toplevel_handle_close(void *data, struct xdg_toplevel *xdg_surface)
{ {
struct window *window = data; struct window *window = data;
window_close(window); window_close(window);
} }
static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = { static const struct xdg_toplevel_listener xdg_toplevel_listener = {
xdg_toplevel_handle_configure, xdg_toplevel_handle_configure,
xdg_toplevel_handle_close, xdg_toplevel_handle_close,
}; };
@ -4329,7 +4329,7 @@ static const struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
static void static void
window_sync_parent(struct window *window) window_sync_parent(struct window *window)
{ {
struct zxdg_toplevel_v6 *parent_toplevel; struct xdg_toplevel *parent_toplevel;
if (!window->xdg_surface) if (!window->xdg_surface)
return; return;
@ -4342,7 +4342,7 @@ window_sync_parent(struct window *window)
else else
parent_toplevel = NULL; parent_toplevel = NULL;
zxdg_toplevel_v6_set_parent(window->xdg_toplevel, parent_toplevel); xdg_toplevel_set_parent(window->xdg_toplevel, parent_toplevel);
window->last_parent = window->parent; window->last_parent = window->parent;
} }
@ -4374,11 +4374,11 @@ window_sync_geometry(struct window *window)
geometry.height == window->last_geometry.height) geometry.height == window->last_geometry.height)
return; return;
zxdg_surface_v6_set_window_geometry(window->xdg_surface, xdg_surface_set_window_geometry(window->xdg_surface,
geometry.x, geometry.x,
geometry.y, geometry.y,
geometry.width, geometry.width,
geometry.height); geometry.height);
window->last_geometry = geometry; window->last_geometry = geometry;
} }
@ -4585,9 +4585,9 @@ window_set_fullscreen(struct window *window, int fullscreen)
return; return;
if (fullscreen) if (fullscreen)
zxdg_toplevel_v6_set_fullscreen(window->xdg_toplevel, NULL); xdg_toplevel_set_fullscreen(window->xdg_toplevel, NULL);
else else
zxdg_toplevel_v6_unset_fullscreen(window->xdg_toplevel); xdg_toplevel_unset_fullscreen(window->xdg_toplevel);
} }
int int
@ -4606,9 +4606,9 @@ window_set_maximized(struct window *window, int maximized)
return; return;
if (maximized) if (maximized)
zxdg_toplevel_v6_set_maximized(window->xdg_toplevel); xdg_toplevel_set_maximized(window->xdg_toplevel);
else else
zxdg_toplevel_v6_unset_maximized(window->xdg_toplevel); xdg_toplevel_unset_maximized(window->xdg_toplevel);
} }
int int
@ -4623,7 +4623,7 @@ window_set_minimized(struct window *window)
if (!window->xdg_toplevel) if (!window->xdg_toplevel)
return; return;
zxdg_toplevel_v6_set_minimized(window->xdg_toplevel); xdg_toplevel_set_minimized(window->xdg_toplevel);
} }
void void
@ -4727,7 +4727,7 @@ window_set_title(struct window *window, const char *title)
widget_schedule_redraw(window->frame->widget); widget_schedule_redraw(window->frame->widget);
} }
if (window->xdg_toplevel) if (window->xdg_toplevel)
zxdg_toplevel_v6_set_title(window->xdg_toplevel, title); xdg_toplevel_set_title(window->xdg_toplevel, title);
} }
const char * const char *
@ -5183,19 +5183,19 @@ window_create(struct display *display)
if (window->display->xdg_shell) { if (window->display->xdg_shell) {
window->xdg_surface = window->xdg_surface =
zxdg_shell_v6_get_xdg_surface(window->display->xdg_shell, xdg_wm_base_get_xdg_surface(window->display->xdg_shell,
window->main_surface->surface); window->main_surface->surface);
fail_on_null(window->xdg_surface, 0, __FILE__, __LINE__); fail_on_null(window->xdg_surface, 0, __FILE__, __LINE__);
zxdg_surface_v6_add_listener(window->xdg_surface, xdg_surface_add_listener(window->xdg_surface,
&xdg_surface_listener, window); &xdg_surface_listener, window);
window->xdg_toplevel = window->xdg_toplevel =
zxdg_surface_v6_get_toplevel(window->xdg_surface); xdg_surface_get_toplevel(window->xdg_surface);
fail_on_null(window->xdg_toplevel, 0, __FILE__, __LINE__); fail_on_null(window->xdg_toplevel, 0, __FILE__, __LINE__);
zxdg_toplevel_v6_add_listener(window->xdg_toplevel, xdg_toplevel_add_listener(window->xdg_toplevel,
&xdg_toplevel_listener, window); &xdg_toplevel_listener, window);
window_inhibit_redraw(window); window_inhibit_redraw(window);
@ -5350,7 +5350,7 @@ menu_redraw_handler(struct widget *widget, void *data)
static void static void
xdg_popup_handle_configure(void *data, xdg_popup_handle_configure(void *data,
struct zxdg_popup_v6 *zxdg_popup_v6, struct xdg_popup *xdg_popup,
int32_t x, int32_t x,
int32_t y, int32_t y,
int32_t width, int32_t width,
@ -5359,7 +5359,7 @@ xdg_popup_handle_configure(void *data,
} }
static void static void
xdg_popup_handle_popup_done(void *data, struct zxdg_popup_v6 *xdg_popup) xdg_popup_handle_popup_done(void *data, struct xdg_popup *xdg_popup)
{ {
struct window *window = data; struct window *window = data;
struct menu *menu = window->main_surface->widget->user_data; struct menu *menu = window->main_surface->widget->user_data;
@ -5368,7 +5368,7 @@ xdg_popup_handle_popup_done(void *data, struct zxdg_popup_v6 *xdg_popup)
menu_destroy(menu); menu_destroy(menu);
} }
static const struct zxdg_popup_v6_listener xdg_popup_listener = { static const struct xdg_popup_listener xdg_popup_listener = {
xdg_popup_handle_configure, xdg_popup_handle_configure,
xdg_popup_handle_popup_done, xdg_popup_handle_popup_done,
}; };
@ -5424,22 +5424,20 @@ create_menu(struct display *display,
return menu; return menu;
} }
static struct zxdg_positioner_v6 * static struct xdg_positioner *
create_simple_positioner(struct display *display, create_simple_positioner(struct display *display,
int x, int y, int w, int h) int x, int y, int w, int h)
{ {
struct zxdg_positioner_v6 *positioner; struct xdg_positioner *positioner;
positioner = zxdg_shell_v6_create_positioner(display->xdg_shell); positioner = xdg_wm_base_create_positioner(display->xdg_shell);
fail_on_null(positioner, 0, __FILE__, __LINE__); fail_on_null(positioner, 0, __FILE__, __LINE__);
zxdg_positioner_v6_set_anchor_rect(positioner, x, y, 1, 1); xdg_positioner_set_anchor_rect(positioner, x, y, 1, 1);
zxdg_positioner_v6_set_size(positioner, w, h); xdg_positioner_set_size(positioner, w, h);
zxdg_positioner_v6_set_anchor(positioner, xdg_positioner_set_anchor(positioner,
ZXDG_POSITIONER_V6_ANCHOR_TOP | XDG_POSITIONER_ANCHOR_TOP_LEFT);
ZXDG_POSITIONER_V6_ANCHOR_LEFT); xdg_positioner_set_gravity(positioner,
zxdg_positioner_v6_set_gravity(positioner, XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT);
ZXDG_POSITIONER_V6_ANCHOR_BOTTOM |
ZXDG_POSITIONER_V6_ANCHOR_RIGHT);
return positioner; return positioner;
} }
@ -5454,7 +5452,7 @@ window_show_menu(struct display *display,
struct window *window; struct window *window;
int32_t ix, iy; int32_t ix, iy;
struct rectangle parent_geometry; struct rectangle parent_geometry;
struct zxdg_positioner_v6 *positioner; struct xdg_positioner *positioner;
menu = create_menu(display, input, time, func, entries, count, parent); menu = create_menu(display, input, time, func, entries, count, parent);
@ -5476,29 +5474,27 @@ window_show_menu(struct display *display,
return; return;
window->xdg_surface = window->xdg_surface =
zxdg_shell_v6_get_xdg_surface(display->xdg_shell, xdg_wm_base_get_xdg_surface(display->xdg_shell,
window->main_surface->surface); window->main_surface->surface);
fail_on_null(window->xdg_surface, 0, __FILE__, __LINE__); fail_on_null(window->xdg_surface, 0, __FILE__, __LINE__);
zxdg_surface_v6_add_listener(window->xdg_surface, xdg_surface_add_listener(window->xdg_surface,
&xdg_surface_listener, window); &xdg_surface_listener, window);
positioner = create_simple_positioner(display, positioner = create_simple_positioner(display,
window->x - (ix + parent_geometry.x), window->x - (ix + parent_geometry.x),
window->y - (iy + parent_geometry.y), window->y - (iy + parent_geometry.y),
frame_width(menu->frame), frame_width(menu->frame),
frame_height(menu->frame)); frame_height(menu->frame));
window->xdg_popup = window->xdg_popup = xdg_surface_get_popup(window->xdg_surface,
zxdg_surface_v6_get_popup(window->xdg_surface, parent->xdg_surface,
parent->xdg_surface, positioner);
positioner);
fail_on_null(window->xdg_popup, 0, __FILE__, __LINE__); fail_on_null(window->xdg_popup, 0, __FILE__, __LINE__);
zxdg_positioner_v6_destroy(positioner); xdg_positioner_destroy(positioner);
zxdg_popup_v6_grab(window->xdg_popup, xdg_popup_grab(window->xdg_popup, input->seat,
input->seat, display_get_serial(window->display));
display_get_serial(window->display)); xdg_popup_add_listener(window->xdg_popup,
zxdg_popup_v6_add_listener(window->xdg_popup, &xdg_popup_listener, window);
&xdg_popup_listener, window);
window_inhibit_redraw(window); window_inhibit_redraw(window);
@ -5891,13 +5887,13 @@ struct wl_shm_listener shm_listener = {
}; };
static void static void
xdg_shell_handle_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial) xdg_wm_base_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 xdg_shell_listener = { static const struct xdg_wm_base_listener wm_base_listener = {
xdg_shell_handle_ping, xdg_wm_base_ping,
}; };
static void static void
@ -5941,10 +5937,10 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
wl_registry_bind(registry, id, wl_registry_bind(registry, id,
&wl_data_device_manager_interface, &wl_data_device_manager_interface,
d->data_device_manager_version); d->data_device_manager_version);
} else if (strcmp(interface, "zxdg_shell_v6") == 0) { } else if (strcmp(interface, "xdg_wm_base") == 0) {
d->xdg_shell = wl_registry_bind(registry, id, d->xdg_shell = wl_registry_bind(registry, id,
&zxdg_shell_v6_interface, 1); &xdg_wm_base_interface, 1);
zxdg_shell_v6_add_listener(d->xdg_shell, &xdg_shell_listener, d); xdg_wm_base_add_listener(d->xdg_shell, &wm_base_listener, d);
} else if (strcmp(interface, "text_cursor_position") == 0) { } else if (strcmp(interface, "text_cursor_position") == 0) {
d->text_cursor_position = d->text_cursor_position =
wl_registry_bind(registry, id, wl_registry_bind(registry, id,
@ -6250,7 +6246,7 @@ display_destroy(struct display *display)
wl_subcompositor_destroy(display->subcompositor); wl_subcompositor_destroy(display->subcompositor);
if (display->xdg_shell) if (display->xdg_shell)
zxdg_shell_v6_destroy(display->xdg_shell); xdg_wm_base_destroy(display->xdg_shell);
if (display->shm) if (display->shm)
wl_shm_destroy(display->shm); wl_shm_destroy(display->shm);

Loading…
Cancel
Save