[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 authored and Geoffrey McRae committed 2021-02-27 14:48:28 +11:00
1 parent 5ad70ccc41
commit d6b8823dce
2 files changed
+12 -8

No files matched your search

+11 -8
View File
@@ -71,7 +71,8 @@ void waylandOutputFree(void)
struct WaylandOutput * temp;
wl_list_for_each_safe(node, temp, &wlWm.outputs, link)
{
wl_output_release(node->output);
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->output = wl_registry_bind(wlWm.registry, name,
&wl_output_interface, 3);
node->name = name;
node->scale = 0;
node->version = version;
node->output = wl_registry_bind(wlWm.registry, name,
&wl_output_interface, version >= 3 ? 3 : 2);
if (!node->output)
{
@@ -113,7 +115,8 @@ void waylandOutputTryUnbind(uint32_t name)
{
if (node->name == name)
{
wl_output_release(node->output);
if (node->version >= 3)
wl_output_release(node->output);
wl_list_remove(&node->link);
free(node);
break;
+1
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;
};