diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-22 08:43:00 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-22 08:43:00 +1000 |
commit | 5354988317f07e436f23c4022992b09623ef1322 (patch) | |
tree | 74c960b2bb44198562a494afffc6edee6dfceb71 | |
parent | Use constants for titlebar dimensions (diff) | |
download | sway-5354988317f07e436f23c4022992b09623ef1322.tar.gz sway-5354988317f07e436f23c4022992b09623ef1322.tar.zst sway-5354988317f07e436f23c4022992b09623ef1322.zip |
Implement clicking stacked title bars
-rw-r--r-- | sway/tree/container.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 3f30a079..9cf18f61 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -533,8 +533,23 @@ static struct sway_container *container_at_tabbed(struct sway_container *parent, | |||
533 | static struct sway_container *container_at_stacked( | 533 | static struct sway_container *container_at_stacked( |
534 | struct sway_container *parent, double ox, double oy, | 534 | struct sway_container *parent, double ox, double oy, |
535 | struct wlr_surface **surface, double *sx, double *sy) { | 535 | struct wlr_surface **surface, double *sx, double *sy) { |
536 | // TODO | 536 | if (oy < parent->y || oy > parent->y + parent->height) { |
537 | return NULL; | 537 | return NULL; |
538 | } | ||
539 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
540 | |||
541 | // Title bars | ||
542 | int title_height = container_titlebar_height(); | ||
543 | int child_index = (oy - parent->y) / title_height; | ||
544 | if (child_index < parent->children->length) { | ||
545 | struct sway_container *child = parent->children->items[child_index]; | ||
546 | return seat_get_focus_inactive(seat, child); | ||
547 | } | ||
548 | |||
549 | // Surfaces | ||
550 | struct sway_container *current = seat_get_active_child(seat, parent); | ||
551 | |||
552 | return container_at(current, ox, oy, surface, sx, sy); | ||
538 | } | 553 | } |
539 | 554 | ||
540 | /** | 555 | /** |