summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2011-06-14 12:40:01 (GMT)
committerSami Merila <sami.merila@nokia.com>2011-06-14 12:40:01 (GMT)
commita0af3a2d12828e69a23d3697a4a6c8c03d9bd92f (patch)
tree9aaf9a946f839e6f781489ddd65e464290f336bf
parent7cfeaa9de75e8e567cf01cca8dd70880ad404b55 (diff)
downloadQt-a0af3a2d12828e69a23d3697a4a6c8c03d9bd92f.zip
Qt-a0af3a2d12828e69a23d3697a4a6c8c03d9bd92f.tar.gz
Qt-a0af3a2d12828e69a23d3697a4a6c8c03d9bd92f.tar.bz2
Drop-down menu position is altered when Partial VKB is invoked
When a new window is shown and splitview is open, native side claims that available screen area for the application is only the screen area above keyboard. However, since opening a new window, will eventually lead to keyboard getting closed, the new window will look strange occupying only top part of the screen. Fix it so that when a new window opens and splitview is open, window will still get its extent set to fullscreen area (minus native panes, if available). Task-number: QT-5103 Reviewed-by: Miikka Heikkinen
-rw-r--r--src/gui/kernel/qapplication_s60.cpp53
-rw-r--r--src/gui/kernel/qdesktopwidget_s60.cpp2
-rw-r--r--src/gui/kernel/qt_s60_p.h1
-rw-r--r--src/gui/kernel/qwidget_s60.cpp12
4 files changed, 38 insertions, 30 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index bf76a0e..6896b7d 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -134,7 +134,7 @@ void QS60Data::setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, boo
s->MakeVisible(statusPaneVisible);
}
if (buttonGroupVisibilityChanged || statusPaneVisibilityChanged) {
- const QSize size = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()).size();
+ const QSize size = qt_TRect2QRect(S60->clientRect()).size();
const QSize oldSize; // note that QDesktopWidget::resizeEvent ignores the QResizeEvent contents
QResizeEvent event(size, oldSize);
QApplication::instance()->sendEvent(QApplication::desktop(), &event);
@@ -231,6 +231,28 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible)
}
}
+TRect QS60Data::clientRect()
+{
+ TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ if (S60->partialKeyboardOpen) {
+ // Adjust client rect when splitview is open, since for some curious reason
+ // native side insists that clientRect starts from (0,0) even though status
+ // pane might be visible.
+ TRect statusPaneRect;
+ TRect mainRect;
+ AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect);
+ AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainRect);
+ int clientAreaHeight = mainRect.Height();
+ CEikStatusPane *const s = S60->statusPane();
+ if (s && s->IsVisible())
+ r.Move(0, statusPaneRect.Height());
+ else
+ clientAreaHeight += statusPaneRect.Height();
+ r.SetHeight(clientAreaHeight);
+ }
+ return r;
+}
+
bool qt_nograb() // application no-grab option
{
#if defined(QT_DEBUG)
@@ -1426,25 +1448,9 @@ void QSymbianControl::handleClientAreaChange()
if (qwidget->isFullScreen() && !cbaVisibilityHint) {
SetExtentToWholeScreen();
} else if (qwidget->isMaximized() || (qwidget->isFullScreen() && cbaVisibilityHint)) {
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
- if (!S60->splitViewLastWidget && S60->partialKeyboardOpen) {
- // For some curious reason, native side indicates that splitviewRect starts
- // underneath statuspane. So, if statuspane is visible, move the splitview
- // down a little bit. Note that if there is S60->splitViewLastWidget, it means
- // the resizing is done by input context handling and this metrics calculation
- // is not needed.
- TRect statusPaneRect;
- TRect mainRect;
- AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect);
- AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainRect);
- int clientAreaHeight = mainRect.Height();
- CEikStatusPane *const s = S60->statusPane();
- if (s && s->IsVisible())
- r.Move(0, statusPaneRect.Height());
- else
- clientAreaHeight += statusPaneRect.Height();
- r.SetHeight(clientAreaHeight);
- }
+ // Note that if there is S60->splitViewLastWidget, it means the resizing is done
+ // by input context handling and we can use just default ClientRect.
+ TRect r = (!S60->splitViewLastWidget) ? S60->clientRect() : static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
SetExtent(r.iTl, r.Size());
} else if (!qwidget->isMinimized()) { // Normal geometry
if (!qwidget->testAttribute(Qt::WA_Resized)) {
@@ -1452,7 +1458,7 @@ void QSymbianControl::handleClientAreaChange()
qwidget->setAttribute(Qt::WA_Resized, false); //not a user resize
}
if (!qwidget->testAttribute(Qt::WA_Moved) && qwidget->windowType() != Qt::Dialog) {
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ TRect r = S60->clientRect();
SetPosition(r.iTl);
qwidget->setAttribute(Qt::WA_Moved, false); // not really an explicit position
}
@@ -1498,13 +1504,14 @@ void QSymbianControl::HandleResourceChange(int resourceType)
if (!ic) {
ic = qobject_cast<QCoeFepInputContext *>(qApp->inputContext());
}
- if (ic && isSplitViewWidget(widget)) {
+ if (ic) {
if (resourceType == KSplitViewCloseEvent) {
S60->partialKeyboardOpen = false;
ic->resetSplitViewWidget();
} else {
S60->partialKeyboardOpen = true;
- ic->ensureFocusWidgetVisible(widget);
+ if (isSplitViewWidget(widget))
+ ic->ensureFocusWidgetVisible(widget);
}
}
}
diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp
index 156c970..86d8f3f 100644
--- a/src/gui/kernel/qdesktopwidget_s60.cpp
+++ b/src/gui/kernel/qdesktopwidget_s60.cpp
@@ -161,7 +161,7 @@ void QDesktopWidgetPrivate::init(QDesktopWidget *that)
(*rects)[i] = r;
QRect wr;
if (i == 0)
- wr = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect());
+ wr = qt_TRect2QRect(S60->clientRect());
else
wr = rects->at(i);
(*workrects)[i].setRect(wr.x(), wr.y(), wr.width(), wr.height());
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index bb37d00..c4ddc26 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -189,6 +189,7 @@ public:
static bool setRecursiveDecorationsVisibility(QWidget *window, Qt::WindowStates newState);
#endif
static void controlVisibilityChanged(CCoeControl *control, bool visible);
+ static TRect clientRect();
#ifdef Q_OS_SYMBIAN
TTrapHandler *s60InstalledTrapHandler;
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index ef492b3..5630706 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -348,7 +348,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
if (popup)
flags |= Qt::WindowStaysOnTopHint; // a popup stays on top
- TRect clientRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ TRect clientRect = S60->clientRect();
int sw = clientRect.Width();
int sh = clientRect.Height();
@@ -523,8 +523,6 @@ void QWidgetPrivate::show_sys()
QT_TRAP_THROWING(
factory->CreateResourceIndependentFurnitureL(ui);
- TRect boundingRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
-
CEikButtonGroupContainer *cba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba,
CEikButtonGroupContainer::EHorizontal,ui,R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
if (isFullscreen && !cbaRequested)
@@ -577,11 +575,13 @@ void QWidgetPrivate::show_sys()
// Fill client area if maximized OR
// Put window below status pane unless the window has an explicit position.
if (!isFullscreen) {
+ // Use QS60Data::clientRect to take into account that native keyboard
+ // might affect ClientRect() return value.
if (q->windowState() & Qt::WindowMaximized) {
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ TRect r = S60->clientRect();
id->SetExtent(r.iTl, r.Size());
} else if (!q->testAttribute(Qt::WA_Moved) && q->windowType() != Qt::Dialog) {
- id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl);
+ id->SetPosition(S60->clientRect().iTl);
}
}
@@ -1252,7 +1252,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
// normal mode after showing the status pane, the geometry would overlap so we should
// move it if it never had an explicit position.
if (!wasMoved && S60->statusPane() && decorationsVisible) {
- TPoint tl = static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl;
+ TPoint tl = S60->clientRect().iTl;
normalGeometry.setTopLeft(QPoint(tl.iX, tl.iY));
}
#endif