diff options
author | emersion <contact@emersion.fr> | 2018-05-17 09:21:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-17 09:21:17 +0100 |
commit | ec6e56a31488691e1895af72cab419d7163eedab (patch) | |
tree | 0ff033fc349662878813d5438a64faa7638592a2 | |
parent | f1fcc685b62d5c37c3b99ce6bfeb11ac1fa59ea6 (diff) | |
parent | 63fd2203fec43c380056a01ace2a3d4294e5e90d (diff) |
Merge pull request #966 from emersion/xdg-output-2
Add support for version 2 of the xdg-output protocol
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | types/wlr_xdg_output.c | 20 |
2 files changed, 18 insertions, 4 deletions
diff --git a/meson.build b/meson.build index 362de9f6..597236ca 100644 --- a/meson.build +++ b/meson.build @@ -49,7 +49,7 @@ add_project_arguments('-DWL_HIDE_DEPRECATED', language: 'c') wayland_server = dependency('wayland-server') wayland_client = dependency('wayland-client') wayland_egl = dependency('wayland-egl') -wayland_protos = dependency('wayland-protocols', version: '>=1.12') +wayland_protos = dependency('wayland-protocols', version: '>=1.14') egl = dependency('egl') glesv2 = dependency('glesv2') drm = dependency('libdrm') diff --git a/types/wlr_xdg_output.c b/types/wlr_xdg_output.c index ba99cfcb..282968ab 100644 --- a/types/wlr_xdg_output.c +++ b/types/wlr_xdg_output.c @@ -1,5 +1,6 @@ #include <assert.h> #include <stdlib.h> +#include <stdio.h> #include <wlr/types/wlr_output_layout.h> #include <wlr/types/wlr_output.h> #include <wlr/types/wlr_xdg_output.h> @@ -23,11 +24,25 @@ static void output_handle_resource_destroy(struct wl_resource *resource) { static void output_send_details(struct wl_resource *resource, struct wlr_output_layout_output *layout_output) { + struct wlr_output *output = layout_output->output; zxdg_output_v1_send_logical_position(resource, layout_output->x, layout_output->y); + int width, height; wlr_output_effective_resolution(layout_output->output, &width, &height); zxdg_output_v1_send_logical_size(resource, width, height); + + uint32_t version = wl_resource_get_version(resource); + if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION) { + zxdg_output_v1_send_name(resource, output->name); + } + if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION) { + char description[128]; + snprintf(description, sizeof(description), "%s %s %s (%s)", + output->make, output->model, output->serial, output->name); + zxdg_output_v1_send_description(resource, description); + } + zxdg_output_v1_send_done(resource); } @@ -173,12 +188,11 @@ struct wlr_xdg_output_manager *wlr_xdg_output_manager_create( } manager->layout = layout; manager->global = wl_global_create(display, - &zxdg_output_manager_v1_interface, - OUTPUT_MANAGER_VERSION, manager, output_manager_bind); + &zxdg_output_manager_v1_interface, OUTPUT_MANAGER_VERSION, manager, + output_manager_bind); if (!manager->global) { free(manager); return NULL; - } wl_list_init(&manager->resources); |