static void seat_handle_capabilities (void *data, struct wl_seat *seat, enum wl_seat_capability caps) { GstGLWindowWaylandEGL *window_egl = data; struct display *display = &window_egl->display; if ((caps & WL_SEAT_CAPABILITY_POINTER) && !display->pointer) { display->pointer = wl_seat_get_pointer (seat); wl_pointer_set_user_data (display->pointer, window_egl); wl_pointer_add_listener (display->pointer, &pointer_listener, window_egl); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && display->pointer) { wl_pointer_destroy (display->pointer); display->pointer = NULL; } #if 0 if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) { input->keyboard = wl_seat_get_keyboard (seat); wl_keyboard_set_user_data (input->keyboard, input); wl_keyboard_add_listener (input->keyboard, &keyboard_listener, input); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) { wl_keyboard_destroy (input->keyboard); input->keyboard = NULL; } #endif }
static void seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps) { struct input *input = data; struct pointer *pointer; struct keyboard *keyboard; if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) { pointer = xzalloc(sizeof *pointer); pointer->wl_pointer = wl_seat_get_pointer(seat); wl_pointer_set_user_data(pointer->wl_pointer, pointer); wl_pointer_add_listener(pointer->wl_pointer, &pointer_listener, pointer); input->pointer = pointer; } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) { wl_pointer_destroy(input->pointer->wl_pointer); free(input->pointer); input->pointer = NULL; } if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) { keyboard = xzalloc(sizeof *keyboard); keyboard->wl_keyboard = wl_seat_get_keyboard(seat); wl_keyboard_set_user_data(keyboard->wl_keyboard, keyboard); wl_keyboard_add_listener(keyboard->wl_keyboard, &keyboard_listener, keyboard); input->keyboard = keyboard; } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) { wl_keyboard_destroy(input->keyboard->wl_keyboard); free(input->keyboard); input->keyboard = NULL; } }
static void input_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps) { struct wayland_input *input = data; if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) { input->pointer = wl_seat_get_pointer(seat); wl_pointer_set_user_data(input->pointer, input); wl_pointer_add_listener(input->pointer, &pointer_listener, input); weston_seat_init_pointer(&input->base); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) { wl_pointer_destroy(input->pointer); input->pointer = NULL; } if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) { input->keyboard = wl_seat_get_keyboard(seat); wl_keyboard_set_user_data(input->keyboard, input); wl_keyboard_add_listener(input->keyboard, &keyboard_listener, input); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && input->keyboard) { wl_keyboard_destroy(input->keyboard); input->keyboard = NULL; } }
static void seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps) { struct vo_wayland_state *wl = data; if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !wl->input.keyboard) { wl->input.keyboard = wl_seat_get_keyboard(seat); wl_keyboard_set_user_data(wl->input.keyboard, wl); wl_keyboard_add_listener(wl->input.keyboard, &keyboard_listener, wl); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && wl->input.keyboard) { wl_keyboard_destroy(wl->input.keyboard); wl->input.keyboard = NULL; } if ((caps & WL_SEAT_CAPABILITY_POINTER) && !wl->input.pointer) { wl->input.pointer = wl_seat_get_pointer(seat); wl_pointer_set_user_data(wl->input.pointer, wl); wl_pointer_add_listener(wl->input.pointer, &pointer_listener, wl); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && wl->input.pointer) { wl_pointer_destroy(wl->input.pointer); wl->input.pointer = NULL; } }
static void ss_seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps) { struct ss_seat *ss_seat = data; if ((caps & WL_SEAT_CAPABILITY_POINTER) && !ss_seat->parent.pointer) { ss_seat->parent.pointer = wl_seat_get_pointer(seat); wl_pointer_set_user_data(ss_seat->parent.pointer, ss_seat); wl_pointer_add_listener(ss_seat->parent.pointer, &ss_seat_pointer_listener, ss_seat); weston_seat_init_pointer(&ss_seat->base); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && ss_seat->parent.pointer) { wl_pointer_destroy(ss_seat->parent.pointer); ss_seat->parent.pointer = NULL; } if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !ss_seat->parent.keyboard) { ss_seat->parent.keyboard = wl_seat_get_keyboard(seat); wl_keyboard_set_user_data(ss_seat->parent.keyboard, ss_seat); wl_keyboard_add_listener(ss_seat->parent.keyboard, &ss_seat_keyboard_listener, ss_seat); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && ss_seat->parent.keyboard) { wl_keyboard_destroy(ss_seat->parent.keyboard); ss_seat->parent.keyboard = NULL; } }
static void _ecore_wl_input_seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps) { Ecore_Wl_Input *input; if (!(input = data)) return; LOGFN(__FILE__, __LINE__, __FUNCTION__); if ((caps & WL_SEAT_CAPABILITY_POINTER) && (!input->pointer)) { input->pointer = wl_seat_get_pointer(seat); wl_pointer_set_user_data(input->pointer, input); wl_pointer_add_listener(input->pointer, &pointer_listener, input); if (!input->cursor_surface) { input->cursor_surface = wl_compositor_create_surface(_ecore_wl_disp->wl.compositor); } } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && (input->pointer)) { if (input->cursor_surface) wl_surface_destroy(input->cursor_surface); input->cursor_surface = NULL; wl_pointer_destroy(input->pointer); input->pointer = NULL; } if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && (!input->keyboard)) { input->keyboard = wl_seat_get_keyboard(seat); wl_keyboard_set_user_data(input->keyboard, input); wl_keyboard_add_listener(input->keyboard, &keyboard_listener, input); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && (input->keyboard)) { wl_keyboard_destroy(input->keyboard); input->keyboard = NULL; } if ((caps & WL_SEAT_CAPABILITY_TOUCH) && (!input->touch)) { input->touch = wl_seat_get_touch(seat); wl_touch_set_user_data(input->touch, input); wl_touch_add_listener(input->touch, &touch_listener, input); } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && (input->touch)) { wl_touch_destroy(input->touch); input->touch = NULL; } }
void WLContext::SeatHandleCapabilities(void* data, struct wl_seat* seat, uint32_t caps) { struct WLContext::seat_data* context = static_cast<struct WLContext::seat_data*>(data); assert(context); if ((caps & WL_SEAT_CAPABILITY_POINTER) && !context->wlPointer){ context->wlPointer = wl_seat_get_pointer(seat); wl_pointer_set_user_data(context->wlPointer, data); wl_pointer_add_listener(context->wlPointer, context->ctx->GetWLPointerListener(), data); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && context->wlPointer){ wl_pointer_destroy(context->wlPointer); context->wlPointer = NULL; } if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !context->wlKeyboard){ context->wlKeyboard = wl_seat_get_keyboard(seat); wl_keyboard_set_user_data(context->wlKeyboard, data); wl_keyboard_add_listener(context->wlKeyboard, context->ctx->GetWLKeyboardListener(), data); } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && context->wlKeyboard){ wl_keyboard_destroy(context->wlKeyboard); context->wlKeyboard = NULL; } if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !context->wlTouch){ context->wlTouch = wl_seat_get_touch(seat); wl_touch_set_user_data(context->wlTouch, data); wl_touch_add_listener(context->wlTouch, context->ctx->GetWLTouchListener(), data); } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && context->wlTouch){ wl_touch_destroy(context->wlTouch); context->wlTouch = NULL; } wl_display_dispatch(context->ctx->GetWLDisplay()); }
static void clutter_wayland_handle_seat (void *data, struct wl_seat *seat, uint32_t capabilities) { ClutterInputDeviceWayland *device = data; /* XXX: Needs to handle removals too. */ if ((capabilities & WL_SEAT_CAPABILITY_POINTER) && !device->has_pointer) { struct wl_pointer *pointer; pointer = wl_seat_get_pointer (seat); if (pointer) { wl_pointer_add_listener (pointer, &_clutter_pointer_wayland_listener, device); wl_pointer_set_user_data (pointer, device); device->has_pointer = 1; } } if ((capabilities & WL_SEAT_CAPABILITY_KEYBOARD) && !device->has_keyboard) { struct wl_keyboard *keyboard; keyboard = wl_seat_get_keyboard (seat); if (keyboard) { wl_keyboard_add_listener (keyboard, &_clutter_keyboard_wayland_listener, device); wl_keyboard_set_user_data (keyboard, device); device->has_keyboard = 1; } } }
void XdevLWindowEventServerWayland::setKeyboard(wl_keyboard* keyboard) { m_keyboard = keyboard; wl_keyboard_set_user_data(keyboard, this); wl_keyboard_add_listener(keyboard, &keyboardListener, this); }