From c6edbb7e5a3e10b4f86a3bee215de5f4c7021674 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 5 Dec 2023 16:50:31 +0100 Subject: [PATCH] input/seat: simplify seat_is_input_allowed() Use an early return to make the code more readable. --- sway/input/seat.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sway/input/seat.c b/sway/input/seat.c index 31c9b72b..cb8ac6a4 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -1092,19 +1092,19 @@ void seat_configure_xcursor(struct sway_seat *seat) { bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface) { - if (server.session_lock.locked) { - if (server.session_lock.lock == NULL) { - return false; - } - struct wlr_session_lock_surface_v1 *lock_surf; - wl_list_for_each(lock_surf, &server.session_lock.lock->surfaces, link) { - if (lock_surf->surface == surface) { - return true; - } - } + if (!server.session_lock.locked) { + return true; + } + if (server.session_lock.lock == NULL) { return false; } - return true; + struct wlr_session_lock_surface_v1 *lock_surf; + wl_list_for_each(lock_surf, &server.session_lock.lock->surfaces, link) { + if (lock_surf->surface == surface) { + return true; + } + } + return false; } static void send_unfocus(struct sway_container *con, void *data) {