Commit 7cc272cd authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Use an init once function to register IME classes.

parent 9a4401af
...@@ -122,14 +122,10 @@ static BOOL UnlockRealIMC(HIMC hIMC) ...@@ -122,14 +122,10 @@ static BOOL UnlockRealIMC(HIMC hIMC)
return FALSE; return FALSE;
} }
static void IME_RegisterClasses(void) static BOOL WINAPI register_classes( INIT_ONCE *once, void *param, void **context )
{ {
static BOOL done = FALSE;
WNDCLASSW wndClass; WNDCLASSW wndClass;
if (done) return;
done = TRUE;
ZeroMemory(&wndClass, sizeof(WNDCLASSW)); ZeroMemory(&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS | CS_IME | CS_HREDRAW | CS_VREDRAW; wndClass.style = CS_GLOBALCLASS | CS_IME | CS_HREDRAW | CS_VREDRAW;
wndClass.lpfnWndProc = IME_WindowProc; wndClass.lpfnWndProc = IME_WindowProc;
...@@ -151,6 +147,7 @@ static void IME_RegisterClasses(void) ...@@ -151,6 +147,7 @@ static void IME_RegisterClasses(void)
WM_MSIME_RECONVERT = RegisterWindowMessageA("MSIMEReconvert"); WM_MSIME_RECONVERT = RegisterWindowMessageA("MSIMEReconvert");
WM_MSIME_QUERYPOSITION = RegisterWindowMessageA("MSIMEQueryPosition"); WM_MSIME_QUERYPOSITION = RegisterWindowMessageA("MSIMEQueryPosition");
WM_MSIME_DOCUMENTFEED = RegisterWindowMessageA("MSIMEDocumentFeed"); WM_MSIME_DOCUMENTFEED = RegisterWindowMessageA("MSIMEDocumentFeed");
return TRUE;
} }
static HIMCC ImeCreateBlankCompStr(void) static HIMCC ImeCreateBlankCompStr(void)
...@@ -561,8 +558,10 @@ static void IME_AddToSelected(HIMC hIMC) ...@@ -561,8 +558,10 @@ static void IME_AddToSelected(HIMC hIMC)
BOOL WINAPI ImeInquire(LPIMEINFO lpIMEInfo, LPWSTR lpszUIClass, BOOL WINAPI ImeInquire(LPIMEINFO lpIMEInfo, LPWSTR lpszUIClass,
LPCWSTR lpszOption) LPCWSTR lpszOption)
{ {
static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
TRACE("\n"); TRACE("\n");
IME_RegisterClasses(); InitOnceExecuteOnce( &init_once, register_classes, NULL, NULL );
lpIMEInfo->dwPrivateDataSize = sizeof (IMEPRIVATE); lpIMEInfo->dwPrivateDataSize = sizeof (IMEPRIVATE);
lpIMEInfo->fdwProperty = IME_PROP_UNICODE | IME_PROP_AT_CARET; lpIMEInfo->fdwProperty = IME_PROP_UNICODE | IME_PROP_AT_CARET;
lpIMEInfo->fdwConversionCaps = IME_CMODE_NATIVE; lpIMEInfo->fdwConversionCaps = IME_CMODE_NATIVE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment