Alexandre Julliard : winemac: Use an init once function to register IME classes.

Alexandre Julliard julliard at winehq.org
Tue Oct 22 13:30:40 CDT 2013


Module: wine
Branch: master
Commit: 639c202ea7113f6e2b49733dd7041bc158284943
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=639c202ea7113f6e2b49733dd7041bc158284943

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Oct 21 22:05:39 2013 +0200

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

---

 dlls/winemac.drv/ime.c    |   50 +++++++++++++++++++++++---------------------
 dlls/winemac.drv/macdrv.h |    2 -
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/dlls/winemac.drv/ime.c b/dlls/winemac.drv/ime.c
index 53a10f3..2c74f6e 100644
--- a/dlls/winemac.drv/ime.c
+++ b/dlls/winemac.drv/ime.c
@@ -563,25 +563,6 @@ static void UpdateDataInDefaultIMEWindow(HIMC hIMC, HWND hwnd, BOOL showable)
     UnlockRealIMC(hIMC);
 }
 
-BOOL WINAPI ImeInquire(LPIMEINFO lpIMEInfo, LPWSTR lpszUIClass, LPCWSTR lpszOption)
-{
-    TRACE("\n");
-    IME_RegisterClasses( macdrv_module );
-    lpIMEInfo->dwPrivateDataSize = sizeof(IMEPRIVATE);
-    lpIMEInfo->fdwProperty = IME_PROP_UNICODE | IME_PROP_AT_CARET;
-    lpIMEInfo->fdwConversionCaps = IME_CMODE_NATIVE;
-    lpIMEInfo->fdwSentenceCaps = IME_SMODE_AUTOMATIC;
-    lpIMEInfo->fdwUICaps = UI_CAP_2700;
-    /* Tell App we cannot accept ImeSetCompositionString calls */
-    /* FIXME: Can we? */
-    lpIMEInfo->fdwSCSCaps = 0;
-    lpIMEInfo->fdwSelectCaps = SELECT_CAP_CONVERSION;
-
-    lstrcpyW(lpszUIClass, UI_CLASS_NAME);
-
-    return TRUE;
-}
-
 BOOL WINAPI ImeConfigure(HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData)
 {
     FIXME("(%p, %p, %d, %p): stub\n", hKL, hWnd, dwMode, lpData);
@@ -1394,10 +1375,7 @@ static LRESULT WINAPI IME_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
     return rc;
 }
 
-
-/* Interfaces to other parts of the Mac driver */
-
-void IME_RegisterClasses(HINSTANCE hImeInst)
+static BOOL WINAPI register_classes( INIT_ONCE *once, void *param, void **context )
 {
     WNDCLASSW wndClass;
     ZeroMemory(&wndClass, sizeof(WNDCLASSW));
@@ -1405,7 +1383,7 @@ void IME_RegisterClasses(HINSTANCE hImeInst)
     wndClass.lpfnWndProc = (WNDPROC) IME_WindowProc;
     wndClass.cbClsExtra = 0;
     wndClass.cbWndExtra = 2 * sizeof(LONG_PTR);
-    wndClass.hInstance = hImeInst;
+    wndClass.hInstance = macdrv_module;
     wndClass.hCursor = LoadCursorW(NULL, (LPWSTR)IDC_ARROW);
     wndClass.hIcon = LoadIconW(NULL, (LPWSTR)IDI_APPLICATION);
     wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
@@ -1421,8 +1399,32 @@ void IME_RegisterClasses(HINSTANCE hImeInst)
     WM_MSIME_RECONVERT = RegisterWindowMessageA("MSIMEReconvert");
     WM_MSIME_QUERYPOSITION = RegisterWindowMessageA("MSIMEQueryPosition");
     WM_MSIME_DOCUMENTFEED = RegisterWindowMessageA("MSIMEDocumentFeed");
+    return TRUE;
 }
 
+BOOL WINAPI ImeInquire(LPIMEINFO lpIMEInfo, LPWSTR lpszUIClass, LPCWSTR lpszOption)
+{
+    static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
+
+    TRACE("\n");
+    InitOnceExecuteOnce( &init_once, register_classes, NULL, NULL );
+    lpIMEInfo->dwPrivateDataSize = sizeof(IMEPRIVATE);
+    lpIMEInfo->fdwProperty = IME_PROP_UNICODE | IME_PROP_AT_CARET;
+    lpIMEInfo->fdwConversionCaps = IME_CMODE_NATIVE;
+    lpIMEInfo->fdwSentenceCaps = IME_SMODE_AUTOMATIC;
+    lpIMEInfo->fdwUICaps = UI_CAP_2700;
+    /* Tell App we cannot accept ImeSetCompositionString calls */
+    /* FIXME: Can we? */
+    lpIMEInfo->fdwSCSCaps = 0;
+    lpIMEInfo->fdwSelectCaps = SELECT_CAP_CONVERSION;
+
+    lstrcpyW(lpszUIClass, UI_CLASS_NAME);
+
+    return TRUE;
+}
+
+/* Interfaces to other parts of the Mac driver */
+
 /***********************************************************************
  *              macdrv_im_set_text
  */
diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h
index 24c3f65..98ecb90 100644
--- a/dlls/winemac.drv/macdrv.h
+++ b/dlls/winemac.drv/macdrv.h
@@ -210,8 +210,6 @@ extern void macdrv_status_item_mouse_move(const macdrv_event *event) DECLSPEC_HI
  * Mac IME driver
  */
 
-extern void IME_RegisterClasses(HINSTANCE hImeInst) DECLSPEC_HIDDEN;
-
 extern BOOL macdrv_process_text_input(UINT vkey, UINT scan, UINT repeat, const BYTE *key_state,
                                       void *himc) DECLSPEC_HIDDEN;
 




More information about the wine-cvs mailing list