[PATCH 11/17] shell32/autocomplete: Remove flicker while redrawing the AutoComplete listbox

Gabriel Ivăncescu gabrielopcode at gmail.com
Wed Sep 5 11:13:13 CDT 2018


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---

For some reason the continuous SetParent made it flicker badly when it
changed its contents, so just set it once at listbox creation. It also
removes unnecessary overhead at the same time.

 dlls/shell32/autocomplete.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index b71cbc0..1678d87 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -263,8 +263,6 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
             if (len+1 != old_len)
                 hwndText = heap_realloc(hwndText, len+1);
 
-            send_to_LB(This, This->hwndListBox, LB_RESETCONTENT, 0, 0);
-
             /* Set txtbackup to point to hwndText itself (which must not be released) */
             heap_free(This->txtbackup);
             This->txtbackup = hwndText;
@@ -272,6 +270,10 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
             if (!displayall && !len)
                 return ret;
 
+            if (This->options & ACO_AUTOSUGGEST) {
+                send_to_LB(This, This->hwndListBox, WM_SETREDRAW, FALSE, 0);
+                send_to_LB(This, This->hwndListBox, LB_RESETCONTENT, 0, 0);
+            }
             IEnumString_Reset(This->enumstr);
             for(cpt = 0;;) {
                 LPOLESTR strs = NULL;
@@ -321,12 +323,12 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
                     UINT height = send_to_LB(This, This->hwndListBox, LB_GETITEMHEIGHT, 0, 0);
                     send_to_LB(This, This->hwndListBox, LB_CARETOFF, 0, 0);
                     GetWindowRect(hwnd, &r);
-                    SetParent(This->hwndListBox, HWND_DESKTOP);
                     /* It seems that Windows XP displays 7 lines at most
                        and otherwise displays a vertical scroll bar */
                     SetWindowPos(This->hwndListBox, HWND_TOP,
                                  r.left, r.bottom + 1, r.right - r.left, height*min(cpt+1, 7),
                                  SWP_SHOWWINDOW );
+                    send_to_LB(This, This->hwndListBox, WM_SETREDRAW, TRUE, 0);
                 } else {
                     ShowWindow(This->hwndListBox, SW_HIDE);
                 }
@@ -393,6 +395,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