From 6b85acd51583b36c3185ddffcccbf852a681928a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 26 Jan 2012 14:35:55 +0100 Subject: Fix virtual keyboard on Harmattan not following window content orientation changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Track the input item's window and notify the input method server when the content orientation changes. Change-Id: I401c4fd677ed2eebd8b85968d4a2b3692517e097 Reviewed-by: Tor Arne Vestbø --- .../meego/qmeegoplatforminputcontext.cpp | 18 ++++++++++++++++-- .../meego/qmeegoplatforminputcontext.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforminputcontexts') diff --git a/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.cpp b/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.cpp index dc0a4f286d..0df21e3908 100644 --- a/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.cpp @@ -151,6 +151,7 @@ public: bool correctionEnabled; QRect keyboardRect; QString preedit; + QWeakPointer window; QMeeGoPlatformInputContext *q; }; @@ -447,6 +448,11 @@ void QMeeGoPlatformInputContext::updateInputMethodArea(int x, int y, int width, emitKeyboardRectChanged(); } +void QMeeGoPlatformInputContext::updateServerWindowOrientation(Qt::ScreenOrientation orientation) +{ + d->server->appOrientationChanged(orientationAngle(orientation)); +} + void QMeeGoPlatformInputContext::inputItemChanged() { if (!d->valid) @@ -455,6 +461,15 @@ void QMeeGoPlatformInputContext::inputItemChanged() QInputPanel *panel = qApp->inputPanel(); QObject *input = panel->inputItem(); QWindow *window = panel->inputWindow(); + if (window != d->window.data()) { + if (d->window) + disconnect(d->window.data(), SIGNAL(contentOrientationChanged(Qt::ScreenOrientation)), + this, SLOT(updateServerWindowOrientation(Qt::ScreenOrientation))); + d->window = window; + if (d->window) + connect(d->window.data(), SIGNAL(contentOrientationChanged(Qt::ScreenOrientation)), + this, SLOT(updateServerWindowOrientation(Qt::ScreenOrientation))); + } d->imState["focusState"] = input != 0; if (input) { @@ -465,9 +480,8 @@ void QMeeGoPlatformInputContext::inputItemChanged() d->active = true; d->server->activateContext(); - // ### react to orientation changes, too if (window) - d->server->appOrientationChanged(orientationAngle(window->screen()->orientation())); + d->server->appOrientationChanged(orientationAngle(window->contentOrientation())); } } d->sendStateUpdate(/*focusChanged*/true); diff --git a/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.h b/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.h index e84ac2035d..8b3edd0f9b 100644 --- a/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.h +++ b/src/plugins/platforminputcontexts/meego/qmeegoplatforminputcontext.h @@ -86,6 +86,7 @@ public Q_SLOTS: void setRedirectKeys(bool ); void setSelection(int start, int length); void updateInputMethodArea(int x, int y, int width, int height); + void updateServerWindowOrientation(Qt::ScreenOrientation orientation); private: QMeeGoPlatformInputContextPrivate *d; -- cgit v1.2.3