X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/6908fed739ac49c43d4400ef572e0811a0ac676e..3ca5c28cafade2c9e0ada4d5b30c1d9b1be32f4c:/winctrls.c diff --git a/winctrls.c b/winctrls.c index 126c4a71..df0edce7 100644 --- a/winctrls.c +++ b/winctrls.c @@ -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; }