summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/clipboard/qmacmime.mm9
-rw-r--r--src/platformsupport/eglconvenience/qeglconvenience.cpp31
-rw-r--r--src/platformsupport/fontdatabases/basic/basic.pri1
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp2
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm5
5 files changed, 37 insertions, 11 deletions
diff --git a/src/platformsupport/clipboard/qmacmime.mm b/src/platformsupport/clipboard/qmacmime.mm
index 27a490335b..6fcd19e07b 100644
--- a/src/platformsupport/clipboard/qmacmime.mm
+++ b/src/platformsupport/clipboard/qmacmime.mm
@@ -48,6 +48,7 @@
#include "qmacmime_p.h"
#include "qguiapplication.h"
+#include "private/qcore_mac_p.h"
QT_BEGIN_NAMESPACE
@@ -335,9 +336,9 @@ QVariant QMacPasteboardMimePlainTextFallback::convertToMime(const QString &mimet
// Note that public.text is documented by Apple to have an undefined encoding. From
// testing it seems that utf8 is normally used, at least by Safari on iOS.
const QByteArray &firstData = data.first();
- return QString::fromCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
+ return QString(QCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
reinterpret_cast<const UInt8 *>(firstData.constData()),
- firstData.size(), kCFStringEncodingUTF8, false));
+ firstData.size(), kCFStringEncodingUTF8, false)));
} else {
qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
}
@@ -410,9 +411,9 @@ QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, Q
// I can only handle two types (system and unicode) so deal with them that way
QVariant ret;
if (flavor == QLatin1String("public.utf8-plain-text")) {
- ret = QString::fromCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
+ ret = QString(QCFString(CFStringCreateWithBytes(kCFAllocatorDefault,
reinterpret_cast<const UInt8 *>(firstData.constData()),
- firstData.size(), CFStringGetSystemEncoding(), false));
+ firstData.size(), CFStringGetSystemEncoding(), false)));
} else if (flavor == QLatin1String("public.utf16-plain-text")) {
ret = QString(reinterpret_cast<const QChar *>(firstData.constData()),
firstData.size() / sizeof(QChar));
diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp
index 80153cd18f..f3a135a499 100644
--- a/src/platformsupport/eglconvenience/qeglconvenience.cpp
+++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp
@@ -37,8 +37,8 @@
#ifdef Q_OS_LINUX
#include <sys/ioctl.h>
#include <linux/fb.h>
-#include <private/qmath_p.h>
#endif
+#include <private/qmath_p.h>
#include "qeglconvenience_p.h"
@@ -448,10 +448,13 @@ void q_printEglConfig(EGLDisplay display, EGLConfig config)
}
}
-#ifdef Q_OS_LINUX
+#ifdef Q_OS_UNIX
QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize)
{
+#ifndef Q_OS_LINUX
+ Q_UNUSED(framebufferDevice)
+#endif
const int defaultPhysicalDpi = 100;
static QSizeF size;
@@ -466,10 +469,11 @@ QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize
return size;
}
- struct fb_var_screeninfo vinfo;
int w = -1;
int h = -1;
QSize screenResolution;
+#ifdef Q_OS_LINUX
+ struct fb_var_screeninfo vinfo;
if (framebufferDevice != -1) {
if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) == -1) {
@@ -479,7 +483,9 @@ QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize
h = vinfo.height;
screenResolution = QSize(vinfo.xres, vinfo.yres);
}
- } else {
+ } else
+#endif
+ {
// Use the provided screen size, when available, since some platforms may have their own
// specific way to query it. Otherwise try querying it from the framebuffer.
screenResolution = screenSize.isEmpty() ? q_screenSizeFromFb(framebufferDevice) : screenSize;
@@ -499,6 +505,9 @@ QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize
QSize q_screenSizeFromFb(int framebufferDevice)
{
+#ifndef Q_OS_LINUX
+ Q_UNUSED(framebufferDevice)
+#endif
const int defaultWidth = 800;
const int defaultHeight = 600;
static QSize size;
@@ -513,6 +522,7 @@ QSize q_screenSizeFromFb(int framebufferDevice)
return size;
}
+#ifdef Q_OS_LINUX
struct fb_var_screeninfo vinfo;
int xres = -1;
int yres = -1;
@@ -528,6 +538,10 @@ QSize q_screenSizeFromFb(int framebufferDevice)
size.setWidth(xres <= 0 ? defaultWidth : xres);
size.setHeight(yres <= 0 ? defaultHeight : yres);
+#else
+ size.setWidth(defaultWidth);
+ size.setHeight(defaultHeight);
+#endif
}
return size;
@@ -535,10 +549,14 @@ QSize q_screenSizeFromFb(int framebufferDevice)
int q_screenDepthFromFb(int framebufferDevice)
{
+#ifndef Q_OS_LINUX
+ Q_UNUSED(framebufferDevice)
+#endif
const int defaultDepth = 32;
static int depth = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DEPTH");
if (depth == 0) {
+#ifdef Q_OS_LINUX
struct fb_var_screeninfo vinfo;
if (framebufferDevice != -1) {
@@ -550,11 +568,14 @@ int q_screenDepthFromFb(int framebufferDevice)
if (depth <= 0)
depth = defaultDepth;
+#else
+ depth = defaultDepth;
+#endif
}
return depth;
}
-#endif // Q_OS_LINUX
+#endif // Q_OS_UNIX
QT_END_NAMESPACE
diff --git a/src/platformsupport/fontdatabases/basic/basic.pri b/src/platformsupport/fontdatabases/basic/basic.pri
index 88be809cd8..c2b882ed5a 100644
--- a/src/platformsupport/fontdatabases/basic/basic.pri
+++ b/src/platformsupport/fontdatabases/basic/basic.pri
@@ -17,6 +17,7 @@ contains(QT_CONFIG, freetype) {
$$QT_FREETYPE_DIR/src/base/ftbbox.c \
$$QT_FREETYPE_DIR/src/base/ftdebug.c \
$$QT_FREETYPE_DIR/src/base/ftglyph.c \
+ $$QT_FREETYPE_DIR/src/base/ftlcdfil.c \
$$QT_FREETYPE_DIR/src/base/ftinit.c \
$$QT_FREETYPE_DIR/src/base/ftmm.c \
$$QT_FREETYPE_DIR/src/base/fttype1.c \
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 2b9883eb36..5dec1d0915 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -409,7 +409,7 @@ static void populateFromPattern(FcPattern *pattern)
#endif
FontFile *fontFile = new FontFile;
- fontFile->fileName = QLatin1String((const char *)file_value);
+ fontFile->fileName = QString::fromLocal8Bit((const char *)file_value);
fontFile->indexValue = indexValue;
QFont::Style style = (slant_value == FC_SLANT_ITALIC)
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 207b525664..44f6be21c7 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -353,7 +353,10 @@ QFixed QCoreTextFontEngine::averageCharWidth() const
qreal QCoreTextFontEngine::maxCharWidth() const
{
- return 0;
+ // ### FIXME: 'W' might not be the widest character, but this is better than nothing
+ const glyph_t glyph = glyphIndex('W');
+ glyph_metrics_t bb = const_cast<QCoreTextFontEngine *>(this)->boundingBox(glyph);
+ return bb.xoff.toReal();
}
qreal QCoreTextFontEngine::minLeftBearing() const