The dummy drag-list item wasn't being removed on a single-click or
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 21 Nov 2001 22:16:04 +0000 (22:16 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 21 Nov 2001 22:16:04 +0000 (22:16 +0000)
double-click (DL_BEGINDRAG followed immediately by DL_DROPPED with
no intervening DL_DRAGGING). Fixed.

git-svn-id: svn://svn.tartarus.org/sgt/putty@1391 cda61777-01e9-0310-a592-d414129be87e

winctrls.c

index 126c4a7..df0edce 100644 (file)
@@ -1024,20 +1024,20 @@ int handle_prefslist(struct prefslist *hdl,
                    SetWindowLong(hwnd, DWL_MSGRESULT, DL_STOPCURSOR);
                 ret = 1; break;
               case DL_DROPPED:
-               ret = 1;
-               if (!hdl->dragging) break;
-               dest = pl_itemfrompt(dlm->hWnd, dlm->ptCursor, TRUE);
-               if (dest > hdl->dummyitem) dest = hdl->dummyitem;
-               DrawInsert (hwnd, dlm->hWnd, -1);
+               if (hdl->dragging) {
+                   dest = pl_itemfrompt(dlm->hWnd, dlm->ptCursor, TRUE);
+                   if (dest > hdl->dummyitem) dest = hdl->dummyitem;
+                   DrawInsert (hwnd, dlm->hWnd, -1);
+               }
                SendDlgItemMessage(hwnd, hdl->listid,
                                   LB_DELETESTRING, hdl->dummyitem, 0);
-               hdl->dragging = 0;
-               if (dest >= 0) {
-                   /* Correct for "missing" item. This means you can't drag
-                    * an item to the end, but that seems to be the way this
-                    * control is used. */
-                   if (dest > hdl->srcitem) dest--;
-                   pl_moveitem(hwnd, hdl->listid, hdl->srcitem, dest);
+               if (hdl->dragging) {
+                   hdl->dragging = 0;
+                   if (dest >= 0) {
+                       /* Correct for "missing" item. */
+                       if (dest > hdl->srcitem) dest--;
+                       pl_moveitem(hwnd, hdl->listid, hdl->srcitem, dest);
+                   }
                }
                 ret = 1; break;
             }