Bind correct wl_output version

This commit is contained in:
Leon Henrik Plickat 2022-01-31 15:19:14 +01:00
parent eb251dec93
commit 27b7ccd1f1

10
wlopm.c
View File

@ -135,6 +135,14 @@ static void registry_handle_global (void *data, struct wl_registry *registry,
{ {
if ( strcmp(interface, wl_output_interface.name) == 0 ) if ( strcmp(interface, wl_output_interface.name) == 0 )
{ {
if ( version < 4 )
{
fputs("ERROR: The compositor uses an outdated wl_output version.\n"
" Please inform the compositor developers so they can update to the latest version.\n", stderr);
loop = false;
return;
}
struct Output *output = calloc(1, sizeof(struct Output)); struct Output *output = calloc(1, sizeof(struct Output));
if ( output == NULL ) if ( output == NULL )
{ {
@ -143,7 +151,7 @@ static void registry_handle_global (void *data, struct wl_registry *registry,
} }
output->wl_output = wl_registry_bind(registry, name, output->wl_output = wl_registry_bind(registry, name,
&wl_output_interface, version); &wl_output_interface, 4);
wl_output_add_listener(output->wl_output, &wl_output_listener, output); wl_output_add_listener(output->wl_output, &wl_output_listener, output);
output->wlr_output_power = NULL; output->wlr_output_power = NULL;
output->name = NULL; output->name = NULL;