Re: imm32: there is only 1 default Hwnd per thread
Aric Stewart <aric(a)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? -- Alexandre Julliard julliard(a)winehq.org
On 9/25/12 1:38 PM, Alexandre Julliard wrote:
Aric Stewart <aric(a)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
participants (2)
-
Alexandre Julliard -
Aric Stewart