Qt 4.8
qwininputcontext_win.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qwininputcontext_p.h"
43 #include "qinputcontext_p.h"
44 #ifndef QT_NO_IM
45 
46 #include "qfont.h"
47 #include "qwidget.h"
48 #include "qapplication.h"
49 #include "qevent.h"
50 #include "qtextformat.h"
51 #include "qtextboundaryfinder.h"
52 
53 //#define Q_IME_DEBUG
54 
55 #ifdef Q_IME_DEBUG
56 #include "qdebug.h"
57 #endif
58 
59 #if defined(Q_WS_WINCE)
60 extern void qt_wince_show_SIP(bool show); // defined in qguifunctions_wince.cpp
61 #endif
62 
64 
65 extern bool qt_sendSpontaneousEvent(QObject*, QEvent*);
66 
67 
68 DEFINE_GUID(IID_IActiveIMMApp,
69 0x08c0e040, 0x62d1, 0x11d1, 0x93, 0x26, 0x0, 0x60, 0xb0, 0x67, 0xb8, 0x6e);
70 
71 
72 
73 DEFINE_GUID(CLSID_CActiveIMM,
74 0x4955DD33, 0xB159, 0x11d0, 0x8F, 0xCF, 0x0, 0xAA, 0x00, 0x6B, 0xCC, 0x59);
75 
76 
77 
78 DEFINE_GUID(IID_IActiveIMMMessagePumpOwner,
79 0xb5cf2cfa, 0x8aeb, 0x11d1, 0x93, 0x64, 0x0, 0x60, 0xb0, 0x67, 0xb8, 0x6e);
80 
81 
82 
83 interface IEnumRegisterWordW;
84 interface IEnumInputContext;
85 
86 
88 
89 
90 #define IFMETHOD HRESULT STDMETHODCALLTYPE
91 
92 interface IActiveIMMApp : public IUnknown
93 {
94 public:
95  virtual IFMETHOD AssociateContext(HWND hWnd, HIMC hIME, HIMC __RPC_FAR *phPrev) = 0;
96  virtual IFMETHOD dummy_ConfigureIMEA() = 0;
97  virtual IFMETHOD ConfigureIMEW(HKL hKL, HWND hWnd, DWORD dwMode, REGISTERWORDW __RPC_FAR *pData) = 0;
98  virtual IFMETHOD CreateContext(HIMC __RPC_FAR *phIMC) = 0;
99  virtual IFMETHOD DestroyContext(HIMC hIME) = 0;
100  virtual IFMETHOD dummy_EnumRegisterWordA() = 0;
101  virtual IFMETHOD EnumRegisterWordW(HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szRegister, LPVOID pData,
102  IEnumRegisterWordW __RPC_FAR *__RPC_FAR *pEnum) = 0;
103  virtual IFMETHOD dummy_EscapeA() = 0;
104  virtual IFMETHOD EscapeW(HKL hKL, HIMC hIMC, UINT uEscape, LPVOID pData, LRESULT __RPC_FAR *plResult) = 0;
105  virtual IFMETHOD dummy_GetCandidateListA() = 0;
106  virtual IFMETHOD GetCandidateListW(HIMC hIMC, DWORD dwIndex, UINT uBufLen, CANDIDATELIST __RPC_FAR *pCandList,
107  UINT __RPC_FAR *puCopied) = 0;
109  virtual IFMETHOD GetCandidateListCountW(HIMC hIMC, DWORD __RPC_FAR *pdwListSize, DWORD __RPC_FAR *pdwBufLen) = 0;
110  virtual IFMETHOD GetCandidateWindow(HIMC hIMC, DWORD dwIndex, CANDIDATEFORM __RPC_FAR *pCandidate) = 0;
111  virtual IFMETHOD dummy_GetCompositionFontA() = 0;
112  virtual IFMETHOD GetCompositionFontW(HIMC hIMC, LOGFONTW __RPC_FAR *plf) = 0;
114  virtual IFMETHOD GetCompositionStringW(HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LONG __RPC_FAR *plCopied, LPVOID pBuf) = 0;
115  virtual IFMETHOD GetCompositionWindow(HIMC hIMC, COMPOSITIONFORM __RPC_FAR *pCompForm) = 0;
116  virtual IFMETHOD GetContext(HWND hWnd, HIMC __RPC_FAR *phIMC) = 0;
117  virtual IFMETHOD dummy_GetConversionListA() = 0;
118  virtual IFMETHOD GetConversionListW(HKL hKL, HIMC hIMC, LPWSTR pSrc, UINT uBufLen, UINT uFlag,
119  CANDIDATELIST __RPC_FAR *pDst, UINT __RPC_FAR *puCopied) = 0;
120  virtual IFMETHOD GetConversionStatus(HIMC hIMC, DWORD __RPC_FAR *pfdwConversion, DWORD __RPC_FAR *pfdwSentence) = 0;
121  virtual IFMETHOD GetDefaultIMEWnd(HWND hWnd, HWND __RPC_FAR *phDefWnd) = 0;
122  virtual IFMETHOD dummy_GetDescriptionA() = 0;
123  virtual IFMETHOD GetDescriptionW(HKL hKL, UINT uBufLen, LPWSTR szDescription, UINT __RPC_FAR *puCopied) = 0;
124  virtual IFMETHOD dummy_GetGuideLineA() = 0;
125  virtual IFMETHOD GetGuideLineW(HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LPWSTR pBuf, DWORD __RPC_FAR *pdwResult) = 0;
126  virtual IFMETHOD dummy_GetIMEFileNameA() = 0;
127  virtual IFMETHOD GetIMEFileNameW(HKL hKL, UINT uBufLen, LPWSTR szFileName, UINT __RPC_FAR *puCopied) = 0;
128  virtual IFMETHOD GetOpenStatus(HIMC hIMC) = 0;
129  virtual IFMETHOD GetProperty(HKL hKL, DWORD fdwIndex, DWORD __RPC_FAR *pdwProperty) = 0;
131  virtual IFMETHOD GetRegisterWordStyleW(HKL hKL, UINT nItem, STYLEBUFW __RPC_FAR *pStyleBuf, UINT __RPC_FAR *puCopied) = 0;
132  virtual IFMETHOD GetStatusWindowPos(HIMC hIMC, POINT __RPC_FAR *pptPos) = 0;
133  virtual IFMETHOD GetVirtualKey(HWND hWnd, UINT __RPC_FAR *puVirtualKey) = 0;
134  virtual IFMETHOD dummy_InstallIMEA() = 0;
135  virtual IFMETHOD InstallIMEW(LPWSTR szIMEFileName, LPWSTR szLayoutText, HKL __RPC_FAR *phKL) = 0;
136  virtual IFMETHOD IsIME(HKL hKL) = 0;
137  virtual IFMETHOD dummy_IsUIMessageA() = 0;
138  virtual IFMETHOD IsUIMessageW(HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam) = 0;
139  virtual IFMETHOD NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue) = 0;
140  virtual IFMETHOD dummy_RegisterWordA() = 0;
141  virtual IFMETHOD RegisterWordW(HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szRegister) = 0;
142  virtual IFMETHOD ReleaseContext(HWND hWnd, HIMC hIMC) = 0;
143  virtual IFMETHOD SetCandidateWindow(HIMC hIMC, CANDIDATEFORM __RPC_FAR *pCandidate) = 0;
144  virtual IFMETHOD SetCompositionFontA(HIMC hIMC, LOGFONTA __RPC_FAR *plf) = 0;
145  virtual IFMETHOD SetCompositionFontW(HIMC hIMC, LOGFONTW __RPC_FAR *plf) = 0;
147  virtual IFMETHOD SetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID pComp, DWORD dwCompLen,
148  LPVOID pRead, DWORD dwReadLen) = 0;
149  virtual IFMETHOD SetCompositionWindow(HIMC hIMC, COMPOSITIONFORM __RPC_FAR *pCompForm) = 0;
150  virtual IFMETHOD SetConversionStatus(HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence) = 0;
151  virtual IFMETHOD SetOpenStatus(HIMC hIMC, BOOL fOpen) = 0;
152  virtual IFMETHOD SetStatusWindowPos(HIMC hIMC, POINT __RPC_FAR *pptPos) = 0;
153  virtual IFMETHOD SimulateHotKey(HWND hWnd, DWORD dwHotKeyID) = 0;
154  virtual IFMETHOD dummy_UnregisterWordA() = 0;
155  virtual IFMETHOD UnregisterWordW(HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szUnregister) = 0;
156  virtual IFMETHOD Activate(BOOL fRestoreLayout) = 0;
157  virtual IFMETHOD Deactivate(void) = 0;
158  virtual IFMETHOD OnDefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT __RPC_FAR *plResult) = 0;
159  virtual IFMETHOD FilterClientWindows(ATOM __RPC_FAR *aaClassList, UINT uSize) = 0;
160  virtual IFMETHOD dummy_GetCodePageA() = 0;
161  virtual IFMETHOD GetLangId(HKL hKL, LANGID __RPC_FAR *plid) = 0;
162  virtual IFMETHOD AssociateContextEx(HWND hWnd, HIMC hIMC, DWORD dwFlags) = 0;
163  virtual IFMETHOD DisableIME(DWORD idThread) = 0;
164  virtual IFMETHOD dummy_GetImeMenuItemsA() = 0;
165  virtual IFMETHOD GetImeMenuItemsW(HIMC hIMC, DWORD dwFlags, DWORD dwType, /*IMEMENUITEMINFOW*/ void __RPC_FAR *pImeParentMenu,
166  /*IMEMENUITEMINFOW*/ void __RPC_FAR *pImeMenu, DWORD dwSize, DWORD __RPC_FAR *pdwResult) = 0;
167  virtual IFMETHOD EnumInputContext(DWORD idThread, IEnumInputContext __RPC_FAR *__RPC_FAR *ppEnum) = 0;
168 };
169 
170 interface IActiveIMMMessagePumpOwner : public IUnknown
171 {
172 public:
173  virtual IFMETHOD Start(void) = 0;
174  virtual IFMETHOD End(void) = 0;
175  virtual IFMETHOD OnTranslateMessage(const MSG __RPC_FAR *pMsg) = 0;
176  virtual IFMETHOD Pause(DWORD __RPC_FAR *pdwCookie) = 0;
177  virtual IFMETHOD Resume(DWORD dwCookie) = 0;
178 };
179 
180 
181 static IActiveIMMApp *aimm = 0;
182 static IActiveIMMMessagePumpOwner *aimmpump = 0;
184 static int imePosition = -1;
185 extern bool qt_use_rtl_extensions;
186 static bool haveCaret = false;
187 
188 #ifndef LGRPID_INSTALLED
189 #define LGRPID_INSTALLED 0x00000001 // installed language group ids
190 #define LGRPID_SUPPORTED 0x00000002 // supported language group ids
191 #endif
192 
193 #ifndef LGRPID_ARABIC
194 #define LGRPID_WESTERN_EUROPE 0x0001 // Western Europe & U.S.
195 #define LGRPID_CENTRAL_EUROPE 0x0002 // Central Europe
196 #define LGRPID_BALTIC 0x0003 // Baltic
197 #define LGRPID_GREEK 0x0004 // Greek
198 #define LGRPID_CYRILLIC 0x0005 // Cyrillic
199 #define LGRPID_TURKISH 0x0006 // Turkish
200 #define LGRPID_JAPANESE 0x0007 // Japanese
201 #define LGRPID_KOREAN 0x0008 // Korean
202 #define LGRPID_TRADITIONAL_CHINESE 0x0009 // Traditional Chinese
203 #define LGRPID_SIMPLIFIED_CHINESE 0x000a // Simplified Chinese
204 #define LGRPID_THAI 0x000b // Thai
205 #define LGRPID_HEBREW 0x000c // Hebrew
206 #define LGRPID_ARABIC 0x000d // Arabic
207 #define LGRPID_VIETNAMESE 0x000e // Vietnamese
208 #define LGRPID_INDIC 0x000f // Indic
209 #define LGRPID_GEORGIAN 0x0010 // Georgian
210 #define LGRPID_ARMENIAN 0x0011 // Armenian
211 #endif
212 
213 static DWORD WM_MSIME_MOUSE = 0;
214 
216  : QInputContext(parent), recursionGuard(false)
217 {
218 #ifndef Q_WS_WINCE
220  if (ver & QSysInfo::WV_NT_based && ver >= QSysInfo::WV_VISTA) {
221  // Since the IsValidLanguageGroup/IsValidLocale functions always return true on
222  // Vista, check the Keyboard Layouts for enabling RTL.
223  UINT nLayouts = GetKeyboardLayoutList(0, 0);
224  if (nLayouts) {
225  HKL *lpList = new HKL[nLayouts];
226  GetKeyboardLayoutList(nLayouts, lpList);
227  for (int i = 0; i<(int)nLayouts; i++) {
228  WORD plangid = PRIMARYLANGID((quintptr)lpList[i]);
229  if (plangid == LANG_ARABIC
230  || plangid == LANG_HEBREW
231  || plangid == LANG_FARSI
232 #ifdef LANG_SYRIAC
233  || plangid == LANG_SYRIAC
234 #endif
235  ) {
236  qt_use_rtl_extensions = true;
237  break;
238  }
239  }
240  delete []lpList;
241  }
242  } else {
243  // figure out whether a RTL language is installed
244  qt_use_rtl_extensions = IsValidLanguageGroup(LGRPID_ARABIC, LGRPID_INSTALLED)
245  || IsValidLanguageGroup(LGRPID_HEBREW, LGRPID_INSTALLED)
246  || IsValidLocale(MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
247  || IsValidLocale(MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
248 #ifdef LANG_SYRIAC
249  || IsValidLocale(MAKELCID(MAKELANGID(LANG_SYRIAC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
250 #endif
251  || IsValidLocale(MAKELCID(MAKELANGID(LANG_FARSI, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED);
252  }
253 #else
254  qt_use_rtl_extensions = false;
255 #endif
256 
257  WM_MSIME_MOUSE = RegisterWindowMessage(L"MSIMEMouseOperation");
258 }
259 
261 {
262  // release active input method if we have one
263  if (aimm) {
264  aimmpump->End();
265  aimmpump->Release();
266  aimm->Deactivate();
267  aimm->Release();
268  aimm = 0;
269  aimmpump = 0;
270  }
271  delete imeComposition;
272  imeComposition = 0;
273 }
274 
275 static HWND getDefaultIMEWnd(HWND wnd)
276 {
277  HWND ime_wnd;
278  if(aimm)
279  aimm->GetDefaultIMEWnd(wnd, &ime_wnd);
280  else
281  ime_wnd = ImmGetDefaultIMEWnd(wnd);
282  return ime_wnd;
283 }
284 
285 static HIMC getContext(HWND wnd)
286 {
287  HIMC imc;
288  if (aimm)
289  aimm->GetContext(wnd, &imc);
290  else
291  imc = ImmGetContext(wnd);
292 
293  return imc;
294 }
295 
296 static void releaseContext(HWND wnd, HIMC imc)
297 {
298  if (aimm)
299  aimm->ReleaseContext(wnd, imc);
300  else
301  ImmReleaseContext(wnd, imc);
302 }
303 
304 static void notifyIME(HIMC imc, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
305 {
306  if (!imc)
307  return;
308  if (aimm)
309  aimm->NotifyIME(imc, dwAction, dwIndex, dwValue);
310  else
311  ImmNotifyIME(imc, dwAction, dwIndex, dwValue);
312 }
313 
314 static LONG getCompositionString(HIMC himc, DWORD dwIndex, LPVOID lpbuf, DWORD dBufLen)
315 {
316  LONG len = 0;
317  if (aimm)
318  aimm->GetCompositionStringW(himc, dwIndex, dBufLen, &len, lpbuf);
319  else
320  len = ImmGetCompositionString(himc, dwIndex, lpbuf, dBufLen);
321  return len;
322 }
323 
324 static int getCursorPosition(HIMC himc)
325 {
326  return getCompositionString(himc, GCS_CURSORPOS, 0, 0);
327 }
328 
329 static QString getString(HIMC himc, DWORD dwindex, int *selStart = 0, int *selLength = 0)
330 {
331  const int bufferSize = 256;
332  wchar_t buffer[bufferSize];
333  int len = getCompositionString(himc, dwindex, buffer, bufferSize * sizeof(wchar_t));
334 
335  if (selStart) {
336  char attrbuffer[bufferSize];
337  int attrlen = getCompositionString(himc, GCS_COMPATTR, attrbuffer, bufferSize);
338  *selStart = attrlen+1;
339  *selLength = -1;
340  for (int i = 0; i < attrlen; i++) {
341  if (attrbuffer[i] & ATTR_TARGET_CONVERTED) {
342  *selStart = qMin(*selStart, i);
343  *selLength = qMax(*selLength, i);
344  }
345  }
346  *selLength = qMax(0, *selLength - *selStart + 1);
347  }
348 
349  if (len <= 0)
350  return QString();
351 
352  return QString((QChar*)buffer, len / sizeof(QChar));
353 }
354 
356 {
357  if (!aimmpump || aimmpump->OnTranslateMessage(msg) != S_OK)
358  ::TranslateMessage(msg);
359 }
360 
361 LRESULT QWinInputContext::DefWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
362 {
363  LRESULT retval;
364  if (!aimm || aimm->OnDefWindowProc(hwnd, msg, wParam, lParam, &retval) != S_OK)
365  {
366  retval = ::DefWindowProc(hwnd, msg, wParam, lParam);
367  }
368  return retval;
369 }
370 
371 
373 {
374  QWidget *w = focusWidget();
375  if(!w)
376  return;
377 
379  HIMC imc = getContext(w->effectiveWinId());
380 
381  if (!imc)
382  return;
383 
385  HFONT hf;
386  hf = f.handle();
387 
388  LOGFONT lf;
389  if (GetObject(hf, sizeof(lf), &lf)) {
390  if (aimm)
391  aimm->SetCompositionFontW(imc, &lf);
392  else
393  ImmSetCompositionFont(imc, &lf);
394  }
395 
397 
398  // The ime window positions are based on the WinId with active focus.
399  QWidget *imeWnd = QWidget::find(::GetFocus());
400  if (imeWnd && !aimm) {
401  QPoint pt (r.topLeft());
402  pt = w->mapToGlobal(pt);
403  pt = imeWnd->mapFromGlobal(pt);
404  r.moveTo(pt);
405  }
406 
407  COMPOSITIONFORM cf;
408  // ### need X-like inputStyle config settings
409  cf.dwStyle = CFS_FORCE_POSITION;
410  cf.ptCurrentPos.x = r.x();
411  cf.ptCurrentPos.y = r.y();
412 
413  CANDIDATEFORM candf;
414  candf.dwIndex = 0;
415  candf.dwStyle = CFS_EXCLUDE;
416  candf.ptCurrentPos.x = r.x();
417  candf.ptCurrentPos.y = r.y() + r.height();
418  candf.rcArea.left = r.x();
419  candf.rcArea.top = r.y();
420  candf.rcArea.right = r.x() + r.width();
421  candf.rcArea.bottom = r.y() + r.height();
422 
423  if(haveCaret)
424  SetCaretPos(r.x(), r.y());
425 
426  if (aimm) {
427  aimm->SetCompositionWindow(imc, &cf);
428  aimm->SetCandidateWindow(imc, &candf);
429  } else {
430  ImmSetCompositionWindow(imc, &cf);
431  ImmSetCandidateWindow(imc, &candf);
432  }
433 
434  releaseContext(w->effectiveWinId(), imc);
435 }
436 
437 
439 {
440  QWidget *fw = focusWidget();
441 #ifdef Q_IME_DEBUG
442  qDebug("endComposition! fw = %s", fw ? fw->className() : "(null)");
443 #endif
444  bool result = true;
445  if(imePosition == -1 || recursionGuard)
446  return result;
447 
448  // Googles Pinyin Input Method likes to call endComposition again
449  // when we call notifyIME with CPS_CANCEL, so protect ourselves
450  // against that.
451  recursionGuard = true;
452 
453  if (fw) {
455  HIMC imc = getContext(fw->effectiveWinId());
456  notifyIME(imc, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
457  releaseContext(fw->effectiveWinId(), imc);
458  if(haveCaret) {
459  DestroyCaret();
460  haveCaret = false;
461  }
462  }
463 
464  if (!fw)
466 
467  if (fw) {
469  result = qt_sendSpontaneousEvent(fw, &e);
470  }
471 
472  if (imeComposition)
473  imeComposition->clear();
474  imePosition = -1;
475 
476  recursionGuard = false;
477 
478  return result;
479 }
480 
482 {
483  QWidget *fw = focusWidget();
484 
485 #ifdef Q_IME_DEBUG
486  qDebug("sending accept to focus widget %s", fw ? fw->className() : "(null)");
487 #endif
488 
489  if (fw && imePosition != -1) {
491  if (imeComposition)
492  e.setCommitString(*imeComposition);
493  imePosition = -1;
494  qt_sendSpontaneousEvent(fw, &e);
495  }
496 
497  if (imeComposition)
498  imeComposition->clear();
499  imePosition = -1;
500 
501  if (fw) {
503  HIMC imc = getContext(fw->effectiveWinId());
504  notifyIME(imc, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
505  releaseContext(fw->effectiveWinId(), imc);
506  }
507 
508 }
509 
510 
512 {
513 #ifdef Q_IME_DEBUG
514  qDebug("startComposition");
515 #endif
516 
517  if (!imeComposition)
518  imeComposition = new QString();
519 
520  QWidget *fw = focusWidget();
521  if (fw) {
523  imePosition = 0;
524  haveCaret = CreateCaret(fw->effectiveWinId(), 0, 1, 1);
525  HideCaret(fw->effectiveWinId());
526  update();
527  }
528  return fw != 0;
529 }
530 
534 };
535 
536 bool QWinInputContext::composition(LPARAM lParam)
537 {
538 #ifdef Q_IME_DEBUG
539  QString str;
540  if (lParam & GCS_RESULTSTR)
541  str += "RESULTSTR ";
542  if (lParam & GCS_COMPSTR)
543  str += "COMPSTR ";
544  if (lParam & GCS_COMPATTR)
545  str += "COMPATTR ";
546  if (lParam & GCS_CURSORPOS)
547  str += "CURSORPOS ";
548  if (lParam & GCS_COMPCLAUSE)
549  str += "COMPCLAUSE ";
550  if (lParam & CS_INSERTCHAR)
551  str += "INSERTCHAR ";
552  if (lParam & CS_NOMOVECARET)
553  str += "NOMOVECARET ";
554  qDebug("composition, lParam=(%x) %s imePosition=%d", lParam, str.latin1(), imePosition);
555 #endif
556 
557  bool result = true;
558 
559  if(!lParam)
560  // bogus event
561  return true;
562 
564  if (fw) {
566  HIMC imc = getContext(fw->effectiveWinId());
568  if (lParam & (GCS_COMPSTR | GCS_COMPATTR | GCS_CURSORPOS)) {
569  if (imePosition == -1)
570  // need to send a start event
572 
573  // some intermediate composition result
574  int selStart, selLength;
575  *imeComposition = getString(imc, GCS_COMPSTR, &selStart, &selLength);
577  if (lParam & CS_INSERTCHAR && lParam & CS_NOMOVECARET) {
578  // make korean work correctly. Hope this is correct for all IMEs
579  selStart = 0;
580  selLength = imeComposition->length();
581  }
582  if(selLength == 0)
583  selStart = 0;
584 
586  if (selStart > 0)
589  if (selLength)
590  attrs << QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, selStart, selLength,
592  if (selStart + selLength < imeComposition->length())
593  attrs << QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, selStart + selLength,
594  imeComposition->length() - selStart - selLength,
596  if(imePosition >= 0)
597  attrs << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, imePosition, selLength ? 0 : 1, QVariant());
598 
599  e = QInputMethodEvent(*imeComposition, attrs);
600  }
601  if (lParam & GCS_RESULTSTR) {
602  if(imePosition == -1)
604  // a fixed result, return the converted string
605  *imeComposition = getString(imc, GCS_RESULTSTR);
606  imePosition = -1;
607  e.setCommitString(*imeComposition);
608  imeComposition->clear();
609  }
610  result = qt_sendSpontaneousEvent(fw, &e);
611  update();
612  releaseContext(fw->effectiveWinId(), imc);
613  }
614 #ifdef Q_IME_DEBUG
615  qDebug("imecomposition: cursor pos at %d, str=%x", imePosition, str[0].unicode());
616 #endif
617  return result;
618 }
619 
620 static HIMC defaultContext = 0;
621 
622 // checks whether widget is a popup
623 inline bool isPopup(QWidget *w)
624 {
625  if (w && (w->windowFlags() & Qt::Popup) == Qt::Popup)
626  return true;
627  else
628  return false;
629 }
630 // checks whether widget is in a popup
631 inline bool isInPopup(QWidget *w)
632 {
633  if (w && (isPopup(w) || isPopup(w->window())))
634  return true;
635  else
636  return false;
637 }
638 
639 // find the parent widget, which is a non popup toplevel
640 // this is valid only if the widget is/in a popup
642 {
644  // check if this or its parent is a popup
645  while (isInPopup(e)) {
646  e = e->window()->parentWidget();
647  if (!e)
648  break;
649  e = QWidget::find(e->effectiveWinId());
650  }
651  if (e)
652  return e->window();
653  else
654  return 0;
655 }
656 
657 // enables or disables the ime
658 inline void enableIme(QWidget *w, bool value)
659 {
660  if (value) {
661  // enable ime
662  if (defaultContext)
663  ImmAssociateContext(w->effectiveWinId(), defaultContext);
664 #ifdef Q_WS_WINCE
665  if (qApp->autoSipEnabled())
666  qt_wince_show_SIP(true);
667 #endif
668  } else {
669  // disable ime
670  HIMC oldimc = ImmAssociateContext(w->effectiveWinId(), 0);
671  if (!defaultContext)
672  defaultContext = oldimc;
673 #ifdef Q_WS_WINCE
674  if (qApp->autoSipEnabled())
675  qt_wince_show_SIP(false);
676 #endif
677  }
678 }
679 
680 
682 {
683  if (!w)
684  return;
685  // It's always the proxy that carries the hints.
686  QWidget *focusProxyWidget = w->focusProxy();
687  if (!focusProxyWidget)
688  focusProxyWidget = w;
690  && !(focusProxyWidget->inputMethodHints() & (Qt::ImhExclusiveInputMask | Qt::ImhHiddenText));
691  bool hasIme = e && hasFocus;
692 #ifdef Q_IME_DEBUG
693  qDebug("%s HasFocus = %d hasIme = %d e = %d ", w->className(), hasFocus, hasIme, e);
694 #endif
695  if (hasFocus || e) {
696  if (isInPopup(w))
698  else
699  QWinInputContext::enable(w, hasIme);
700  }
701 }
702 
704 {
705  if (aimm) {
706  enable(w, e);
707  return;
708  }
709 
710  if (!w || !isInPopup(w))
711  return;
712 #ifdef Q_IME_DEBUG
713  qDebug("enablePopupChild: w=%s, enable = %s", w ? w->className() : "(null)" , e ? "true" : "false");
714 #endif
716  if (parent) {
717  // update ime status of the normal toplevel parent of the popup
718  enableIme(parent, e);
719  }
720  QWidget *toplevel = w->window();
721  if (toplevel) {
722  // update ime status of the toplevel popup
723  enableIme(toplevel, e);
724  }
725 }
726 
728 {
729  if(w) {
730 #ifdef Q_IME_DEBUG
731  qDebug("enable: w=%s, enable = %s", w ? w->className() : "(null)" , e ? "true" : "false");
732 #endif
734  return;
735  if(aimm) {
736  HIMC oldimc;
737  if (!e) {
738  aimm->AssociateContext(w->effectiveWinId(), 0, &oldimc);
739  if (!defaultContext)
740  defaultContext = oldimc;
741  } else if (defaultContext) {
742  aimm->AssociateContext(w->effectiveWinId(), defaultContext, &oldimc);
743  }
744  } else {
745  // update ime status on the widget
747  if (p)
748  enableIme(p, e);
749  }
750  }
751 }
752 
754 {
755  QWidget *oldFocus = focusWidget();
756  if (oldFocus == w)
757  return;
758  if (w) {
760  } else {
761  if (oldFocus)
762  QWinInputContext::updateImeStatus(oldFocus , false);
763  }
765  update();
766 }
767 
769 {
770  return imeComposition && !imeComposition->isEmpty();
771 }
772 
774 {
775  if(e->type() != QEvent::MouseButtonPress)
776  return;
777 
778  if (pos < 0 || pos > imeComposition->length())
779  reset();
780 
781  // Probably should pass the correct button, but it seems to work fine like this.
782  DWORD button = MK_LBUTTON;
783 
784  QWidget *fw = focusWidget();
785  if (fw) {
787  HIMC himc = getContext(fw->effectiveWinId());
788  HWND ime_wnd = getDefaultIMEWnd(fw->effectiveWinId());
789  SendMessage(ime_wnd, WM_MSIME_MOUSE, MAKELONG(MAKEWORD(button, pos == 0 ? 2 : 1), pos), (LPARAM)himc);
790  releaseContext(fw->effectiveWinId(), himc);
791  }
792  //qDebug("mouseHandler: got value %d pos=%d", ret,pos);
793 }
794 
796 {
797  return QString();
798 }
799 
801 {
802  QWidget *w = focusWidget();
803  if(!w)
804  return -1;
805 
808  int memSize = sizeof(RECONVERTSTRING)+(surroundingText.length()+1)*sizeof(ushort);
809  // If memory is not allocated, return the required size.
810  if (!reconv) {
811  if (surroundingText.isEmpty())
812  return -1;
813  else
814  return memSize;
815  }
817  // find the word in the surrounding text.
818  QTextBoundaryFinder bounds(QTextBoundaryFinder::Word, surroundingText);
819  bounds.setPosition(pos);
820  if (bounds.isAtBoundary()) {
821  if (QTextBoundaryFinder::EndWord == bounds.boundaryReasons())
822  bounds.toPreviousBoundary();
823  } else {
824  bounds.toPreviousBoundary();
825  }
826  int startPos = bounds.position();
827  bounds.toNextBoundary();
828  int endPos = bounds.position();
829  // select the text, this will be overwritten by following ime events.
831  attrs << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, startPos, endPos-startPos, QVariant());
832  QInputMethodEvent e(QString(), attrs);
834 
835  reconv->dwSize = memSize;
836  reconv->dwVersion = 0;
837 
838  reconv->dwStrLen = surroundingText.length();
839  reconv->dwStrOffset = sizeof(RECONVERTSTRING);
840  reconv->dwCompStrLen = endPos-startPos;
841  reconv->dwCompStrOffset = startPos*sizeof(ushort);
842  reconv->dwTargetStrLen = reconv->dwCompStrLen;
843  reconv->dwTargetStrOffset = reconv->dwCompStrOffset;
844  memcpy((char*)(reconv+1), surroundingText.utf16(), surroundingText.length()*sizeof(ushort));
845  return memSize;
846 }
847 
849 #endif // QT_NO_IM
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
virtual IFMETHOD EnumInputContext(DWORD idThread, IEnumInputContext __RPC_FAR *__RPC_FAR *ppEnum)=0
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
virtual IFMETHOD Pause(DWORD __RPC_FAR *pdwCookie)=0
virtual IFMETHOD CreateContext(HIMC __RPC_FAR *phIMC)=0
int reconvertString(RECONVERTSTRING *reconv)
bool qt_sendSpontaneousEvent(QObject *, QEvent *)
static int imePosition
static void enable(QWidget *w, bool e)
QIntegerForSizeof< void * >::Unsigned quintptr
Definition: qglobal.h:986
virtual IFMETHOD GetProperty(HKL hKL, DWORD fdwIndex, DWORD __RPC_FAR *pdwProperty)=0
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
virtual IFMETHOD GetDefaultIMEWnd(HWND hWnd, HWND __RPC_FAR *phDefWnd)=0
virtual IFMETHOD dummy_InstallIMEA()=0
virtual IFMETHOD GetDescriptionW(HKL hKL, UINT uBufLen, LPWSTR szDescription, UINT __RPC_FAR *puCopied)=0
virtual IFMETHOD EnumRegisterWordW(HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szRegister, LPVOID pData, IEnumRegisterWordW __RPC_FAR *__RPC_FAR *pEnum)=0
The QInputMethodEvent::Attribute class stores an input method attribute.
Definition: qevent.h:441
static QString * imeComposition
WId effectiveWinId() const
Returns the effective window system identifier of the widget, i.
Definition: qwidget.cpp:2654
virtual void update()
This virtual function is called when a state in the focus widget has changed.
virtual IFMETHOD IsIME(HKL hKL)=0
virtual void reset()
This function can be reimplemented in a subclass to reset the state of the input method.
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
virtual IFMETHOD GetStatusWindowPos(HIMC hIMC, POINT __RPC_FAR *pptPos)=0
virtual IFMETHOD GetConversionListW(HKL hKL, HIMC hIMC, LPWSTR pSrc, UINT uBufLen, UINT uFlag, CANDIDATELIST __RPC_FAR *pDst, UINT __RPC_FAR *puCopied)=0
#define LGRPID_ARABIC
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void qt_wince_show_SIP(bool show)
virtual IFMETHOD SetCompositionWindow(HIMC hIMC, COMPOSITIONFORM __RPC_FAR *pCompForm)=0
static WinVersion windowsVersion()
Returns the version of the Windows operating system on which the application is run (Windows only)...
virtual IFMETHOD dummy_GetConversionListA()=0
virtual IFMETHOD GetRegisterWordStyleW(HKL hKL, UINT nItem, STYLEBUFW __RPC_FAR *pStyleBuf, UINT __RPC_FAR *puCopied)=0
void setCommitString(const QString &commitString, int replaceFrom=0, int replaceLength=0)
Sets the commit string to commitString.
Definition: qevent.cpp:2042
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
virtual IFMETHOD dummy_IsUIMessageA()=0
virtual IFMETHOD AssociateContextEx(HWND hWnd, HIMC hIMC, DWORD dwFlags)=0
void moveTo(int x, int t)
Moves the rectangle, leaving the top-left corner at the given position (x, y).
Definition: qrect.h:334
virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const
This method is only relevant for input widgets.
Definition: qwidget.cpp:9683
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
QWidget * focusWidget() const
Returns the widget that has an input focus for this input context.
virtual IFMETHOD GetCompositionFontW(HIMC hIMC, LOGFONTW __RPC_FAR *plf)=0
The QString class provides a Unicode character string.
Definition: qstring.h:83
HFONT handle() const
Returns the window system handle to the font, for low-level access.
Definition: qfont_mac.cpp:121
static int getCursorPosition(HIMC himc)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
virtual IFMETHOD Resume(DWORD dwCookie)=0
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define LGRPID_HEBREW
virtual IFMETHOD SetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID pComp, DWORD dwCompLen, LPVOID pRead, DWORD dwReadLen)=0
static void TranslateMessage(const MSG *msg)
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QWidget * focusProxy() const
Returns the focus proxy, or 0 if there is no focus proxy.
Definition: qwidget.cpp:6561
virtual IFMETHOD dummy_GetCandidateListCountA()=0
virtual IFMETHOD dummy_SetCompositionStringA()=0
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
virtual bool isComposing() const
This function indicates whether InputMethodStart event had been sent to the current focus widget...
virtual IFMETHOD dummy_RegisterWordA()=0
#define ATOM(x)
Definition: qt_x11_p.h:723
virtual IFMETHOD IsUIMessageW(HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)=0
Q_CORE_EXPORT void qDebug(const char *,...)
virtual IFMETHOD dummy_UnregisterWordA()=0
QWinInputContext(QObject *parent=0)
static void updateImeStatus(QWidget *w, bool hasFocus)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
virtual IFMETHOD GetCompositionStringW(HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LONG __RPC_FAR *plCopied, LPVOID pBuf)=0
static LONG getCompositionString(HIMC himc, DWORD dwIndex, LPVOID lpbuf, DWORD dBufLen)
virtual IFMETHOD dummy_GetDescriptionA()=0
static DWORD WM_MSIME_MOUSE
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
#define qApp
virtual IFMETHOD RegisterWordW(HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szRegister)=0
QTextFormat standardFormat(StandardFormat s) const
Returns a QTextFormat object that specifies the format for component s.
#define LANG_SYRIAC
virtual IFMETHOD SimulateHotKey(HWND hWnd, DWORD dwHotKeyID)=0
virtual IFMETHOD GetContext(HWND hWnd, HIMC __RPC_FAR *phIMC)=0
static QWidget * find(WId)
Returns a pointer to the widget with window identifer/handle id.
Definition: qwidget.cpp:2517
virtual IFMETHOD dummy_GetCandidateListA()=0
virtual IFMETHOD GetCandidateWindow(HIMC hIMC, DWORD dwIndex, CANDIDATEFORM __RPC_FAR *pCandidate)=0
virtual void mouseHandler(int x, QMouseEvent *event)
This function can be reimplemented in a subclass to handle mouse press, release, double-click, and move events within the preedit text.
virtual IFMETHOD dummy_ConfigureIMEA()=0
virtual QString language()
This function must be implemented in any subclasses to return a language code (e. ...
virtual IFMETHOD OnTranslateMessage(const MSG __RPC_FAR *pMsg)=0
virtual IFMETHOD dummy_GetCompositionStringA()=0
virtual IFMETHOD ConfigureIMEW(HKL hKL, HWND hWnd, DWORD dwMode, REGISTERWORDW __RPC_FAR *pData)=0
bool isPopup(QWidget *w)
virtual IFMETHOD dummy_EscapeA()=0
bool qt_use_rtl_extensions
struct tagRECONVERTSTRING RECONVERTSTRING
virtual IFMETHOD GetVirtualKey(HWND hWnd, UINT __RPC_FAR *puVirtualKey)=0
virtual IFMETHOD UnregisterWordW(HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szUnregister)=0
bool isEnabled() const
Definition: qwidget.h:948
virtual IFMETHOD dummy_GetIMEFileNameA()=0
virtual IFMETHOD dummy_GetImeMenuItemsA()=0
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
virtual IFMETHOD SetCompositionFontW(HIMC hIMC, LOGFONTW __RPC_FAR *plf)=0
virtual IFMETHOD Activate(BOOL fRestoreLayout)=0
virtual IFMETHOD OnDefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT __RPC_FAR *plResult)=0
virtual IFMETHOD GetConversionStatus(HIMC hIMC, DWORD __RPC_FAR *pfdwConversion, DWORD __RPC_FAR *pfdwSentence)=0
The QInputMethodEvent class provides parameters for input method events.
Definition: qevent.h:431
virtual IFMETHOD GetLangId(HKL hKL, LANGID __RPC_FAR *plid)=0
virtual IFMETHOD EscapeW(HKL hKL, HIMC hIMC, UINT uEscape, LPVOID pData, LRESULT __RPC_FAR *plResult)=0
bool composition(LPARAM lparam)
struct tagMSG MSG
virtual IFMETHOD dummy_GetRegisterWordStyleA()=0
virtual IFMETHOD Deactivate(void)=0
interface HIMC hIME
void enableIme(QWidget *w, bool value)
static HIMC getContext(HWND wnd)
virtual IFMETHOD GetIMEFileNameW(HKL hKL, UINT uBufLen, LPWSTR szFileName, UINT __RPC_FAR *puCopied)=0
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
virtual IFMETHOD dummy_GetGuideLineA()=0
void clear()
Clears the contents of the string and makes it empty.
Definition: qstring.h:723
unsigned short ushort
Definition: qglobal.h:995
QRect toRect() const
Returns the variant as a QRect if the variant has type() Rect ; otherwise returns an invalid QRect...
Definition: qvariant.cpp:2416
static void enablePopupChild(QWidget *w, bool e)
virtual IFMETHOD GetCompositionWindow(HIMC hIMC, COMPOSITIONFORM __RPC_FAR *pCompForm)=0
static IActiveIMMMessagePumpOwner * aimmpump
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
virtual IFMETHOD GetCandidateListCountW(HIMC hIMC, DWORD __RPC_FAR *pdwListSize, DWORD __RPC_FAR *pdwBufLen)=0
virtual IFMETHOD SetOpenStatus(HIMC hIMC, BOOL fOpen)=0
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
virtual IFMETHOD dummy_GetCompositionFontA()=0
virtual IFMETHOD GetGuideLineW(HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LPWSTR pBuf, DWORD __RPC_FAR *pdwResult)=0
interface HIMC HIMC __RPC_FAR * phPrev
virtual IFMETHOD SetStatusWindowPos(HIMC hIMC, POINT __RPC_FAR *pptPos)=0
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
static HIMC defaultContext
static IActiveIMMApp * aimm
#define IFMETHOD
static LRESULT DefWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
T qvariant_cast(const QVariant &)
Definition: qvariant.h:571
virtual void setFocusWidget(QWidget *w)
Sets the widget that has an input focus for this input context.
virtual IFMETHOD GetCandidateListW(HIMC hIMC, DWORD dwIndex, UINT uBufLen, CANDIDATELIST __RPC_FAR *pCandList, UINT __RPC_FAR *puCopied)=0
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
virtual IFMETHOD DestroyContext(HIMC hIME)=0
virtual IFMETHOD dummy_EnumRegisterWordA()=0
virtual IFMETHOD GetOpenStatus(HIMC hIMC)=0
virtual IFMETHOD SetConversionStatus(HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)=0
WinVersion
This enum provides symbolic names for the various versions of the Windows operating system...
Definition: qglobal.h:1579
static HWND getDefaultIMEWnd(HWND wnd)
static void releaseContext(HWND wnd, HIMC imc)
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
static QString getString(HIMC himc, DWORD dwindex, int *selStart=0, int *selLength=0)
static void notifyIME(HIMC imc, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
The QInputContext class abstracts the input method dependent data and composing state.
Definition: qinputcontext.h:83
bool isInPopup(QWidget *w)
virtual IFMETHOD NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)=0
Qt::InputMethodHints inputMethodHints
What input method specific hints the widget has.
Definition: qwidget.h:224
static bool haveCaret
DEFINE_GUID(IID_IActiveIMMApp, 0x08c0e040, 0x62d1, 0x11d1, 0x93, 0x26, 0x0, 0x60, 0xb0, 0x67, 0xb8, 0x6e)
QWidget * findParentforPopup(QWidget *w)
virtual IFMETHOD InstallIMEW(LPWSTR szIMEFileName, LPWSTR szLayoutText, HKL __RPC_FAR *phKL)=0
virtual void setFocusWidget(QWidget *w)
Sets the widget that has an input focus for this input context.
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
virtual IFMETHOD SetCompositionFontA(HIMC hIMC, LOGFONTA __RPC_FAR *plf)=0
virtual IFMETHOD DisableIME(DWORD idThread)=0
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or 0 if no widget in this applicati...
virtual IFMETHOD FilterClientWindows(ATOM __RPC_FAR *aaClassList, UINT uSize)=0
The QTextBoundaryFinder class provides a way of finding Unicode text boundaries in a string...
virtual IFMETHOD ReleaseContext(HWND hWnd, HIMC hIMC)=0
virtual IFMETHOD End(void)=0
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.
virtual IFMETHOD dummy_GetCodePageA()=0
virtual IFMETHOD GetImeMenuItemsW(HIMC hIMC, DWORD dwFlags, DWORD dwType, void __RPC_FAR *pImeParentMenu, void __RPC_FAR *pImeMenu, DWORD dwSize, DWORD __RPC_FAR *pdwResult)=0
virtual IFMETHOD SetCandidateWindow(HIMC hIMC, CANDIDATEFORM __RPC_FAR *pCandidate)=0
#define LGRPID_INSTALLED
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288