MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Tools / seat_handle_capabilities

Function seat_handle_capabilities

cube/cube.cpp:627–645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

625};
626
627static void seat_handle_capabilities(void *data, wl_seat *seat, uint32_t caps) {
628 // Subscribe to pointer events
629 Demo &demo = *static_cast<Demo *>(data);
630 if ((caps & WL_SEAT_CAPABILITY_POINTER) && !demo.pointer) {
631 demo.pointer = wl_seat_get_pointer(seat);
632 wl_pointer_add_listener(demo.pointer, &pointer_listener, &demo);
633 } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && demo.pointer) {
634 wl_pointer_destroy(demo.pointer);
635 demo.pointer = nullptr;
636 }
637 // Subscribe to keyboard events
638 if (caps & WL_SEAT_CAPABILITY_KEYBOARD) {
639 demo.keyboard = wl_seat_get_keyboard(seat);
640 wl_keyboard_add_listener(demo.keyboard, &keyboard_listener, &demo);
641 } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && demo.keyboard) {
642 wl_keyboard_destroy(demo.keyboard);
643 demo.keyboard = nullptr;
644 }
645}
646
647static const wl_seat_listener seat_listener = {
648 seat_handle_capabilities,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected