[4/5] comctl32/monthcal: Don't redraw if date didn't change on MCM_SETTODAY

Nikolay Sivov bunglehead at gmail.com
Thu Sep 24 18:49:41 CDT 2009


>From c6af194f0b8468d829d33ef1c3932fb8516ebad3 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Fri, 25 Sep 2009 03:32:18 +0400
Subject: Don't redraw if date didn't change on MCM_SETTODAY

---
 dlls/comctl32/monthcal.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index aa4b35c..5cbd9aa 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;
-- 
1.5.6.5







More information about the wine-patches mailing list