From 3a3424280f6a5093f9299629848b53a9b15031a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= <gabrielopcode@gmail.com> Date: Tue, 2 Apr 2019 14:28:13 +0300 Subject: [PATCH] shell32/autocomplete: Make the dropdown listbox a proper pop-up window. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> --- dlls/shell32/autocomplete.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c index ed8b270b2d3..9e8d93c871b 100644 --- a/dlls/shell32/autocomplete.c +++ b/dlls/shell32/autocomplete.c @@ -301,7 +301,8 @@ static void show_listbox(IAutoCompleteImpl *ac) height = SendMessageW(ac->hwndListBox, LB_GETITEMHEIGHT, 0, 0) * min(cnt + 1, 7); width = r.right - r.left; - SetWindowPos(ac->hwndListBox, HWND_TOP, r.left, r.bottom + 1, width, height, SWP_SHOWWINDOW); + SetWindowPos(ac->hwndListBox, HWND_TOP, r.left, r.bottom + 1, width, height, + SWP_SHOWWINDOW | SWP_NOACTIVATE); } static size_t format_quick_complete(WCHAR *dst, const WCHAR *qc, const WCHAR *str, size_t str_len) @@ -798,6 +799,8 @@ static LRESULT APIENTRY ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, int sel, len; switch (uMsg) { + case WM_MOUSEACTIVATE: + return MA_NOACTIVATE; case WM_MOUSEMOVE: sel = SendMessageW(hwnd, LB_ITEMFROMPOINT, 0, lParam); SendMessageW(hwnd, LB_SETCURSEL, sel, 0); @@ -821,16 +824,15 @@ static LRESULT APIENTRY ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, static void create_listbox(IAutoCompleteImpl *This) { /* FIXME : The listbox should be resizable with the mouse. WS_THICKFRAME looks ugly */ - This->hwndListBox = CreateWindowExW(0, WC_LISTBOXW, NULL, - WS_BORDER | WS_CHILD | WS_VSCROLL | LBS_HASSTRINGS | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT, - 0, 0, 0, 0, GetParent(This->hwndEdit), NULL, shell32_hInstance, NULL); + This->hwndListBox = CreateWindowExW(WS_EX_NOACTIVATE, WC_LISTBOXW, NULL, + WS_BORDER | WS_POPUP | WS_VSCROLL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT, + 0, 0, 0, 0, NULL, NULL, shell32_hInstance, NULL); if (This->hwndListBox) { HFONT edit_font; This->wpOrigLBoxProc = (WNDPROC) SetWindowLongPtrW( This->hwndListBox, GWLP_WNDPROC, (LONG_PTR) ACLBoxSubclassProc); SetWindowLongPtrW( This->hwndListBox, GWLP_USERDATA, (LONG_PTR)This); - SetParent(This->hwndListBox, HWND_DESKTOP); /* Use the same font as the edit control, as it gets destroyed before it anyway */ edit_font = (HFONT)SendMessageW(This->hwndEdit, WM_GETFONT, 0, 0);