From decc86add9bca24dc7b1680018feddde50405856 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 25 Sep 2009 03:32:18 +0400 Subject: [PATCH] comctl32/monthcal: Don't redraw if date didn't change on MCM_SETTODAY. --- dlls/comctl32/monthcal.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index aa4b35ce412..5cbd9aa3c32 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -158,6 +158,12 @@ int MONTHCAL_MonthLength(int month, int year) } } +/* compares timestamps using date part only */ +static inline BOOL MONTHCAL_IsDateEqual(const SYSTEMTIME *first, const SYSTEMTIME *second) +{ + return (first->wYear == second->wYear) && (first->wMonth == second->wMonth) && + (first->wDay == second->wDay); +} /* make sure that time is valid */ static int MONTHCAL_ValidateTime(SYSTEMTIME time) @@ -1093,6 +1099,9 @@ MONTHCAL_SetToday(MONTHCAL_INFO *infoPtr, SYSTEMTIME *today) TRACE("%p\n", today); if(!today) return FALSE; + + if(MONTHCAL_IsDateEqual(today, &infoPtr->todaysDate)) return TRUE; + MONTHCAL_CopyTime(today, &infoPtr->todaysDate); InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); return TRUE; -- 2.11.4.GIT