imm32: there is only 1 default Hwnd per thread

Aric Stewart aric at codeweavers.com
Tue Sep 25 13:44:50 CDT 2012


On 9/25/12 1:38 PM, Alexandre Julliard wrote:
> Aric Stewart <aric at codeweavers.com> writes:
> 
>> @@ -2323,12 +2323,18 @@ BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen)
>>   
>>       if (data->imeWnd == NULL)
>>       {
>> -        /* create the ime window */
>> -        data->imeWnd = CreateWindowExW( WS_EX_TOOLWINDOW,
>> -                    data->immKbd->imeClassName, NULL, WS_POPUP, 0, 0, 1, 1, 0,
>> -                    0, data->immKbd->hIME, 0);
>> -        SetWindowLongPtrW(data->imeWnd, IMMGWL_IMC, (LONG_PTR)data);
>> -        IMM_GetThreadData()->hwndDefault = data->imeWnd;
>> +        HWND def = IMM_GetThreadData()->hwndDefault;
>> +        if (def == NULL)
>> +        {
>> +            /* create the ime window */
>> +            data->imeWnd = CreateWindowExW( WS_EX_TOOLWINDOW,
>> +                        data->immKbd->imeClassName, NULL, WS_POPUP, 0, 0, 1, 1, 0,
>> +                        0, data->immKbd->hIME, 0);
>> +            SetWindowLongPtrW(data->imeWnd, IMMGWL_IMC, (LONG_PTR)data);
>> +            IMM_GetThreadData()->hwndDefault = data->imeWnd;
>> +        }
>> +        else
>> +            data->imeWnd = def;
> 
> So what happens to the window if the first IMC is destroyed?
> 

The window should stick around until the thread data is destroyed. Theoretically the IMC that has this window is the default one for the thread. Which cannot be destroyed until the thread data is destroyed.

I see the issue you are worried about and I will work to resolve that.
-aric



More information about the wine-devel mailing list