summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWater-Team <water@pad.test.qt.nokia.com>2011-10-07 23:00:14 (GMT)
committerWater-Team <water@pad.test.qt.nokia.com>2011-10-07 23:00:14 (GMT)
commit34ad8bd00efbc4f76066826f068b3d7bff0152c0 (patch)
treeda24f8987e5e26d85024fe2b5e7342625bd04e78 /src
parent1e8479b2aa781e6ce3fadf01294023fbc6ddbc22 (diff)
parent95e5e8ff45d2aa8acda595186136b54f695bb9cb (diff)
downloadQt-34ad8bd00efbc4f76066826f068b3d7bff0152c0.zip
Qt-34ad8bd00efbc4f76066826f068b3d7bff0152c0.tar.gz
Qt-34ad8bd00efbc4f76066826f068b3d7bff0152c0.tar.bz2
Merge branch '4.8-upstream' into master-water
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qdeclarativeimport.cpp10
-rw-r--r--src/declarative/qml/qdeclarativepropertycache_p.h2
-rw-r--r--src/gui/dialogs/qfiledialog_win.cpp4
-rw-r--r--src/gui/dialogs/qwizard.cpp3
-rw-r--r--src/gui/egl/qegl.cpp32
-rw-r--r--src/gui/kernel/qapplication_win.cpp13
-rw-r--r--src/gui/kernel/qcursor_win.cpp2
-rw-r--r--src/gui/kernel/qguiplatformplugin.cpp4
-rw-r--r--src/gui/kernel/qwhatsthis.cpp4
-rw-r--r--src/gui/kernel/qwidget.cpp24
-rw-r--r--src/gui/kernel/qwidget_p.h1
-rw-r--r--src/gui/kernel/qwidget_s60.cpp58
-rw-r--r--src/gui/painting/qgraphicssystemex_symbian.cpp107
-rw-r--r--src/gui/styles/qstylefactory.cpp4
-rw-r--r--src/gui/styles/qwindowsstyle.cpp8
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp2
-rw-r--r--src/gui/styles/qwindowsxpstyle.cpp2
-rw-r--r--src/gui/widgets/qlinecontrol.cpp4
-rw-r--r--src/network/access/qhttpnetworkreply.cpp2
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp23
-rw-r--r--src/network/access/qnetworkreplyimpl_p.h2
-rw-r--r--src/network/kernel/qhostinfo_win.cpp5
-rw-r--r--src/opengl/qgl.cpp20
23 files changed, 263 insertions, 73 deletions
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp
index bf261ef..c2f0086 100644
--- a/src/declarative/qml/qdeclarativeimport.cpp
+++ b/src/declarative/qml/qdeclarativeimport.cpp
@@ -46,6 +46,7 @@
#include <QtCore/qfileinfo.h>
#include <QtCore/qpluginloader.h>
#include <QtCore/qlibraryinfo.h>
+#include <QtCore/qalgorithms.h>
#include <QtDeclarative/qdeclarativeextensioninterface.h>
#include <private/qdeclarativeglobal_p.h>
#include <private/qdeclarativetypenamecache_p.h>
@@ -734,8 +735,12 @@ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e)
}
RFs& fs = qt_s60GetRFs();
TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.constData()));
+ // Symbian searches should start from Y:. Fix start drive otherwise TFindFile starts from the session drive
+ _LIT(KStartDir, "Y:");
+ TFileName dirPath(KStartDir);
+ dirPath.Append(tempPathPtr);
TFindFile finder(fs);
- TInt err = finder.FindByDir(tempPathPtr, tempPathPtr);
+ TInt err = finder.FindByDir(tempPathPtr, dirPath);
while (err == KErrNone) {
QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()),
finder.File().Length());
@@ -743,6 +748,9 @@ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e)
addImportPath(foundDir);
err = finder.Find();
}
+ // TFindFile found the directories in the order we want, but addImportPath reverses it.
+ // Reverse the order again to get it right.
+ QAlgorithmsPrivate::qReverse(fileImportPath.begin(), fileImportPath.end());
} else {
addImportPath(installImportsPath);
}
diff --git a/src/declarative/qml/qdeclarativepropertycache_p.h b/src/declarative/qml/qdeclarativepropertycache_p.h
index 581f519..c648d25 100644
--- a/src/declarative/qml/qdeclarativepropertycache_p.h
+++ b/src/declarative/qml/qdeclarativepropertycache_p.h
@@ -111,7 +111,7 @@ public:
int relatedIndex; // When IsFunction
};
uint overrideIndexIsProperty : 1;
- int overrideIndex : 31;
+ signed int overrideIndex : 31;
int revision;
int metaObjectOffset;
diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp
index 32dbe4f..2d4769a 100644
--- a/src/gui/dialogs/qfiledialog_win.cpp
+++ b/src/gui/dialogs/qfiledialog_win.cpp
@@ -654,7 +654,7 @@ QStringList qt_win_get_open_file_names(const QFileDialogArgs &args,
// GetOpenFileName() will return only one folder name for all the files. To retrieve
// the correct path for all selected files, we have to use Common Item Dialog interfaces.
#ifndef Q_WS_WINCE
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
+ if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
return qt_win_CID_get_open_file_names(args, initialDirectory, filterLst, selectedFilter, idx);
#endif
@@ -741,7 +741,7 @@ static int __stdcall winGetExistDirCallbackProc(HWND hwnd,
QString qt_win_get_existing_directory(const QFileDialogArgs &args)
{
#ifndef Q_WS_WINCE
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
+ if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
return qt_win_CID_get_existing_directory(args);
#endif
diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp
index 83bdaa0..9f8d526 100644
--- a/src/gui/dialogs/qwizard.cpp
+++ b/src/gui/dialogs/qwizard.cpp
@@ -572,8 +572,7 @@ public:
#endif
}
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
+ if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
vistaInitPending = true;
#endif
}
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 2a37d45..6fe1c8c 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -684,6 +684,37 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglPr
else
props = 0;
EGLSurface surf;
+#ifdef Q_OS_SYMBIAN
+ // On Symbian there might be situations (especially on 32MB GPU devices)
+ // where Qt is trying to create EGL surface while some other application
+ // is still holding all available GPU memory but is about to release it
+ // soon. For an example when exiting native video recorder and going back to
+ // Qt application behind it. Video stack tear down takes some time and Qt
+ // app might be too quick in reserving its EGL surface and thus running out
+ // of GPU memory right away. So if EGL surface creation fails due to bad
+ // alloc, let's try recreating it four times within ~1 second if needed.
+ // This strategy gives some time for video recorder to tear down its stack
+ // and a chance to Qt for creating a valid surface.
+ int tries = 4;
+ while(tries--) {
+ if (devType == QInternal::Widget)
+ surf = eglCreateWindowSurface(QEgl::display(), cfg, windowDrawable, props);
+ else
+ surf = eglCreatePixmapSurface(QEgl::display(), cfg, pixmapDrawable, props);
+ if (surf == EGL_NO_SURFACE) {
+ EGLint error = eglGetError();
+ if (error == EGL_BAD_ALLOC) {
+ if (tries) {
+ User::After(1000 * 250); // 250ms
+ continue;
+ }
+ }
+ qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", error);
+ } else {
+ break;
+ }
+ }
+#else
if (devType == QInternal::Widget)
surf = eglCreateWindowSurface(QEgl::display(), cfg, windowDrawable, props);
else
@@ -691,6 +722,7 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglPr
if (surf == EGL_NO_SURFACE) {
qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
}
+#endif
return surf;
}
#endif
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index b84fe56..19e7ba5 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -682,7 +682,7 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
QColor menuText(qt_colorref2qrgb(GetSysColor(COLOR_MENUTEXT)));
BOOL isFlat = false;
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
SystemParametersInfo(SPI_GETFLATMENU, 0, &isFlat, 0);
QPalette menu(pal);
// we might need a special color group for the menu.
@@ -697,7 +697,7 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
menu.setColor(QPalette::Disabled, QPalette::Highlight,
QColor(qt_colorref2qrgb(GetSysColor(
(QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)
+ && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
&& isFlat ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT))));
menu.setColor(QPalette::Disabled, QPalette::HighlightedText, disabled);
menu.setColor(QPalette::Disabled, QPalette::Button,
@@ -719,7 +719,7 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
QApplication::setPalette(menu, "QMenu");
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) && isFlat) {
+ && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) && isFlat) {
QColor menubar(qt_colorref2qrgb(GetSysColor(COLOR_MENUBAR)));
menu.setColor(QPalette::Active, QPalette::Button, menubar);
menu.setColor(QPalette::Disabled, QPalette::Button, menubar);
@@ -982,7 +982,7 @@ const QString qt_reg_winclass(QWidget *w) // register window class
style = CS_DBLCLKS;
if (w->inherits("QTipLabel") || w->inherits("QAlphaWidget")) {
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) {
+ && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) {
style |= CS_DROPSHADOW;
}
cname = QLatin1String("QToolTip");
@@ -1000,7 +1000,7 @@ const QString qt_reg_winclass(QWidget *w) // register window class
style |= CS_SAVEBITS;
#endif
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
style |= CS_DROPSHADOW;
icon = false;
} else {
@@ -4144,7 +4144,8 @@ PtrCloseTouchInputHandle QApplicationPrivate::CloseTouchInputHandle = 0;
void QApplicationPrivate::initializeMultitouch_sys()
{
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
+ if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7
+ && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) {
static const int QT_SM_DIGITIZER = 94;
int value = GetSystemMetrics(QT_SM_DIGITIZER);
static const int QT_NID_INTEGRATED_TOUCH = 0x01;
diff --git a/src/gui/kernel/qcursor_win.cpp b/src/gui/kernel/qcursor_win.cpp
index cef83f5..a68472c 100644
--- a/src/gui/kernel/qcursor_win.cpp
+++ b/src/gui/kernel/qcursor_win.cpp
@@ -477,7 +477,7 @@ void QCursorData::update()
QPixmap pixmap = QApplicationPrivate::instance()->getPixmapCursor(cshape);
hcurs = create32BitCursor(pixmap, hx, hy);
}
- break;
+ return;
default:
qWarning("QCursor::update: Invalid cursor shape %d", cshape);
return;
diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp
index 708859d..04fd111 100644
--- a/src/gui/kernel/qguiplatformplugin.cpp
+++ b/src/gui/kernel/qguiplatformplugin.cpp
@@ -137,10 +137,10 @@ QString QGuiPlatformPlugin::styleName()
return QLatin1String("WindowsCE");
#elif defined(Q_WS_WIN)
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
return QLatin1String("WindowsVista");
else if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
return QLatin1String("WindowsXP");
else
return QLatin1String("Windows"); // default styles for Windows
diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp
index 5328cb1..da79250 100644
--- a/src/gui/kernel/qwhatsthis.cpp
+++ b/src/gui/kernel/qwhatsthis.cpp
@@ -227,7 +227,7 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor
}
#if defined(Q_WS_WIN)
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
{
BOOL shadow;
SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0);
@@ -305,7 +305,7 @@ void QWhatsThat::paintEvent(QPaintEvent*)
bool drawShadow = true;
#if defined(Q_WS_WIN)
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
{
BOOL shadow;
SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0);
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 0aa1dfa..9b5a283 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -2260,10 +2260,16 @@ void QWidgetPrivate::updateIsOpaque()
#endif
#ifdef Q_WS_S60
- if (q->windowType() == Qt::Dialog && q->testAttribute(Qt::WA_TranslucentBackground)
- && S60->avkonComponentsSupportTransparency) {
- setOpaque(false);
- return;
+ if (q->testAttribute(Qt::WA_TranslucentBackground)) {
+ if (q->windowType() & Qt::Dialog || q->windowType() & Qt::Popup) {
+ if (S60->avkonComponentsSupportTransparency) {
+ setOpaque(false);
+ return;
+ }
+ } else {
+ setOpaque(false);
+ return;
+ }
}
#endif
@@ -2283,11 +2289,16 @@ void QWidgetPrivate::updateIsOpaque()
}
if (q->isWindow() && !q->testAttribute(Qt::WA_NoSystemBackground)) {
+#ifdef Q_WS_S60
+ setOpaque(true);
+ return;
+#else
const QBrush &windowBrush = q->palette().brush(QPalette::Window);
if (windowBrush.style() != Qt::NoBrush && windowBrush.isOpaque()) {
setOpaque(true);
return;
}
+#endif
}
setOpaque(false);
}
@@ -10948,11 +10959,14 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
}
break;
case Qt::WA_TranslucentBackground:
+#if defined(Q_OS_SYMBIAN)
+ setAttribute(Qt::WA_NoSystemBackground, on);
+#else
if (on) {
setAttribute(Qt::WA_NoSystemBackground);
d->updateIsTranslucent();
}
-
+#endif
break;
case Qt::WA_AcceptTouchEvents:
#if defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN)
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index aefffb6..9ac9479 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -233,6 +233,7 @@ struct QTLWExtra {
uint inExpose : 1; // Prevents drawing recursion
uint nativeWindowTransparencyEnabled : 1; // Tracks native window transparency
uint forcedToRaster : 1;
+ uint noSystemRotationDisabled : 1;
#elif defined(Q_WS_QPA)
QPlatformWindow *platformWindow;
QPlatformWindowFormat platformWindowFormat;
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index e06b625..00661ae 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -804,19 +804,12 @@ void QWidgetPrivate::setConstraints_sys()
void QWidgetPrivate::s60UpdateIsOpaque()
{
Q_Q(QWidget);
-
if (!q->testAttribute(Qt::WA_WState_Created))
return;
-
const bool writeAlpha = extraData()->nativePaintMode == QWExtra::BlitWriteAlpha;
- if (!q->testAttribute(Qt::WA_TranslucentBackground) && !writeAlpha)
- return;
const bool requireAlphaChannel = !isOpaque || writeAlpha;
-
createTLExtra();
-
RWindow *const window = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow());
-
#ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE
if (QApplicationPrivate::instance()->useTranslucentEGLSurfaces
&& !extra->topextra->forcedToRaster) {
@@ -825,25 +818,47 @@ void QWidgetPrivate::s60UpdateIsOpaque()
return;
}
#endif
+ const bool recreateBackingStore = extra->topextra->backingStore.data() && (
+ QApplicationPrivate::graphics_system_name == QLatin1String("openvg") ||
+ QApplicationPrivate::graphics_system_name == QLatin1String("opengl")
+ );
if (requireAlphaChannel) {
- const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
- if (window->SetTransparencyAlphaChannel() == KErrNone) {
+ window->SetRequiredDisplayMode(EColor16MA);
+ if (window->SetTransparencyAlphaChannel() == KErrNone)
window->SetBackgroundColor(TRgb(255, 255, 255, 0));
- extra->topextra->nativeWindowTransparencyEnabled = 1;
- if (extra->topextra->backingStore.data() && (
- QApplicationPrivate::graphics_system_name == QLatin1String("openvg")
- || QApplicationPrivate::graphics_system_name == QLatin1String("opengl"))) {
- // Semi-transparent EGL surfaces aren't supported. We need to
- // recreate backing store to get translucent surface (raster surface).
- extra->topextra->backingStore.create(q);
- extra->topextra->backingStore.registerWidget(q);
- // FixNativeOrientation() will not work without an EGL surface.
+ } else {
+ if (recreateBackingStore) {
+ // Clear the UI surface to ensure that the EGL surface content is visible
+ CWsScreenDevice *screenDevice = S60->screenDevice(q);
+ QScopedPointer<CWindowGc> gc(new CWindowGc(screenDevice));
+ const int err = gc->Construct();
+ if (!err) {
+ gc->Activate(*window);
+ window->BeginRedraw();
+ gc->SetDrawMode(CWindowGc::EDrawModeWriteAlpha);
+ gc->SetBrushColor(TRgb(0, 0, 0, 0));
+ gc->Clear(TRect(0, 0, q->width(), q->height()));
+ window->EndRedraw();
+ }
+ }
+ if (extra->topextra->nativeWindowTransparencyEnabled)
+ window->SetTransparentRegion(TRegionFix<1>());
+ }
+ extra->topextra->nativeWindowTransparencyEnabled = requireAlphaChannel;
+ if (recreateBackingStore) {
+ extra->topextra->backingStore.create(q);
+ extra->topextra->backingStore.registerWidget(q);
+ bool noSystemRotationDisabled = false;
+ if (requireAlphaChannel) {
+ if (q->testAttribute(Qt::WA_SymbianNoSystemRotation)) {
+ // FixNativeOrientation() will not work without an EGL surface
q->setAttribute(Qt::WA_SymbianNoSystemRotation, false);
+ noSystemRotationDisabled = true;
}
+ } else {
+ q->setAttribute(Qt::WA_SymbianNoSystemRotation, extra->topextra->noSystemRotationDisabled);
}
- } else if (extra->topextra->nativeWindowTransparencyEnabled) {
- window->SetTransparentRegion(TRegionFix<1>());
- extra->topextra->nativeWindowTransparencyEnabled = 0;
+ extra->topextra->noSystemRotationDisabled = noSystemRotationDisabled;
}
}
@@ -1004,6 +1019,7 @@ void QWidgetPrivate::createTLSysExtra()
extra->topextra->inExpose = 0;
extra->topextra->nativeWindowTransparencyEnabled = 0;
extra->topextra->forcedToRaster = 0;
+ extra->topextra->noSystemRotationDisabled = 0;
}
void QWidgetPrivate::deleteTLSysExtra()
diff --git a/src/gui/painting/qgraphicssystemex_symbian.cpp b/src/gui/painting/qgraphicssystemex_symbian.cpp
index 4469704..32e040f 100644
--- a/src/gui/painting/qgraphicssystemex_symbian.cpp
+++ b/src/gui/painting/qgraphicssystemex_symbian.cpp
@@ -46,31 +46,108 @@
#include <e32property.h>
+#ifdef Q_SYMBIAN_SUPPORTS_SURFACES
+#include "private/qegl_p.h"
+#endif
+
QT_BEGIN_NAMESPACE
static bool bcm2727Initialized = false;
static bool bcm2727 = false;
+#ifdef Q_SYMBIAN_SUPPORTS_SURFACES
+typedef EGLBoolean (*NOK_resource_profiling)(EGLDisplay, EGLint, EGLint*, EGLint, EGLint*);
+#define EGL_PROF_TOTAL_MEMORY_NOK 0x3070
+#endif
+
+// Detect if Qt is running on BCM2727 chip.
+// BCM2727 is a special case on Symbian because
+// it has only 32MB GPU memory which exposes
+// significant limitations to hw accelerated UI.
bool QSymbianGraphicsSystemEx::hasBCM2727()
{
if (bcm2727Initialized)
return bcm2727;
- const TUid KIvePropertyCat = {0x2726beef};
- enum TIvePropertyChipType {
- EVCBCM2727B1 = 0x00000000,
- EVCBCM2763A0 = 0x04000100,
- EVCBCM2763B0 = 0x04000102,
- EVCBCM2763C0 = 0x04000103,
- EVCBCM2763C1 = 0x04000104,
- EVCBCMUnknown = 0x7fffffff
- };
-
- TInt chipType = EVCBCMUnknown;
- if (RProperty::Get(KIvePropertyCat, 0, chipType) == KErrNone) {
- if (chipType == EVCBCM2727B1)
+#ifdef Q_SYMBIAN_SUPPORTS_SURFACES
+ EGLDisplay display = QEgl::display();
+#if 1
+ // Hacky but fast ~0ms.
+ const char* vendor = eglQueryString(display, EGL_VENDOR);
+ if (strstr(vendor, "Broadcom")) {
+ const TUid KIvePropertyCat = {0x2726beef};
+ enum TIvePropertyChipType {
+ EVCBCM2727B1 = 0x00000000,
+ EVCBCM2763A0 = 0x04000100,
+ EVCBCM2763B0 = 0x04000102,
+ EVCBCM2763C0 = 0x04000103,
+ EVCBCM2763C1 = 0x04000104,
+ EVCBCMUnknown = 0x7fffffff
+ };
+
+ // Broadcom driver publishes KIvePropertyCat PS key on
+ // devices which are running on BCM2727 chip and post Anna Symbian.
+ TInt chipType = EVCBCMUnknown;
+ if (RProperty::Get(KIvePropertyCat, 0, chipType) == KErrNone) {
+ if (chipType == EVCBCM2727B1)
+ bcm2727 = true;
+ } else if (QSysInfo::symbianVersion() <= QSysInfo::SV_SF_3) {
+ // Device is running on Symbian Anna or older Symbian^3 in which
+ // KIvePropertyCat is not published. These ones are always 32MB devices.
+ bcm2727 = true;
+ } else {
+ // We have some other Broadcom chip on post Anna Symbian.
+ // Should have > 32MB GPU memory.
+ }
+ }
+#else
+ // Fool proof but takes 15-20ms and we don't want this delay on app startup...
+
+ // All devices with <= 32MB GPU memory should be
+ // dealed in similar manner to BCM2727
+ // So let's query max GPU memory amount.
+ NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK");
+ if (eglQueryProfilingData) {
+ EGLint dataCount;
+ eglQueryProfilingData(display,
+ EGL_PROF_QUERY_GLOBAL_BIT_NOK |
+ EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK,
+ NULL,
+ 0,
+ (EGLint*)&dataCount);
+
+ // Allocate room for the profiling data
+ EGLint* profData = (EGLint*)malloc(dataCount * sizeof(EGLint));
+ memset(profData,0,dataCount * sizeof(EGLint));
+
+ // Retrieve the profiling data
+ eglQueryProfilingData(display,
+ EGL_PROF_QUERY_GLOBAL_BIT_NOK |
+ EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK,
+ profData,
+ dataCount,
+ (EGLint*)&dataCount);
+
+ int totalMemory;
+ EGLint i = 0;
+ while (profData && i < dataCount) {
+ switch (profData[i++]) {
+ case EGL_PROF_TOTAL_MEMORY_NOK:
+ totalMemory = profData[i++];
+ break;
+ default:
+ i++;
+ }
+ }
+
+ // ok, hasBCM2727() naming is a bit misleading but Qt must
+ // behave the same on all chips like BCM2727 (<= 32MB GPU memory)
+ // and our code (and others) are already using this function.
+ if (totalMemory <= 33554432)
bcm2727 = true;
}
+#endif
+#endif // Q_SYMBIAN_SUPPORTS_SURFACES
bcm2727Initialized = true;
@@ -80,7 +157,9 @@ bool QSymbianGraphicsSystemEx::hasBCM2727()
void QSymbianGraphicsSystemEx::releaseCachedGpuResources()
{
// Do nothing here
- // This is implemented in graphics system specific plugin
+
+ // This virtual function should be implemented in graphics system specific
+ // plugin
}
void QSymbianGraphicsSystemEx::releaseAllGpuResources()
diff --git a/src/gui/styles/qstylefactory.cpp b/src/gui/styles/qstylefactory.cpp
index 83b6748..de693db 100644
--- a/src/gui/styles/qstylefactory.cpp
+++ b/src/gui/styles/qstylefactory.cpp
@@ -225,12 +225,12 @@ QStringList QStyleFactory::keys()
#endif
#ifndef QT_NO_STYLE_WINDOWSXP
if (!list.contains(QLatin1String("WindowsXP")) &&
- (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
list << QLatin1String("WindowsXP");
#endif
#ifndef QT_NO_STYLE_WINDOWSVISTA
if (!list.contains(QLatin1String("WindowsVista")) &&
- (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
+ (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
list << QLatin1String("WindowsVista");
#endif
#ifndef QT_NO_STYLE_MOTIF
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index 9732c7e..342c4c6 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -125,7 +125,7 @@ QWindowsStylePrivate::QWindowsStylePrivate()
{
#if defined(Q_WS_WIN) && !defined(Q_OS_WINCE)
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) {
+ && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) {
QSystemLibrary shellLib(QLatin1String("shell32"));
pSHGetStockIconInfo = (PtrSHGetStockIconInfo)shellLib.resolve("SHGetStockIconInfo");
}
@@ -1058,7 +1058,7 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl
case SP_VistaShield:
{
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based
+ && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)
&& pSHGetStockIconInfo)
{
QPixmap pixmap;
@@ -1200,7 +1200,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
case SH_LineEdit_PasswordCharacter:
{
#ifdef Q_WS_WIN
- if (widget && (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) {
+ if (widget && (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) {
const QFontMetrics &fm = widget->fontMetrics();
if (fm.inFont(QChar(0x25CF)))
ret = 0x25CF;
@@ -3362,7 +3362,7 @@ QIcon QWindowsStyle::standardIconImplementation(StandardPixmap standardIcon, con
case SP_VistaShield:
{
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
- && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based
+ && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)
&& pSHGetStockIconInfo)
{
icon.addPixmap(proxy()->standardPixmap(SP_VistaShield, option, widget)); //fetches small icon
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index f991cbc..5525468 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -140,7 +140,7 @@ bool QWindowsVistaStylePrivate::useVista()
{
return (QWindowsVistaStylePrivate::useXP() &&
(QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA &&
- QSysInfo::WindowsVersion < QSysInfo::WV_NT_based));
+ (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)));
}
/*!
diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp
index dd7f1f6..9934545 100644
--- a/src/gui/styles/qwindowsxpstyle.cpp
+++ b/src/gui/styles/qwindowsxpstyle.cpp
@@ -791,7 +791,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
inspectData = (tmt_transparentcolor != 0 || tmt_borderonly || proporigin == PO_PART || proporigin == PO_STATE);
// ### This is a vista-specific workaround for broken alpha in titlebar pixmaps
- if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) {
+ if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) {
if (themeData.partId == WP_CAPTION || themeData.partId == WP_SMALLCAPTION)
inspectData = false;
}
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index d58da37..0af2e59 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -445,6 +445,8 @@ void QLineControl::moveCursor(int pos, bool mark)
void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
{
int priorState = 0;
+ int originalSelectionStart = m_selstart;
+ int originalSelectionEnd = m_selend;
bool isGettingInput = !event->commitString().isEmpty()
|| event->preeditString() != preeditAreaText()
|| event->replacementLength() > 0;
@@ -523,6 +525,8 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
}
m_textLayout.setAdditionalFormats(formats);
updateDisplayText(/*force*/ true);
+ if (originalSelectionStart != m_selstart || originalSelectionEnd != m_selend)
+ emit selectionChanged();
if (cursorPositionChanged)
emitCursorPositionChanged();
else if (m_preeditCursor != oldPreeditCursor)
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index 1a02200..6173b39 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -891,7 +891,7 @@ bool QHttpNetworkReplyPrivate::expectContent()
|| statusCode == 204 || statusCode == 304)
return false;
if (request.operation() == QHttpNetworkRequest::Head)
- return !shouldEmitSignals();
+ return false; // no body expected for HEAD request
qint64 expectedContentLength = contentLength();
if (expectedContentLength == 0)
return false;
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 0b568d4..6f2daec 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -471,6 +471,7 @@ bool QNetworkReplyImplPrivate::isCachingEnabled() const
void QNetworkReplyImplPrivate::setCachingEnabled(bool enable)
{
+ Q_Q(QNetworkReplyImpl);
if (!enable && !cacheEnabled)
return; // nothing to do
if (enable && cacheEnabled)
@@ -493,15 +494,27 @@ void QNetworkReplyImplPrivate::setCachingEnabled(bool enable)
networkCache()->remove(url);
cacheSaveDevice = 0;
cacheEnabled = false;
+ QObject::disconnect(networkCache(), SIGNAL(destroyed()), q, SLOT(_q_cacheDestroyed()));
}
}
+void QNetworkReplyImplPrivate::_q_cacheDestroyed()
+{
+ //destruction of cache invalidates cacheSaveDevice
+ cacheSaveDevice = 0;
+ cacheEnabled = false;
+}
+
void QNetworkReplyImplPrivate::completeCacheSave()
{
- if (cacheEnabled && errorCode != QNetworkReplyImpl::NoError) {
- networkCache()->remove(url);
- } else if (cacheEnabled && cacheSaveDevice) {
- networkCache()->insert(cacheSaveDevice);
+ Q_Q(QNetworkReplyImpl);
+ if (cacheEnabled) {
+ if (errorCode != QNetworkReplyImpl::NoError) {
+ networkCache()->remove(url);
+ } else if (cacheSaveDevice) {
+ networkCache()->insert(cacheSaveDevice);
+ }
+ QObject::disconnect(networkCache(), SIGNAL(destroyed()), q, SLOT(_q_cacheDestroyed()));
}
cacheSaveDevice = 0;
cacheEnabled = false;
@@ -561,6 +574,8 @@ void QNetworkReplyImplPrivate::initCacheSaveDevice()
networkCache()->remove(url);
cacheSaveDevice = 0;
cacheEnabled = false;
+ } else {
+ q->connect(networkCache(), SIGNAL(destroyed()), SLOT(_q_cacheDestroyed()));
}
}
diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h
index 089c87e..286d8ea 100644
--- a/src/network/access/qnetworkreplyimpl_p.h
+++ b/src/network/access/qnetworkreplyimpl_p.h
@@ -104,6 +104,7 @@ public:
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected())
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed())
#endif
+ Q_PRIVATE_SLOT(d_func(), void _q_cacheDestroyed())
};
class QNetworkReplyImplPrivate: public QNetworkReplyPrivate
@@ -140,6 +141,7 @@ public:
void _q_networkSessionConnected();
void _q_networkSessionFailed();
#endif
+ void _q_cacheDestroyed();
void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request,
QIODevice *outgoingData);
diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp
index 1cbf350..58a5bee 100644
--- a/src/network/kernel/qhostinfo_win.cpp
+++ b/src/network/kernel/qhostinfo_win.cpp
@@ -102,7 +102,7 @@ static void resolveLibrary()
#if defined(Q_OS_WINCE)
#include <qmutex.h>
-QMutex qPrivCEMutex;
+Q_GLOBAL_STATIC(QMutex, qPrivCEMutex)
#endif
QHostInfo QHostInfoAgent::fromName(const QString &hostName)
@@ -110,8 +110,9 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
resolveLibrary();
#if defined(Q_OS_WINCE)
- QMutexLocker locker(&qPrivCEMutex);
+ QMutexLocker locker(qPrivCEMutex());
#endif
+
QWindowsSockInit winSock;
QHostInfo results;
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index cedccaa..423fa08 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -103,6 +103,7 @@
#ifdef Q_OS_SYMBIAN
#include <private/qgltexturepool_p.h>
+#include <private/qeglcontext_p.h>
#endif
// #define QT_GL_CONTEXT_RESOURCE_DEBUG
@@ -3432,8 +3433,25 @@ const QGLContext* QGLContext::currentContext()
return 0;
#else
QGLThreadContext *threadContext = qgl_context_storage.localData();
- if (threadContext)
+ if (threadContext) {
+#ifdef Q_OS_SYMBIAN
+ // Query the current context and return null if it is different.
+ // This is needed to support mixed VG-GL rendering.
+ // QtOpenVG is free to make a QEglContext current at any time and
+ // QGLContext gets no notification that its underlying QEglContext is
+ // not current anymore. We query directly from EGL to be thread-safe.
+ // QEglContext does not store all the contexts per-thread.
+ if (threadContext->context) {
+ QEglContext *eglcontext = threadContext->context->d_func()->eglContext;
+ if (eglcontext) {
+ EGLContext ctx = eglcontext->context();
+ if (ctx != eglGetCurrentContext())
+ return 0;
+ }
+ }
+#endif
return threadContext->context;
+ }
return 0;
#endif //Q_WS_QPA
}