diff options
Diffstat (limited to 'sway/handlers.c')
-rw-r--r-- | sway/handlers.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index 5993223d..79628fe5 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -20,10 +20,7 @@ static struct wlc_origin mouse_origin; | |||
20 | static bool pointer_test(swayc_t *view, void *_origin) { | 20 | static bool pointer_test(swayc_t *view, void *_origin) { |
21 | const struct wlc_origin *origin = _origin; | 21 | const struct wlc_origin *origin = _origin; |
22 | // Determine the output that the view is under | 22 | // Determine the output that the view is under |
23 | swayc_t *parent = view; | 23 | swayc_t *parent = swayc_parent_by_type(view, C_OUTPUT); |
24 | while (parent->type != C_OUTPUT) { | ||
25 | parent = parent->parent; | ||
26 | } | ||
27 | if (origin->x >= view->x && origin->y >= view->y | 24 | if (origin->x >= view->x && origin->y >= view->y |
28 | && origin->x < view->x + view->width && origin->y < view->y + view->height | 25 | && origin->x < view->x + view->width && origin->y < view->y + view->height |
29 | && view->visible && parent == root_container.focused) { | 26 | && view->visible && parent == root_container.focused) { |
@@ -191,10 +188,7 @@ static bool handle_view_created(wlc_handle handle) { | |||
191 | 188 | ||
192 | if (newview) { | 189 | if (newview) { |
193 | set_focused_container(newview); | 190 | set_focused_container(newview); |
194 | swayc_t *output = newview->parent; | 191 | swayc_t *output = swayc_parent_by_type(newview, C_OUTPUT); |
195 | while (output && output->type != C_OUTPUT) { | ||
196 | output = output->parent; | ||
197 | } | ||
198 | arrange_windows(output, -1, -1); | 192 | arrange_windows(output, -1, -1); |
199 | } | 193 | } |
200 | return true; | 194 | return true; |
@@ -262,10 +256,7 @@ static void handle_view_state_request(wlc_handle view, enum wlc_view_state_bit s | |||
262 | arrange_windows(c->parent, -1, -1); | 256 | arrange_windows(c->parent, -1, -1); |
263 | // Set it as focused window for that workspace if its going fullscreen | 257 | // Set it as focused window for that workspace if its going fullscreen |
264 | if (toggle) { | 258 | if (toggle) { |
265 | swayc_t *ws = c; | 259 | swayc_t *ws = swayc_parent_by_type(c, C_WORKSPACE); |
266 | while (ws->type != C_WORKSPACE) { | ||
267 | ws = ws->parent; | ||
268 | } | ||
269 | // Set ws focus to c | 260 | // Set ws focus to c |
270 | set_focused_container_for(ws, c); | 261 | set_focused_container_for(ws, c); |
271 | } | 262 | } |