[PATCH v2 1/8] shell32/autocomplete: Remove flicker while redrawing the AutoComplete listbox
Gabriel Ivăncescu
gabrielopcode at gmail.com
Tue Sep 25 06:55:27 CDT 2018
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
This series supersedes 150640, 150641, and 150646.
For some reason the continuous SetParent made it flicker when it changed
its contents even with WM_SETREDRAW, so just set it once at listbox creation.
dlls/shell32/autocomplete.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index 2153968..b5a053c 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -175,12 +175,15 @@ static void autocomplete_text(IAutoCompleteImpl *ac, HWND hwnd, enum autoappend_
if (len + 1 != size)
text = heap_realloc(text, (len + 1) * sizeof(WCHAR));
- SendMessageW(ac->hwndListBox, LB_RESETCONTENT, 0, 0);
-
/* Set txtbackup to point to text itself (which must not be released) */
heap_free(ac->txtbackup);
ac->txtbackup = text;
+ if (ac->options & ACO_AUTOSUGGEST)
+ {
+ SendMessageW(ac->hwndListBox, WM_SETREDRAW, FALSE, 0);
+ SendMessageW(ac->hwndListBox, LB_RESETCONTENT, 0, 0);
+ }
IEnumString_Reset(ac->enumstr);
for (cpt = 0;;)
{
@@ -220,12 +223,12 @@ static void autocomplete_text(IAutoCompleteImpl *ac, HWND hwnd, enum autoappend_
UINT height = SendMessageW(ac->hwndListBox, LB_GETITEMHEIGHT, 0, 0);
SendMessageW(ac->hwndListBox, LB_CARETOFF, 0, 0);
GetWindowRect(hwnd, &r);
- SetParent(ac->hwndListBox, HWND_DESKTOP);
/* It seems that Windows XP displays 7 lines at most
and otherwise displays a vertical scroll bar */
SetWindowPos(ac->hwndListBox, HWND_TOP,
r.left, r.bottom + 1, r.right - r.left, height * min(cpt + 1, 7),
SWP_SHOWWINDOW );
+ SendMessageW(ac->hwndListBox, WM_SETREDRAW, TRUE, 0);
}
else
ShowWindow(ac->hwndListBox, SW_HIDE);
@@ -438,6 +441,7 @@ static void create_listbox(IAutoCompleteImpl *This)
if (This->hwndListBox) {
This->wpOrigLBoxProc = (WNDPROC) SetWindowLongPtrW( This->hwndListBox, GWLP_WNDPROC, (LONG_PTR) ACLBoxSubclassProc);
SetWindowLongPtrW( This->hwndListBox, GWLP_USERDATA, (LONG_PTR)This);
+ SetParent(This->hwndListBox, HWND_DESKTOP);
}
else
This->options &= ~ACO_AUTOSUGGEST;
--
1.9.1
More information about the wine-devel
mailing list