diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2014-10-17 22:38:59 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2014-10-17 22:40:02 +0200 |
commit | 4fd8f0b11e565587f349b910b3abfd16b611e767 (patch) | |
tree | 3de68fab7708b59290931d34f6951856943cc2aa | |
parent | 7f62fb185c2617eb308f7ca5fe8b9e18828cb772 (diff) | |
download | calcurse-4fd8f0b11e565587f349b910b3abfd16b611e767.tar.gz calcurse-4fd8f0b11e565587f349b910b3abfd16b611e767.zip |
Only werase() calendar if month is changed
Optimize the monthly view by only erasing the window content when a new
month is selected.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r-- | src/ui-calendar.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/ui-calendar.c b/src/ui-calendar.c index bd8d7fe..d72f71a 100644 --- a/src/ui-calendar.c +++ b/src/ui-calendar.c @@ -309,6 +309,10 @@ draw_monthly_view(struct scrollwin *sw, struct date *current_day, /* Write the current month and year on top of the calendar */ WINS_CALENDAR_LOCK; + if (yr * YEARINMONTHS + mo != monthly_view_cache_month) { + /* erase the window if a new month is selected */ + werase(sw_cal.inner); + } custom_apply_attr(sw->inner, ATTR_HIGHEST); mvwprintw(sw->inner, ofs_y, (w - (strlen(_(monthnames[mo - 1])) + 5)) / 2, @@ -491,6 +495,7 @@ draw_weekly_view(struct scrollwin *sw, struct date *current_day, /* Print the week number. */ weeknum = ISO8601weeknum(&t); WINS_CALENDAR_LOCK; + werase(sw_cal.inner); custom_apply_attr(sw->inner, ATTR_HIGHEST); mvwprintw(sw->win, conf.compact_panels ? 0 : 2, sw->w - 9, "(# %02d)", weeknum); @@ -596,15 +601,8 @@ void ui_calendar_update_panel(void) unsigned sunday_first; ui_calendar_store_current_date(¤t_day); - - WINS_CALENDAR_LOCK; - werase(sw_cal.inner); - WINS_CALENDAR_UNLOCK; - - sunday_first = ui_calendar_week_begins_on_monday()? 0 : 1; - + sunday_first = !ui_calendar_week_begins_on_monday(); draw_calendar[ui_calendar_view] (&sw_cal, ¤t_day, sunday_first); - wins_scrollwin_display(&sw_cal); } |