diff options
-rw-r--r-- | sway/tree/container.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 1b7b9dd0..68fbec2f 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -311,7 +311,30 @@ static struct sway_container *floating_container_at(double lx, double ly, | |||
311 | return NULL; | 311 | return NULL; |
312 | } | 312 | } |
313 | 313 | ||
314 | struct sway_container *view_container_at(struct sway_node *parent, | 314 | static struct sway_container *view_container_content_at(struct sway_node *parent, |
315 | double lx, double ly, | ||
316 | struct wlr_surface **surface, double *sx, double *sy) { | ||
317 | if (!sway_assert(node_is_view(parent), "Expected a view")) { | ||
318 | return NULL; | ||
319 | } | ||
320 | |||
321 | struct sway_container *container = parent->sway_container; | ||
322 | struct wlr_box box = { | ||
323 | .x = container->pending.content_x, | ||
324 | .y = container->pending.content_y, | ||
325 | .width = container->pending.content_width, | ||
326 | .height = container->pending.content_height, | ||
327 | }; | ||
328 | |||
329 | if (wlr_box_contains_point(&box, lx, ly)) { | ||
330 | surface_at_view(parent->sway_container, lx, ly, surface, sx, sy); | ||
331 | return container; | ||
332 | } | ||
333 | |||
334 | return NULL; | ||
335 | } | ||
336 | |||
337 | static struct sway_container *view_container_at(struct sway_node *parent, | ||
315 | double lx, double ly, | 338 | double lx, double ly, |
316 | struct wlr_surface **surface, double *sx, double *sy) { | 339 | struct wlr_surface **surface, double *sx, double *sy) { |
317 | if (!sway_assert(node_is_view(parent), "Expected a view")) { | 340 | if (!sway_assert(node_is_view(parent), "Expected a view")) { |
@@ -395,7 +418,7 @@ struct sway_container *container_at(struct sway_workspace *workspace, | |||
395 | } | 418 | } |
396 | // Tiling (focused) | 419 | // Tiling (focused) |
397 | if (focus && focus->view && !is_floating) { | 420 | if (focus && focus->view && !is_floating) { |
398 | if ((c = view_container_at(&focus->node, lx, ly, surface, sx, sy))) { | 421 | if ((c = view_container_content_at(&focus->node, lx, ly, surface, sx, sy))) { |
399 | return c; | 422 | return c; |
400 | } | 423 | } |
401 | } | 424 | } |