Fix virtual keyboard on Harmattan not following window content orientation changes

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ø <tor.arne.vestbo@nokia.com>
bb10
Simon Hausmann 2012-01-26 14:35:55 +01:00 committed by Qt by Nokia
parent 0818fce01a
commit 6b85acd515
2 changed files with 17 additions and 2 deletions

View File

@ -151,6 +151,7 @@ public:
bool correctionEnabled;
QRect keyboardRect;
QString preedit;
QWeakPointer<QWindow> 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);

View File

@ -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;