From 85722666a920fee9006356bdf3edd8d251d40727 Mon Sep 17 00:00:00 2001 From: Hidenori Takeshima Date: Sat, 16 Dec 2000 20:18:07 +0000 Subject: [PATCH] Implemented some APIs and IME class - far from complete. --- dlls/imm32/Makefile.in | 1 + dlls/imm32/imewnd.c | 202 +++++++++++++++++++++++++++++++++++++++++++++++ dlls/imm32/imm.c | 26 ------ dlls/imm32/imm_private.h | 10 ++- dlls/imm32/main.c | 4 +- 5 files changed, 212 insertions(+), 31 deletions(-) create mode 100644 dlls/imm32/imewnd.c diff --git a/dlls/imm32/Makefile.in b/dlls/imm32/Makefile.in index ea08e6f3e4c..c4ec243b9b7 100644 --- a/dlls/imm32/Makefile.in +++ b/dlls/imm32/Makefile.in @@ -9,6 +9,7 @@ LDDLLFLAGS = @LDDLLFLAGS@ SYMBOLFILE = $(MODULE).tmp.o C_SRCS = \ + imewnd.c \ imm.c \ main.c \ memory.c \ diff --git a/dlls/imm32/imewnd.c b/dlls/imm32/imewnd.c new file mode 100644 index 00000000000..90f99156f99 --- /dev/null +++ b/dlls/imm32/imewnd.c @@ -0,0 +1,202 @@ +/* + * Implementation of the 'IME window' class + * + * Copyright 2000 Hidenori Takeshima + * + * + * FIXME: + * - handle all messages. + * - handle all notifications. + */ + +#include "config.h" + +#include "winbase.h" +#include "windef.h" +#include "wingdi.h" +#include "winuser.h" +#include "winerror.h" +#include "immddk.h" + +#include "debugtools.h" +DEFAULT_DEBUG_CHANNEL(imm); + +#include "imm_private.h" + +static CHAR IMM32_szIMEClass[] = "IME"; + +typedef struct +{ + int dummy; +} IMM32_IMEWNDPARAM; + + +static BOOL IMM32_IsUIMessage( UINT nMsg ); + + +static +LRESULT CALLBACK IMM32_IMEWndProc( HWND hwnd, UINT nMsg, + WPARAM wParam, LPARAM lParam ) +{ + IMM32_IMEWNDPARAM* pParam = + (IMM32_IMEWNDPARAM*)GetWindowLongA( hwnd, 0L ); + + if ( nMsg == WM_CREATE ) + { + pParam = (IMM32_IMEWNDPARAM*)IMM32_HeapAlloc( + HEAP_ZERO_MEMORY, sizeof(IMM32_IMEWNDPARAM) ); + if ( pParam == NULL ) + return -1L; + SetWindowLongA( hwnd, 0L, (LONG)pParam ); + + /* FIXME - Initialize pParam. */ + + return 0; + } + else if ( nMsg == WM_DESTROY ) + { + /* FIXME - Uninitialize pParam. */ + + IMM32_HeapFree( pParam ); + SetWindowLongA( hwnd, 0L, (LONG)NULL ); + return 0; + } + + if ( pParam == NULL ) + { + if ( IMM32_IsUIMessage( nMsg ) ) + return 0; + return DefWindowProcA( hwnd, nMsg, wParam, lParam ); + } + + /* FIXME - handle all messages. */ + /* FIXME - handle all notifications. */ + if ( IMM32_IsUIMessage( nMsg ) ) + return 0; + + return DefWindowProcA( hwnd, nMsg, wParam, lParam ); +} + + +/*********************************************************************** + * IMM32_RegisterClass (internal) + */ +BOOL IMM32_RegisterIMEWndClass( HINSTANCE hInstDLL ) +{ + WNDCLASSA wc; + + /* SDK says the "IME" window class is a system global class. */ + wc.style = CS_GLOBALCLASS; + wc.lpfnWndProc = IMM32_IMEWndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = sizeof(LONG); + wc.hInstance = hInstDLL; + wc.hIcon = LoadIconA((HINSTANCE)NULL,IDI_APPLICATIONA); + wc.hCursor = LoadCursorA((HINSTANCE)NULL,IDC_IBEAMA); + wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); /* FIXME? */ + wc.lpszMenuName = NULL; + wc.lpszClassName = IMM32_szIMEClass; + if ( !RegisterClassA( &wc ) ) + return FALSE; + + return TRUE; +} + +/*********************************************************************** + * IMM32_UnregisterClass (internal) + */ +void IMM32_UnregisterIMEWndClass( HINSTANCE hInstDLL ) +{ + (void)UnregisterClassA( IMM32_szIMEClass, hInstDLL ); +} + + + +static BOOL IMM32_IsUIMessage( UINT nMsg ) +{ + switch ( nMsg ) + { + case WM_IME_STARTCOMPOSITION: + case WM_IME_ENDCOMPOSITION: + case WM_IME_COMPOSITION: + case WM_IME_SETCONTEXT: + case WM_IME_NOTIFY: + case WM_IME_COMPOSITIONFULL: + case WM_IME_SELECT: + case 0x287: /* What is this message? IMM32.DLL returns TRUE. */ + return TRUE; + } + + return FALSE; +} + + +/*********************************************************************** + * ImmIsUIMessageA (IMM32.@) + */ +BOOL WINAPI ImmIsUIMessageA( + HWND hwndIME, UINT msg, WPARAM wParam, LPARAM lParam) +{ + TRACE("(0x%08x, %d, %d, %ld)\n", + hwndIME, msg, wParam, lParam); + + if ( !IMM32_IsUIMessage( msg ) ) + return FALSE; + if ( hwndIME == (HWND)NULL ) + return TRUE; + + switch ( msg ) + { + case WM_IME_STARTCOMPOSITION: + case WM_IME_ENDCOMPOSITION: + case WM_IME_COMPOSITION: + case WM_IME_SETCONTEXT: + case WM_IME_NOTIFY: + case WM_IME_COMPOSITIONFULL: + case WM_IME_SELECT: + SendMessageA( hwndIME, msg, wParam, lParam ); + break; + case 0x287: /* What is this message? */ + FIXME("(0x%08x, %d, %d, %ld) - unknown message 0x287.\n", + hwndIME, msg, wParam, lParam); + SendMessageA( hwndIME, msg, wParam, lParam ); + break; + } + + return TRUE; +} + +/*********************************************************************** + * ImmIsUIMessageW (IMM32.@) + */ +BOOL WINAPI ImmIsUIMessageW( + HWND hwndIME, UINT msg, WPARAM wParam, LPARAM lParam) +{ + TRACE("(0x%08x, %d, %d, %ld)\n", + hwndIME, msg, wParam, lParam); + + if ( !IMM32_IsUIMessage( msg ) ) + return FALSE; + if ( hwndIME == (HWND)NULL ) + return TRUE; + + switch ( msg ) + { + case WM_IME_STARTCOMPOSITION: + case WM_IME_ENDCOMPOSITION: + case WM_IME_COMPOSITION: + case WM_IME_SETCONTEXT: + case WM_IME_NOTIFY: + case WM_IME_COMPOSITIONFULL: + case WM_IME_SELECT: + SendMessageW( hwndIME, msg, wParam, lParam ); + break; + case 0x287: /* What is this message? */ + FIXME("(0x%08x, %d, %d, %ld) - unknown message 0x287.\n", + hwndIME, msg, wParam, lParam); + SendMessageW( hwndIME, msg, wParam, lParam ); + break; + } + + return TRUE; +} diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index a2850dc4500..45c110aa93f 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -519,32 +519,6 @@ BOOL WINAPI ImmIsIME(HKL hKL) } /*********************************************************************** - * ImmIsUIMessageA (IMM32.@) - */ -BOOL WINAPI ImmIsUIMessageA( - HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam) -{ - FIXME("(0x%08x, %d, %d, %ld): stub\n", - hWndIME, msg, wParam, lParam - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -/*********************************************************************** - * ImmIsUIMessageW (IMM32.@) - */ -BOOL WINAPI ImmIsUIMessageW( - HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam) -{ - FIXME("(0x%08x, %d, %d, %ld): stub\n", - hWndIME, msg, wParam, lParam - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -/*********************************************************************** * ImmNotifyIME (IMM32.@) */ BOOL WINAPI ImmNotifyIME( diff --git a/dlls/imm32/imm_private.h b/dlls/imm32/imm_private.h index 73233d05ff1..e63b4a5e4a4 100644 --- a/dlls/imm32/imm_private.h +++ b/dlls/imm32/imm_private.h @@ -121,13 +121,13 @@ struct IMM32_IME_EXPORTED_HANDLERS -/* imm_main.c */ +/* main.c */ LPVOID IMM32_HeapAlloc( DWORD dwFlags, DWORD dwSize ); LPVOID IMM32_HeapReAlloc( DWORD dwFlags, LPVOID lpv, DWORD dwSize ); void IMM32_HeapFree( LPVOID lpv ); IMM32_THREADDATA* IMM32_GetThreadData( void ); -/* imm_memory.c */ +/* memory.c */ IMM32_MOVEABLEMEM* IMM32_MoveableAlloc( DWORD dwHeapFlags, DWORD dwHeapSize ); void IMM32_MoveableFree( IMM32_MOVEABLEMEM* lpMoveable ); BOOL IMM32_MoveableReAlloc( IMM32_MOVEABLEMEM* lpMoveable, @@ -137,7 +137,7 @@ BOOL IMM32_MoveableUnlock( IMM32_MOVEABLEMEM* lpMoveable ); DWORD IMM32_MoveableGetLockCount( IMM32_MOVEABLEMEM* lpMoveable ); DWORD IMM32_MoveableGetSize( IMM32_MOVEABLEMEM* lpMoveable ); -/* imm_string.c */ +/* string.c */ INT IMM32_strlenAtoW( LPCSTR lpstr ); INT IMM32_strlenWtoA( LPCWSTR lpwstr ); LPWSTR IMM32_strncpyAtoW( LPWSTR lpwstr, LPCSTR lpstr, INT wbuflen ); @@ -145,4 +145,8 @@ LPSTR IMM32_strncpyWtoA( LPSTR lpstr, LPCWSTR lpwstr, INT abuflen ); LPWSTR IMM32_strdupAtoW( LPCSTR lpstr ); LPSTR IMM32_strdupWtoA( LPCWSTR lpwstr ); +/* imewnd.c */ +BOOL IMM32_RegisterIMEWndClass( HINSTANCE hInstDLL ); +void IMM32_UnregisterIMEWndClass( HINSTANCE hInstDLL ); + diff --git a/dlls/imm32/main.c b/dlls/imm32/main.c index 4b8f4af507b..ffdea565f33 100644 --- a/dlls/imm32/main.c +++ b/dlls/imm32/main.c @@ -48,11 +48,11 @@ BOOL WINAPI IMM32_DllMain( IMM32_dwProcessAttached ++; IMM32_InitProcessMem(); - /*IMM32_RegisterIMEWndClass( hInstDLL );*/ + IMM32_RegisterIMEWndClass( hInstDLL ); break; case DLL_PROCESS_DETACH: /*IMM32_UnloadAllIMEs();*/ - /*IMM32_UnregisterIMEWndClass( hInstDLL );*/ + IMM32_UnregisterIMEWndClass( hInstDLL ); IMM32_CleanupProcessMem(); IMM32_dwProcessAttached --; -- 2.11.4.GIT