diff options
Diffstat (limited to 'sway/desktop/render.c')
-rw-r--r-- | sway/desktop/render.c | 61 |
1 files changed, 23 insertions, 38 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 4bfc573b..17fe823a 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -543,9 +543,6 @@ static void render_container(struct sway_output *output, | |||
543 | static void render_container_simple(struct sway_output *output, | 543 | static void render_container_simple(struct sway_output *output, |
544 | pixman_region32_t *damage, struct sway_container *con, | 544 | pixman_region32_t *damage, struct sway_container *con, |
545 | bool parent_focused) { | 545 | bool parent_focused) { |
546 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
547 | struct sway_container *focus = seat_get_focus(seat); | ||
548 | |||
549 | for (int i = 0; i < con->current.children->length; ++i) { | 546 | for (int i = 0; i < con->current.children->length; ++i) { |
550 | struct sway_container *child = con->current.children->items[i]; | 547 | struct sway_container *child = con->current.children->items[i]; |
551 | 548 | ||
@@ -556,11 +553,11 @@ static void render_container_simple(struct sway_output *output, | |||
556 | struct wlr_texture *marks_texture; | 553 | struct wlr_texture *marks_texture; |
557 | struct sway_container_state *state = &child->current; | 554 | struct sway_container_state *state = &child->current; |
558 | 555 | ||
559 | if (focus == child || parent_focused) { | 556 | if (state->focused || parent_focused) { |
560 | colors = &config->border_colors.focused; | 557 | colors = &config->border_colors.focused; |
561 | title_texture = child->title_focused; | 558 | title_texture = child->title_focused; |
562 | marks_texture = view->marks_focused; | 559 | marks_texture = view->marks_focused; |
563 | } else if (seat_get_focus_inactive(seat, con) == child) { | 560 | } else if (con->current.focused_inactive_child == child) { |
564 | colors = &config->border_colors.focused_inactive; | 561 | colors = &config->border_colors.focused_inactive; |
565 | title_texture = child->title_focused_inactive; | 562 | title_texture = child->title_focused_inactive; |
566 | marks_texture = view->marks_focused_inactive; | 563 | marks_texture = view->marks_focused_inactive; |
@@ -580,7 +577,7 @@ static void render_container_simple(struct sway_output *output, | |||
580 | render_view(output, damage, child, colors); | 577 | render_view(output, damage, child, colors); |
581 | } else { | 578 | } else { |
582 | render_container(output, damage, child, | 579 | render_container(output, damage, child, |
583 | parent_focused || focus == child); | 580 | parent_focused || child->current.focused); |
584 | } | 581 | } |
585 | } | 582 | } |
586 | } | 583 | } |
@@ -594,11 +591,9 @@ static void render_container_tabbed(struct sway_output *output, | |||
594 | if (!con->current.children->length) { | 591 | if (!con->current.children->length) { |
595 | return; | 592 | return; |
596 | } | 593 | } |
597 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
598 | struct sway_container *focus = seat_get_focus(seat); | ||
599 | struct sway_container *current = seat_get_active_current_child(seat, con); | ||
600 | struct border_colors *current_colors = &config->border_colors.unfocused; | ||
601 | struct sway_container_state *pstate = &con->current; | 594 | struct sway_container_state *pstate = &con->current; |
595 | struct sway_container *current = pstate->focused_inactive_child; | ||
596 | struct border_colors *current_colors = &config->border_colors.unfocused; | ||
602 | 597 | ||
603 | double width_gap_adjustment = 2 * pstate->current_gaps; | 598 | double width_gap_adjustment = 2 * pstate->current_gaps; |
604 | int tab_width = | 599 | int tab_width = |
@@ -613,11 +608,11 @@ static void render_container_tabbed(struct sway_output *output, | |||
613 | struct wlr_texture *title_texture; | 608 | struct wlr_texture *title_texture; |
614 | struct wlr_texture *marks_texture; | 609 | struct wlr_texture *marks_texture; |
615 | 610 | ||
616 | if (focus == child || parent_focused) { | 611 | if (cstate->focused || parent_focused) { |
617 | colors = &config->border_colors.focused; | 612 | colors = &config->border_colors.focused; |
618 | title_texture = child->title_focused; | 613 | title_texture = child->title_focused; |
619 | marks_texture = view ? view->marks_focused : NULL; | 614 | marks_texture = view ? view->marks_focused : NULL; |
620 | } else if (child == current) { | 615 | } else if (child == pstate->focused_inactive_child) { |
621 | colors = &config->border_colors.focused_inactive; | 616 | colors = &config->border_colors.focused_inactive; |
622 | title_texture = child->title_focused_inactive; | 617 | title_texture = child->title_focused_inactive; |
623 | marks_texture = view ? view->marks_focused_inactive : NULL; | 618 | marks_texture = view ? view->marks_focused_inactive : NULL; |
@@ -644,13 +639,11 @@ static void render_container_tabbed(struct sway_output *output, | |||
644 | } | 639 | } |
645 | 640 | ||
646 | // Render surface and left/right/bottom borders | 641 | // Render surface and left/right/bottom borders |
647 | if (current) { | 642 | if (current->type == C_VIEW) { |
648 | if (current->type == C_VIEW) { | 643 | render_view(output, damage, current, current_colors); |
649 | render_view(output, damage, current, current_colors); | 644 | } else { |
650 | } else { | 645 | render_container(output, damage, current, |
651 | render_container(output, damage, current, | 646 | parent_focused || current->current.focused); |
652 | parent_focused || current == focus); | ||
653 | } | ||
654 | } | 647 | } |
655 | } | 648 | } |
656 | 649 | ||
@@ -663,11 +656,9 @@ static void render_container_stacked(struct sway_output *output, | |||
663 | if (!con->current.children->length) { | 656 | if (!con->current.children->length) { |
664 | return; | 657 | return; |
665 | } | 658 | } |
666 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
667 | struct sway_container *focus = seat_get_focus(seat); | ||
668 | struct sway_container *current = seat_get_active_current_child(seat, con); | ||
669 | struct border_colors *current_colors = &config->border_colors.unfocused; | ||
670 | struct sway_container_state *pstate = &con->current; | 659 | struct sway_container_state *pstate = &con->current; |
660 | struct sway_container *current = pstate->focused_inactive_child; | ||
661 | struct border_colors *current_colors = &config->border_colors.unfocused; | ||
671 | 662 | ||
672 | size_t titlebar_height = container_titlebar_height(); | 663 | size_t titlebar_height = container_titlebar_height(); |
673 | 664 | ||
@@ -680,11 +671,11 @@ static void render_container_stacked(struct sway_output *output, | |||
680 | struct wlr_texture *title_texture; | 671 | struct wlr_texture *title_texture; |
681 | struct wlr_texture *marks_texture; | 672 | struct wlr_texture *marks_texture; |
682 | 673 | ||
683 | if (focus == child || parent_focused) { | 674 | if (cstate->focused || parent_focused) { |
684 | colors = &config->border_colors.focused; | 675 | colors = &config->border_colors.focused; |
685 | title_texture = child->title_focused; | 676 | title_texture = child->title_focused; |
686 | marks_texture = view ? view->marks_focused : NULL; | 677 | marks_texture = view ? view->marks_focused : NULL; |
687 | } else if (child == current) { | 678 | } else if (child == pstate->focused_inactive_child) { |
688 | colors = &config->border_colors.focused_inactive; | 679 | colors = &config->border_colors.focused_inactive; |
689 | title_texture = child->title_focused_inactive; | 680 | title_texture = child->title_focused_inactive; |
690 | marks_texture = view ? view->marks_focused_inactive : NULL; | 681 | marks_texture = view ? view->marks_focused_inactive : NULL; |
@@ -704,13 +695,11 @@ static void render_container_stacked(struct sway_output *output, | |||
704 | } | 695 | } |
705 | 696 | ||
706 | // Render surface and left/right/bottom borders | 697 | // Render surface and left/right/bottom borders |
707 | if (current) { | 698 | if (current->type == C_VIEW) { |
708 | if (current->type == C_VIEW) { | 699 | render_view(output, damage, current, current_colors); |
709 | render_view(output, damage, current, current_colors); | 700 | } else { |
710 | } else { | 701 | render_container(output, damage, current, |
711 | render_container(output, damage, current, | 702 | parent_focused || current->current.focused); |
712 | parent_focused || current == focus); | ||
713 | } | ||
714 | } | 703 | } |
715 | } | 704 | } |
716 | 705 | ||
@@ -738,13 +727,11 @@ static void render_floating_container(struct sway_output *soutput, | |||
738 | pixman_region32_t *damage, struct sway_container *con) { | 727 | pixman_region32_t *damage, struct sway_container *con) { |
739 | if (con->type == C_VIEW) { | 728 | if (con->type == C_VIEW) { |
740 | struct sway_view *view = con->sway_view; | 729 | struct sway_view *view = con->sway_view; |
741 | struct sway_seat *seat = input_manager_current_seat(input_manager); | ||
742 | struct sway_container *focus = seat_get_focus(seat); | ||
743 | struct border_colors *colors; | 730 | struct border_colors *colors; |
744 | struct wlr_texture *title_texture; | 731 | struct wlr_texture *title_texture; |
745 | struct wlr_texture *marks_texture; | 732 | struct wlr_texture *marks_texture; |
746 | 733 | ||
747 | if (focus == con) { | 734 | if (con->current.focused) { |
748 | colors = &config->border_colors.focused; | 735 | colors = &config->border_colors.focused; |
749 | title_texture = con->title_focused; | 736 | title_texture = con->title_focused; |
750 | marks_texture = view->marks_focused; | 737 | marks_texture = view->marks_focused; |
@@ -871,9 +858,7 @@ void output_render(struct sway_output *output, struct timespec *when, | |||
871 | render_layer(output, damage, | 858 | render_layer(output, damage, |
872 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); | 859 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); |
873 | 860 | ||
874 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 861 | render_container(output, damage, workspace, workspace->current.focused); |
875 | struct sway_container *focus = seat_get_focus(seat); | ||
876 | render_container(output, damage, workspace, focus == workspace); | ||
877 | render_floating(output, damage); | 862 | render_floating(output, damage); |
878 | 863 | ||
879 | render_unmanaged(output, damage, | 864 | render_unmanaged(output, damage, |