[client] wayland: gracefully downgrade to wl_output v2

We don't necessarily need `wl_output.release`, which is the only
addition in v3.

This allows Looking Glass to run on Ubuntu 20.04 without having to go
difficult lengths to acquire newer Wayland packages. Since 20.04 is an
LTS release, this seems worthwhile for the small amount of complexity
this introduces.

Fixes
https://forum.level1techs.com/t/latest-build-allow-inhibiting-shortcuts-dialog-ubuntu/168684/6.
This commit is contained in:
Tudor Brindus 2021-02-26 21:38:20 -05:00 committed by Geoffrey McRae
parent 5ad70ccc41
commit d6b8823dce
2 changed files with 12 additions and 8 deletions

View File

@ -71,6 +71,7 @@ void waylandOutputFree(void)
struct WaylandOutput * temp;
wl_list_for_each_safe(node, temp, &wlWm.outputs, link)
{
if (node->version >= 3)
wl_output_release(node->output);
wl_list_remove(&node->link);
free(node);
@ -83,16 +84,17 @@ void waylandOutputBind(uint32_t name, uint32_t version)
if (!node)
return;
if (version < 3)
if (version < 2)
{
DEBUG_WARN("wl_output version too old: expected 3, got %d", version);
DEBUG_WARN("wl_output version too old: expected >= 2, got %d", version);
return;
}
node->name = name;
node->scale = 0;
node->version = version;
node->output = wl_registry_bind(wlWm.registry, name,
&wl_output_interface, 3);
&wl_output_interface, version >= 3 ? 3 : 2);
if (!node->output)
{
@ -113,6 +115,7 @@ void waylandOutputTryUnbind(uint32_t name)
{
if (node->name == name)
{
if (node->version >= 3)
wl_output_release(node->output);
wl_list_remove(&node->link);
free(node);

View File

@ -56,6 +56,7 @@ struct WaylandOutput
uint32_t name;
int32_t scale;
struct wl_output * output;
uint32_t version;
struct wl_list link;
};