From bb7381765c435ac37e133f7fcc14a07823539050 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Sun, 17 Dec 2017 08:25:10 +0100 Subject: Scrollbar and right window border (corrected) When a scrollbar is on display in APP or TOD windows, the right vertical border (outside the scrollbar) is not highlighted when the window is selected. The scrollbar is always highlighted: - when APP or TOD is deselected - in configuration windows where borders otherwise are not The patch moves the scrollbar parameters (except highlight) from arguments of draw_scrollbar() to the function itself. The highlight argument was 1; instead it is set higher in the call hierarchy (wins_update_panels()) and passed on down. Signed-off-by: Lukas Fleischer --- src/utils.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index 2879de7..495b8fc 100644 --- a/src/utils.c +++ b/src/utils.c @@ -574,8 +574,7 @@ long min2sec(unsigned minutes) * Display a scroll bar when there are so many items that they * can not be displayed inside the corresponding panel. */ -void -draw_scrollbar(struct scrollwin *sw) +void draw_scrollbar(struct scrollwin *sw, int hilt) { int y = (conf.compact_panels ? 1 : 3); int h = sw->h - (conf.compact_panels ? 2 : 4); @@ -584,20 +583,14 @@ draw_scrollbar(struct scrollwin *sw) int sbar_y = y + sw->line_off * (h - sbar_h) / (sw->line_num - h); int sbar_x = sw->w - 1; - /* which scrollwin am I? */ - enum win swid = -1; - if (strcmp(sw->label, _("TODO")) == 0) - swid = TOD; - else if (strcmp(sw->label, _("Appointments")) == 0) - swid = APP; - /* - * Redraw the vertical right border. - * For APP and TOD this is done as part of the move up/down. - */ - if (swid == -1) - mvwvline(sw->win, y, sbar_x, ACS_VLINE, h); + /* Redraw part of the border. */ + if (hilt) + custom_apply_attr(sw->win, ATTR_HIGHEST); + mvwvline(sw->win, y, sbar_x, ACS_VLINE, h); + if (hilt) + custom_remove_attr(sw->win, ATTR_HIGHEST); - int hilt = swid == wins_slctd(); + /* Draw the scrollbar. */ if (hilt) custom_apply_attr(sw->win, ATTR_HIGHEST); wattron(sw->win, A_REVERSE); -- cgit v1.2.3