summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Barron <jason.barron@nokia.com>2011-09-14 16:26:13 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-15 09:11:35 +0200
commitebb929d49318deae9d6bfdf97294315690640f91 (patch)
tree5aa647d83d8788dfbcee8b7c26b6cb3d3e92241b
parent5bb0c7c5cacb0f741420d16be26768c156d4f288 (diff)
Make the Windows input context compile after the refactoring.
There is no longer a focusObject setter/getter in the input context. Instead the object can be gotten from the new input panel API. Instead of reimplementing setFocusObject(), implementations should now connect to the inputItemChanged() signal of QInputPanel. Change-Id: I6c674424da5a0c8c3995e5f5acd191ef91ba8a00 Reviewed-on: http://codereview.qt-project.org/4913 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.cpp34
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.h3
2 files changed, 14 insertions, 23 deletions
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
index 6c915acfd3..34ae93ee7c 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
@@ -93,7 +93,7 @@ template <class T>
QInputMethodQueryEvent queryEvent(query);
if (!QCoreApplication::sendEvent(fo, &queryEvent))
return false;
- *result = qvariant_cast<T>(queryEvent.value());
+ *result = qvariant_cast<T>(queryEvent.value(query));
return true;
}
@@ -179,7 +179,7 @@ void QWindowsInputContext::reset()
QPlatformInputContext::reset();
if (!m_compositionContext.hwnd)
return;
- QObject *fo = focusObject();
+ QObject *fo = qApp->inputPanel()->inputItem();
if (QWindowsContext::verboseInputMethods)
qDebug() << __FUNCTION__<< fo;
if (!fo)
@@ -199,12 +199,12 @@ void QWindowsInputContext::reset()
\brief Moves the candidate window along with microfocus of the focus object.
*/
-void QWindowsInputContext::update()
+void QWindowsInputContext::update(Qt::InputMethodQueries queries)
{
- QPlatformInputContext::update();
+ QPlatformInputContext::update(queries);
if (!m_compositionContext.hwnd)
return;
- QObject *fo = focusObject();
+ QObject *fo = qApp->inputPanel()->inputItem();
if (!fo)
return;
const HIMC himc = ImmGetContext(m_compositionContext.hwnd);
@@ -265,14 +265,6 @@ void QWindowsInputContext::mouseHandler(int pos, QMouseEvent *event)
ImmReleaseContext(m_compositionContext.hwnd, himc);
}
-void QWindowsInputContext::setFocusObject(QObject *object)
-{
- if (QWindowsContext::verboseInputMethods)
- qDebug() << __FUNCTION__ << object;
-
- QPlatformInputContext::setFocusObject(object);
-}
-
QWindowsInputContext *QWindowsInputContext::instance()
{
return static_cast<QWindowsInputContext *>(QWindowsIntegration::instance()->inputContext());
@@ -333,11 +325,11 @@ static inline QTextFormat standardFormat(StandardFormat format)
bool QWindowsInputContext::startComposition(HWND hwnd)
{
- const QObject *fo = focusObject();
+ const QObject *fo = qApp->inputPanel()->inputItem();
if (!fo)
return false;
// This should always match the object.
- QWindow *window = QGuiApplication::activeWindow();
+ QWindow *window = qApp->inputPanel()->inputWindow();
if (!window)
return false;
if (QWindowsContext::verboseInputMethods)
@@ -358,7 +350,7 @@ void QWindowsInputContext::startContextComposition()
m_compositionContext.isComposing = true;
m_compositionContext.composition.clear();
m_compositionContext.position = 0;
- update();
+ update(Qt::ImQueryAll);
}
void QWindowsInputContext::endContextComposition()
@@ -401,7 +393,7 @@ static inline QList<QInputMethodEvent::Attribute>
bool QWindowsInputContext::composition(HWND hwnd, LPARAM lParamIn)
{
- QObject *fo = focusObject();
+ QObject *fo = qApp->inputPanel()->inputItem();
const int lParam = int(lParamIn);
if (QWindowsContext::verboseInputMethods)
qDebug() << '>' << __FUNCTION__ << fo << debugComposition(lParam)
@@ -449,7 +441,7 @@ bool QWindowsInputContext::composition(HWND hwnd, LPARAM lParamIn)
<< event->attributes().size()
<< " commit=" << event->commitString()
<< " to " << fo << " returns " << result;
- update();
+ update(Qt::ImQueryAll);
ImmReleaseContext(m_compositionContext.hwnd, himc);
return result;
}
@@ -463,7 +455,7 @@ bool QWindowsInputContext::endComposition(HWND hwnd)
// against that.
if (m_endCompositionRecursionGuard || m_compositionContext.hwnd != hwnd)
return false;
- QObject *fo = focusObject();
+ QObject *fo = qApp->inputPanel()->inputItem();
if (!fo)
return false;
@@ -490,7 +482,7 @@ void QWindowsInputContext::initContext(HWND hwnd)
// Chinese input methods.
m_compositionContext.haveCaret = CreateCaret(hwnd, 0, 1, 1);
HideCaret(hwnd);
- update();
+ update(Qt::ImQueryAll);
m_compositionContext.isComposing = false;
m_compositionContext.position = 0;
}
@@ -541,7 +533,7 @@ bool QWindowsInputContext::handleIME_Request(WPARAM wParam,
int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
{
- QObject *fo = focusObject();
+ QObject *fo = qApp->inputPanel()->inputItem();
if (!fo)
return false;
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.h b/src/plugins/platforms/windows/qwindowsinputcontext.h
index 5198b5129e..2c683ee4e7 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.h
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.h
@@ -67,10 +67,9 @@ public:
~QWindowsInputContext();
virtual void reset();
- virtual void update();
+ virtual void update(Qt::InputMethodQueries);
virtual void mouseHandler(int x, QMouseEvent *event);
- virtual void setFocusObject(QObject *o);
static QWindowsInputContext *instance();