[PATCH v6 2/6] shell32/autocomplete: Redesign the window proc to trigger on key presses instead of key release

Huw Davies huw at codeweavers.com
Mon Sep 17 05:10:52 CDT 2018


On Fri, Sep 14, 2018 at 02:00:32PM +0300, Gabriel Ivăncescu wrote:
> @@ -314,6 +322,7 @@ static LRESULT ACEditSubclassProc_KeyUp(IAutoCompleteImpl *ac, HWND hwnd, UINT u
>  static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
>  {
>      IAutoCompleteImpl *This = GetPropW(hwnd, autocomplete_propertyW);
> +    LRESULT ret;
>  
>      if (!This->enabled) return CallWindowProcW(This->wpOrigEditProc, hwnd, uMsg, wParam, lParam);
>  
> @@ -329,8 +338,15 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
>                  ShowWindow(This->hwndListBox, SW_HIDE);
>              }
>              return CallWindowProcW(This->wpOrigEditProc, hwnd, uMsg, wParam, lParam);
> -        case WM_KEYUP:
> -            return ACEditSubclassProc_KeyUp(This, hwnd, uMsg, wParam, lParam);
> +        case WM_KEYDOWN:
> +            return ACEditSubclassProc_KeyDown(This, hwnd, uMsg, wParam, lParam);
> +        case WM_CHAR:
> +        case WM_UNICHAR:
> +            ret = CallWindowProcW(This->wpOrigEditProc, hwnd, uMsg, wParam, lParam);
> +            autocomplete_text(This, hwnd, (This->options & ACO_AUTOAPPEND) &&
> +                                          (wParam >= ' ' || wParam == 0x16 /* ^V (paste) */)
> +                                          ? autoappend_flag_yes : autoappend_flag_no);

The condition on flag setting is a hack.  For paste you'll likely want
a WM_PASTE handler.  If pasting didn't work before, then leave it for a
later patch, if it did work before this patch you'll have to add such
a handler before this one.

Huw.



More information about the wine-devel mailing list