(resend) imm32: there is only 1 default Hwnd per thread

Aric Stewart aric at codeweavers.com
Wed Sep 26 08:03:43 CDT 2012



On 9/26/12 7:27 AM, Alexandre Julliard wrote:
> Aric Stewart <aric at codeweavers.com> writes:
> 
>> This corrects issues with applications that create and manage multiple IMCs
>> try 2:
>> avoid premature destruction of the window
>> ---
>>   dlls/imm32/imm.c         |   22 ++++++++++++----------
>>   dlls/imm32/tests/imm32.c |   28 ++++++++++++++++++++++++++++
>>   2 files changed, 40 insertions(+), 10 deletions(-)
>>
>>
>>
>> diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
>> index 7394101..a18aa26 100644
>> --- a/dlls/imm32/imm.c
>> +++ b/dlls/imm32/imm.c
>> @@ -678,10 +678,6 @@ static BOOL IMM_DestroyContext(HIMC hIMC)
>>           data->immKbd->pImeSelect(hIMC, FALSE);
>>           SendMessageW(data->IMC.hWnd, WM_IME_SELECT, FALSE, (LPARAM)GetKeyboardLayout(0));
>>   
>> -        if (IMM_GetThreadData()->hwndDefault == data->imeWnd)
>> -            IMM_GetThreadData()->hwndDefault = NULL;
>> -        DestroyWindow(data->imeWnd);
>> -
>>           ImmDestroyIMCC(data->IMC.hCompStr);
>>           ImmDestroyIMCC(data->IMC.hCandInfo);
>>           ImmDestroyIMCC(data->IMC.hGuideLine);
>> @@ -2323,12 +2319,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 why is there a window in the IMC at all, if it's not used for
> anything?
> 

So looking and reading my documentation I can see i had a bit of a miss-understanding about the default IME window all the way back to when i initial did the code for loading IME as separate dlls.  This is a leftover from that. 

There should not be a window in the IMC. I will remove that.

-aric



More information about the wine-devel mailing list