summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qapplication_s60.cpp49
-rw-r--r--src/gui/kernel/qdesktopwidget_s60.cpp2
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60.cpp54
-rw-r--r--src/gui/kernel/qt_s60_p.h3
-rw-r--r--src/gui/kernel/qwidget_s60.cpp12
5 files changed, 89 insertions, 31 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 086cfec..5ac9803 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)
@@ -908,6 +930,15 @@ TKeyResponse QSymbianControl::sendSymbianKeyEvent(const TKeyEvent &keyEvent, QEv
}
Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers);
+
+ TInt code = keyEvent.iCode;
+
+ if (mods == Qt::ControlModifier) {
+ //only support ctrl+a .. ctrl+z, 0x40 is the key value before Qt::Key_A
+ if (code > 0 && code < 27)
+ keyCode = 0x40 + code;
+ }
+
QKeyEventEx qKeyEvent(type, keyCode, mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods),
(keyEvent.iRepeats != 0), 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers);
QWidget *widget;
@@ -1435,7 +1466,9 @@ void QSymbianControl::handleClientAreaChange()
if (qwidget->isFullScreen() && !cbaVisibilityHint) {
SetExtentToWholeScreen();
} else if (qwidget->isMaximized() || (qwidget->isFullScreen() && cbaVisibilityHint)) {
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ // 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)) {
@@ -1443,7 +1476,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
}
@@ -1489,13 +1522,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);
}
}
}
@@ -1508,7 +1542,8 @@ void QSymbianControl::HandleResourceChange(int resourceType)
// client area.
if (S60->statusPane() && (S60->statusPane()->IsVisible() || m_lastStatusPaneVisibility)) {
m_lastStatusPaneVisibility = S60->statusPane()->IsVisible();
- handleClientAreaChange();
+ if (S60->handleStatusPaneResizeNotifications)
+ handleClientAreaChange();
}
if (IsFocused() && IsVisible()) {
qwidget->d_func()->setWindowIcon_sys(true);
@@ -1912,7 +1947,7 @@ void qt_cleanup()
qt_S60Beep = 0;
}
QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles
- QPixmapCache::clear(); // Has to happen now, since QS60PixmapData has FBS handles
+ QPixmapCache::clear(); // Has to happen now, since QSymbianRasterPixmapData has FBS handles
#ifdef QT_NO_FREETYPE
qt_cleanup_symbianFontDatabase();
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/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp
index acdb0e5..b5d0101 100644
--- a/src/gui/kernel/qsoftkeymanager_s60.cpp
+++ b/src/gui/kernel/qsoftkeymanager_s60.cpp
@@ -53,6 +53,10 @@
#include <eiksoftkeyimage.h>
#include <eikcmbut.h>
+#ifndef QT_NO_STYLE_S60
+#include <qs60style.h>
+#endif
+
#ifndef QT_NO_SOFTKEYMANAGER
QT_BEGIN_NAMESPACE
@@ -220,26 +224,42 @@ bool QSoftKeyManagerPrivateS60::isOrientationLandscape()
QSize QSoftKeyManagerPrivateS60::cbaIconSize(CEikButtonGroupContainer *cba, int position)
{
-
int index = position;
index += isOrientationLandscape() ? 0 : 1;
if(cachedCbaIconSize[index].isNull()) {
- // Only way I figured out to get CBA icon size without RnD SDK, was
- // to set some dummy icon to CBA first and then ask CBA button CCoeControl::Size()
- // The returned value is cached to avoid unnecessary icon setting every time.
- const bool left = (position == LSK_POSITION);
- if(position == LSK_POSITION || position == RSK_POSITION) {
- CEikImage* tmpImage = NULL;
- QT_TRAP_THROWING(tmpImage = new (ELeave) CEikImage);
- EikSoftkeyImage::SetImage(cba, *tmpImage, left); // Takes myimage ownership
- int command = S60_COMMAND_START + position;
- setNativeSoftkey(*cba, position, command, KNullDesC());
- cachedCbaIconSize[index] = qt_TSize2QSize(cba->ControlOrNull(command)->Size());
- EikSoftkeyImage::SetLabel(cba, left);
-
- if(cachedCbaIconSize[index] == QSize(138,72)) {
- // Hack for S60 5.0 (5800) landscape orientation, which return wrong icon size
- cachedCbaIconSize[index] = QSize(60,60);
+ if (QSysInfo::s60Version() >= QSysInfo::SV_S60_5_3) {
+ // S60 5.3 and later have fixed icon size on softkeys, while the button
+ // itself is bigger, so the automatic check doesn't work.
+ // Use custom pixel metrics to deduce the CBA icon size
+ int iconHeight = 30;
+ int iconWidth = 30;
+#ifndef QT_NO_STYLE_S60
+ QS60Style *s60Style = 0;
+ s60Style = qobject_cast<QS60Style *>(QApplication::style());
+ if (s60Style) {
+ iconWidth = s60Style->pixelMetric((QStyle::PixelMetric)PM_CbaIconWidth);
+ iconHeight = s60Style->pixelMetric((QStyle::PixelMetric)PM_CbaIconHeight);
+ }
+#endif
+ cachedCbaIconSize[index] = QSize(iconWidth, iconHeight);
+ } else {
+ // Only way I figured out to get CBA icon size without RnD SDK, was
+ // to set some dummy icon to CBA first and then ask CBA button CCoeControl::Size()
+ // The returned value is cached to avoid unnecessary icon setting every time.
+ const bool left = (position == LSK_POSITION);
+ if (position == LSK_POSITION || position == RSK_POSITION) {
+ CEikImage* tmpImage = NULL;
+ QT_TRAP_THROWING(tmpImage = new (ELeave) CEikImage);
+ EikSoftkeyImage::SetImage(cba, *tmpImage, left); // Takes tmpImage ownership
+ int command = S60_COMMAND_START + position;
+ setNativeSoftkey(*cba, position, command, KNullDesC());
+ cachedCbaIconSize[index] = qt_TSize2QSize(cba->ControlOrNull(command)->Size());
+ EikSoftkeyImage::SetLabel(cba, left);
+
+ if (cachedCbaIconSize[index] == QSize(138,72)) {
+ // Hack for S60 5.0 landscape orientation, which return wrong icon size
+ cachedCbaIconSize[index] = QSize(60,60);
+ }
}
}
}
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 67eb07b..c429b04 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -161,6 +161,7 @@ public:
int partial_keyboard : 1;
int partial_keyboardAutoTranslation : 1;
int partialKeyboardOpen : 1;
+ int handleStatusPaneResizeNotifications : 1;
QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
QPointer<QWidget> splitViewLastWidget;
@@ -198,6 +199,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;
@@ -353,6 +355,7 @@ inline QS60Data::QS60Data()
partial_keyboard(0),
partial_keyboardAutoTranslation(1),
partialKeyboardOpen(0),
+ handleStatusPaneResizeNotifications(1),
s60ApplicationFactory(0)
#ifdef Q_OS_SYMBIAN
,s60InstalledTrapHandler(0)
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 5672686..d6aaa3f 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -359,7 +359,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();
@@ -538,8 +538,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)
@@ -592,11 +590,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);
}
}
@@ -1267,7 +1267,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