input: Eliminate weston_seat::has_pointer/keyboard/touch

We can just look at weston_seat::pointer/keyboard/touch now.
This commit is contained in:
Kristian Høgsberg 2013-05-07 23:17:41 -04:00
parent aad8099c2f
commit 2bf876282f
4 changed files with 6 additions and 19 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;