[PATCH v2 10/11] shell32/autocomplete: Localize some variables and simplify some calculations
Gabriel Ivăncescu
gabrielopcode at gmail.com
Thu Sep 6 13:26:20 CDT 2018
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
dlls/shell32/autocomplete.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index af8c067..ea15d8d 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -111,9 +111,8 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
LRESULT ret;
WCHAR *hwndText;
UINT len, size, cpt;
- RECT r;
BOOLEAN displayall = FALSE, noautoappend = !(This->options & ACO_AUTOAPPEND);
- int height, sel;
+ INT sel;
if (!This->enabled) return CallWindowProcW(This->wpOrigEditProc, hwnd, uMsg, wParam, lParam);
@@ -188,9 +187,8 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
goto autocomplete_text;
}
} else {
- int count;
+ INT count = SendMessageW(This->hwndListBox, LB_GETCOUNT, 0, 0);
- count = SendMessageW(This->hwndListBox, LB_GETCOUNT, 0, 0);
/* Change the selection */
sel = SendMessageW(This->hwndListBox, LB_GETCURSEL, 0, 0);
if (wParam == VK_UP)
@@ -305,14 +303,15 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
if (This->options & ACO_AUTOSUGGEST) {
if (cpt) {
- height = SendMessageW(This->hwndListBox, LB_GETITEMHEIGHT, 0, 0);
+ RECT r;
+ UINT height = SendMessageW(This->hwndListBox, LB_GETITEMHEIGHT, 0, 0);
SendMessageW(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, min(height * 7, height*(cpt+1)),
+ r.left, r.bottom + 1, r.right - r.left, height*min(cpt+1, 7),
SWP_SHOWWINDOW );
} else {
ShowWindow(This->hwndListBox, SW_HIDE);
@@ -323,8 +322,8 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
{
WNDPROC proc = This->wpOrigEditProc;
- RemovePropW(hwnd, autocomplete_propertyW);
SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)proc);
+ RemovePropW(hwnd, autocomplete_propertyW);
destroy_autocomplete_object(This);
return CallWindowProcW(proc, hwnd, uMsg, wParam, lParam);
}
--
1.9.1
More information about the wine-devel
mailing list