From d34205ef9490bd186e57578136807dd98bf1f0da Mon Sep 17 00:00:00 2001 From: Susan Farley Date: Mon, 15 May 2000 02:34:20 +0000 Subject: [PATCH] Avoid calls to SetFocus when they are unnecessary. --- controls/listbox.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/controls/listbox.c b/controls/listbox.c index eaabe720dc9..7bb9176e703 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -1819,7 +1819,12 @@ static LRESULT LISTBOX_HandleLButtonDown( WND *wnd, LB_DESCR *descr, } } - if( !descr->lphc ) SetFocus( wnd->hwndSelf ); + if( !descr->lphc ) + { + HWND hwndFocus = GetFocus(); + if ((hwndFocus != wnd->hwndSelf) && (hwndFocus != descr->owner)) + SetFocus( wnd->hwndSelf ); + } else SetFocus( (descr->lphc->hWndEdit) ? descr->lphc->hWndEdit : descr->lphc->self->hwndSelf ) ; @@ -2638,6 +2643,10 @@ static inline LRESULT WINAPI ListBoxWndProc_locked( WND* wnd, UINT msg, LISTBOX_RepaintItem( wnd, descr, descr->focus_item, ODA_FOCUS ); return LB_OKAY; + case WM_MOUSEACTIVATE: + case WM_ACTIVATE: + return MA_NOACTIVATE; + case WM_DESTROY: return LISTBOX_Destroy( wnd, descr );