Merge pull request #840 from swaywm/xdg-output-updates

Fix sending updates to xdg-output resources
This commit is contained in:
emersion 2018-04-05 18:28:16 -04:00 committed by GitHub
commit ce09537a9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,6 +46,15 @@ static void xdg_output_manager_get_xdg_output(struct wl_client *client,
wlr_output_layout_get(layout, wlr_output); wlr_output_layout_get(layout, wlr_output);
assert(layout_output); assert(layout_output);
struct wlr_xdg_output *_xdg_output, *xdg_output = NULL;
wl_list_for_each(_xdg_output, &manager->outputs, link) {
if (_xdg_output->layout_output == layout_output) {
xdg_output = _xdg_output;
break;
}
}
assert(xdg_output);
struct wl_resource *output_resource = wl_resource_create(client, struct wl_resource *output_resource = wl_resource_create(client,
&zxdg_output_v1_interface, wl_resource_get_version(resource), id); &zxdg_output_v1_interface, wl_resource_get_version(resource), id);
if (!output_resource) { if (!output_resource) {
@ -55,6 +64,8 @@ static void xdg_output_manager_get_xdg_output(struct wl_client *client,
wl_resource_set_implementation(output_resource, wl_resource_set_implementation(output_resource,
&xdg_output_implementation, NULL, NULL); &xdg_output_implementation, NULL, NULL);
xdg_output_send_details(output_resource, layout_output); xdg_output_send_details(output_resource, layout_output);
wl_list_insert(&xdg_output->resources,
wl_resource_get_link(output_resource));
} }
static const struct zxdg_output_manager_v1_interface xdg_output_manager_implementation = { static const struct zxdg_output_manager_v1_interface xdg_output_manager_implementation = {