commit c6edbb7e5a3e10b4f86a3bee215de5f4c7021674
parent e8a02056079a6aa9bead020677667e51fc41a055
Author: Simon Ser <contact@emersion.fr>
Date: Tue, 5 Dec 2023 16:50:31 +0100
input/seat: simplify seat_is_input_allowed()
Use an early return to make the code more readable.
Diffstat:
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git 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) {