[PATCH] comctl32/listview: Keep the active item selected after hwndEdit is destroyed

Hugh McMaster hugh.mcmaster at outlook.com
Wed Aug 9 23:54:05 CDT 2017


Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 dlls/comctl32/listview.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 73eceff509..05bd375571 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -10216,6 +10216,7 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN
   static BOOL bGroupSelect = TRUE;
   POINT pt = { x, y };
   INT nItem;
+  BOOL editing = FALSE;
 
   TRACE("(key=%hu, X=%u, Y=%u)\n", wKey, x, y);
 
@@ -10309,11 +10310,20 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN
   else
   {
     if (!infoPtr->bFocus)
+    {
+        editing = IsWindow(infoPtr->hwndEdit);
         SetFocus(infoPtr->hwndSelf);
+    }
 
-    /* remove all selections */
+    /* keep the active item selected after hwndEdit is destroyed, or deselect all items */
     if (!(wKey & MK_CONTROL) && !(wKey & MK_SHIFT))
-        LISTVIEW_DeselectAll(infoPtr);
+    {
+        if (editing)
+            LISTVIEW_DeselectAllSkipItem(infoPtr, infoPtr->nFocusedItem);
+        else
+            LISTVIEW_DeselectAll(infoPtr);
+    }
+
     ReleaseCapture();
   }
   
-- 
2.13.2




More information about the wine-patches mailing list