From 8f7535c3939e78f0c397d32945b577a98c234980 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 29 Aug 2011 13:24:53 +0300 Subject: Fix pointer event mapping when windows are fixed to native orientation When the "fix native orientation" feature is enabled via WA_SymbianNoSystemRotation, QSymbianControl has to do an extra mapping for all pointer events because in this special mode the RWindow and thus the CCoeControl will "rotate" (i.e. will change their dimensions according to the orientation of the device), however the EGL window surface and the QWidget will remain locked to the native orientation of the device (typically portrait). This means that the pointer events will correspond to the current orientation of the device, which is not what Qt wants: typically a graphics view or similar will perform the transformation of the input events too, and therefore passing already-transformed events is wrong (as it would result in double transformation). To solve this, all pointer event coordinates are mapped back to the native orientation. This had a problem however: It only took the traditional portrait and landscape modes into account. When there are two landscape modes (i.e. rotations of both 90 and 270 degrees are supported), the mapping of pointer events generated wrong results in one of them because they treated them the same. The patch corrects this, so all three orientations will result in proper input behavior, even when NoSystemRotation is set. Task-number: QT-5236 Reviewed-by: Sami Merila --- src/gui/kernel/qapplication_s60.cpp | 15 +++++++++++---- src/gui/kernel/qt_s60_p.h | 27 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 5ac9803..58fd0a8 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -580,13 +580,20 @@ QPoint QSymbianControl::translatePointForFixedNativeOrientation(const TPoint &po { QPoint pos(pointerEventPos.iX, pointerEventPos.iY); if (qwidget->d_func()->fixNativeOrientationCalled) { - QSize wsize = qwidget->size(); - TSize size = Size(); + QSize wsize = qwidget->size(); // always same as the size in the native orientation + TSize size = Size(); // depends on the current orientation if (size.iWidth == wsize.height() && size.iHeight == wsize.width()) { qreal x = pos.x(); qreal y = pos.y(); - pos.setX(size.iHeight - y); - pos.setY(x); + if (S60->screenRotation == QS60Data::ScreenRotation90) { + // DisplayRightUp + pos.setX(size.iHeight - y); + pos.setY(x); + } else if (S60->screenRotation == QS60Data::ScreenRotation270) { + // DisplayLeftUp + pos.setX(y); + pos.setY(size.iWidth - x); + } } } return pos; diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 3ec4052..96b8141 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -77,6 +77,7 @@ #include // CAknContextPane #include // CEikStatusPane #include // MAknFadedComponent and TAknPopupFader +#include // EGraphicsOrientation constants #ifdef QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H #include // BeginFullScreen #include // BeginFullScreen @@ -213,6 +214,14 @@ public: int nativeScreenWidthInPixels; int nativeScreenHeightInPixels; + enum ScreenRotation { + ScreenRotation0, // portrait (or the native orientation) + ScreenRotation90, // typically DisplayLeftUp landscape + ScreenRotation180, // not used + ScreenRotation270 // DisplayRightUp landscape when 3-way orientation is supported + }; + ScreenRotation screenRotation; + int beginFullScreenCalled : 1; int endFullScreenCalled : 1; }; @@ -384,6 +393,24 @@ inline void QS60Data::updateScreenSize() inches = S60->screenWidthInTwips / (TReal)KTwipsPerInch; S60->defaultDpiX = S60->screenWidthInPixels / inches; + switch (params.iRotation) { + case CFbsBitGc::EGraphicsOrientationNormal: + S60->screenRotation = ScreenRotation0; + break; + case CFbsBitGc::EGraphicsOrientationRotated90: + S60->screenRotation = ScreenRotation90; + break; + case CFbsBitGc::EGraphicsOrientationRotated180: + S60->screenRotation = ScreenRotation180; + break; + case CFbsBitGc::EGraphicsOrientationRotated270: + S60->screenRotation = ScreenRotation270; + break; + default: + S60->screenRotation = ScreenRotation0; + break; + } + int screens = S60->screenCount(); for (int i = 0; i < screens; ++i) { CWsScreenDevice *dev = S60->screenDevice(i); -- cgit v0.12 From 726cf479c1c03a5562841aacb7c1e7677e711c90 Mon Sep 17 00:00:00 2001 From: Honglei Zhang Date: Tue, 30 Aug 2011 17:42:15 +0300 Subject: Fix QXmlSimpleReader auto test failer Bug fix for QTBUG-21025 has introduced a auto test failure. One added xml file has typo and failed a test driver. The extra charactor is removed from the test xml file. Task-number: QTBUG-21025 Reviewed-by: Trust Me --- tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml b/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml index 5550dab..0e7b9cc 100644 --- a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml +++ b/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/015.xml @@ -1,6 +1,5 @@ + ]> &e; - -- cgit v0.12 From 131647aa8f90ea90905eb376697998939df049d6 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 30 Aug 2011 14:58:33 +0300 Subject: Fix Symbian system date format parsing. System date format parsing didn't work correctly when the format was locale-dependent (i.e. didn't have %F). The abbreviations of day, month, and year where not taken into account if they were specified in their proper place, i.e. with %*D, %*M, or %*Y parameter. Task-number: QT-5237 Reviewed-by: Sami Merila --- src/corelib/tools/qlocale_symbian.cpp | 63 ++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index cdf0ab1..1214e46 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -195,7 +195,9 @@ QByteArray qt_symbianLocaleName(int code) return qt_resolveSymbianLocaleName(code, ISO); } -// order is: normal, abbr, nmode, nmode+abbr +// Rows are: normal, abbr, nmode, nmode+abbr +// First three values on a row are used for three component date, +// while the last two are used for two component date (i.e. no year). static const char *us_locale_dep[] = { "MM", "dd", "yyyy", "MM", "dd", "M", "d", "yy", "M", "d", @@ -214,6 +216,13 @@ static const char *jp_locale_dep[] = { "yyyy", "MMMM", "dd", "MMMM", "dd", "yy", "MMM", "d", "MMM", "d" }; +// 0 = day, 1 = month, 2 = year +static const int digit_map[] = { + 1, 0, 2, 1, 0, // American + 0, 1, 2, 0, 1, // European + 2, 1, 0, 1, 0 // Japanese +}; + /*! Returns a Qt version of the given \a sys_fmt Symbian locale format string. */ @@ -229,6 +238,9 @@ static QString s60ToQtFormat(const QString &sys_fmt) int i = 0; bool open_escape = false; bool abbrev_next = false; + bool abbrev_day = false; + bool abbrev_month = false; + bool abbrev_year = false; bool locale_indep_ordering = false; bool minus_mode = false; bool plus_mode = false; @@ -305,8 +317,11 @@ static QString s60ToQtFormat(const QString &sys_fmt) case 'D': { - if (!locale_indep_ordering) + if (!locale_indep_ordering) { + if (abbrev_next) + abbrev_day = true; break; + } if (!abbrev_next) result += QLatin1String("dd"); @@ -318,8 +333,11 @@ static QString s60ToQtFormat(const QString &sys_fmt) case 'M': { - if (!locale_indep_ordering) + if (!locale_indep_ordering) { + if (abbrev_next) + abbrev_month = true; break; + } if (!n_mode) { if (!abbrev_next) @@ -340,8 +358,11 @@ static QString s60ToQtFormat(const QString &sys_fmt) { n_mode = true; - if (!locale_indep_ordering) + if (!locale_indep_ordering) { + if (abbrev_next) + abbrev_month = true; break; + } if (!abbrev_next) result += QLatin1String("MMMM"); @@ -353,8 +374,11 @@ static QString s60ToQtFormat(const QString &sys_fmt) case 'Y': { - if (!locale_indep_ordering) + if (!locale_indep_ordering) { + if (abbrev_next) + abbrev_year = true; break; + } if (!abbrev_next) result += QLatin1String("yyyy"); @@ -522,7 +546,9 @@ static QString s60ToQtFormat(const QString &sys_fmt) const char **locale_dep; switch (df) { - default: // fallthru to american + default: + df = EDateAmerican; + // fallthru to american case EDateAmerican: locale_dep = us_locale_dep; break; @@ -534,12 +560,33 @@ static QString s60ToQtFormat(const QString &sys_fmt) break; } int offset = 0; - if (abbrev_next) + int adjustedDigit = c.digitValue() - 1; + + bool abbrev_this = abbrev_next; + // If abbreviation specified for this digit, use that. + // Otherwise abbreviate according to %D, %M, and %Y specified previously. + if (!abbrev_this) { + switch (digit_map[adjustedDigit + (static_cast(df) * 5)]) { + case 0: + abbrev_this = abbrev_day; + break; + case 1: + abbrev_this = abbrev_month; + break; + case 2: + abbrev_this = abbrev_year; + break; + default: + break; // never happens + } + } + + if (abbrev_this) offset += 5; if (n_mode) offset += 10; - result += QLatin1String(locale_dep[offset + (c.digitValue()-1)]); + result += QLatin1String(locale_dep[offset + (adjustedDigit)]); break; } -- cgit v0.12