From 2bf876282fa640f8f3f33bab2c9fd1df1cafa1c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 7 May 2013 23:17:41 -0400 Subject: [PATCH] input: Eliminate weston_seat::has_pointer/keyboard/touch We can just look at weston_seat::pointer/keyboard/touch now. --- src/compositor.h | 3 --- src/input.c | 16 +++------------- src/shell.c | 4 ++-- src/text-backend.c | 2 +- 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/compositor.h b/src/compositor.h index 45054f5..b9ca79e 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 1d8aee3..f0a642e 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 f129288..4021e7d 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 ed9bf8b..036d48a 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; -- 2.7.4