2 * Implementation of the 'IME window' class
4 * Copyright 2000 Hidenori Takeshima
8 * - handle all messages.
9 * - handle all notifications.
21 #include "debugtools.h"
22 DEFAULT_DEBUG_CHANNEL(imm);
24 #include "imm_private.h"
26 static CHAR IMM32_szIMEClass[] = "IME";
34 static BOOL IMM32_IsUIMessage( UINT nMsg );
38 LRESULT CALLBACK IMM32_IMEWndProc( HWND hwnd, UINT nMsg,
39 WPARAM wParam, LPARAM lParam )
41 IMM32_IMEWNDPARAM* pParam =
42 (IMM32_IMEWNDPARAM*)GetWindowLongA( hwnd, 0L );
44 if ( nMsg == WM_CREATE )
46 pParam = (IMM32_IMEWNDPARAM*)IMM32_HeapAlloc(
47 HEAP_ZERO_MEMORY, sizeof(IMM32_IMEWNDPARAM) );
50 SetWindowLongA( hwnd, 0L, (LONG)pParam );
52 /* FIXME - Initialize pParam. */
56 else if ( nMsg == WM_DESTROY )
58 /* FIXME - Uninitialize pParam. */
60 IMM32_HeapFree( pParam );
61 SetWindowLongA( hwnd, 0L, (LONG)NULL );
67 if ( IMM32_IsUIMessage( nMsg ) )
69 return DefWindowProcA( hwnd, nMsg, wParam, lParam );
72 /* FIXME - handle all messages. */
73 /* FIXME - handle all notifications. */
74 if ( IMM32_IsUIMessage( nMsg ) )
77 return DefWindowProcA( hwnd, nMsg, wParam, lParam );
81 /***********************************************************************
82 * IMM32_RegisterClass (internal)
84 BOOL IMM32_RegisterIMEWndClass( HINSTANCE hInstDLL )
88 /* SDK says the "IME" window class is a system global class. */
89 wc.style = CS_GLOBALCLASS;
90 wc.lpfnWndProc = IMM32_IMEWndProc;
92 wc.cbWndExtra = sizeof(LONG);
93 wc.hInstance = hInstDLL;
94 wc.hIcon = LoadIconA((HINSTANCE)NULL,IDI_APPLICATIONA);
95 wc.hCursor = LoadCursorA((HINSTANCE)NULL,IDC_IBEAMA);
96 wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); /* FIXME? */
97 wc.lpszMenuName = NULL;
98 wc.lpszClassName = IMM32_szIMEClass;
99 if ( !RegisterClassA( &wc ) )
105 /***********************************************************************
106 * IMM32_UnregisterClass (internal)
108 void IMM32_UnregisterIMEWndClass( HINSTANCE hInstDLL )
110 (void)UnregisterClassA( IMM32_szIMEClass, hInstDLL );
115 static BOOL IMM32_IsUIMessage( UINT nMsg )
119 case WM_IME_STARTCOMPOSITION:
120 case WM_IME_ENDCOMPOSITION:
121 case WM_IME_COMPOSITION:
122 case WM_IME_SETCONTEXT:
124 case WM_IME_COMPOSITIONFULL:
126 case 0x287: /* What is this message? IMM32.DLL returns TRUE. */
134 /***********************************************************************
135 * ImmIsUIMessageA (IMM32.@)
137 BOOL WINAPI ImmIsUIMessageA(
138 HWND hwndIME, UINT msg, WPARAM wParam, LPARAM lParam)
140 TRACE("(0x%08x, %d, %d, %ld)\n",
141 hwndIME, msg, wParam, lParam);
143 if ( !IMM32_IsUIMessage( msg ) )
145 if ( hwndIME == (HWND)NULL )
150 case WM_IME_STARTCOMPOSITION:
151 case WM_IME_ENDCOMPOSITION:
152 case WM_IME_COMPOSITION:
153 case WM_IME_SETCONTEXT:
155 case WM_IME_COMPOSITIONFULL:
157 SendMessageA( hwndIME, msg, wParam, lParam );
159 case 0x287: /* What is this message? */
160 FIXME("(0x%08x, %d, %d, %ld) - unknown message 0x287.\n",
161 hwndIME, msg, wParam, lParam);
162 SendMessageA( hwndIME, msg, wParam, lParam );
169 /***********************************************************************
170 * ImmIsUIMessageW (IMM32.@)
172 BOOL WINAPI ImmIsUIMessageW(
173 HWND hwndIME, UINT msg, WPARAM wParam, LPARAM lParam)
175 TRACE("(0x%08x, %d, %d, %ld)\n",
176 hwndIME, msg, wParam, lParam);
178 if ( !IMM32_IsUIMessage( msg ) )
180 if ( hwndIME == (HWND)NULL )
185 case WM_IME_STARTCOMPOSITION:
186 case WM_IME_ENDCOMPOSITION:
187 case WM_IME_COMPOSITION:
188 case WM_IME_SETCONTEXT:
190 case WM_IME_COMPOSITIONFULL:
192 SendMessageW( hwndIME, msg, wParam, lParam );
194 case 0x287: /* What is this message? */
195 FIXME("(0x%08x, %d, %d, %ld) - unknown message 0x287.\n",
196 hwndIME, msg, wParam, lParam);
197 SendMessageW( hwndIME, msg, wParam, lParam );