diff --git a/src/compositor.h b/src/compositor.h index 45054f51..b9ca79e2 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -441,11 +441,8 @@ struct weston_seat { 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; diff --git a/src/input.c b/src/input.c index 1d8aee38..f0a642ee 100644 --- a/src/input.c +++ b/src/input.c @@ -1444,7 +1444,7 @@ weston_compositor_build_global_keymap(struct weston_compositor *ec) 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) { @@ -1469,33 +1469,27 @@ weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap) 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 @@ -1509,10 +1503,6 @@ weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec) 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); diff --git a/src/shell.c b/src/shell.c index f129288d..4021e7d0 100644 --- a/src/shell.c +++ b/src/shell.c @@ -900,7 +900,7 @@ move_surface_to_workspace(struct desktop_shell *shell, 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); @@ -3127,7 +3127,7 @@ weston_surface_set_initial_position (struct weston_surface *surface, * 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; diff --git a/src/text-backend.c b/src/text-backend.c index ed9bf8bc..036d48a6 100644 --- a/src/text-backend.c +++ b/src/text-backend.c @@ -810,7 +810,7 @@ input_method_init_seat(struct weston_seat *seat) 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;