Nikolay Sivov : comctl32/listview: Simplify setting redraw mode flag.

Alexandre Julliard julliard at wine.codeweavers.com
Mon May 2 09:52:30 CDT 2016


Module: wine
Branch: master
Commit: f4542cf7d78de84d2003967aa3ae3dd2cf92bac6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f4542cf7d78de84d2003967aa3ae3dd2cf92bac6

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon May  2 09:00:30 2016 +0300

comctl32/listview: Simplify setting redraw mode flag.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/listview.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index a4336e8..38c376c 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -332,7 +332,7 @@ typedef struct tagLISTVIEW_INFO
   /* painting */
   BOOL bIsDrawing;         /* Drawing in progress */
   INT nMeasureItemHeight;  /* WM_MEASUREITEM result */
-  BOOL bRedraw;            /* WM_SETREDRAW switch */
+  BOOL redraw;             /* WM_SETREDRAW switch */
 
   /* misc */
   DWORD iVersion;          /* CCM_[G,S]ETVERSION */
@@ -1706,7 +1706,7 @@ static inline BOOL LISTVIEW_DrawFocusRect(const LISTVIEW_INFO *infoPtr, HDC hdc)
 
 static inline BOOL is_redrawing(const LISTVIEW_INFO *infoPtr)
 {
-    return infoPtr->bRedraw;
+    return infoPtr->redraw;
 }
 
 static inline void LISTVIEW_InvalidateRect(const LISTVIEW_INFO *infoPtr, const RECT* rect)
@@ -9465,7 +9465,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
   infoPtr->nFocusedItem = -1;
   infoPtr->nSelectionMark = -1;
   infoPtr->nHotItem = -1;
-  infoPtr->bRedraw = TRUE;
+  infoPtr->redraw = TRUE;
   infoPtr->bNoItemMetrics = TRUE;
   infoPtr->bDoChangeNotify = TRUE;
   infoPtr->autoSpacing = TRUE;
@@ -10948,22 +10948,21 @@ static LRESULT LISTVIEW_SetFont(LISTVIEW_INFO *infoPtr, HFONT hFont, WORD fRedra
  *
  * PARAMETER(S):
  * [I] infoPtr : valid pointer to the listview structure
- * [I] bRedraw: state of redraw flag
+ * [I] redraw: state of redraw flag
  *
  * RETURN:
- * DefWinProc return value
+ *     Zero.
  */
-static LRESULT LISTVIEW_SetRedraw(LISTVIEW_INFO *infoPtr, BOOL bRedraw)
+static LRESULT LISTVIEW_SetRedraw(LISTVIEW_INFO *infoPtr, BOOL redraw)
 {
-    TRACE("infoPtr->bRedraw=%d, bRedraw=%d\n", infoPtr->bRedraw, bRedraw);
+    TRACE("old=%d, new=%d\n", infoPtr->redraw, redraw);
 
-    /* we cannot use straight equality here because _any_ non-zero value is TRUE */
-    if ((infoPtr->bRedraw && bRedraw) || (!infoPtr->bRedraw && !bRedraw)) return 0;
+    if (infoPtr->redraw == !!redraw)
+        return 0;
 
-    infoPtr->bRedraw = bRedraw;
+    if (!(infoPtr->redraw = !!redraw))
+        return 0;
 
-    if(!bRedraw) return 0;
-    
     if (is_autoarrange(infoPtr))
 	LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
     LISTVIEW_UpdateScroll(infoPtr);




More information about the wine-cvs mailing list