From 7c55bc0cd61ba72130b4d1699d163150f64acddb Mon Sep 17 00:00:00 2001 From: Ulrich Czekalla Date: Fri, 15 Dec 2000 22:58:25 +0000 Subject: [PATCH] Only capture mouse when an item is selected. --- controls/listbox.c | 50 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/controls/listbox.c b/controls/listbox.c index aa63fa72378..06faf135995 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -1927,39 +1927,39 @@ static LRESULT LISTBOX_HandleLButtonDown( WND *wnd, LB_DESCR *descr, : descr->lphc->self->hwndSelf ); } - if (index != -1) - { - if (descr->style & LBS_EXTENDEDSEL) - { - /* we should perhaps make sure that all items are deselected - FIXME: needed for !LBS_EXTENDEDSEL, too ? - if (!(wParam & (MK_SHIFT|MK_CONTROL))) - LISTBOX_SetSelection( wnd, descr, -1, FALSE, FALSE); - */ + if (index == -1) return 0; - if (!(wParam & MK_SHIFT)) descr->anchor_item = index; - if (wParam & MK_CONTROL) - { - LISTBOX_SetCaretIndex( wnd, descr, index, FALSE ); - LISTBOX_SetSelection( wnd, descr, index, - !descr->items[index].selected, - (descr->style & LBS_NOTIFY) != 0); - } - else LISTBOX_MoveCaret( wnd, descr, index, FALSE ); - } - else + if (descr->style & LBS_EXTENDEDSEL) + { + /* we should perhaps make sure that all items are deselected + FIXME: needed for !LBS_EXTENDEDSEL, too ? + if (!(wParam & (MK_SHIFT|MK_CONTROL))) + LISTBOX_SetSelection( wnd, descr, -1, FALSE, FALSE); + */ + + if (!(wParam & MK_SHIFT)) descr->anchor_item = index; + if (wParam & MK_CONTROL) { - LISTBOX_MoveCaret( wnd, descr, index, FALSE ); + LISTBOX_SetCaretIndex( wnd, descr, index, FALSE ); LISTBOX_SetSelection( wnd, descr, index, - (!(descr->style & LBS_MULTIPLESEL) || - !descr->items[index].selected), - (descr->style & LBS_NOTIFY) != 0 ); + !descr->items[index].selected, + (descr->style & LBS_NOTIFY) != 0); } + else LISTBOX_MoveCaret( wnd, descr, index, FALSE ); + } + else + { + LISTBOX_MoveCaret( wnd, descr, index, FALSE ); + LISTBOX_SetSelection( wnd, descr, index, + (!(descr->style & LBS_MULTIPLESEL) || + !descr->items[index].selected), + (descr->style & LBS_NOTIFY) != 0 ); } descr->captured = TRUE; SetCapture( wnd->hwndSelf ); - if (index != -1 && !descr->lphc) + + if (!descr->lphc) { if (descr->style & LBS_NOTIFY ) SendMessageA( descr->owner, WM_LBTRACKPOINT, index,