diff options
author | Simon Ser <contact@emersion.fr> | 2019-07-18 17:18:55 +0300 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-08-02 10:02:33 -0400 |
commit | 6396710976f351065307634b4869e768c4b453e9 (patch) | |
tree | 86c3d410885394fe6a3934e41f99505b09f8dfd4 | |
parent | ee5f98ad49fed0439f3313ec685307831d1d1d05 (diff) |
xdg-output: add support for xdg-output-unstable-v1 version 3
This adds support for xdg-output-unstable-v1 version 3, added in [1].
The xdg_output.done event is now deprecated and is replaced with
wl_output.done.
[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/commit/962dd535372c8e4681374c23d2603cbe06cd7031
-rw-r--r-- | types/wlr_xdg_output_v1.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/types/wlr_xdg_output_v1.c b/types/wlr_xdg_output_v1.c index 80c58a0c..62cc7a7c 100644 --- a/types/wlr_xdg_output_v1.c +++ b/types/wlr_xdg_output_v1.c @@ -8,7 +8,8 @@ #include "xdg-output-unstable-v1-protocol.h" #include "util/signal.h" -#define OUTPUT_MANAGER_VERSION 2 +#define OUTPUT_MANAGER_VERSION 3 +#define OUTPUT_DONE_DEPRECATED_SINCE_VERSION 3 static void output_handle_destroy(struct wl_client *client, struct wl_resource *resource) { @@ -29,7 +30,9 @@ static void output_send_details(struct wlr_xdg_output_v1 *xdg_output, xdg_output->x, xdg_output->y); zxdg_output_v1_send_logical_size(resource, xdg_output->width, xdg_output->height); - zxdg_output_v1_send_done(resource); + if (wl_resource_get_version(resource) < OUTPUT_DONE_DEPRECATED_SINCE_VERSION) { + zxdg_output_v1_send_done(resource); + } } static void output_update(struct wlr_xdg_output_v1 *xdg_output) { @@ -207,6 +210,13 @@ static void handle_layout_destroy(struct wl_listener *listener, void *data) { struct wlr_xdg_output_manager_v1 *wlr_xdg_output_manager_v1_create( struct wl_display *display, struct wlr_output_layout *layout) { assert(display && layout); + + // TODO: require wayland-protocols 1.18 and remove this condition + int version = OUTPUT_MANAGER_VERSION; + if (version > zxdg_output_manager_v1_interface.version) { + version = zxdg_output_manager_v1_interface.version; + } + struct wlr_xdg_output_manager_v1 *manager = calloc(1, sizeof(struct wlr_xdg_output_manager_v1)); if (manager == NULL) { @@ -214,7 +224,7 @@ struct wlr_xdg_output_manager_v1 *wlr_xdg_output_manager_v1_create( } manager->layout = layout; manager->global = wl_global_create(display, - &zxdg_output_manager_v1_interface, OUTPUT_MANAGER_VERSION, manager, + &zxdg_output_manager_v1_interface, version, manager, output_manager_bind); if (!manager->global) { free(manager); |