Skip to content

backend/wayland: provide default type_name

My compiler (gcc (GCC) 10.3.0) rightfully complains:

  ../subprojects/wlroots/backend/wayland/seat.c: In function ‘create_wl_input_device’:
  ../subprojects/wlroots/backend/wayland/seat.c:494:25: error: ‘type_name’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    494 |  size_t name_size = 8 + strlen(type_name) + strlen(seat->name) + 1;
        |                         ^~~~~~~~~~~~~~~~~

that type_name is not initialized. And while we know that the switch case will fill the variable currently, new additions to enum wlr_input_device_type may forget to adjust the case here, so provide "unknown" as the default.

Fixes: 611b9ca8 ("backend/wayland: improve wayland input device name")

Merge request reports