diff options
author | Simon Ser <contact@emersion.fr> | 2023-12-05 16:50:31 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-12-13 10:11:35 +0100 |
commit | c6edbb7e5a3e10b4f86a3bee215de5f4c7021674 (patch) | |
tree | c2f14d1031198b293ec0bc60d4fd3b1af560959d | |
parent | e8a02056079a6aa9bead020677667e51fc41a055 (diff) |
input/seat: simplify seat_is_input_allowed()
Use an early return to make the code more readable.
-rw-r--r-- | sway/input/seat.c | 22 |
1 files 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) { |