We can just look at weston_seat::pointer/keyboard/touch now.
struct weston_touch *touch;
struct weston_pointer pointer_instance;
- int has_pointer;
struct weston_keyboard keyboard_instance;
- int has_keyboard;
struct weston_touch touch_instance;
- int has_touch;
struct wl_signal destroy_signal;
struct weston_compositor *compositor;
WL_EXPORT int
weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap)
{
- if (seat->has_keyboard)
+ if (seat->keyboard)
return 0;
if (keymap != NULL) {
weston_keyboard_init(&seat->keyboard_instance);
weston_seat_set_keyboard(seat, &seat->keyboard_instance);
- seat->has_keyboard = 1;
-
return 0;
}
WL_EXPORT void
weston_seat_init_pointer(struct weston_seat *seat)
{
- if (seat->has_pointer)
+ if (seat->pointer)
return;
weston_pointer_init(&seat->pointer_instance);
weston_seat_set_pointer(seat, &seat->pointer_instance);
-
- seat->has_pointer = 1;
}
WL_EXPORT void
weston_seat_init_touch(struct weston_seat *seat)
{
- if (seat->has_touch)
+ if (seat->touch)
return;
weston_touch_init(&seat->touch_instance);
weston_seat_set_touch(seat, &seat->touch_instance);
-
- seat->has_touch = 1;
}
WL_EXPORT void
wl_list_init(&seat->drag_resource_list);
wl_signal_init(&seat->destroy_signal);
- seat->has_pointer = 0;
- seat->has_keyboard = 0;
- seat->has_touch = 0;
-
wl_display_add_global(ec->wl_display, &wl_seat_interface, seat,
bind_seat);
drop_focus_state(shell, from, surface);
wl_list_for_each(seat, &shell->compositor->seat_list, link)
- if (seat->has_keyboard &&
+ if (seat->keyboard &&
seat->keyboard->focus == &surface->surface)
weston_keyboard_set_focus(seat->keyboard, NULL);
* TODO: Do something clever for touch too?
*/
wl_list_for_each(seat, &compositor->seat_list, link) {
- if (seat->has_pointer) {
+ if (seat->pointer) {
ix = wl_fixed_to_int(seat->pointer->x);
iy = wl_fixed_to_int(seat->pointer->y);
break;
if (seat->input_method->focus_listener_initialized)
return;
- if (seat->has_keyboard) {
+ if (seat->keyboard) {
seat->input_method->keyboard_focus_listener.notify = handle_keyboard_focus;
wl_signal_add(&seat->keyboard->focus_signal, &seat->input_method->keyboard_focus_listener);
seat->keyboard->input_method_grab.interface = &input_method_context_grab;