diff options
author | 2022-05-31 14:44:49 +0300 | |
---|---|---|
committer | 2022-06-10 21:20:46 +0000 | |
commit | 394b5da767661260043080dc025d0a71998851f8 (patch) | |
tree | 516996900f9c0cfc78fc9eb0fb175e0cb467d838 /src/input.c | |
parent | cac00851d454fcfe6b4e9f3353cfa4007f31c21e (diff) |
shell: Extract some common functions
For instance this exports retreiving a ivi_seat from weston_seat, and
they are useful in other parts as well.
Bug-AGL: SPEC-4413
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I838823570792761dfb5ac4beea635e843dd5cd22
Diffstat (limited to 'src/input.c')
-rw-r--r-- | src/input.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/input.c b/src/input.c index b6b104a..1a143ce 100644 --- a/src/input.c +++ b/src/input.c @@ -32,7 +32,7 @@ #include "ivi-compositor.h" #include "shared/helpers.h" -static struct ivi_surface * +struct ivi_surface * get_ivi_shell_surface(struct weston_surface *surface) { struct weston_desktop_surface *desktop_surface = @@ -59,19 +59,37 @@ ivi_shell_seat_handle_destroy(struct wl_listener *listener, void *data) free(shseat); } -static struct ivi_shell_seat * +struct ivi_shell_seat * get_ivi_shell_seat(struct weston_seat *seat) { struct wl_listener *listener; + if (!seat) + return NULL; + + listener = wl_signal_get(&seat->destroy_signal, ivi_shell_seat_handle_destroy); - assert(listener != NULL); + if (!listener) + return NULL; return container_of(listener, struct ivi_shell_seat, seat_destroy_listener); } +struct weston_seat * +get_ivi_shell_weston_first_seat(struct ivi_compositor *ivi) +{ + struct wl_list *node; + struct weston_compositor *compositor = ivi->compositor; + + if (wl_list_empty(&compositor->seat_list)) + return NULL; + + node = compositor->seat_list.next; + return container_of(node, struct weston_seat, link); +} + static void ivi_shell_seat_handle_pointer_focus(struct wl_listener *listener, void *data) { |