xwayland: Pass the wl_output version

With the wl_output protocol, the actual bind to the interface is done in
xwl_output_create().

Pass the version number from the registry so we can bind to the minimum
version.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
This commit is contained in:
Olivier Fourdan 2023-02-07 15:05:34 +01:00
parent 3c07a01c42
commit b63ef10f18
3 changed files with 6 additions and 4 deletions

View File

@ -791,7 +791,8 @@ xwl_output_from_wl_output(struct xwl_screen *xwl_screen,
} }
struct xwl_output * struct xwl_output *
xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id, Bool with_xrandr) xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id,
Bool with_xrandr, uint32_t version)
{ {
struct xwl_output *xwl_output; struct xwl_output *xwl_output;
char name[MAX_OUTPUT_NAME]; char name[MAX_OUTPUT_NAME];
@ -803,7 +804,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id, Bool with_xrandr)
} }
xwl_output->output = wl_registry_bind(xwl_screen->registry, id, xwl_output->output = wl_registry_bind(xwl_screen->registry, id,
&wl_output_interface, 2); &wl_output_interface, min(version, 2));
if (!xwl_output->output) { if (!xwl_output->output) {
ErrorF("Failed binding wl_output\n"); ErrorF("Failed binding wl_output\n");
goto err; goto err;

View File

@ -84,7 +84,8 @@ struct xwl_output *xwl_output_from_wl_output(struct xwl_screen *xwl_screen,
struct wl_output* wl_output); struct wl_output* wl_output);
struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen, struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen,
uint32_t id, Bool with_xrandr); uint32_t id, Bool with_xrandr,
uint32_t version);
void xwl_output_destroy(struct xwl_output *xwl_output); void xwl_output_destroy(struct xwl_output *xwl_output);

View File

@ -432,7 +432,7 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id,
NULL); NULL);
} }
else if (strcmp(interface, "wl_output") == 0 && version >= 2) { else if (strcmp(interface, "wl_output") == 0 && version >= 2) {
if (xwl_output_create(xwl_screen, id, (xwl_screen->fixed_output == NULL))) if (xwl_output_create(xwl_screen, id, (xwl_screen->fixed_output == NULL), version))
xwl_screen->expecting_event++; xwl_screen->expecting_event++;
} }
else if (strcmp(interface, "zxdg_output_manager_v1") == 0) { else if (strcmp(interface, "zxdg_output_manager_v1") == 0) {