aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2023-12-05 16:50:31 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2023-12-13 10:11:35 +0100
commitc6edbb7e5a3e10b4f86a3bee215de5f4c7021674 (patch)
treec2f14d1031198b293ec0bc60d4fd3b1af560959d
parentinput/seat: rename seat_set_exclusive_client() (diff)
downloadsway-c6edbb7e5a3e10b4f86a3bee215de5f4c7021674.tar.gz
sway-c6edbb7e5a3e10b4f86a3bee215de5f4c7021674.tar.zst
sway-c6edbb7e5a3e10b4f86a3bee215de5f4c7021674.zip
input/seat: simplify seat_is_input_allowed()
Use an early return to make the code more readable.
-rw-r--r--sway/input/seat.c22
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) {
1092 1092
1093bool seat_is_input_allowed(struct sway_seat *seat, 1093bool seat_is_input_allowed(struct sway_seat *seat,
1094 struct wlr_surface *surface) { 1094 struct wlr_surface *surface) {
1095 if (server.session_lock.locked) { 1095 if (!server.session_lock.locked) {
1096 if (server.session_lock.lock == NULL) { 1096 return true;
1097 return false; 1097 }
1098 } 1098 if (server.session_lock.lock == NULL) {
1099 struct wlr_session_lock_surface_v1 *lock_surf;
1100 wl_list_for_each(lock_surf, &server.session_lock.lock->surfaces, link) {
1101 if (lock_surf->surface == surface) {
1102 return true;
1103 }
1104 }
1105 return false; 1099 return false;
1106 } 1100 }
1107 return true; 1101 struct wlr_session_lock_surface_v1 *lock_surf;
1102 wl_list_for_each(lock_surf, &server.session_lock.lock->surfaces, link) {
1103 if (lock_surf->surface == surface) {
1104 return true;
1105 }
1106 }
1107 return false;
1108} 1108}
1109 1109
1110static void send_unfocus(struct sway_container *con, void *data) { 1110static void send_unfocus(struct sway_container *con, void *data) {