[09/10] comctl32/listview: Simplify key selection handler a bit

Nikolay Sivov bunglehead at gmail.com
Sun May 24 16:20:49 CDT 2009


Changelog:
    - Simplify key selection handler a bit

>From 209d7b3ecb3205061aa87234c40c6bd2d34027a1 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Mon, 25 May 2009 00:26:30 +0400
Subject: Simplify key selection handler a bit

---
 dlls/comctl32/listview.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 12a2da8..9b61b44 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -3269,18 +3269,14 @@ static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem, BOOL space)
   TRACE("nItem=%d, wShift=%d, wCtrl=%d\n", nItem, wShift, wCtrl);
   if ((nItem >= 0) && (nItem < infoPtr->nItemCount))
   {
-    if (infoPtr->dwStyle & LVS_SINGLESEL)
-    {
-      bResult = TRUE;
+    bResult = TRUE;
+
+    if (infoPtr->dwStyle & LVS_SINGLESEL || (wShift == 0 && wCtrl == 0))
       LISTVIEW_SetSelection(infoPtr, nItem);
-    }
     else
     {
       if (wShift)
-      {
-        bResult = TRUE;
         LISTVIEW_SetGroupSelection(infoPtr, nItem);
-      }
       else if (wCtrl)
       {
         LVITEMW lvItem;
@@ -3294,11 +3290,6 @@ static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem, BOOL space)
         }
         bResult = LISTVIEW_SetItemFocus(infoPtr, nItem);
       }
-      else
-      {
-        bResult = TRUE;
-        LISTVIEW_SetSelection(infoPtr, nItem);
-      }
     }
     LISTVIEW_EnsureVisible(infoPtr, nItem, FALSE);
   }
-- 
1.5.6.5







More information about the wine-patches mailing list