From 97af2464b710169de09e9d746970027dfabef900 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 10 Jan 2019 09:17:14 -0500 Subject: [PATCH] Update Wayland backend to xdg-shell stable --- backend/wayland/backend.c | 30 +++++++++++++++--------------- backend/wayland/output.c | 32 ++++++++++++++++---------------- include/backend/wayland.h | 6 +++--- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index df1bf4318..da41af026 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -18,7 +18,7 @@ #include "backend/wayland.h" #include "util/signal.h" -#include "xdg-shell-unstable-v6-client-protocol.h" +#include "xdg-shell-client-protocol.h" struct wlr_wl_backend *get_wl_backend_from_backend(struct wlr_backend *backend) { assert(wlr_backend_is_wl(backend)); @@ -49,13 +49,13 @@ static int dispatch_events(int fd, uint32_t mask, void *data) { return 0; } -static void xdg_shell_handle_ping(void *data, struct zxdg_shell_v6 *shell, - uint32_t serial) { - zxdg_shell_v6_pong(shell, serial); +static void xdg_wm_base_handle_ping(void *data, + struct xdg_wm_base *base, uint32_t serial) { + xdg_wm_base_pong(base, serial); } -static const struct zxdg_shell_v6_listener xdg_shell_listener = { - xdg_shell_handle_ping, +static const struct xdg_wm_base_listener xdg_wm_base_listener = { + xdg_wm_base_handle_ping, }; static void registry_global(void *data, struct wl_registry *registry, @@ -77,10 +77,10 @@ static void registry_global(void *data, struct wl_registry *registry, wl->shm = wl_registry_bind(registry, name, &wl_shm_interface, 1); - } else if (strcmp(iface, zxdg_shell_v6_interface.name) == 0) { - wl->shell = wl_registry_bind(registry, name, - &zxdg_shell_v6_interface, 1); - zxdg_shell_v6_add_listener(wl->shell, &xdg_shell_listener, NULL); + } else if (strcmp(iface, xdg_wm_base_interface.name) == 0) { + wl->xdg_wm_base = wl_registry_bind(registry, name, + &xdg_wm_base_interface, 1); + xdg_wm_base_add_listener(wl->xdg_wm_base, &xdg_wm_base_listener, NULL); } } @@ -153,7 +153,7 @@ static void backend_destroy(struct wlr_backend *backend) { if (wl->shm) { wl_shm_destroy(wl->shm); } - zxdg_shell_v6_destroy(wl->shell); + xdg_wm_base_destroy(wl->xdg_wm_base); wl_compositor_destroy(wl->compositor); wl_registry_destroy(wl->registry); wl_display_disconnect(wl->remote_display); @@ -218,9 +218,9 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, "Remote Wayland compositor does not support wl_compositor"); goto error_registry; } - if (!wl->shell) { + if (!wl->xdg_wm_base) { wlr_log(WLR_ERROR, - "Remote Wayland compositor does not support zxdg_shell_v6"); + "Remote Wayland compositor does not support xdg-shell"); goto error_registry; } @@ -267,8 +267,8 @@ error_registry: if (wl->compositor) { wl_compositor_destroy(wl->compositor); } - if (wl->shell) { - zxdg_shell_v6_destroy(wl->shell); + if (wl->xdg_wm_base) { + xdg_wm_base_destroy(wl->xdg_wm_base); } wl_registry_destroy(wl->registry); error_display: diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 89d5b5c9a..f1eb73fdc 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -16,7 +16,7 @@ #include "backend/wayland.h" #include "util/signal.h" -#include "xdg-shell-unstable-v6-client-protocol.h" +#include "xdg-shell-client-protocol.h" static struct wlr_wl_output *get_wl_output_from_output( struct wlr_output *wlr_output) { @@ -181,8 +181,8 @@ static void output_destroy(struct wlr_output *wlr_output) { wlr_egl_destroy_surface(&output->backend->egl, output->egl_surface); wl_egl_window_destroy(output->egl_window); - zxdg_toplevel_v6_destroy(output->xdg_toplevel); - zxdg_surface_v6_destroy(output->xdg_surface); + xdg_toplevel_destroy(output->xdg_toplevel); + xdg_surface_destroy(output->xdg_surface); wl_surface_destroy(output->surface); free(output); } @@ -229,22 +229,22 @@ bool wlr_output_is_wl(struct wlr_output *wlr_output) { return wlr_output->impl == &output_impl; } -static void xdg_surface_handle_configure(void *data, struct zxdg_surface_v6 *xdg_surface, - uint32_t serial) { +static void xdg_surface_handle_configure(void *data, + struct xdg_surface *xdg_surface, uint32_t serial) { struct wlr_wl_output *output = data; assert(output && output->xdg_surface == xdg_surface); - zxdg_surface_v6_ack_configure(xdg_surface, serial); + xdg_surface_ack_configure(xdg_surface, serial); // nothing else? } -static struct zxdg_surface_v6_listener xdg_surface_listener = { +static struct xdg_surface_listener xdg_surface_listener = { .configure = xdg_surface_handle_configure, }; static void xdg_toplevel_handle_configure(void *data, - struct zxdg_toplevel_v6 *xdg_toplevel, + struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height, struct wl_array *states) { struct wlr_wl_output *output = data; assert(output && output->xdg_toplevel == xdg_toplevel); @@ -258,14 +258,14 @@ static void xdg_toplevel_handle_configure(void *data, } static void xdg_toplevel_handle_close(void *data, - struct zxdg_toplevel_v6 *xdg_toplevel) { + struct xdg_toplevel *xdg_toplevel) { struct wlr_wl_output *output = data; assert(output && output->xdg_toplevel == xdg_toplevel); wlr_output_destroy((struct wlr_output *)output); } -static struct zxdg_toplevel_v6_listener xdg_toplevel_listener = { +static struct xdg_toplevel_listener xdg_toplevel_listener = { .configure = xdg_toplevel_handle_configure, .close = xdg_toplevel_handle_close, }; @@ -301,13 +301,13 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) { } wl_surface_set_user_data(output->surface, output); output->xdg_surface = - zxdg_shell_v6_get_xdg_surface(backend->shell, output->surface); + xdg_wm_base_get_xdg_surface(backend->xdg_wm_base, output->surface); if (!output->xdg_surface) { wlr_log_errno(WLR_ERROR, "Could not get xdg surface"); goto error; } output->xdg_toplevel = - zxdg_surface_v6_get_toplevel(output->xdg_surface); + xdg_surface_get_toplevel(output->xdg_surface); if (!output->xdg_toplevel) { wlr_log_errno(WLR_ERROR, "Could not get xdg toplevel"); goto error; @@ -315,13 +315,13 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) { char title[32]; if (snprintf(title, sizeof(title), "wlroots - %s", wlr_output->name)) { - zxdg_toplevel_v6_set_title(output->xdg_toplevel, title); + xdg_toplevel_set_title(output->xdg_toplevel, title); } - zxdg_toplevel_v6_set_app_id(output->xdg_toplevel, "wlroots"); - zxdg_surface_v6_add_listener(output->xdg_surface, + xdg_toplevel_set_app_id(output->xdg_toplevel, "wlroots"); + xdg_surface_add_listener(output->xdg_surface, &xdg_surface_listener, output); - zxdg_toplevel_v6_add_listener(output->xdg_toplevel, + xdg_toplevel_add_listener(output->xdg_toplevel, &xdg_toplevel_listener, output); wl_surface_commit(output->surface); diff --git a/include/backend/wayland.h b/include/backend/wayland.h index dbc309ca9..c41d560aa 100644 --- a/include/backend/wayland.h +++ b/include/backend/wayland.h @@ -30,7 +30,7 @@ struct wlr_wl_backend { struct wl_event_source *remote_display_src; struct wl_registry *registry; struct wl_compositor *compositor; - struct zxdg_shell_v6 *shell; + struct xdg_wm_base *xdg_wm_base; struct wl_shm *shm; struct wl_seat *seat; struct wl_pointer *pointer; @@ -47,8 +47,8 @@ struct wlr_wl_output { struct wl_surface *surface; struct wl_callback *frame_callback; - struct zxdg_surface_v6 *xdg_surface; - struct zxdg_toplevel_v6 *xdg_toplevel; + struct xdg_surface *xdg_surface; + struct xdg_toplevel *xdg_toplevel; struct wl_egl_window *egl_window; EGLSurface egl_surface;