summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2011-06-27 12:27:54 +0200
committerJørgen Lind <jorgen.lind@nokia.com>2011-06-27 12:27:54 +0200
commit18a3f6169bb8a763366003d92b8013950578c79f (patch)
treee39fa00a9511410fea9be35a6130007e43719ad8 /src/widgets
parent371d398f70e10408e0eaba7b5f05e638a0048599 (diff)
parenta06c8405d053b16327d65415f3335eceb37abd3b (diff)
Merge remote-tracking branch 'base/master' into refactor
Conflicts: demos/demos.pro demos/embedded/digiflip/digiflip.pro examples/examples.pro examples/graphicsview/embeddeddialogs/embeddeddialogs.pro src/gui/kernel/qplatformglcontext_qpa.cpp src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp src/plugins/platforms/wayland/qwaylanddisplay.cpp src/plugins/platforms/wayland/qwaylandwindow.cpp Change-Id: I2a4ec9e2ca9c9aa9d57b55f98985e810b77bb745
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/platforms/mac/qfontengine_coretext_p.h8
-rw-r--r--src/widgets/platforms/mac/qwidget_mac.mm2
-rw-r--r--src/widgets/platforms/x11/qfontdatabase_x11.cpp55
-rw-r--r--src/widgets/platforms/x11/qfontengine_x11.cpp28
-rw-r--r--src/widgets/styles/qcommonstyle.cpp2
-rw-r--r--src/widgets/util/qscroller_mac.mm4
6 files changed, 45 insertions, 54 deletions
diff --git a/src/widgets/platforms/mac/qfontengine_coretext_p.h b/src/widgets/platforms/mac/qfontengine_coretext_p.h
index 3ca8a0ad60..b531856a27 100644
--- a/src/widgets/platforms/mac/qfontengine_coretext_p.h
+++ b/src/widgets/platforms/mac/qfontengine_coretext_p.h
@@ -46,6 +46,10 @@
#if !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
class QRawFontPrivate;
class QCoreTextFontEngineMulti;
class QCoreTextFontEngine : public QFontEngine
@@ -143,6 +147,10 @@ private:
CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef);
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
#endif// !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
#endif // QFONTENGINE_CORETEXT_P_H
diff --git a/src/widgets/platforms/mac/qwidget_mac.mm b/src/widgets/platforms/mac/qwidget_mac.mm
index 3a025e9237..4adaa6b288 100644
--- a/src/widgets/platforms/mac/qwidget_mac.mm
+++ b/src/widgets/platforms/mac/qwidget_mac.mm
@@ -5018,7 +5018,7 @@ void QWidgetPrivate::registerTouchWindow(bool enable)
if (enable == touchEventsEnabled)
return;
- QCocoaView *view = static_cast<QCocoaView *>(qt_mac_effectiveview_for(q));
+ QT_MANGLE_NAMESPACE(QCocoaView) *view = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(qt_mac_effectiveview_for(q));
if (!view)
return;
diff --git a/src/widgets/platforms/x11/qfontdatabase_x11.cpp b/src/widgets/platforms/x11/qfontdatabase_x11.cpp
index 754334c0c4..958daa2506 100644
--- a/src/widgets/platforms/x11/qfontdatabase_x11.cpp
+++ b/src/widgets/platforms/x11/qfontdatabase_x11.cpp
@@ -1566,9 +1566,8 @@ static FcPattern *getFcPattern(const QFontPrivate *fp, int script, const QFontDe
qt_addPatternProps(pattern, fp->screen, script, request);
- FcDefaultSubstitute(pattern);
FcConfigSubstitute(0, pattern, FcMatchPattern);
- FcConfigSubstitute(0, pattern, FcMatchFont);
+ FcDefaultSubstitute(pattern);
// these should only get added to the pattern _after_ substitution
// append the default fallback font for the specified script
@@ -1606,35 +1605,20 @@ static void FcFontSetRemove(FcFontSet *fs, int at)
memmove(fs->fonts + at, fs->fonts + at + 1, len);
}
-static QFontEngine *tryPatternLoad(FcPattern *p, int screen,
- const QFontDef &request, int script, FcPattern **matchedPattern = 0)
+static QFontEngine *tryPatternLoad(FcPattern *match, int screen,
+ const QFontDef &request, int script)
{
#ifdef FONT_MATCH_DEBUG
FcChar8 *fam;
- FcPatternGetString(p, FC_FAMILY, 0, &fam);
+ FcPatternGetString(match, FC_FAMILY, 0, &fam);
FM_DEBUG("==== trying %s\n", fam);
#endif
FM_DEBUG("passes charset test\n");
- FcPattern *pattern = FcPatternDuplicate(p);
- // add properties back in as the font selected from the
- // list doesn't contain them.
- qt_addPatternProps(pattern, screen, script, request);
-
- FcConfigSubstitute(0, pattern, FcMatchPattern);
- FcDefaultSubstitute(pattern);
- FcResult res;
- FcPattern *match = FcFontMatch(0, pattern, &res);
-
- if (matchedPattern)
- *matchedPattern = 0;
QFontEngineX11FT *engine = 0;
if (!match) // probably no fonts available.
goto done;
- if (matchedPattern)
- *matchedPattern = FcPatternDuplicate(match);
-
if (script != QUnicodeTables::Common) {
// skip font if it doesn't support the language we want
if (specialChars[script]) {
@@ -1673,11 +1657,6 @@ static QFontEngine *tryPatternLoad(FcPattern *p, int screen,
}
}
done:
- FcPatternDestroy(pattern);
- if (!engine && matchedPattern && *matchedPattern) {
- FcPatternDestroy(*matchedPattern);
- *matchedPattern = 0;
- }
return engine;
}
@@ -1726,14 +1705,26 @@ static QFontEngine *loadFc(const QFontPrivate *fp, int script, const QFontDef &r
#endif
QFontEngine *fe = 0;
- FcPattern *matchedPattern = 0;
- fe = tryPatternLoad(pattern, fp->screen, request, script, &matchedPattern);
+ FcResult res;
+ FcPattern *match = FcFontMatch(0, pattern, &res);
+ fe = tryPatternLoad(match, fp->screen, request, script);
if (!fe) {
FcFontSet *fs = qt_fontSetForPattern(pattern, request);
+ if (match) {
+ FcPatternDestroy(match);
+ match = 0;
+ }
+
if (fs) {
- for (int i = 0; !fe && i < fs->nfont; ++i)
- fe = tryPatternLoad(fs->fonts[i], fp->screen, request, script, &matchedPattern);
+ for (int i = 0; !fe && i < fs->nfont; ++i) {
+ match = FcFontRenderPrepare(NULL, pattern, fs->fonts[i]);
+ fe = tryPatternLoad(match, fp->screen, request, script);
+ if (fe)
+ break;
+ FcPatternDestroy(match);
+ match = 0;
+ }
FcFontSetDestroy(fs);
}
FM_DEBUG("engine for script %d is %s\n", script, fe ? fe->fontDef.family.toLatin1().data(): "(null)");
@@ -1741,11 +1732,11 @@ static QFontEngine *loadFc(const QFontPrivate *fp, int script, const QFontDef &r
if (fe
&& script == QUnicodeTables::Common
&& !(request.styleStrategy & QFont::NoFontMerging) && !fe->symbol) {
- fe = new QFontEngineMultiFT(fe, matchedPattern, pattern, fp->screen, request);
+ fe = new QFontEngineMultiFT(fe, match, pattern, fp->screen, request);
} else {
FcPatternDestroy(pattern);
- if (matchedPattern)
- FcPatternDestroy(matchedPattern);
+ if (match)
+ FcPatternDestroy(match);
}
return fe;
}
diff --git a/src/widgets/platforms/x11/qfontengine_x11.cpp b/src/widgets/platforms/x11/qfontengine_x11.cpp
index 9918f82bf7..c23fb0c174 100644
--- a/src/widgets/platforms/x11/qfontengine_x11.cpp
+++ b/src/widgets/platforms/x11/qfontengine_x11.cpp
@@ -863,11 +863,8 @@ glyph_t QFontEngineXLFD::glyphIndexToFreetypeGlyphIndex(glyph_t g) const
// Multi FT engine
// ------------------------------------------------------------------
-static QFontEngine *engineForPattern(FcPattern *pattern, const QFontDef &request,
- int screen)
+static QFontEngine *engineForPattern(FcPattern *match, const QFontDef &request, int screen)
{
- FcResult res;
- FcPattern *match = FcFontMatch(0, pattern, &res);
QFontEngineX11FT *engine = new QFontEngineX11FT(match, request, screen);
if (!engine->invalid())
return engine;
@@ -879,9 +876,9 @@ static QFontEngine *engineForPattern(FcPattern *pattern, const QFontDef &request
}
QFontEngineMultiFT::QFontEngineMultiFT(QFontEngine *fe, FcPattern *matchedPattern, FcPattern *p, int s, const QFontDef &req)
- : QFontEngineMulti(2), request(req), pattern(p), firstEnginePattern(matchedPattern), fontSet(0), screen(s)
+ : QFontEngineMulti(2), request(req), pattern(p), fontSet(0), screen(s)
{
-
+ firstEnginePattern = FcPatternDuplicate(matchedPattern);
engines[0] = fe;
engines.at(0)->ref.ref();
fontDef = engines[0]->fontDef;
@@ -907,8 +904,6 @@ void QFontEngineMultiFT::loadEngine(int at)
extern QMutex *qt_fontdatabase_mutex();
QMutexLocker locker(qt_fontdatabase_mutex());
- extern void qt_addPatternProps(FcPattern *pattern, int screen, int script,
- const QFontDef &request);
extern QFontDef qt_FcPatternToQFontDef(FcPattern *pattern, const QFontDef &);
extern FcFontSet *qt_fontSetForPattern(FcPattern *pattern, const QFontDef &request);
@@ -940,22 +935,18 @@ void QFontEngineMultiFT::loadEngine(int at)
Q_ASSERT(at < engines.size());
Q_ASSERT(engines.at(at) == 0);
- FcPattern *pattern = FcPatternDuplicate(fontSet->fonts[at + firstFontIndex - 1]);
- qt_addPatternProps(pattern, screen, QUnicodeTables::Common, request);
-
- QFontDef fontDef = qt_FcPatternToQFontDef(pattern, this->request);
+ FcPattern *match = FcFontRenderPrepare(NULL, pattern, fontSet->fonts[at + firstFontIndex - 1]);
+ QFontDef fontDef = qt_FcPatternToQFontDef(match, this->request);
// note: we use -1 for the script to make sure that we keep real
// FT engines separate from Multi engines in the font cache
QFontCache::Key key(fontDef, -1, screen);
QFontEngine *fontEngine = QFontCache::instance()->findEngine(key);
if (!fontEngine) {
- FcConfigSubstitute(0, pattern, FcMatchPattern);
- FcDefaultSubstitute(pattern);
- fontEngine = engineForPattern(pattern, request, screen);
+ fontEngine = engineForPattern(match, request, screen);
QFontCache::instance()->insertEngine(key, fontEngine);
}
- FcPatternDestroy(pattern);
+ FcPatternDestroy(match);
fontEngine->ref.ref();
engines[at] = fontEngine;
}
@@ -1123,17 +1114,14 @@ QFontEngineX11FT::QFontEngineX11FT(FcPattern *pattern, const QFontDef &fd, int s
}
#endif
- if (!init(face_id, antialias, defaultFormat)) {
- FcPatternDestroy(pattern);
+ if (!init(face_id, antialias, defaultFormat))
return;
- }
if (!freetype->charset) {
FcCharSet *cs;
FcPatternGetCharSet (pattern, FC_CHARSET, 0, &cs);
freetype->charset = FcCharSetCopy(cs);
}
- FcPatternDestroy(pattern);
}
QFontEngineX11FT::~QFontEngineX11FT()
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index e5171d854a..ad0e151051 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -5292,7 +5292,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
pixmap = QIcon::fromTheme(QLatin1String("media-seek-backward")).pixmap(16);
break;
case SP_MediaSkipForward:
- pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16);
+ pixmap = QIcon::fromTheme(QLatin1String("media-skip-forward")).pixmap(16);
break;
case SP_MediaSkipBackward:
pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16);
diff --git a/src/widgets/util/qscroller_mac.mm b/src/widgets/util/qscroller_mac.mm
index c0ef4a1665..81d18aaf6b 100644
--- a/src/widgets/util/qscroller_mac.mm
+++ b/src/widgets/util/qscroller_mac.mm
@@ -47,6 +47,8 @@
#include "qscroller_p.h"
+QT_BEGIN_NAMESPACE
+
QPointF QScrollerPrivate::realDpi(int screen)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -68,4 +70,6 @@ QPointF QScrollerPrivate::realDpi(int screen)
[pool release];
}
+QT_END_NAMESPACE
+
#endif