user32: Use delayed imports to call the imm32 functions.

This commit is contained in:
Alexandre Julliard 2014-02-10 20:11:02 +01:00
parent 0f2bed51bd
commit ea9ed542be
1 changed files with 7 additions and 81 deletions

View File

@ -29,6 +29,7 @@
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
#include "winnls.h" #include "winnls.h"
#include "imm.h"
#include "win.h" #include "win.h"
#include "user_private.h" #include "user_private.h"
#include "controls.h" #include "controls.h"
@ -47,7 +48,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(win);
static short iF10Key = 0; static short iF10Key = 0;
static short iMenuSysKey = 0; static short iMenuSysKey = 0;
static const WCHAR imm32W[] = { 'i','m','m','3','2','\0' };
/*********************************************************************** /***********************************************************************
* DEFWND_HandleWindowPosChanged * DEFWND_HandleWindowPosChanged
@ -223,70 +223,6 @@ static void DEFWND_Print( HWND hwnd, HDC hdc, ULONG uFlags)
} }
/*
* helpers for calling IMM32
*
* WM_IME_* messages are generated only by IMM32,
* so I assume imm32 is already LoadLibrary-ed.
*/
static HWND DEFWND_ImmGetDefaultIMEWnd( HWND hwnd )
{
HINSTANCE hInstIMM = GetModuleHandleW( imm32W );
HWND (WINAPI *pFunc)(HWND);
HWND hwndRet = 0;
if (!hInstIMM)
{
ERR( "cannot get IMM32 handle\n" );
return 0;
}
pFunc = (void*)GetProcAddress(hInstIMM,"ImmGetDefaultIMEWnd");
if ( pFunc != NULL )
hwndRet = (*pFunc)( hwnd );
return hwndRet;
}
static BOOL DEFWND_ImmIsUIMessageA( HWND hwndIME, UINT msg, WPARAM wParam, LPARAM lParam )
{
HINSTANCE hInstIMM = GetModuleHandleW( imm32W );
BOOL (WINAPI *pFunc)(HWND,UINT,WPARAM,LPARAM);
BOOL fRet = FALSE;
if (!hInstIMM)
{
ERR( "cannot get IMM32 handle\n" );
return FALSE;
}
pFunc = (void*)GetProcAddress(hInstIMM,"ImmIsUIMessageA");
if ( pFunc != NULL )
fRet = (*pFunc)( hwndIME, msg, wParam, lParam );
return fRet;
}
static BOOL DEFWND_ImmIsUIMessageW( HWND hwndIME, UINT msg, WPARAM wParam, LPARAM lParam )
{
HINSTANCE hInstIMM = GetModuleHandleW( imm32W );
BOOL (WINAPI *pFunc)(HWND,UINT,WPARAM,LPARAM);
BOOL fRet = FALSE;
if (!hInstIMM)
{
ERR( "cannot get IMM32 handle\n" );
return FALSE;
}
pFunc = (void*)GetProcAddress(hInstIMM,"ImmIsUIMessageW");
if ( pFunc != NULL )
fRet = (*pFunc)( hwndIME, msg, wParam, lParam );
return fRet;
}
/*********************************************************************** /***********************************************************************
* DEFWND_DefWinProc * DEFWND_DefWinProc
@ -896,20 +832,15 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
case WM_IME_SELECT: case WM_IME_SELECT:
case WM_IME_NOTIFY: case WM_IME_NOTIFY:
{ {
HWND hwndIME; HWND hwndIME = ImmGetDefaultIMEWnd( hwnd );
hwndIME = DEFWND_ImmGetDefaultIMEWnd( hwnd );
if (hwndIME) if (hwndIME)
result = SendMessageA( hwndIME, msg, wParam, lParam ); result = SendMessageA( hwndIME, msg, wParam, lParam );
} }
break; break;
case WM_IME_SETCONTEXT: case WM_IME_SETCONTEXT:
{ {
HWND hwndIME; HWND hwndIME = ImmGetDefaultIMEWnd( hwnd );
if (hwndIME) result = ImmIsUIMessageA( hwndIME, msg, wParam, lParam );
hwndIME = DEFWND_ImmGetDefaultIMEWnd( hwnd );
if (hwndIME)
result = DEFWND_ImmIsUIMessageA( hwndIME, msg, wParam, lParam );
} }
break; break;
@ -1042,11 +973,8 @@ LRESULT WINAPI DefWindowProcW(
case WM_IME_SETCONTEXT: case WM_IME_SETCONTEXT:
{ {
HWND hwndIME; HWND hwndIME = ImmGetDefaultIMEWnd( hwnd );
if (hwndIME) result = ImmIsUIMessageW( hwndIME, msg, wParam, lParam );
hwndIME = DEFWND_ImmGetDefaultIMEWnd( hwnd );
if (hwndIME)
result = DEFWND_ImmIsUIMessageW( hwndIME, msg, wParam, lParam );
} }
break; break;
@ -1056,9 +984,7 @@ LRESULT WINAPI DefWindowProcW(
case WM_IME_SELECT: case WM_IME_SELECT:
case WM_IME_NOTIFY: case WM_IME_NOTIFY:
{ {
HWND hwndIME; HWND hwndIME = ImmGetDefaultIMEWnd( hwnd );
hwndIME = DEFWND_ImmGetDefaultIMEWnd( hwnd );
if (hwndIME) if (hwndIME)
result = SendMessageW( hwndIME, msg, wParam, lParam ); result = SendMessageW( hwndIME, msg, wParam, lParam );
} }