mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 8.2.4143: MS-Windows: IME support for Win9x is obsolete
Problem: MS-Windows: IME support for Win9x is obsolete. Solution: Remove the Win9x code. (Ken Takata, closes #9559)
This commit is contained in:
@@ -4275,7 +4275,6 @@ typedef HANDLE HIMC;
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
static HINSTANCE hLibImm = NULL;
|
static HINSTANCE hLibImm = NULL;
|
||||||
static LONG (WINAPI *pImmGetCompositionStringA)(HIMC, DWORD, LPVOID, DWORD);
|
|
||||||
static LONG (WINAPI *pImmGetCompositionStringW)(HIMC, DWORD, LPVOID, DWORD);
|
static LONG (WINAPI *pImmGetCompositionStringW)(HIMC, DWORD, LPVOID, DWORD);
|
||||||
static HIMC (WINAPI *pImmGetContext)(HWND);
|
static HIMC (WINAPI *pImmGetContext)(HWND);
|
||||||
static HIMC (WINAPI *pImmAssociateContext)(HWND, HIMC);
|
static HIMC (WINAPI *pImmAssociateContext)(HWND, HIMC);
|
||||||
@@ -4289,7 +4288,6 @@ static BOOL (WINAPI *pImmGetConversionStatus)(HIMC, LPDWORD, LPDWORD);
|
|||||||
static BOOL (WINAPI *pImmSetConversionStatus)(HIMC, DWORD, DWORD);
|
static BOOL (WINAPI *pImmSetConversionStatus)(HIMC, DWORD, DWORD);
|
||||||
static void dyn_imm_load(void);
|
static void dyn_imm_load(void);
|
||||||
#else
|
#else
|
||||||
# define pImmGetCompositionStringA ImmGetCompositionStringA
|
|
||||||
# define pImmGetCompositionStringW ImmGetCompositionStringW
|
# define pImmGetCompositionStringW ImmGetCompositionStringW
|
||||||
# define pImmGetContext ImmGetContext
|
# define pImmGetContext ImmGetContext
|
||||||
# define pImmAssociateContext ImmAssociateContext
|
# define pImmAssociateContext ImmAssociateContext
|
||||||
@@ -5879,56 +5877,6 @@ _OnImeComposition(HWND hwnd, WPARAM dbcs UNUSED, LPARAM param)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* get the current composition string, in UCS-2; *lenp is the number of
|
|
||||||
* *lenp is the number of Unicode characters.
|
|
||||||
*/
|
|
||||||
static short_u *
|
|
||||||
GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp)
|
|
||||||
{
|
|
||||||
LONG ret;
|
|
||||||
LPWSTR wbuf = NULL;
|
|
||||||
char_u *buf;
|
|
||||||
|
|
||||||
if (!pImmGetContext)
|
|
||||||
return NULL; // no imm32.dll
|
|
||||||
|
|
||||||
// Try Unicode; this will always work on NT regardless of codepage.
|
|
||||||
ret = pImmGetCompositionStringW(hIMC, GCS, NULL, 0);
|
|
||||||
if (ret == 0)
|
|
||||||
return NULL; // empty
|
|
||||||
|
|
||||||
if (ret > 0)
|
|
||||||
{
|
|
||||||
// Allocate the requested buffer plus space for the NUL character.
|
|
||||||
wbuf = alloc(ret + sizeof(WCHAR));
|
|
||||||
if (wbuf != NULL)
|
|
||||||
{
|
|
||||||
pImmGetCompositionStringW(hIMC, GCS, wbuf, ret);
|
|
||||||
*lenp = ret / sizeof(WCHAR);
|
|
||||||
}
|
|
||||||
return (short_u *)wbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ret < 0; we got an error, so try the ANSI version. This will work
|
|
||||||
// on 9x/ME, but only if the codepage happens to be set to whatever
|
|
||||||
// we're inputting.
|
|
||||||
ret = pImmGetCompositionStringA(hIMC, GCS, NULL, 0);
|
|
||||||
if (ret <= 0)
|
|
||||||
return NULL; // empty or error
|
|
||||||
|
|
||||||
buf = alloc(ret);
|
|
||||||
if (buf == NULL)
|
|
||||||
return NULL;
|
|
||||||
pImmGetCompositionStringA(hIMC, GCS, buf, ret);
|
|
||||||
|
|
||||||
// convert from codepage to UCS-2
|
|
||||||
MultiByteToWideChar_alloc(GetACP(), 0, (LPCSTR)buf, ret, &wbuf, lenp);
|
|
||||||
vim_free(buf);
|
|
||||||
|
|
||||||
return (short_u *)wbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void GetResultStr()
|
* void GetResultStr()
|
||||||
*
|
*
|
||||||
@@ -5939,17 +5887,27 @@ GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp)
|
|||||||
GetResultStr(HWND hwnd, int GCS, int *lenp)
|
GetResultStr(HWND hwnd, int GCS, int *lenp)
|
||||||
{
|
{
|
||||||
HIMC hIMC; // Input context handle.
|
HIMC hIMC; // Input context handle.
|
||||||
short_u *buf = NULL;
|
LONG ret;
|
||||||
|
WCHAR *buf = NULL;
|
||||||
char_u *convbuf = NULL;
|
char_u *convbuf = NULL;
|
||||||
|
|
||||||
if (!pImmGetContext || (hIMC = pImmGetContext(hwnd)) == (HIMC)0)
|
if (!pImmGetContext || (hIMC = pImmGetContext(hwnd)) == (HIMC)0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// Reads in the composition string.
|
// Get the length of the composition string.
|
||||||
buf = GetCompositionString_inUCS2(hIMC, GCS, lenp);
|
ret = pImmGetCompositionStringW(hIMC, GCS, NULL, 0);
|
||||||
|
if (ret <= 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// Allocate the requested buffer plus space for the NUL character.
|
||||||
|
buf = alloc(ret + sizeof(WCHAR));
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
// Reads in the composition string.
|
||||||
|
pImmGetCompositionStringW(hIMC, GCS, buf, ret);
|
||||||
|
*lenp = ret / sizeof(WCHAR);
|
||||||
|
|
||||||
convbuf = utf16_to_enc(buf, lenp);
|
convbuf = utf16_to_enc(buf, lenp);
|
||||||
pImmReleaseContext(hwnd, hIMC);
|
pImmReleaseContext(hwnd, hIMC);
|
||||||
vim_free(buf);
|
vim_free(buf);
|
||||||
@@ -8399,8 +8357,6 @@ dyn_imm_load(void)
|
|||||||
if (hLibImm == NULL)
|
if (hLibImm == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pImmGetCompositionStringA
|
|
||||||
= (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringA");
|
|
||||||
pImmGetCompositionStringW
|
pImmGetCompositionStringW
|
||||||
= (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringW");
|
= (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringW");
|
||||||
pImmGetContext
|
pImmGetContext
|
||||||
@@ -8424,8 +8380,7 @@ dyn_imm_load(void)
|
|||||||
pImmSetConversionStatus
|
pImmSetConversionStatus
|
||||||
= (void *)GetProcAddress(hLibImm, "ImmSetConversionStatus");
|
= (void *)GetProcAddress(hLibImm, "ImmSetConversionStatus");
|
||||||
|
|
||||||
if ( pImmGetCompositionStringA == NULL
|
if ( pImmGetCompositionStringW == NULL
|
||||||
|| pImmGetCompositionStringW == NULL
|
|
||||||
|| pImmGetContext == NULL
|
|| pImmGetContext == NULL
|
||||||
|| pImmAssociateContext == NULL
|
|| pImmAssociateContext == NULL
|
||||||
|| pImmReleaseContext == NULL
|
|| pImmReleaseContext == NULL
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4143,
|
||||||
/**/
|
/**/
|
||||||
4142,
|
4142,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user