ReactOS  0.4.15-dev-4920-g5fa8403
imm.c File Reference
#include <user32.h>
#include <strsafe.h>
#include <ddk/immdev.h>
#include "immtable.h"
Include dependency graph for imm.c:

Go to the source code of this file.

Macros

#define IMM_INIT_MAGIC   0x19650412
 
#define MAX_CANDIDATEFORM   4
 
#define DEFINE_IMM_ENTRY(type, name, params, retval, retkind)   static type WINAPI IMMSTUB_##name params { IMM_RETURN_##retkind((type)retval); }
 
#define DEFINE_IMM_ENTRY(type, name, params, retval, retkind)   IMMSTUB_##name,
 
#define DEFINE_IMM_ENTRY(type, name, params, retval, retkind)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (user32)
 
HWND FASTCALL IntGetTopLevelWindow (HWND hWnd)
 
HRESULT User32GetImmFileName (_Out_ LPWSTR lpBuffer, _In_ size_t cchBuffer)
 
static BOOL IntInitializeImmEntryTable (VOID)
 
BOOL WINAPI InitializeImmEntryTable (VOID)
 
BOOL WINAPI User32InitializeImmEntryTable (DWORD magic)
 
static BOOL User32CanSetImeWindowToImc (HIMC hIMC, HWND hImeWnd)
 
static BOOL User32GetImeShowStatus (VOID)
 
static LRESULT User32SendImeUIMessage (PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
 
static VOID User32NotifyOpenStatus (PIMEUI pimeui, HWND hwndIMC, BOOL bOpen)
 
static VOID User32SetImeWindowOfImc (HIMC hIMC, HWND hImeWnd)
 
static VOID User32UpdateImcOfImeUI (PIMEUI pimeui, HIMC hNewIMC)
 
static LRESULT ImeWnd_OnImeNotify (PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
 
static HWND User32CreateImeUIWindow (PIMEUI pimeui, HKL hKL)
 
static BOOL ImeWnd_OnCreate (PIMEUI pimeui, LPCREATESTRUCT lpCS)
 
static VOID User32DestroyImeUIWindow (PIMEUI pimeui)
 
static VOID ImeWnd_OnImeSelect (PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
 
static LRESULT ImeWnd_OnImeControl (PIMEUI pimeui, WPARAM wParam, LPARAM lParam, BOOL unicode)
 
static VOID FASTCALL User32SetImeActivenessOfWindow (HWND hWnd, BOOL bActive)
 
static LRESULT ImeWnd_OnImeSystem (PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
 
LRESULT ImeWnd_OnImeSetContext (PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI ImeWndProc_common (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
 
LRESULT WINAPI ImeWndProcA (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI ImeWndProcW (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI UpdatePerUserImmEnabling (VOID)
 
BOOL WINAPI RegisterIMEClass (VOID)
 
BOOL WINAPI IMPSetIMEW (HWND hwnd, LPIMEPROW ime)
 
BOOL WINAPI IMPQueryIMEW (LPIMEPROW ime)
 
BOOL WINAPI IMPGetIMEW (HWND hwnd, LPIMEPROW ime)
 
BOOL WINAPI IMPSetIMEA (HWND hwnd, LPIMEPROA ime)
 
BOOL WINAPI IMPQueryIMEA (LPIMEPROA ime)
 
BOOL WINAPI IMPGetIMEA (HWND hwnd, LPIMEPROA ime)
 
LRESULT WINAPI SendIMEMessageExW (HWND hwnd, LPARAM lParam)
 
LRESULT WINAPI SendIMEMessageExA (HWND hwnd, LPARAM lParam)
 
BOOL WINAPI WINNLSEnableIME (HWND hwnd, BOOL enable)
 
BOOL WINAPI WINNLSGetEnableStatus (HWND hwnd)
 
UINT WINAPI WINNLSGetIMEHotkey (HWND hwnd)
 

Variables

HINSTANCE ghImm32 = NULL
 
BOOL gbImmInitializing = FALSE
 
INT gfConIme = -1
 
Imm32ApiTable gImmApiEntries
 

Macro Definition Documentation

◆ DEFINE_IMM_ENTRY [1/3]

#define DEFINE_IMM_ENTRY (   type,
  name,
  params,
  retval,
  retkind 
)    static type WINAPI IMMSTUB_##name params { IMM_RETURN_##retkind((type)retval); }

Definition at line 42 of file imm.c.

◆ DEFINE_IMM_ENTRY [2/3]

#define DEFINE_IMM_ENTRY (   type,
  name,
  params,
  retval,
  retkind 
)    IMMSTUB_##name,

Definition at line 42 of file imm.c.

◆ DEFINE_IMM_ENTRY [3/3]

#define DEFINE_IMM_ENTRY (   type,
  name,
  params,
  retval,
  retkind 
)
Value:
do { \
FN_##name proc = (FN_##name)GetProcAddress(imm32, #name); \
if (!proc) { \
ERR("Could not load %s\n", #name); \
return FALSE; \
} \
IMM_FN(name) = proc; \
} while (0);
static HANDLE proc()
Definition: pdb.c:34
#define FALSE
Definition: types.h:117
Definition: name.c:38
#define GetProcAddress(x, y)
Definition: compat.h:612
GLuint const GLchar * name
Definition: glext.h:6031

Definition at line 42 of file imm.c.

◆ IMM_INIT_MAGIC

#define IMM_INIT_MAGIC   0x19650412

Definition at line 16 of file imm.c.

◆ MAX_CANDIDATEFORM

#define MAX_CANDIDATEFORM   4

Definition at line 17 of file imm.c.

Function Documentation

◆ ImeWnd_OnCreate()

static BOOL ImeWnd_OnCreate ( PIMEUI  pimeui,
LPCREATESTRUCT  lpCS 
)
static

Definition at line 339 of file imm.c.

340 {
341  PWND pParentWnd, pWnd = pimeui->spwnd;
342  HIMC hIMC = NULL;
343 
344  if (!pWnd || (pWnd->style & (WS_DISABLED | WS_POPUP)) != (WS_DISABLED | WS_POPUP))
345  return FALSE;
346 
347  pParentWnd = ValidateHwnd(lpCS->hwndParent);
348  if (pParentWnd)
349  {
350  hIMC = pParentWnd->hImc;
351  if (hIMC && !User32CanSetImeWindowToImc(hIMC, UserHMGetHandle(pWnd)))
352  hIMC = NULL;
353  }
354 
355  User32UpdateImcOfImeUI(pimeui, hIMC);
356 
357  pimeui->fShowStatus = FALSE;
358  pimeui->nCntInIMEProc = 0;
359  pimeui->fActivate = FALSE;
360  pimeui->fDestroy = FALSE;
361  pimeui->hwndIMC = NULL;
362  pimeui->hKL = GetWin32ClientInfo()->hKL;
363  pimeui->fCtrlShowStatus = TRUE;
364 
365  IMM_FN(ImmLoadIME)(pimeui->hKL);
366 
367  pimeui->hwndUI = NULL;
368 
369  return TRUE;
370 }
#define WS_DISABLED
Definition: pedump.c:621
static BOOL User32CanSetImeWindowToImc(HIMC hIMC, HWND hImeWnd)
Definition: imm.c:155
#define TRUE
Definition: types.h:120
HKL hKL
Definition: ntuser.h:1210
PWND spwnd
Definition: ntuser.h:1207
BOOL WINAPI ImmLoadIME(HKL hKL)
Definition: ime.c:986
LONG nCntInIMEProc
Definition: ntuser.h:1212
#define GetWin32ClientInfo()
Definition: ntuser.h:335
HIMC hImc
Definition: ntuser.h:719
#define FALSE
Definition: types.h:117
HWND hwndUI
Definition: ntuser.h:1211
UINT fDestroy
Definition: ntuser.h:1216
DWORD HIMC
Definition: dimm.idl:75
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
static VOID User32UpdateImcOfImeUI(PIMEUI pimeui, HIMC hNewIMC)
Definition: imm.c:223
Definition: ntuser.h:672
#define WS_POPUP
Definition: pedump.c:616
#define NULL
Definition: types.h:112
UINT fShowStatus
Definition: ntuser.h:1214
UINT fCtrlShowStatus
Definition: ntuser.h:1219
HWND hwndIMC
Definition: ntuser.h:1209
UINT fActivate
Definition: ntuser.h:1215
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
#define IMM_FN(name)
Definition: user32p.h:56
DWORD style
Definition: ntuser.h:685

Referenced by ImeWndProc_common().

◆ ImeWnd_OnImeControl()

static LRESULT ImeWnd_OnImeControl ( PIMEUI  pimeui,
WPARAM  wParam,
LPARAM  lParam,
BOOL  unicode 
)
static

Definition at line 419 of file imm.c.

420 {
421  HIMC hIMC = pimeui->hIMC;
422  DWORD dwConversion, dwSentence;
423  POINT pt;
424 
425  if (!hIMC)
426  return 0;
427 
428  switch (wParam)
429  {
431  if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence))
432  return 1;
433  return dwConversion;
434 
435  case IMC_GETSENTENCEMODE:
436  if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence))
437  return 1;
438  return dwSentence;
439 
440  case IMC_GETOPENSTATUS:
441  return IMM_FN(ImmGetOpenStatus)(hIMC);
442 
444  if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence) ||
445  !IMM_FN(ImmSetConversionStatus)(hIMC, (DWORD)lParam, dwSentence))
446  {
447  return 1;
448  }
449  break;
450 
451  case IMC_SETSENTENCEMODE:
452  if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence) ||
453  !IMM_FN(ImmSetConversionStatus)(hIMC, dwConversion, (DWORD)lParam))
454  {
455  return 1;
456  }
457  break;
458 
459  case IMC_SETOPENSTATUS:
460  if (!IMM_FN(ImmSetOpenStatus)(hIMC, (BOOL)lParam))
461  return 1;
462  break;
463 
464  case IMC_GETCANDIDATEPOS:
466  case IMC_GETSOFTKBDPOS:
467  case IMC_SETSOFTKBDPOS:
469  return User32SendImeUIMessage(pimeui, WM_IME_CONTROL, wParam, lParam, unicode);
470 
471  case IMC_SETCANDIDATEPOS:
473  return 1;
474  break;
475 
477  if (unicode)
478  {
480  return 1;
481  }
482  else
483  {
485  return 1;
486  }
487  break;
488 
490  if (unicode)
491  {
493  return 1;
494  }
495  else
496  {
498  return 1;
499  }
500  break;
501 
504  return 1;
505  break;
506 
508  pt.x = GET_X_LPARAM(lParam);
509  pt.y = GET_Y_LPARAM(lParam);
510  if (!IMM_FN(ImmSetStatusWindowPos)(hIMC, &pt))
511  return 1;
512  break;
513 
515  if (pimeui->fShowStatus && User32GetImeShowStatus())
516  {
517  pimeui->fShowStatus = FALSE;
519  }
520  pimeui->fCtrlShowStatus = FALSE;
521  break;
522 
524  if (!pimeui->fShowStatus && User32GetImeShowStatus())
525  {
526  pimeui->fShowStatus = TRUE;
528  }
529  pimeui->fCtrlShowStatus = TRUE;
530  break;
531 
532  default:
533  break;
534  }
535 
536  return 0;
537 }
#define WM_IME_NOTIFY
Definition: winuser.h:1817
#define IMC_GETCOMPOSITIONFONT
Definition: imm.h:280
#define IMN_CLOSESTATUSWINDOW
Definition: imm.h:521
BOOL WINAPI ImmSetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf)
Definition: ime.c:1560
#define IMN_OPENSTATUSWINDOW
Definition: imm.h:522
#define IMC_SETCANDIDATEPOS
Definition: imm.h:279
BOOL WINAPI ImmGetOpenStatus(HIMC hIMC)
Definition: ime.c:1324
BOOL WINAPI ImmGetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf)
Definition: ime.c:1487
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
#define IMC_SETCOMPOSITIONFONT
Definition: imm.h:281
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
static LRESULT User32SendImeUIMessage(PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:169
#define IMC_GETCONVERSIONMODE
Definition: immdev.h:21
BOOL WINAPI ImmGetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
Definition: ime.c:1523
#define BOOL
Definition: nt_native.h:43
BOOL WINAPI ImmSetConversionStatus(HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)
Definition: ime.c:1807
#define DWORD
Definition: nt_native.h:44
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI ImmSetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
Definition: ime.c:1617
#define IMC_GETSTATUSWINDOWPOS
Definition: imm.h:284
#define FALSE
Definition: types.h:117
BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen)
Definition: ime.c:1347
#define IMC_CLOSESTATUSWINDOW
Definition: imm.h:286
DWORD HIMC
Definition: dimm.idl:75
#define IMC_GETCOMPOSITIONWINDOW
Definition: imm.h:282
#define IMC_SETCONVERSIONMODE
Definition: imm.h:221
HIMC hIMC
Definition: ntuser.h:1208
#define WM_IME_CONTROL
Definition: winuser.h:1818
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IMC_SETSTATUSWINDOWPOS
Definition: imm.h:285
#define IMC_GETSOFTKBDPOS
Definition: immdev.h:24
static BOOL User32GetImeShowStatus(VOID)
Definition: imm.c:162
#define IMC_GETCANDIDATEPOS
Definition: imm.h:278
#define IMC_OPENSTATUSWINDOW
Definition: imm.h:287
#define IMC_SETSENTENCEMODE
Definition: imm.h:222
BOOL WINAPI ImmSetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos)
Definition: ime.c:1408
BOOL WINAPI ImmGetConversionStatus(HIMC hIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence)
Definition: ime.c:1785
#define IMC_SETOPENSTATUS
Definition: imm.h:223
UINT fShowStatus
Definition: ntuser.h:1214
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
BOOL WINAPI ImmSetCandidateWindow(HIMC hIMC, LPCANDIDATEFORM lpCandidate)
Definition: candidate.c:385
#define IMC_SETCOMPOSITIONWINDOW
Definition: imm.h:283
#define IMC_SETSOFTKBDPOS
Definition: immdev.h:25
UINT fCtrlShowStatus
Definition: ntuser.h:1219
#define IMC_GETOPENSTATUS
Definition: immdev.h:23
#define IMC_GETSENTENCEMODE
Definition: immdev.h:22
BOOL WINAPI ImmSetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
Definition: ime.c:1460
LPARAM lParam
Definition: combotst.c:139
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWndProc_common().

◆ ImeWnd_OnImeNotify()

static LRESULT ImeWnd_OnImeNotify ( PIMEUI  pimeui,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 244 of file imm.c.

245 {
246  LRESULT ret = 0;
247  HIMC hIMC;
248  LPINPUTCONTEXT pIC;
249  HWND hwndUI, hwndIMC, hImeWnd, hwndOwner;
250 
251  ASSERT(pimeui->spwnd != NULL);
252 
253  switch (wParam)
254  {
256  case IMN_SETOPENSTATUS:
257  hIMC = pimeui->hIMC;
258  pIC = IMM_FN(ImmLockIMC)(hIMC);
259  if (pIC)
260  {
261  hwndIMC = pimeui->hwndIMC;
262  if (IsWindow(hwndIMC))
263  {
264  NtUserNotifyIMEStatus(hwndIMC, pIC->fOpen, pIC->fdwConversion);
265  }
266  else if (gfConIme == TRUE && pimeui->spwnd)
267  {
268  hImeWnd = UserHMGetHandle(pimeui->spwnd);
269  hwndOwner = GetWindow(hImeWnd, GW_OWNER);
270  if (hwndOwner)
271  {
272  NtUserNotifyIMEStatus(hwndOwner, pIC->fOpen, pIC->fdwConversion);
273  }
274  }
275 
276  IMM_FN(ImmUnlockIMC)(hIMC);
277  }
278  /* FALL THROUGH */
279  default:
281  break;
282 
283  case IMN_PRIVATE:
284  hwndUI = pimeui->hwndUI;
285  if (IsWindow(hwndUI))
287  break;
288  }
289 
290  return ret;
291 }
#define WM_IME_NOTIFY
Definition: winuser.h:1817
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
DWORD NTAPI NtUserNotifyIMEStatus(HWND hwnd, BOOL fOpen, DWORD dwConversion)
Definition: ime.c:809
PWND spwnd
Definition: ntuser.h:1207
static LRESULT User32SendImeUIMessage(PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:169
DWORD fdwConversion
Definition: immdev.h:44
WPARAM wParam
Definition: combotst.c:138
#define IMN_SETOPENSTATUS
Definition: imm.h:528
HWND hwndUI
Definition: ntuser.h:1211
DWORD HIMC
Definition: dimm.idl:75
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
#define ASSERT(a)
Definition: mode.c:44
HIMC hIMC
Definition: ntuser.h:1208
int ret
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define IMN_PRIVATE
Definition: imm.h:534
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IMN_SETCONVERSIONMODE
Definition: imm.h:526
#define NULL
Definition: types.h:112
#define GW_OWNER
Definition: winuser.h:761
HWND hwndIMC
Definition: ntuser.h:1209
LONG_PTR LRESULT
Definition: windef.h:209
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032
LPARAM lParam
Definition: combotst.c:139
INT gfConIme
Definition: imm.c:24
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWndProc_common().

◆ ImeWnd_OnImeSelect()

static VOID ImeWnd_OnImeSelect ( PIMEUI  pimeui,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 388 of file imm.c.

389 {
390  HKL hKL;
391  HWND hwndUI, hwndIMC = pimeui->hwndIMC;
392 
393  if (wParam)
394  {
395  pimeui->hKL = hKL = (HKL)lParam;
396  pimeui->hwndUI = hwndUI = User32CreateImeUIWindow(pimeui, hKL);
397  if (hwndUI)
399 
400  if (User32GetImeShowStatus() && pimeui->fCtrlShowStatus)
401  {
402  if (!pimeui->fShowStatus && pimeui->fActivate && IsWindow(hwndIMC))
403  User32NotifyOpenStatus(pimeui, hwndIMC, TRUE);
404  }
405  }
406  else
407  {
408  if (pimeui->fShowStatus && pimeui->fActivate && IsWindow(hwndIMC))
409  User32NotifyOpenStatus(pimeui, hwndIMC, FALSE);
410 
412  User32DestroyImeUIWindow(pimeui);
413  pimeui->hKL = NULL;
414  }
415 }
static VOID User32NotifyOpenStatus(PIMEUI pimeui, HWND hwndIMC, BOOL bOpen)
Definition: imm.c:198
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
HKL hKL
Definition: ntuser.h:1210
#define WM_IME_SELECT
Definition: winuser.h:1820
static LRESULT User32SendImeUIMessage(PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:169
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
HWND hwndUI
Definition: ntuser.h:1211
static VOID User32DestroyImeUIWindow(PIMEUI pimeui)
Definition: imm.c:373
static BOOL User32GetImeShowStatus(VOID)
Definition: imm.c:162
UINT_PTR HKL
Definition: msctf.idl:101
static HWND User32CreateImeUIWindow(PIMEUI pimeui, HKL hKL)
Definition: imm.c:294
#define NULL
Definition: types.h:112
UINT fShowStatus
Definition: ntuser.h:1214
UINT fCtrlShowStatus
Definition: ntuser.h:1219
HWND hwndIMC
Definition: ntuser.h:1209
UINT fActivate
Definition: ntuser.h:1215
LPARAM lParam
Definition: combotst.c:139

Referenced by ImeWndProc_common().

◆ ImeWnd_OnImeSetContext()

LRESULT ImeWnd_OnImeSetContext ( PIMEUI  pimeui,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 706 of file imm.c.

707 {
708  LRESULT ret;
709  HIMC hIMC;
710  LPINPUTCONTEXTDX pIC;
711  HWND hwndFocus, hwndOldImc, hwndNewImc, hImeWnd, hwndActive, hwndOwner;
712  PWND pwndFocus, pImeWnd, pwndOwner;
713  COMPOSITIONFORM CompForm;
714 
715  pimeui->fActivate = !!wParam;
716  hwndOldImc = pimeui->hwndIMC;
717  ASSERT(pimeui->spwnd != NULL);
718 
719  if (wParam)
720  {
721  if (!pimeui->hwndUI)
722  pimeui->hwndUI = User32CreateImeUIWindow(pimeui, pimeui->hKL);
723 
724  if (gfConIme == -1)
725  {
727  if (gfConIme)
728  pimeui->fCtrlShowStatus = FALSE;
729  }
730 
731  hImeWnd = UserHMGetHandle(pimeui->spwnd);
732 
733  if (gfConIme)
734  {
735  hwndOwner = GetWindow(hImeWnd, GW_OWNER);
736  pwndOwner = ValidateHwnd(hwndOwner);
737  if (pwndOwner)
738  {
739  User32UpdateImcOfImeUI(pimeui, pwndOwner->hImc);
740 
741  if (pimeui->hwndUI)
742  SetWindowLongPtrW(pimeui->hwndUI, IMMGWLP_IMC, (LONG_PTR)pwndOwner->hImc);
743  }
744 
746  }
747 
748  hwndFocus = (HWND)NtUserQueryWindow(hImeWnd, QUERY_WINDOW_FOCUS);
749 
750  hIMC = IMM_FN(ImmGetContext)(hwndFocus);
751 
752  if (hIMC && !User32CanSetImeWindowToImc(hIMC, hImeWnd))
753  {
754  User32UpdateImcOfImeUI(pimeui, NULL);
755  return 0;
756  }
757 
758  User32UpdateImcOfImeUI(pimeui, hIMC);
759 
760  if (pimeui->hwndUI)
761  SetWindowLongPtrW(pimeui->hwndUI, IMMGWLP_IMC, (LONG_PTR)hIMC);
762 
763  if (hIMC)
764  {
765  pIC = IMM_FN(ImmLockIMC)(hIMC);
766  if (!pIC)
767  return 0;
768 
769  if (hwndFocus != pIC->hWnd)
770  {
771  IMM_FN(ImmUnlockIMC)(hIMC);
772  return 0;
773  }
774 
775  if ((pIC->dwUIFlags & 0x40000) && hwndOldImc != hwndFocus)
776  {
777  RtlZeroMemory(&CompForm, sizeof(CompForm));
778  IMM_FN(ImmSetCompositionWindow)(hIMC, &CompForm);
779 
780  pIC->dwUIFlags &= ~0x40000;
781  }
782 
783  IMM_FN(ImmUnlockIMC)(hIMC);
784 
785  hImeWnd = UserHMGetHandle(pimeui->spwnd);
786  if (NtUserSetImeOwnerWindow(hImeWnd, hwndFocus))
787  pimeui->hwndIMC = hwndFocus;
788  }
789  else
790  {
791  pimeui->hwndIMC = hwndFocus;
792 
793  hImeWnd = UserHMGetHandle(pimeui->spwnd);
794  NtUserSetImeOwnerWindow(hImeWnd, NULL);
795  }
796  }
797 
799 
800  if (!pimeui->spwnd)
801  return 0;
802 
803  if (!pimeui->fCtrlShowStatus || !User32GetImeShowStatus())
804  return ret;
805 
806  hImeWnd = UserHMGetHandle(pimeui->spwnd);
807  hwndFocus = (HWND)NtUserQueryWindow(hImeWnd, QUERY_WINDOW_FOCUS);
808  pwndFocus = ValidateHwnd(hwndFocus);
809 
810  if (wParam)
811  {
812  pImeWnd = ValidateHwnd(hImeWnd);
813  if (pwndFocus && pImeWnd && pImeWnd->head.pti == pwndFocus->head.pti)
814  {
815  hwndNewImc = pimeui->hwndIMC;
816  if (pimeui->fShowStatus)
817  {
818  if (hwndOldImc && hwndNewImc && hwndOldImc != hwndNewImc &&
819  IntGetTopLevelWindow(hwndOldImc) != IntGetTopLevelWindow(hwndNewImc))
820  {
821  User32NotifyOpenStatus(pimeui, hwndOldImc, FALSE);
822  User32NotifyOpenStatus(pimeui, hwndNewImc, TRUE);
823  }
824  }
825  else
826  {
827  if (ValidateHwnd(hwndNewImc))
828  User32NotifyOpenStatus(pimeui, hwndNewImc, TRUE);
829  }
830  }
831 
832  pImeWnd = pimeui->spwnd;
833  hImeWnd = (pImeWnd ? UserHMGetHandle(pImeWnd) : NULL);
834  if (hImeWnd)
836  }
837  else
838  {
839  pImeWnd = pimeui->spwnd;
840  hImeWnd = UserHMGetHandle(pImeWnd);
841  hwndActive = (HWND)NtUserQueryWindow(hImeWnd, QUERY_WINDOW_ACTIVE);
842  if (!pwndFocus || !hwndActive || pImeWnd->head.pti != pwndFocus->head.pti)
843  {
844  if (IsWindow(hwndOldImc))
845  {
846  User32NotifyOpenStatus(pimeui, hwndOldImc, FALSE);
847  }
848  else
849  {
850  pimeui->fShowStatus = FALSE;
852  }
853  }
854  }
855 
856  return ret;
857 }
static BOOL User32CanSetImeWindowToImc(HIMC hIMC, HWND hImeWnd)
Definition: imm.c:155
#define WM_IME_NOTIFY
Definition: winuser.h:1817
static VOID User32NotifyOpenStatus(PIMEUI pimeui, HWND hwndIMC, BOOL bOpen)
Definition: imm.c:198
DWORD dwUIFlags
Definition: immdev.h:110
#define IMN_CLOSESTATUSWINDOW
Definition: imm.h:521
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:232
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
#define INT
Definition: polytest.cpp:20
HKL hKL
Definition: ntuser.h:1210
HANDLE HWND
Definition: compat.h:19
PWND spwnd
Definition: ntuser.h:1207
static LRESULT User32SendImeUIMessage(PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:169
HIMC hImc
Definition: ntuser.h:719
WPARAM wParam
Definition: combotst.c:138
DWORD_PTR NTAPI NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:4172
#define QUERY_WINDOW_FOCUS
Definition: ntuser.h:2922
#define FALSE
Definition: types.h:117
HWND hwndUI
Definition: ntuser.h:1211
BOOL NTAPI NtUserCallHwndLock(HWND hWnd, DWORD Routine)
Definition: simplecall.c:590
THRDESKHEAD head
Definition: ntuser.h:674
BOOL NTAPI NtUserSetImeOwnerWindow(HWND hImeWnd, HWND hwndFocus)
Definition: ime.c:1344
DWORD HIMC
Definition: dimm.idl:75
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
#define QUERY_WINDOW_ACTIVE
Definition: ntuser.h:2921
#define ASSERT(a)
Definition: mode.c:44
#define IMMGWLP_IMC
Definition: immdev.h:36
#define WM_IME_SETCONTEXT
Definition: winuser.h:1816
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1010
static BOOL User32GetImeShowStatus(VOID)
Definition: imm.c:162
int ret
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
static VOID User32UpdateImcOfImeUI(PIMEUI pimeui, HIMC hNewIMC)
Definition: imm.c:223
Definition: ntuser.h:672
static HWND User32CreateImeUIWindow(PIMEUI pimeui, HKL hKL)
Definition: imm.c:294
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define GW_OWNER
Definition: winuser.h:761
UINT fShowStatus
Definition: ntuser.h:1214
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
UINT fCtrlShowStatus
Definition: ntuser.h:1219
#define SetWindowLongPtrW
Definition: winuser.h:5326
HWND hwndIMC
Definition: ntuser.h:1209
BOOL WINAPI ImmSetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
Definition: ime.c:1460
LONG_PTR LRESULT
Definition: windef.h:209
UINT fActivate
Definition: ntuser.h:1215
HWND FASTCALL IntGetTopLevelWindow(HWND hWnd)
Definition: imm.c:26
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032
LPARAM lParam
Definition: combotst.c:139
INT gfConIme
Definition: imm.c:24
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWndProc_common().

◆ ImeWnd_OnImeSystem()

static LRESULT ImeWnd_OnImeSystem ( PIMEUI  pimeui,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 556 of file imm.c.

557 {
558  LRESULT ret = 0;
559  LPINPUTCONTEXTDX pIC;
560  HIMC hIMC = pimeui->hIMC;
561  LPCANDIDATEFORM pCandForm;
562  LPCOMPOSITIONFORM pCompForm;
563  DWORD dwConversion, dwSentence;
564  HWND hImeWnd;
565  BOOL bCompForm;
566  CANDIDATEFORM CandForm;
567  COMPOSITIONFORM CompForm;
568  UINT iCandForm;
569 
570  ASSERT(pimeui->spwnd != NULL);
571 
572  switch (wParam)
573  {
574  case 0x05:
575  if (User32GetImeShowStatus() == !lParam)
576  {
577  hImeWnd = UserHMGetHandle(pimeui->spwnd);
579  }
580  break;
581 
582  case 0x06:
583  if (!hIMC)
584  break;
585 
586  bCompForm = TRUE;
587  pIC = IMM_FN(ImmLockIMC)(hIMC);
588  if (pIC)
589  {
590  bCompForm = !(pIC->dwUIFlags & 0x2);
591  IMM_FN(ImmUnlockIMC)(hIMC);
592  }
593 
594  if (!IsWindow(pimeui->hwndIMC))
595  break;
596 
597  if (bCompForm && IMM_FN(ImmGetCompositionWindow)(hIMC, &CompForm))
598  {
599  if (CompForm.dwStyle)
600  IMM_FN(ImmSetCompositionWindow)(hIMC, &CompForm);
601  }
602 
603  for (iCandForm = 0; iCandForm < MAX_CANDIDATEFORM; ++iCandForm)
604  {
605  if (IMM_FN(ImmGetCandidateWindow)(hIMC, iCandForm, &CandForm))
606  {
607  if (CandForm.dwStyle)
608  IMM_FN(ImmSetCandidateWindow)(hIMC, &CandForm);
609  }
610  }
611  break;
612 
613  case 0x09:
614  pIC = IMM_FN(ImmLockIMC)(hIMC);
615  if (!pIC)
616  break;
617 
618  pCandForm = &pIC->cfCandForm[lParam];
619  IMM_FN(ImmSetCandidateWindow)(hIMC, pCandForm);
620  IMM_FN(ImmUnlockIMC)(hIMC);
621  break;
622 
623  case 0x0A:
624  pIC = IMM_FN(ImmLockIMC)(hIMC);
625  if (!pIC)
626  break;
627 
628  IMM_FN(ImmSetCompositionFontW)(hIMC, &pIC->lfFont.W);
629  IMM_FN(ImmUnlockIMC)(hIMC);
630  break;
631 
632  case 0x0B:
633  pIC = IMM_FN(ImmLockIMC)(hIMC);
634  if (!pIC)
635  break;
636 
637  pCompForm = &pIC->cfCompForm;
638  pIC->dwUIFlags |= 0x8;
639  IMM_FN(ImmSetCompositionWindow)(hIMC, pCompForm);
640  IMM_FN(ImmUnlockIMC)(hIMC);
641  break;
642 
643  case 0x0D:
645  break;
646 
647  case 0x0F:
648  if (hIMC)
650  break;
651 
652  case 0x11:
654  break;
655 
656  case 0x13:
657  // TODO:
658  break;
659 
660  case 0x14:
661  IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence);
662  ret = dwConversion;
663  break;
664 
665  case 0x15:
666  // TODO:
667  break;
668 
669  case IMS_IMEACTIVATE:
671  break;
672 
673  case IMS_IMEDEACTIVATE:
675  break;
676 
677  case IMS_ACTIVATELAYOUT:
679  break;
680 
681  case IMS_GETIMEMENU:
683  break;
684 
685  case 0x1D:
686  // TODO:
687  break;
688 
689  case 0x1E:
691  break;
692 
693  case 0x1F:
694  case 0x20:
696  break;
697 
698  default:
699  break;
700  }
701 
702  return ret;
703 }
DWORD dwUIFlags
Definition: immdev.h:110
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
#define MAX_CANDIDATEFORM
Definition: imm.c:17
#define IMS_IMEACTIVATE
Definition: immdev.h:28
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1023
HANDLE HWND
Definition: compat.h:19
PWND spwnd
Definition: ntuser.h:1207
LRESULT WINAPI ImmPutImeMenuItemsIntoMappedFile(HIMC hIMC)
Definition: ime.c:388
DWORD dwStyle
Definition: dimm.idl:80
BOOL WINAPI ImmGetCandidateWindow(HIMC hIMC, DWORD dwIndex, LPCANDIDATEFORM lpCandidate)
Definition: candidate.c:359
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI ImmSetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
Definition: ime.c:1617
#define IMS_IMEDEACTIVATE
Definition: immdev.h:29
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen)
Definition: ime.c:1347
BOOL WINAPI ImmFreeLayout(DWORD dwUnknown)
Definition: imm.c:117
BOOL WINAPI ImmGetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
Definition: ime.c:1436
DWORD HIMC
Definition: dimm.idl:75
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
#define ASSERT(a)
Definition: mode.c:44
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1010
HIMC hIMC
Definition: ntuser.h:1208
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL User32GetImeShowStatus(VOID)
Definition: imm.c:162
#define IMS_ACTIVATELAYOUT
Definition: immdev.h:30
int ret
static VOID FASTCALL User32SetImeActivenessOfWindow(HWND hWnd, BOOL bActive)
Definition: imm.c:540
UINT_PTR HKL
Definition: msctf.idl:101
BOOL WINAPI ImmConfigureIMEW(HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData)
Definition: ime.c:1920
DWORD NTAPI NtUserCallHwndParamLock(HWND hWnd, DWORD_PTR Param, DWORD Routine)
Definition: simplecall.c:889
LRESULT WINAPI ImmSystemHandler(HIMC hIMC, WPARAM wParam, LPARAM lParam)
Definition: keymsg.c:759
BOOL WINAPI ImmGetConversionStatus(HIMC hIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence)
Definition: ime.c:1785
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define IME_CONFIG_GENERAL
Definition: imm.h:553
#define IMS_GETIMEMENU
Definition: immdev.h:31
BOOL WINAPI ImmSetCandidateWindow(HIMC hIMC, LPCANDIDATEFORM lpCandidate)
Definition: candidate.c:385
#define ULONG_PTR
Definition: config.h:101
BOOL WINAPI ImmActivateLayout(HKL hKL)
Definition: imm.c:446
HWND hwndIMC
Definition: ntuser.h:1209
BOOL WINAPI ImmSetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
Definition: ime.c:1460
LONG_PTR LRESULT
Definition: windef.h:209
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1032
LPARAM lParam
Definition: combotst.c:139
DWORD dwStyle
Definition: dimm.idl:86
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWndProc_common().

◆ ImeWndProc_common()

LRESULT WINAPI ImeWndProc_common ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  unicode 
)

Definition at line 861 of file imm.c.

862 {
863  PWND pWnd;
864  PIMEUI pimeui;
865 
866  pWnd = ValidateHwnd(hwnd);
867  if (pWnd)
868  {
869  if (!pWnd->fnid)
870  {
871  if (msg != WM_NCCREATE)
872  {
873  if (unicode)
874  return DefWindowProcW(hwnd, msg, wParam, lParam);
875  return DefWindowProcA(hwnd, msg, wParam, lParam);
876  }
878  pimeui = HeapAlloc( GetProcessHeap(), 0, sizeof(IMEUI) );
879  pimeui->spwnd = pWnd;
881  }
882  else
883  {
884  if (pWnd->fnid != FNID_IME)
885  {
886  ERR("Wrong window class for Ime! fnId 0x%x\n",pWnd->fnid);
887  return 0;
888  }
889  pimeui = ((PIMEWND)pWnd)->pimeui;
890  if (pimeui == NULL)
891  {
892  ERR("Window is not set to IME!\n");
893  return 0;
894  }
895  }
896  }
897 
898  if (pimeui->nCntInIMEProc > 0)
899  {
900  switch (msg)
901  {
902  case WM_IME_CHAR:
904  case WM_IME_CONTROL:
905  case WM_IME_NOTIFY:
906  case WM_IME_REQUEST:
907  case WM_IME_SELECT:
908  case WM_IME_SETCONTEXT:
909  case WM_IME_STARTCOMPOSITION:
910  case WM_IME_COMPOSITION:
911  case WM_IME_ENDCOMPOSITION:
912  return 0;
913 
914  case WM_IME_SYSTEM:
915  switch (wParam)
916  {
917  case 0x03:
918  case 0x10:
919  case 0x13:
920  break;
921 
922  default:
923  return 0;
924  }
925  break;
926 
927  default:
928  {
929  if (unicode)
930  return DefWindowProcW(hwnd, msg, wParam, lParam);
931  return DefWindowProcA(hwnd, msg, wParam, lParam);
932  }
933  }
934  }
935 
936  switch (msg)
937  {
938  case WM_CREATE:
939  return (ImeWnd_OnCreate(pimeui, (LPCREATESTRUCT)lParam) ? 0 : -1);
940 
941  case WM_DESTROY:
942  User32DestroyImeUIWindow(pimeui);
943  break;
944 
945  case WM_NCDESTROY:
946  HeapFree(GetProcessHeap(), 0, pimeui);
949  break;
950 
951  case WM_ERASEBKGND:
952  return TRUE;
953 
954  case WM_PAINT:
955  break;
956 
957  case WM_COPYDATA:
958  // TODO:
959  break;
960 
961  case WM_IME_STARTCOMPOSITION:
962  case WM_IME_COMPOSITION:
963  case WM_IME_ENDCOMPOSITION:
964  return User32SendImeUIMessage(pimeui, msg, wParam, lParam, unicode);
965 
966  case WM_IME_CONTROL:
967  return ImeWnd_OnImeControl(pimeui, wParam, lParam, unicode);
968 
969  case WM_IME_NOTIFY:
970  return ImeWnd_OnImeNotify(pimeui, wParam, lParam);
971 
972  case WM_IME_REQUEST:
973  break;
974 
975  case WM_IME_SELECT:
976  ImeWnd_OnImeSelect(pimeui, wParam, lParam);
977  break;
978 
979  case WM_IME_SETCONTEXT:
980  return ImeWnd_OnImeSetContext(pimeui, wParam, lParam);
981 
982  case WM_IME_SYSTEM:
983  return ImeWnd_OnImeSystem(pimeui, wParam, lParam);
984 
985  default:
986  {
987  if (unicode)
988  return DefWindowProcW(hwnd, msg, wParam, lParam);
989  return DefWindowProcA(hwnd, msg, wParam, lParam);
990  }
991  }
992 
993  return 0;
994 }
#define WM_IME_NOTIFY
Definition: winuser.h:1817
#define WM_IME_CHAR
Definition: winuser.h:1821
static LRESULT ImeWnd_OnImeNotify(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
Definition: imm.c:244
#define TRUE
Definition: types.h:120
#define WM_IME_SELECT
Definition: winuser.h:1820
PWND spwnd
Definition: ntuser.h:1207
static LRESULT User32SendImeUIMessage(PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:169
LONG nCntInIMEProc
Definition: ntuser.h:1212
#define FNID_DESTROY
Definition: ntuser.h:877
#define WM_NCCREATE
Definition: winuser.h:1670
#define WM_IME_COMPOSITIONFULL
Definition: winuser.h:1819
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD fnid
Definition: ntuser.h:688
static VOID User32DestroyImeUIWindow(PIMEUI pimeui)
Definition: imm.c:373
LRESULT ImeWnd_OnImeSetContext(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
Definition: imm.c:706
#define WM_IME_REQUEST
Definition: winuser.h:1823
#define WM_IME_SYSTEM
Definition: undocuser.h:59
#define WM_DESTROY
Definition: winuser.h:1596
#define WM_COPYDATA
Definition: winuser.h:1651
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define IMMGWLP_IMC
Definition: immdev.h:36
#define WM_IME_SETCONTEXT
Definition: winuser.h:1816
static LRESULT ImeWnd_OnImeSystem(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
Definition: imm.c:556
#define WM_IME_CONTROL
Definition: winuser.h:1818
#define WM_NCDESTROY
Definition: winuser.h:1671
#define WM_PAINT
Definition: winuser.h:1607
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:672
struct _IMEWND * PIMEWND
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
static BOOL ImeWnd_OnCreate(PIMEUI pimeui, LPCREATESTRUCT lpCS)
Definition: imm.c:339
#define NULL
Definition: types.h:112
static VOID ImeWnd_OnImeSelect(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
Definition: imm.c:388
#define msg(x)
Definition: auth_time.c:54
#define WM_CREATE
Definition: winuser.h:1595
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4327
#define SetWindowLongPtrW
Definition: winuser.h:5326
#define WM_ERASEBKGND
Definition: winuser.h:1612
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:594
#define FNID_IME
Definition: ntuser.h:853
static LRESULT ImeWnd_OnImeControl(PIMEUI pimeui, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:419
#define ValidateHwnd(hwnd)
Definition: precomp.h:85

Referenced by ImeWndProcA(), ImeWndProcW(), and RegisterClientPFN().

◆ ImeWndProcA()

LRESULT WINAPI ImeWndProcA ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 997 of file imm.c.

998 {
1000 }
LRESULT WINAPI ImeWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:861
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define msg(x)
Definition: auth_time.c:54
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPARAM lParam
Definition: combotst.c:139

Referenced by RegisterClientPFN().

◆ ImeWndProcW()

LRESULT WINAPI ImeWndProcW ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1003 of file imm.c.

1004 {
1006 }
#define TRUE
Definition: types.h:120
LRESULT WINAPI ImeWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:861
WPARAM wParam
Definition: combotst.c:138
#define msg(x)
Definition: auth_time.c:54
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPARAM lParam
Definition: combotst.c:139

Referenced by RegisterClientPFN(), and RegisterIMEClass().

◆ IMPGetIMEA()

BOOL WINAPI IMPGetIMEA ( HWND  hwnd,
LPIMEPROA  ime 
)

Definition at line 1112 of file imm.c.

1113 {
1114  return IMM_FN(ImmIMPGetIMEA)(hwnd, ime);
1115 }
BOOL WINAPI ImmIMPGetIMEA(HWND hWnd, LPIMEPROA pImePro)
Definition: utils.c:1177
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IMM_FN(name)
Definition: user32p.h:56

◆ IMPGetIMEW()

BOOL WINAPI IMPGetIMEW ( HWND  hwnd,
LPIMEPROW  ime 
)

Definition at line 1082 of file imm.c.

1083 {
1084  return IMM_FN(ImmIMPGetIMEW)(hwnd, ime);
1085 }
BOOL WINAPI ImmIMPGetIMEW(HWND hWnd, LPIMEPROW pImePro)
Definition: utils.c:1186
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IMM_FN(name)
Definition: user32p.h:56

◆ IMPQueryIMEA()

BOOL WINAPI IMPQueryIMEA ( LPIMEPROA  ime)

Definition at line 1102 of file imm.c.

1103 {
1104  return IMM_FN(ImmIMPQueryIMEA)(ime);
1105 }
BOOL WINAPI ImmIMPQueryIMEA(LPIMEPROA pImePro)
Definition: utils.c:1195
#define IMM_FN(name)
Definition: user32p.h:56

◆ IMPQueryIMEW()

BOOL WINAPI IMPQueryIMEW ( LPIMEPROW  ime)

Definition at line 1072 of file imm.c.

1073 {
1074  return IMM_FN(ImmIMPQueryIMEW)(ime);
1075 }
BOOL WINAPI ImmIMPQueryIMEW(LPIMEPROW pImePro)
Definition: utils.c:1204
#define IMM_FN(name)
Definition: user32p.h:56

◆ IMPSetIMEA()

BOOL WINAPI IMPSetIMEA ( HWND  hwnd,
LPIMEPROA  ime 
)

Definition at line 1092 of file imm.c.

1093 {
1094  return IMM_FN(ImmIMPSetIMEA)(hwnd, ime);
1095 }
BOOL WINAPI ImmIMPSetIMEA(HWND hWnd, LPIMEPROA pImePro)
Definition: utils.c:1213
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IMM_FN(name)
Definition: user32p.h:56

◆ IMPSetIMEW()

BOOL WINAPI IMPSetIMEW ( HWND  hwnd,
LPIMEPROW  ime 
)

Definition at line 1062 of file imm.c.

1063 {
1064  return IMM_FN(ImmIMPSetIMEW)(hwnd, ime);
1065 }
BOOL WINAPI ImmIMPSetIMEW(HWND hWnd, LPIMEPROW pImePro)
Definition: utils.c:1222
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IMM_FN(name)
Definition: user32p.h:56

◆ InitializeImmEntryTable()

BOOL WINAPI InitializeImmEntryTable ( VOID  )

Definition at line 119 of file imm.c.

120 {
123 }
#define TRUE
Definition: types.h:120
BOOL gbImmInitializing
Definition: imm.c:22
static BOOL IntInitializeImmEntryTable(VOID)
Definition: imm.c:70

Referenced by DllMain().

◆ IntGetTopLevelWindow()

HWND FASTCALL IntGetTopLevelWindow ( HWND  hWnd)

Definition at line 26 of file imm.c.

27 {
28  DWORD style;
29 
30  for (; hWnd; hWnd = GetParent(hWnd))
31  {
33  if (!(style & WS_CHILD))
34  break;
35  }
36 
37  return hWnd;
38 }
HWND hWnd
Definition: settings.c:17
#define WS_CHILD
Definition: pedump.c:617
#define GetWindowLongPtrW
Definition: winuser.h:4809
#define DWORD
Definition: nt_native.h:44
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GWL_STYLE
Definition: winuser.h:846
HWND WINAPI GetParent(_In_ HWND)
Arabic default style
Definition: afstyles.h:93

Referenced by ImeWnd_OnImeSetContext().

◆ IntInitializeImmEntryTable()

static BOOL IntInitializeImmEntryTable ( VOID  )
static

Definition at line 70 of file imm.c.

71 {
72  WCHAR ImmFile[MAX_PATH];
73  HMODULE imm32 = ghImm32;
74 
75  /* Check whether the IMM table has already been initialized */
76  if (IMM_FN(ImmWINNLSEnableIME) != IMMSTUB_ImmWINNLSEnableIME)
77  return TRUE;
78 
79  User32GetImmFileName(ImmFile, _countof(ImmFile));
80  TRACE("File %S\n", ImmFile);
81 
82  /* If IMM32 is already loaded, use it without increasing reference count. */
83  if (imm32 == NULL)
84  imm32 = GetModuleHandleW(ImmFile);
85 
86  /*
87  * Loading imm32.dll will call imm32!DllMain function.
88  * imm32!DllMain calls User32InitializeImmEntryTable.
89  * Thus, if imm32.dll was loaded, the table has been loaded.
90  */
91  if (imm32 == NULL)
92  {
93  imm32 = ghImm32 = LoadLibraryW(ImmFile);
94  if (imm32 == NULL)
95  {
96  ERR("Did not load imm32.dll!\n");
97  return FALSE;
98  }
99  return TRUE;
100  }
101 
102 /* load imm procedures */
103 #undef DEFINE_IMM_ENTRY
104 #define DEFINE_IMM_ENTRY(type, name, params, retval, retkind) \
105  do { \
106  FN_##name proc = (FN_##name)GetProcAddress(imm32, #name); \
107  if (!proc) { \
108  ERR("Could not load %s\n", #name); \
109  return FALSE; \
110  } \
111  IMM_FN(name) = proc; \
112  } while (0);
113 #include "immtable.h"
114 
115  return TRUE;
116 }
#define TRUE
Definition: types.h:120
HRESULT User32GetImmFileName(_Out_ LPWSTR lpBuffer, _In_ size_t cchBuffer)
Definition: imm.c:57
#define FALSE
Definition: types.h:117
#define LoadLibraryW(x)
Definition: compat.h:606
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI ImmWINNLSEnableIME(HWND hWnd, BOOL enable)
Definition: ime.c:2000
#define ERR(fmt,...)
Definition: debug.h:110
HINSTANCE ghImm32
Definition: imm.c:20
#define NULL
Definition: types.h:112
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by InitializeImmEntryTable(), and User32InitializeImmEntryTable().

◆ RegisterIMEClass()

BOOL WINAPI RegisterIMEClass ( VOID  )

Definition at line 1034 of file imm.c.

1035 {
1036  ATOM atom;
1037  WNDCLASSEXW WndClass = { sizeof(WndClass) };
1038 
1039  WndClass.lpszClassName = L"IME";
1040  WndClass.style = CS_GLOBALCLASS;
1041  WndClass.lpfnWndProc = ImeWndProcW;
1042  WndClass.cbWndExtra = sizeof(LONG_PTR);
1043  WndClass.hCursor = LoadCursorW(NULL, IDC_ARROW);
1044 
1045  atom = RegisterClassExWOWW(&WndClass, 0, FNID_IME, 0, FALSE);
1046  if (!atom)
1047  {
1048  ERR("Failed to register IME Class!\n");
1049  return FALSE;
1050  }
1051 
1053  TRACE("RegisterIMEClass atom = %u\n", atom);
1054  return TRUE;
1055 }
#define LONG_PTR
Definition: treelist.c:79
WORD ATOM
Definition: dimm.idl:113
#define TRUE
Definition: types.h:120
LRESULT WINAPI ImeWndProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: imm.c:1003
ATOM WINAPI RegisterClassExWOWW(WNDCLASSEXW *, LPDWORD, WORD, DWORD, BOOL)
Definition: class.c:1413
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
#define CS_GLOBALCLASS
Definition: winuser.h:647
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define ICLS_IME
Definition: ntuser.h:906
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
#define IDC_ARROW
Definition: winuser.h:682
#define ICLASS_TO_MASK(iCls)
Definition: ntuser.h:881
DWORD RegisterDefaultClasses
Definition: regcontrol.c:13
WCHAR WndClass[]
Definition: capicon.c:23
#define FNID_IME
Definition: ntuser.h:853

Referenced by RegisterSystemControls().

◆ SendIMEMessageExA()

LRESULT WINAPI SendIMEMessageExA ( HWND  hwnd,
LPARAM  lParam 
)

Definition at line 1132 of file imm.c.

1133 {
1135 }
WORD WINAPI ImmSendIMEMessageExA(HWND hWnd, LPARAM lParam)
Definition: win3.c:210
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPARAM lParam
Definition: combotst.c:139
#define IMM_FN(name)
Definition: user32p.h:56

◆ SendIMEMessageExW()

LRESULT WINAPI SendIMEMessageExW ( HWND  hwnd,
LPARAM  lParam 
)

Definition at line 1122 of file imm.c.

1123 {
1125 }
WORD WINAPI ImmSendIMEMessageExW(HWND hWnd, LPARAM lParam)
Definition: win3.c:219
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
LPARAM lParam
Definition: combotst.c:139
#define IMM_FN(name)
Definition: user32p.h:56

◆ UpdatePerUserImmEnabling()

BOOL WINAPI UpdatePerUserImmEnabling ( VOID  )

Definition at line 1009 of file imm.c.

1010 {
1011  HMODULE imm32;
1012  BOOL ret;
1013 
1015  if (!ret || !(gpsi->dwSRVIFlags & SRVINFO_IMM32))
1016  return FALSE;
1017 
1018  imm32 = GetModuleHandleW(L"imm32.dll");
1019  if (imm32)
1020  return TRUE;
1021 
1022  imm32 = LoadLibraryW(L"imm32.dll");
1023  if (imm32)
1024  {
1025  ERR("UPUIE: Imm32 not installed!\n");
1026  ret = FALSE;
1027  }
1028 
1029  return ret;
1030 }
#define TRUE
Definition: types.h:120
PSERVERINFO gpsi
Definition: imm.c:17
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
DWORD dwSRVIFlags
Definition: ntuser.h:1022
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LoadLibraryW(x)
Definition: compat.h:606
int ret
DWORD_PTR NTAPI NtUserCallNoParam(DWORD Routine)
Definition: simplecall.c:59
#define ERR(fmt,...)
Definition: debug.h:110
#define SRVINFO_IMM32
Definition: ntuser.h:928
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838

Referenced by UpdatePerUserSystemParameters().

◆ User32CanSetImeWindowToImc()

static BOOL User32CanSetImeWindowToImc ( HIMC  hIMC,
HWND  hImeWnd 
)
static

Definition at line 155 of file imm.c.

156 {
157  PIMC pIMC = ValidateHandle(hIMC, TYPE_INPUTCONTEXT);
158  return pIMC && (!pIMC->hImeWnd || pIMC->hImeWnd == hImeWnd || !ValidateHwnd(pIMC->hImeWnd));
159 }
Definition: ntuser.h:190
HWND hImeWnd
Definition: ntuser.h:195
LPVOID FASTCALL ValidateHandle(HANDLE hObject, UINT uType)
Definition: utils.c:328
#define ValidateHwnd(hwnd)
Definition: precomp.h:85

Referenced by ImeWnd_OnCreate(), and ImeWnd_OnImeSetContext().

◆ User32CreateImeUIWindow()

static HWND User32CreateImeUIWindow ( PIMEUI  pimeui,
HKL  hKL 
)
static

Definition at line 294 of file imm.c.

295 {
296  IMEINFOEX ImeInfoEx;
297  PIMEDPI pImeDpi;
298  WNDCLASSW wc;
299  HWND hwndUI = NULL;
300  CHAR szUIClass[32];
301  PWND pwnd = pimeui->spwnd;
302 
303  ASSERT(pimeui->spwnd != NULL);
304 
305  if (!pwnd || !IMM_FN(ImmGetImeInfoEx)(&ImeInfoEx, ImeInfoExKeyboardLayout, &hKL))
306  return NULL;
307 
308  pImeDpi = IMM_FN(ImmLockImeDpi)(hKL);
309  if (!pImeDpi)
310  return NULL;
311 
312  if (!GetClassInfoW(pImeDpi->hInst, ImeInfoEx.wszUIClass, &wc))
313  goto Quit;
314 
315  if (ImeInfoEx.ImeInfo.fdwProperty & IME_PROP_UNICODE)
316  {
317  hwndUI = CreateWindowW(ImeInfoEx.wszUIClass, ImeInfoEx.wszUIClass, WS_POPUP | WS_DISABLED,
318  0, 0, 0, 0, UserHMGetHandle(pwnd), 0, wc.hInstance, NULL);
319  }
320  else
321  {
322  WideCharToMultiByte(CP_ACP, 0, ImeInfoEx.wszUIClass, -1,
323  szUIClass, _countof(szUIClass), NULL, NULL);
324  szUIClass[_countof(szUIClass) - 1] = 0;
325 
326  hwndUI = CreateWindowA(szUIClass, szUIClass, WS_POPUP | WS_DISABLED,
327  0, 0, 0, 0, UserHMGetHandle(pwnd), 0, wc.hInstance, NULL);
328  }
329 
330  if (hwndUI)
331  NtUserSetWindowLong(hwndUI, IMMGWL_IMC, (LONG_PTR)pimeui->hIMC, FALSE);
332 
333 Quit:
334  IMM_FN(ImmUnlockImeDpi)(pImeDpi);
335  return hwndUI;
336 }
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:938
#define WS_DISABLED
Definition: pedump.c:621
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
char CHAR
Definition: xmlstorage.h:175
BOOL WINAPI ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearchKey)
Definition: ime.c:866
PWND spwnd
Definition: ntuser.h:1207
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4296
#define FALSE
Definition: types.h:117
HINSTANCE hInst
Definition: ntuser.h:1251
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4295
BOOL WINAPI GetClassInfoW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSW)
#define IME_PROP_UNICODE
Definition: imm.h:393
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
#define ASSERT(a)
Definition: mode.c:44
DWORD fdwProperty
Definition: imm.h:158
#define _countof(array)
Definition: sndvol32.h:68
HIMC hIMC
Definition: ntuser.h:1208
PIMEDPI WINAPI ImmLockImeDpi(HKL hKL)
Definition: ime.c:909
WCHAR wszUIClass[16]
Definition: ntuser.h:1180
Definition: ntuser.h:672
IMEINFO ImeInfo
Definition: ntuser.h:1179
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define IMMGWL_IMC
Definition: immdev.h:33
#define WS_POPUP
Definition: pedump.c:616
#define NULL
Definition: types.h:112
HINSTANCE hInstance
Definition: winuser.h:3160
LONG NTAPI NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
Definition: window.c:4028
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWnd_OnImeSelect(), and ImeWnd_OnImeSetContext().

◆ User32DestroyImeUIWindow()

static VOID User32DestroyImeUIWindow ( PIMEUI  pimeui)
static

Definition at line 373 of file imm.c.

374 {
375  HWND hwndUI = pimeui->hwndUI;
376 
377  if (IsWindow(hwndUI))
378  {
379  pimeui->fDestroy = TRUE;
380  NtUserDestroyWindow(hwndUI);
381  }
382 
383  pimeui->fShowStatus = pimeui->fDestroy = FALSE;
384  pimeui->hwndUI = NULL;
385 }
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HWND hwndUI
Definition: ntuser.h:1211
BOOLEAN NTAPI NtUserDestroyWindow(HWND Wnd)
Definition: window.c:3010
UINT fDestroy
Definition: ntuser.h:1216
#define NULL
Definition: types.h:112
UINT fShowStatus
Definition: ntuser.h:1214

Referenced by ImeWnd_OnImeSelect(), and ImeWndProc_common().

◆ User32GetImeShowStatus()

static BOOL User32GetImeShowStatus ( VOID  )
static

Definition at line 162 of file imm.c.

163 {
165 }
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD_PTR NTAPI NtUserCallNoParam(DWORD Routine)
Definition: simplecall.c:59

Referenced by ImeWnd_OnImeControl(), ImeWnd_OnImeSelect(), ImeWnd_OnImeSetContext(), and ImeWnd_OnImeSystem().

◆ User32GetImmFileName()

HRESULT User32GetImmFileName ( _Out_ LPWSTR  lpBuffer,
_In_ size_t  cchBuffer 
)

Definition at line 57 of file imm.c.

58 {
60  if (length && length < cchBuffer)
61  {
63  return StringCchCatW(lpBuffer, cchBuffer, L"imm32.dll");
64  }
65  return StringCchCopyW(lpBuffer, cchBuffer, L"imm32.dll");
66 }
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
#define L(x)
Definition: ntvdm.h:50
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
static DWORD cchBuffer
Definition: fusion.c:85
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
unsigned int UINT
Definition: ndis.h:50

Referenced by DllMain(), IntInitializeImmEntryTable(), and User32InitializeImmEntryTable().

◆ User32InitializeImmEntryTable()

BOOL WINAPI User32InitializeImmEntryTable ( DWORD  magic)

Definition at line 126 of file imm.c.

127 {
128  TRACE("Imm (%x)\n", magic);
129 
130  if (magic != IMM_INIT_MAGIC)
131  return FALSE;
132 
133  /* Check whether the IMM table has already been initialized */
134  if (IMM_FN(ImmWINNLSEnableIME) != IMMSTUB_ImmWINNLSEnableIME)
135  return TRUE;
136 
138 
139  if (ghImm32 == NULL && !gbImmInitializing)
140  {
141  WCHAR ImmFile[MAX_PATH];
142  User32GetImmFileName(ImmFile, _countof(ImmFile));
143  ghImm32 = LoadLibraryW(ImmFile);
144  if (ghImm32 == NULL)
145  {
146  ERR("Did not load imm32.dll!\n");
147  return FALSE;
148  }
149  }
150 
152 }
#define TRUE
Definition: types.h:120
u32_t magic(void)
HRESULT User32GetImmFileName(_Out_ LPWSTR lpBuffer, _In_ size_t cchBuffer)
Definition: imm.c:57
BOOL WINAPI ImmRegisterClient(PSHAREDINFO ptr, HINSTANCE hMod)
Definition: imm.c:44
#define FALSE
Definition: types.h:117
#define LoadLibraryW(x)
Definition: compat.h:606
BOOL gbImmInitializing
Definition: imm.c:22
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
SHAREDINFO gSharedInfo
Definition: imm.c:18
BOOL WINAPI ImmWINNLSEnableIME(HWND hWnd, BOOL enable)
Definition: ime.c:2000
static BOOL IntInitializeImmEntryTable(VOID)
Definition: imm.c:70
#define ERR(fmt,...)
Definition: debug.h:110
HINSTANCE ghImm32
Definition: imm.c:20
#define NULL
Definition: types.h:112
#define IMM_INIT_MAGIC
Definition: imm.c:16
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by DllMain().

◆ User32NotifyOpenStatus()

static VOID User32NotifyOpenStatus ( PIMEUI  pimeui,
HWND  hwndIMC,
BOOL  bOpen 
)
static

Definition at line 198 of file imm.c.

199 {
201 
202  ASSERT(pimeui->spwnd != NULL);
203 
204  pimeui->fShowStatus = bOpen;
205 
206  if (LOWORD(GetWin32ClientInfo()->dwExpWinVer) >= 0x400)
207  SendMessageW(hwndIMC, WM_IME_NOTIFY, wParam, 0);
208  else
210 }
#define WM_IME_NOTIFY
Definition: winuser.h:1817
#define IMN_CLOSESTATUSWINDOW
Definition: imm.h:521
#define IMN_OPENSTATUSWINDOW
Definition: imm.h:522
#define TRUE
Definition: types.h:120
PWND spwnd
Definition: ntuser.h:1207
static LRESULT User32SendImeUIMessage(PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: imm.c:169
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWin32ClientInfo()
Definition: ntuser.h:335
WPARAM wParam
Definition: combotst.c:138
#define ASSERT(a)
Definition: mode.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
UINT fShowStatus
Definition: ntuser.h:1214
#define LOWORD(l)
Definition: pedump.c:82

Referenced by ImeWnd_OnImeSelect(), and ImeWnd_OnImeSetContext().

◆ User32SendImeUIMessage()

static LRESULT User32SendImeUIMessage ( PIMEUI  pimeui,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  unicode 
)
static

Definition at line 169 of file imm.c.

170 {
171  LRESULT ret = 0;
172  HWND hwndUI = pimeui->hwndUI;
173  PWND pwnd, pwndUI;
174 
175  ASSERT(pimeui->spwnd != NULL);
176 
177  pwnd = pimeui->spwnd;
178  pwndUI = ValidateHwnd(hwndUI);
179  if (!pwnd || (pwnd->state & WNDS_DESTROYED) || (pwnd->state2 & WNDS2_INDESTROY) ||
180  !pwndUI || (pwndUI->state & WNDS_DESTROYED) || (pwndUI->state2 & WNDS2_INDESTROY))
181  {
182  return 0;
183  }
184 
186 
187  if (unicode)
188  ret = SendMessageW(hwndUI, uMsg, wParam, lParam);
189  else
190  ret = SendMessageA(hwndUI, uMsg, wParam, lParam);
191 
193 
194  return ret;
195 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
PWND spwnd
Definition: ntuser.h:1207
LONG nCntInIMEProc
Definition: ntuser.h:1212
WPARAM wParam
Definition: combotst.c:138
HWND hwndUI
Definition: ntuser.h:1211
#define ASSERT(a)
Definition: mode.c:44
int ret
#define InterlockedDecrement
Definition: armddk.h:52
Definition: ntuser.h:672
#define InterlockedIncrement
Definition: armddk.h:53
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD state
Definition: ntuser.h:680
#define NULL
Definition: types.h:112
DWORD state2
Definition: ntuser.h:681
LONG_PTR LRESULT
Definition: windef.h:209
#define WNDS_DESTROYED
Definition: ntuser.h:619
LPARAM lParam
Definition: combotst.c:139
#define WNDS2_INDESTROY
Definition: ntuser.h:631
#define ValidateHwnd(hwnd)
Definition: precomp.h:85

Referenced by ImeWnd_OnImeControl(), ImeWnd_OnImeNotify(), ImeWnd_OnImeSelect(), ImeWnd_OnImeSetContext(), ImeWndProc_common(), and User32NotifyOpenStatus().

◆ User32SetImeActivenessOfWindow()

static VOID FASTCALL User32SetImeActivenessOfWindow ( HWND  hWnd,
BOOL  bActive 
)
static

Definition at line 540 of file imm.c.

541 {
542  HIMC hIMC;
543 
544  if (!hWnd || !IsWindow(hWnd))
545  {
546  IMM_FN(ImmSetActiveContext)(NULL, NULL, bActive);
547  return;
548  }
549 
550  hIMC = IMM_FN(ImmGetContext)(hWnd);
551  IMM_FN(ImmSetActiveContext)(hWnd, hIMC, bActive);
552  IMM_FN(ImmReleaseContext)(hWnd, hIMC);
553 }
BOOL WINAPI IsWindow(_In_opt_ HWND)
HWND hWnd
Definition: settings.c:17
BOOL WINAPI ImmSetActiveContext(HWND hWnd, HIMC hIMC, BOOL fActive)
Definition: imm.c:1129
DWORD HIMC
Definition: dimm.idl:75
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1010
BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:1051
#define NULL
Definition: types.h:112
#define IMM_FN(name)
Definition: user32p.h:56

Referenced by ImeWnd_OnImeSystem().

◆ User32SetImeWindowOfImc()

static VOID User32SetImeWindowOfImc ( HIMC  hIMC,
HWND  hImeWnd 
)
static

Definition at line 213 of file imm.c.

214 {
215  PIMC pIMC = ValidateHandle(hIMC, TYPE_INPUTCONTEXT);
216  if (!pIMC || pIMC->hImeWnd == hImeWnd)
217  return;
218 
220 }
Definition: ntuser.h:190
uint32_t ULONG_PTR
Definition: typedefs.h:65
HWND hImeWnd
Definition: ntuser.h:195
BOOL NTAPI NtUserUpdateInputContext(HIMC hIMC, DWORD dwType, DWORD_PTR dwValue)
Definition: ime.c:1744
LPVOID FASTCALL ValidateHandle(HANDLE hObject, UINT uType)
Definition: utils.c:328

Referenced by User32UpdateImcOfImeUI().

◆ User32UpdateImcOfImeUI()

static VOID User32UpdateImcOfImeUI ( PIMEUI  pimeui,
HIMC  hNewIMC 
)
static

Definition at line 223 of file imm.c.

224 {
225  HWND hImeWnd;
226  HIMC hOldIMC = pimeui->hIMC;
227 
228  ASSERT(pimeui->spwnd != NULL);
229  hImeWnd = UserHMGetHandle(pimeui->spwnd);
230 
231  if (hNewIMC == hOldIMC)
232  return;
233 
234  if (hOldIMC)
235  User32SetImeWindowOfImc(hOldIMC, NULL);
236 
237  pimeui->hIMC = hNewIMC;
238 
239  if (hNewIMC)
240  User32SetImeWindowOfImc(hNewIMC, hImeWnd);
241 }
PWND spwnd
Definition: ntuser.h:1207
static VOID User32SetImeWindowOfImc(HIMC hIMC, HWND hImeWnd)
Definition: imm.c:213
DWORD HIMC
Definition: dimm.idl:75
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
#define ASSERT(a)
Definition: mode.c:44
HIMC hIMC
Definition: ntuser.h:1208
#define NULL
Definition: types.h:112

Referenced by ImeWnd_OnCreate(), and ImeWnd_OnImeSetContext().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )

◆ WINNLSEnableIME()

BOOL WINAPI WINNLSEnableIME ( HWND  hwnd,
BOOL  enable 
)

Definition at line 1142 of file imm.c.

1143 {
1145 }
BOOL WINAPI ImmWINNLSEnableIME(HWND hWnd, BOOL enable)
Definition: ime.c:2000
GLboolean enable
Definition: glext.h:11120
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IMM_FN(name)
Definition: user32p.h:56

◆ WINNLSGetEnableStatus()

BOOL WINAPI WINNLSGetEnableStatus ( HWND  hwnd)

Definition at line 1152 of file imm.c.

1153 {
1155 }
BOOL WINAPI ImmWINNLSGetEnableStatus(HWND hWnd)
Definition: imm.c:1225
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IMM_FN(name)
Definition: user32p.h:56

◆ WINNLSGetIMEHotkey()

UINT WINAPI WINNLSGetIMEHotkey ( HWND  hwnd)

Definition at line 1162 of file imm.c.

1163 {
1164  return FALSE;
1165 }
#define FALSE
Definition: types.h:117

Variable Documentation

◆ gbImmInitializing

BOOL gbImmInitializing = FALSE

Definition at line 22 of file imm.c.

Referenced by InitializeImmEntryTable(), and User32InitializeImmEntryTable().

◆ gfConIme

INT gfConIme = -1

Definition at line 24 of file imm.c.

Referenced by ImeWnd_OnImeNotify(), and ImeWnd_OnImeSetContext().

◆ ghImm32

HINSTANCE ghImm32 = NULL

Definition at line 20 of file imm.c.

Referenced by DllMain(), IntInitializeImmEntryTable(), and User32InitializeImmEntryTable().

◆ gImmApiEntries

Imm32ApiTable gImmApiEntries
Initial value:
= {
#define DEFINE_IMM_ENTRY(type, name, params, retval, retkind)
}

Definition at line 47 of file imm.c.