[PATCH] user32: Modal dialogs send WM_CANCELMODE when mouse is captured by unrelated window in same thread.

Dmitry Timoshkov dmitry at baikal.ru
Wed Jul 17 23:22:52 CDT 2019


Sergio <sdelreal at codeweavers.com> wrote:

> @@ -701,7 +701,10 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
>  
>          if (template.style & WS_VISIBLE && !(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
>          {
> +           HWND hwnd_capture;
>             ShowWindow( hwnd, SW_SHOWNORMAL );   /* SW_SHOW doesn't always work */
> +           if ( (hwnd_capture = GetCapture()) && !IsChild( hwnd, hwnd_capture ) && modal_owner )
> +              SendMessageW(hwnd_capture, WM_CANCELMODE, 0, 0);
>          }

This is most likely wrong, WM_CANCELMODE should be sent when the capturing
window loses focus during ShowWindow( hwnd, SW_SHOWNORMAL ) call.

> +static INT_PTR CALLBACK TestModalDlgWithCaptureProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
> +{
> +    struct recvd_message msg;
> +
> +    if (ignore_message( message )) return 0;
> +
> +    switch (message)
> +    {
> +        case WM_NCHITTEST:
> +            return HTCLIENT;
> +        case WM_QUERYNEWPALETTE:
> +        case WM_GETTEXT:
> +        case WM_WINDOWPOSCHANGING:
> +        case WM_WINDOWPOSCHANGED:
> +        case WM_NCPAINT:
> +        case WM_NCACTIVATE:
> +        case WM_NCCALCSIZE:
> +        case WM_NCDESTROY:
> +        case WM_PAINT:
> +        case WM_ERASEBKGND:
> +        case WM_ACTIVATEAPP:
> +        case WM_CTLCOLORDLG:
> +        case WM_CTLCOLORBTN:
> +        case WM_SETFOCUS:
> +        case WM_KILLFOCUS:
> +        case 0x90:
> +           break;

The fact that you need to filter out so many messages is a clear sign that
the test is broken. Same comment applies for the next message proc.

-- 
Dmitry.



More information about the wine-devel mailing list