Don't fail on startup when input device(s) are not present

The wl_seat protocol may not be available unless input devices (keyboard,
mouse) are connected to the compositor on the target system.

Warn but continue executing examples with default settings.
This commit is contained in:
Tomek Bury 2021-05-04 16:37:57 +01:00
parent 2d47dc6e9c
commit b212fa0840

View file

@ -842,6 +842,7 @@ VulkanExampleBase::~VulkanExampleBase()
wl_keyboard_destroy(keyboard); wl_keyboard_destroy(keyboard);
if (pointer) if (pointer)
wl_pointer_destroy(pointer); wl_pointer_destroy(pointer);
if (seat)
wl_seat_destroy(seat); wl_seat_destroy(seat);
xdg_wm_base_destroy(shell); xdg_wm_base_destroy(shell);
wl_compositor_destroy(compositor); wl_compositor_destroy(compositor);
@ -2128,12 +2129,17 @@ void VulkanExampleBase::initWaylandConnection()
wl_registry_add_listener(registry, &registry_listener, this); wl_registry_add_listener(registry, &registry_listener, this);
wl_display_dispatch(display); wl_display_dispatch(display);
wl_display_roundtrip(display); wl_display_roundtrip(display);
if (!compositor || !shell || !seat) if (!compositor || !shell)
{ {
std::cout << "Could not bind Wayland protocols!\n"; std::cout << "Could not bind Wayland protocols!\n";
fflush(stdout); fflush(stdout);
exit(1); exit(1);
} }
if (!seat)
{
std::cout << "WARNING: Input handling not available!\n";
fflush(stdout);
}
} }
void VulkanExampleBase::setSize(int width, int height) void VulkanExampleBase::setSize(int width, int height)