summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-03-29 12:11:10 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-03-29 12:11:10 (GMT)
commit77ece74c2473c0f0c6a6d8bc229d447b19594da2 (patch)
treebd4f176e8f816e6201aee17c335b63035607b51f /src/gui
parent3bdff93c991bfabcaa729a89a2b171c562633ced (diff)
parent809583a34cb69367ecb4218f798a5928de9aacec (diff)
downloadQt-77ece74c2473c0f0c6a6d8bc229d447b19594da2.zip
Qt-77ece74c2473c0f0c6a6d8bc229d447b19594da2.tar.gz
Qt-77ece74c2473c0f0c6a6d8bc229d447b19594da2.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/egl/qegl.cpp13
-rw-r--r--src/gui/egl/qegl_p.h24
-rw-r--r--src/gui/styles/qmacstyle_mac.mm4
-rw-r--r--src/gui/text/qfontengine_mac.mm48
-rw-r--r--src/gui/widgets/qmenu_mac.mm6
5 files changed, 66 insertions, 29 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index b870523..f36904d 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -528,6 +528,11 @@ QEglProperties QEglContext::configProperties() const
return QEglProperties(config());
}
+#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_base)
+_eglCreateImageKHR eglCreateImageKHR = 0;
+_eglDestroyImageKHR eglDestroyImageKHR = 0;
+#endif
+
EGLDisplay QEgl::display()
{
static EGLDisplay dpy = EGL_NO_DISPLAY;
@@ -549,6 +554,14 @@ EGLDisplay QEgl::display()
qWarning() << "QEgl::display(): Cannot initialize EGL display:" << QEgl::errorString();
return EGL_NO_DISPLAY;
}
+
+ // Resolve the egl extension function pointers:
+#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_base)
+ if (QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_base")) {
+ eglCreateImageKHR = (_eglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR");
+ eglDestroyImageKHR = (_eglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR");
+ }
+#endif
}
return dpy;
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index 7dad9fe..c659796 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -100,13 +100,34 @@ typedef NativeDisplayType EGLNativeDisplayType;
QT_END_INCLUDE_NAMESPACE
#include <QtGui/qpaintdevice.h>
-
#include <QFlags>
QT_BEGIN_NAMESPACE
#define QEGL_NO_CONFIG ((EGLConfig)-1)
+#ifndef EGLAPIENTRY
+#define EGLAPIENTRY
+#endif
+
+#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_base)
+
+typedef void *EGLImageKHR;
+#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
+#define EGL_IMAGE_PRESERVED_KHR 0x30D2
+
+typedef EGLImageKHR (EGLAPIENTRY *_eglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, EGLint*);
+typedef EGLBoolean (EGLAPIENTRY *_eglDestroyImageKHR)(EGLDisplay, EGLImageKHR);
+
+// Defined in qegl.cpp:
+extern Q_GUI_EXPORT _eglCreateImageKHR eglCreateImageKHR;
+extern Q_GUI_EXPORT _eglDestroyImageKHR eglDestroyImageKHR;
+
+#endif // !defined(EGL_KHR_image) && !defined(EGL_KHR_image_base)
+
+#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_pixmap)
+#define EGL_NATIVE_PIXMAP_KHR 0x30B0
+#endif
class QEglProperties;
@@ -132,7 +153,6 @@ namespace QEgl {
};
Q_DECLARE_FLAGS(ConfigOptions, ConfigOption);
-
// Most of the time we use the same config for things like widgets & pixmaps, so rather than
// go through the eglChooseConfig loop every time, we use defaultConfig, which will return
// the config for a particular device/api/option combo. This function assumes that once a
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 7097291..074dd89 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -434,13 +434,13 @@ static inline bool isTreeView(const QWidget *widget)
QString qt_mac_removeMnemonics(const QString &original)
{
- // copied from qt_format_text (to be bug-for-bug compatible).
QString returnText(original.size(), 0);
int finalDest = 0;
int currPos = 0;
int l = original.length();
while (l) {
- if (original.at(currPos) == QLatin1Char('&')) {
+ if (original.at(currPos) == QLatin1Char('&')
+ && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) {
++currPos;
--l;
if (l == 0)
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index 3f84544..0bfdbc0 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -306,8 +306,8 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
outAdvances_y[idx] = QFixed::fromReal(tmpPoints[i + 1].y - tmpPoints[i].y);
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
- outAdvances_x[idx] = outAdvances_x[idx].ceil();
- outAdvances_y[idx] = outAdvances_y[idx].ceil();
+ outAdvances_x[idx] = outAdvances_x[idx].round();
+ outAdvances_y[idx] = outAdvances_y[idx].round();
}
}
CGSize lastGlyphAdvance;
@@ -316,7 +316,7 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
outGlyphs[rtl ? 0 : (glyphCount - 1)] = tmpGlyphs[glyphCount - 1] | fontIndex;
outAdvances_x[rtl ? 0 : (glyphCount - 1)] =
(fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? QFixed::fromReal(lastGlyphAdvance.width).ceil()
+ ? QFixed::fromReal(lastGlyphAdvance.width).round()
: QFixed::fromReal(lastGlyphAdvance.width);
}
outGlyphs += glyphCount;
@@ -389,7 +389,7 @@ glyph_metrics_t QCoreTextFontEngine::boundingBox(const QGlyphLayout &glyphs)
QFixed w;
for (int i = 0; i < glyphs.numGlyphs; ++i) {
w += (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? glyphs.effectiveAdvance(i).ceil()
+ ? glyphs.effectiveAdvance(i).round()
: glyphs.effectiveAdvance(i);
}
return glyph_metrics_t(0, -(ascent()), w, ascent()+descent(), w, 0);
@@ -409,8 +409,8 @@ glyph_metrics_t QCoreTextFontEngine::boundingBox(glyph_t glyph)
ret.yoff = QFixed::fromReal(advances[0].height);
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
- ret.xoff = ret.xoff.ceil();
- ret.yoff = ret.yoff.ceil();
+ ret.xoff = ret.xoff.round();
+ ret.yoff = ret.yoff.round();
}
return ret;
@@ -419,14 +419,14 @@ glyph_metrics_t QCoreTextFontEngine::boundingBox(glyph_t glyph)
QFixed QCoreTextFontEngine::ascent() const
{
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? QFixed::fromReal(CTFontGetAscent(ctfont)).ceil()
+ ? QFixed::fromReal(CTFontGetAscent(ctfont)).round()
: QFixed::fromReal(CTFontGetAscent(ctfont));
}
QFixed QCoreTextFontEngine::descent() const
{
QFixed d = QFixed::fromReal(CTFontGetDescent(ctfont));
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- d = d.ceil();
+ d = d.round();
// subtract a pixel to even out the historical +1 in QFontMetrics::height().
// Fix in Qt 5.
@@ -435,20 +435,20 @@ QFixed QCoreTextFontEngine::descent() const
QFixed QCoreTextFontEngine::leading() const
{
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? QFixed::fromReal(CTFontGetLeading(ctfont)).ceil()
+ ? QFixed::fromReal(CTFontGetLeading(ctfont)).round()
: QFixed::fromReal(CTFontGetLeading(ctfont));
}
QFixed QCoreTextFontEngine::xHeight() const
{
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? QFixed::fromReal(CTFontGetXHeight(ctfont)).ceil()
+ ? QFixed::fromReal(CTFontGetXHeight(ctfont)).round()
: QFixed::fromReal(CTFontGetXHeight(ctfont));
}
QFixed QCoreTextFontEngine::averageCharWidth() const
{
// ### Need to implement properly and get the information from the OS/2 Table.
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? QFontEngine::averageCharWidth().ceil()
+ ? QFontEngine::averageCharWidth().round()
: QFontEngine::averageCharWidth();
}
@@ -888,8 +888,8 @@ static OSStatus atsuPostLayoutCallback(ATSULayoutOperationSelector selector, ATS
QFixed xAdvance = FixedToQFixed(layoutData[glyphIdx + 1].realPos - layoutData[glyphIdx].realPos);
if (nfo->styleStrategy & QFont::ForceIntegerMetrics) {
- yAdvance = yAdvance.ceil();
- xAdvance = xAdvance.ceil();
+ yAdvance = yAdvance.round();
+ xAdvance = xAdvance.round();
}
if (glyphId != 0xffff || i == 0) {
@@ -1403,8 +1403,8 @@ void QFontEngineMac::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla
glyphs->advances_y[i] = QFixed::fromReal(metrics[i].deviceAdvance.y);
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
- glyphs->advances_x[i] = glyphs->advances_x[i].ceil();
- glyphs->advances_y[i] = glyphs->advances_y[i].ceil();
+ glyphs->advances_x[i] = glyphs->advances_x[i].round();
+ glyphs->advances_y[i] = glyphs->advances_y[i].round();
}
}
}
@@ -1414,7 +1414,7 @@ glyph_metrics_t QFontEngineMac::boundingBox(const QGlyphLayout &glyphs)
QFixed w;
for (int i = 0; i < glyphs.numGlyphs; ++i) {
w += (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? glyphs.effectiveAdvance(i).ceil()
+ ? glyphs.effectiveAdvance(i).round()
: glyphs.effectiveAdvance(i);
}
return glyph_metrics_t(0, -(ascent()), w, ascent()+descent(), w, 0);
@@ -1444,8 +1444,8 @@ glyph_metrics_t QFontEngineMac::boundingBox(glyph_t glyph)
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
gm.x = gm.x.floor();
gm.y = gm.y.floor();
- gm.xoff = gm.xoff.ceil();
- gm.yoff = gm.yoff.ceil();
+ gm.xoff = gm.xoff.round();
+ gm.yoff = gm.yoff.round();
}
return gm;
@@ -1454,7 +1454,7 @@ glyph_metrics_t QFontEngineMac::boundingBox(glyph_t glyph)
QFixed QFontEngineMac::ascent() const
{
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? m_ascent.ceil()
+ ? m_ascent.round()
: m_ascent;
}
@@ -1463,35 +1463,35 @@ QFixed QFontEngineMac::descent() const
// subtract a pixel to even out the historical +1 in QFontMetrics::height().
// Fix in Qt 5.
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? m_descent.ceil() - 1
+ ? m_descent.round() - 1
: m_descent;
}
QFixed QFontEngineMac::leading() const
{
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? m_leading.ceil()
+ ? m_leading.round()
: m_leading;
}
qreal QFontEngineMac::maxCharWidth() const
{
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? qCeil(m_maxCharWidth)
+ ? qRound(m_maxCharWidth)
: m_maxCharWidth;
}
QFixed QFontEngineMac::xHeight() const
{
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? m_xHeight.ceil()
+ ? m_xHeight.round()
: m_xHeight;
}
QFixed QFontEngineMac::averageCharWidth() const
{
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? m_averageCharWidth.ceil()
+ ? m_averageCharWidth.round()
: m_averageCharWidth;
}
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index 9a14ce6..6a0eb53 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -1391,7 +1391,11 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action)
} else {
[item setTitle: qt_mac_QStringToNSString(finalString)];
}
- [item setTitle:qt_mac_QStringToNSString(qt_mac_removeMnemonics(text))];
+
+ if (action->action->menuRole() == QAction::AboutRole || action->action->menuRole() == QAction::QuitRole)
+ [item setTitle:qt_mac_QStringToNSString(text)];
+ else
+ [item setTitle:qt_mac_QStringToNSString(qt_mac_removeMnemonics(text))];
// Cocoa Enabled
[item setEnabled: action->action->isEnabled()];