summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsinputcontext.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-02-24 14:47:20 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-02-24 14:47:20 +0000
commitb736151c2bb6c68f700d38274d740a6e0cf59a49 (patch)
tree83e110a7205757addba6e86a3c2367e4b52afa05 /src/plugins/platforms/windows/qwindowsinputcontext.cpp
parentff76300a5c9f209f625384f35ad0fdb0acebd799 (diff)
parent1fadc7292b66d4b3984bf5ef36c70b46b07a1c6b (diff)
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsinputcontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
index f1addf186d..d0c3b80707 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
@@ -323,7 +323,9 @@ void QWindowsInputContext::invokeAction(QInputMethod::Action action, int cursorP
// position.
const HIMC himc = ImmGetContext(m_compositionContext.hwnd);
const HWND imeWindow = ImmGetDefaultIMEWnd(m_compositionContext.hwnd);
- SendMessage(imeWindow, m_WM_MSIME_MOUSE, MAKELONG(MAKEWORD(MK_LBUTTON, cursorPosition == 0 ? 2 : 1), cursorPosition), (LPARAM)himc);
+ const WPARAM mouseOperationCode =
+ MAKELONG(MAKEWORD(MK_LBUTTON, cursorPosition == 0 ? 2 : 1), cursorPosition);
+ SendMessage(imeWindow, m_WM_MSIME_MOUSE, mouseOperationCode, LPARAM(himc));
ImmReleaseContext(m_compositionContext.hwnd, himc);
}
@@ -332,7 +334,7 @@ static inline QString getCompositionString(HIMC himc, DWORD dwIndex)
enum { bufferSize = 256 };
wchar_t buffer[bufferSize];
const int length = ImmGetCompositionString(himc, dwIndex, buffer, bufferSize * sizeof(wchar_t));
- return QString::fromWCharArray(buffer, length / sizeof(wchar_t));
+ return QString::fromWCharArray(buffer, size_t(length) / sizeof(wchar_t));
}
// Determine the converted string range as pair of start/length to be selected.
@@ -563,9 +565,8 @@ bool QWindowsInputContext::handleIME_Request(WPARAM wParam,
if (size < 0)
return false;
*result = size;
- return true;
}
- break;
+ return true;
case IMR_CONFIRMRECONVERTSTRING:
return true;
default:
@@ -576,7 +577,7 @@ bool QWindowsInputContext::handleIME_Request(WPARAM wParam,
void QWindowsInputContext::handleInputLanguageChanged(WPARAM wparam, LPARAM lparam)
{
- const LCID newLanguageId = languageIdFromLocaleId(lparam);
+ const LCID newLanguageId = languageIdFromLocaleId(WORD(lparam));
if (newLanguageId == m_languageId)
return;
const LCID oldLanguageId = m_languageId;
@@ -610,13 +611,13 @@ int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
if (!surroundingTextV.isValid())
return -1;
const QString surroundingText = surroundingTextV.toString();
- const DWORD memSize = sizeof(RECONVERTSTRING)
- + (surroundingText.length() + 1) * sizeof(ushort);
+ const int memSize = int(sizeof(RECONVERTSTRING))
+ + (surroundingText.length() + 1) * int(sizeof(ushort));
qCDebug(lcQpaInputMethods) << __FUNCTION__ << " reconv=" << reconv
<< " surroundingText=" << surroundingText << " size=" << memSize;
// If memory is not allocated, return the required size.
if (!reconv)
- return surroundingText.isEmpty() ? -1 : int(memSize);
+ return surroundingText.isEmpty() ? -1 : memSize;
const QVariant posV = QInputMethod::queryFocusObject(Qt::ImCursorPosition, QVariant());
const int pos = posV.isValid() ? posV.toInt() : 0;
@@ -635,13 +636,13 @@ int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
QInputMethodEvent selectEvent(QString(), attributes);
QCoreApplication::sendEvent(fo, &selectEvent);
- reconv->dwSize = memSize;
+ reconv->dwSize = DWORD(memSize);
reconv->dwVersion = 0;
- reconv->dwStrLen = surroundingText.size();
+ reconv->dwStrLen = DWORD(surroundingText.size());
reconv->dwStrOffset = sizeof(RECONVERTSTRING);
- reconv->dwCompStrLen = endPos - startPos; // TCHAR count.
- reconv->dwCompStrOffset = startPos * sizeof(ushort); // byte count.
+ reconv->dwCompStrLen = DWORD(endPos - startPos); // TCHAR count.
+ reconv->dwCompStrOffset = DWORD(startPos) * sizeof(ushort); // byte count.
reconv->dwTargetStrLen = reconv->dwCompStrLen;
reconv->dwTargetStrOffset = reconv->dwCompStrOffset;
ushort *pastReconv = reinterpret_cast<ushort *>(reconv + 1);