Nikolay Sivov : comctl32/listbox: Remove duplicated condition.

Alexandre Julliard julliard at winehq.org
Fri Nov 23 14:18:02 CST 2018


Module: wine
Branch: master
Commit: 656f3f5b29e8f0e0a41361b0a37c67cf7e705565
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=656f3f5b29e8f0e0a41361b0a37c67cf7e705565

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Nov 23 10:16:14 2018 +0300

comctl32/listbox: Remove duplicated condition.

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

---

 dlls/comctl32/listbox.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index 51f6115..71a9c18 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -490,8 +490,8 @@ static INT LISTBOX_GetItemFromPoint( const LB_DESCR *descr, INT x, INT y )
 static void LISTBOX_PaintItem( LB_DESCR *descr, HDC hdc, const RECT *rect,
 			       INT index, UINT action, BOOL ignoreFocus )
 {
+    BOOL selected = FALSE, focused;
     LB_ITEMDATA *item = NULL;
-    BOOL selected = FALSE;
 
     if (index < descr->nb_items)
     {
@@ -499,6 +499,8 @@ static void LISTBOX_PaintItem( LB_DESCR *descr, HDC hdc, const RECT *rect,
         selected = is_item_selected(descr, index);
     }
 
+    focused = !ignoreFocus && descr->focus_item == index && descr->caret_on && descr->in_focus;
+
     if (IS_OWNERDRAW(descr))
     {
         DRAWITEMSTRUCT dis;
@@ -530,9 +532,8 @@ static void LISTBOX_PaintItem( LB_DESCR *descr, HDC hdc, const RECT *rect,
         dis.itemState    = 0;
         if (selected)
             dis.itemState |= ODS_SELECTED;
-        if (!ignoreFocus && (descr->focus_item == index) &&
-            (descr->caret_on) &&
-            (descr->in_focus)) dis.itemState |= ODS_FOCUS;
+        if (focused)
+            dis.itemState |= ODS_FOCUS;
         if (!IsWindowEnabled(descr->self)) dis.itemState |= ODS_DISABLED;
         dis.itemData     = item->data;
         dis.rcItem       = *rect;
@@ -582,9 +583,8 @@ static void LISTBOX_PaintItem( LB_DESCR *descr, HDC hdc, const RECT *rect,
             SetBkColor( hdc, oldBk );
             SetTextColor( hdc, oldText );
         }
-        if (!ignoreFocus && (descr->focus_item == index) &&
-            (descr->caret_on) &&
-            (descr->in_focus)) DrawFocusRect( hdc, rect );
+        if (focused)
+            DrawFocusRect( hdc, rect );
     }
 }
 




More information about the wine-cvs mailing list