diff options
author | Ivan Chebykin <ivan@chebykin.org> | 2018-05-26 15:51:36 +0300 |
---|---|---|
committer | Ivan Chebykin <ivan@chebykin.org> | 2018-05-26 15:51:36 +0300 |
commit | 6e6b0decd95eb3fd4b336817839c08a2c71c7505 (patch) | |
tree | 5020892ac6a7ff3e1c3dab80e5220db2d3220575 | |
parent | Moved visibility check of of loop, added asserts (diff) | |
download | sway-6e6b0decd95eb3fd4b336817839c08a2c71c7505.tar.gz sway-6e6b0decd95eb3fd4b336817839c08a2c71c7505.tar.zst sway-6e6b0decd95eb3fd4b336817839c08a2c71c7505.zip |
Fix usage of sway_assert
-rw-r--r-- | sway/input/cursor.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index b404a634..62967cb8 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -167,7 +167,9 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, | |||
167 | // If pointed container is in nested containers which are | 167 | // If pointed container is in nested containers which are |
168 | // inside tabbed/stacked layout we should skip them | 168 | // inside tabbed/stacked layout we should skip them |
169 | bool do_mouse_focus = true; | 169 | bool do_mouse_focus = true; |
170 | sway_assert(c->type == C_VIEW, "pointed container is not a view"); | 170 | if(!sway_assert(c->type == C_VIEW, "pointed container is not a view")) { |
171 | return; | ||
172 | } | ||
171 | bool is_visible = view_is_visible(c->sway_view); | 173 | bool is_visible = view_is_visible(c->sway_view); |
172 | struct sway_container *p = c->parent; | 174 | struct sway_container *p = c->parent; |
173 | while (p) { | 175 | while (p) { |
@@ -181,8 +183,10 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, | |||
181 | if (!do_mouse_focus) { | 183 | if (!do_mouse_focus) { |
182 | struct sway_container *next_focus = seat_get_focus_inactive( | 184 | struct sway_container *next_focus = seat_get_focus_inactive( |
183 | cursor->seat, p); | 185 | cursor->seat, p); |
184 | sway_assert(next_focus->type == C_VIEW, | 186 | if(!sway_assert(next_focus->type == C_VIEW, |
185 | "focus inactive container is not a view"); | 187 | "focus inactive container is not a view")) { |
188 | return; | ||
189 | } | ||
186 | if (next_focus && view_is_visible(next_focus->sway_view)) { | 190 | if (next_focus && view_is_visible(next_focus->sway_view)) { |
187 | seat_set_focus_warp(cursor->seat, next_focus, false); | 191 | seat_set_focus_warp(cursor->seat, next_focus, false); |
188 | } | 192 | } |