summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/dbusmenu/qdbusmenutypes.cpp1
-rw-r--r--src/platformsupport/dbusmenu/qdbusmenutypes_p.h15
-rw-r--r--src/platformsupport/dbustray/qdbustraytypes.cpp2
-rw-r--r--src/platformsupport/dbustray/qdbustraytypes_p.h2
-rw-r--r--src/platformsupport/eglconvenience/eglconvenience.pri25
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext.cpp17
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext_p.h1
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcursor.cpp410
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcursor_p.h142
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformintegration.cpp366
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformintegration_p.h122
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformscreen.cpp146
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformscreen_p.h79
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformwindow.cpp138
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformwindow_p.h85
-rw-r--r--src/platformsupport/fbconvenience/qfbscreen.cpp5
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp5
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm14
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtablet.cpp2
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtablet_p.h3
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp12
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h3
-rw-r--r--src/platformsupport/linuxaccessibility/atspiadaptor.cpp10
-rw-r--r--src/platformsupport/linuxaccessibility/cache.cpp3
-rw-r--r--src/platformsupport/linuxaccessibility/dbusconnection.cpp26
-rw-r--r--src/platformsupport/linuxaccessibility/dbusconnection_p.h1
-rw-r--r--src/platformsupport/linuxaccessibility/struct_marshallers_p.h32
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp5
28 files changed, 112 insertions, 1560 deletions
diff --git a/src/platformsupport/dbusmenu/qdbusmenutypes.cpp b/src/platformsupport/dbusmenu/qdbusmenutypes.cpp
index 73957eacfe..94df0f53dd 100644
--- a/src/platformsupport/dbusmenu/qdbusmenutypes.cpp
+++ b/src/platformsupport/dbusmenu/qdbusmenutypes.cpp
@@ -208,6 +208,7 @@ QDBusMenuItemList QDBusMenuItem::items(const QList<int> &ids, const QStringList
Q_UNUSED(propertyNames)
QDBusMenuItemList ret;
QList<const QDBusPlatformMenuItem *> items = QDBusPlatformMenuItem::byIds(ids);
+ ret.reserve(items.size());
Q_FOREACH (const QDBusPlatformMenuItem *item, items)
ret << QDBusMenuItem(item);
return ret;
diff --git a/src/platformsupport/dbusmenu/qdbusmenutypes_p.h b/src/platformsupport/dbusmenu/qdbusmenutypes_p.h
index 28d16b32d5..8dae75281c 100644
--- a/src/platformsupport/dbusmenu/qdbusmenutypes_p.h
+++ b/src/platformsupport/dbusmenu/qdbusmenutypes_p.h
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
class QDBusPlatformMenu;
class QDBusPlatformMenuItem;
class QDBusMenuItem;
-typedef QList<QDBusMenuItem> QDBusMenuItemList;
+typedef QVector<QDBusMenuItem> QDBusMenuItemList;
class QDBusMenuItem
{
@@ -61,6 +61,7 @@ public:
int m_id;
QVariantMap m_properties;
};
+Q_DECLARE_TYPEINFO(QDBusMenuItem, Q_MOVABLE_TYPE);
const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuItem &item);
const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuItem &item);
@@ -72,11 +73,12 @@ public:
int id;
QStringList properties;
};
+Q_DECLARE_TYPEINFO(QDBusMenuItemKeys, Q_MOVABLE_TYPE);
const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuItemKeys &keys);
const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuItemKeys &keys);
-typedef QList<QDBusMenuItemKeys> QDBusMenuItemKeysList;
+typedef QVector<QDBusMenuItemKeys> QDBusMenuItemKeysList;
class QDBusMenuLayoutItem
{
@@ -87,13 +89,14 @@ public:
int m_id;
QVariantMap m_properties;
- QList<QDBusMenuLayoutItem> m_children;
+ QVector<QDBusMenuLayoutItem> m_children;
};
+Q_DECLARE_TYPEINFO(QDBusMenuLayoutItem, Q_MOVABLE_TYPE);
const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuLayoutItem &);
const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuLayoutItem &item);
-typedef QList<QDBusMenuLayoutItem> QDBusMenuLayoutItemList;
+typedef QVector<QDBusMenuLayoutItem> QDBusMenuLayoutItemList;
class QDBusMenuEvent
{
@@ -103,11 +106,13 @@ public:
QDBusVariant m_data;
uint m_timestamp;
};
+Q_DECLARE_TYPEINFO(QDBusMenuEvent, Q_MOVABLE_TYPE); // QDBusVariant is movable, even though it cannot
+ // be marked as such until Qt 6.
const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuEvent &ev);
const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuEvent &ev);
-typedef QList<QDBusMenuEvent> QDBusMenuEventList;
+typedef QVector<QDBusMenuEvent> QDBusMenuEventList;
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const QDBusMenuItem &item);
diff --git a/src/platformsupport/dbustray/qdbustraytypes.cpp b/src/platformsupport/dbustray/qdbustraytypes.cpp
index 7b7d31b7c3..83b5d5da3f 100644
--- a/src/platformsupport/dbustray/qdbustraytypes.cpp
+++ b/src/platformsupport/dbustray/qdbustraytypes.cpp
@@ -82,6 +82,8 @@ QXdgDBusImageVector iconToQXdgDBusImageVector(const QIcon &icon)
sizes.append(QSize(IconNormalSmallSize * dpr, IconNormalSmallSize * dpr));
if (!hasMediumIcon)
sizes.append(QSize(IconNormalMediumSize * dpr, IconNormalMediumSize * dpr));
+
+ ret.reserve(sizes.size());
foreach (QSize size, sizes) {
// Protocol specifies ARGB32 format in network byte order
QImage im = icon.pixmap(size).toImage().convertToFormat(QImage::Format_ARGB32);
diff --git a/src/platformsupport/dbustray/qdbustraytypes_p.h b/src/platformsupport/dbustray/qdbustraytypes_p.h
index 4e7ae70a96..e6f200362f 100644
--- a/src/platformsupport/dbustray/qdbustraytypes_p.h
+++ b/src/platformsupport/dbustray/qdbustraytypes_p.h
@@ -56,6 +56,7 @@ struct QXdgDBusImageStruct
int height;
QByteArray data;
};
+Q_DECLARE_TYPEINFO(QXdgDBusImageStruct, Q_MOVABLE_TYPE);
typedef QVector<QXdgDBusImageStruct> QXdgDBusImageVector;
@@ -69,6 +70,7 @@ struct QXdgDBusToolTipStruct
QString title;
QString subTitle;
};
+Q_DECLARE_TYPEINFO(QXdgDBusToolTipStruct, Q_MOVABLE_TYPE);
const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusImageStruct &icon);
const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusImageStruct &icon);
diff --git a/src/platformsupport/eglconvenience/eglconvenience.pri b/src/platformsupport/eglconvenience/eglconvenience.pri
index d102203d5e..457efd68fb 100644
--- a/src/platformsupport/eglconvenience/eglconvenience.pri
+++ b/src/platformsupport/eglconvenience/eglconvenience.pri
@@ -1,29 +1,16 @@
contains(QT_CONFIG,egl) {
HEADERS += \
- $$PWD/qeglconvenience_p.h \
- $$PWD/qeglpbuffer_p.h
+ $$PWD/qeglconvenience_p.h
SOURCES += \
- $$PWD/qeglconvenience.cpp \
- $$PWD/qeglpbuffer.cpp
+ $$PWD/qeglconvenience.cpp
contains(QT_CONFIG,opengl) {
- HEADERS += $$PWD/qeglplatformcontext_p.h
- SOURCES += $$PWD/qeglplatformcontext.cpp
+ HEADERS += $$PWD/qeglplatformcontext_p.h \
+ $$PWD/qeglpbuffer_p.h
- unix {
- HEADERS += \
- $$PWD/qeglplatformcursor_p.h \
- $$PWD/qeglplatformwindow_p.h \
- $$PWD/qeglplatformscreen_p.h \
- $$PWD/qeglplatformintegration_p.h
-
- SOURCES += \
- $$PWD/qeglplatformcursor.cpp \
- $$PWD/qeglplatformwindow.cpp \
- $$PWD/qeglplatformscreen.cpp \
- $$PWD/qeglplatformintegration.cpp
- }
+ SOURCES += $$PWD/qeglplatformcontext.cpp \
+ $$PWD/qeglpbuffer.cpp
}
# Avoid X11 header collision
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
index 6d9f9e4ae0..8929a038e0 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
@@ -154,6 +154,7 @@ void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLCont
}
}
contextAttrs.append(EGL_NONE);
+ m_contextAttrs = contextAttrs;
switch (m_format.renderableType()) {
case QSurfaceFormat::OpenVG:
@@ -243,6 +244,8 @@ void QEGLPlatformContext::initialize()
updateFormatFromGL();
}
+// Base implementation for pbuffers. Subclasses will handle the specialized cases for
+// platforms without pbuffers.
EGLSurface QEGLPlatformContext::createTemporaryOffscreenSurface()
{
// Make the context current to ensure the GL version query works. This needs a surface too.
@@ -282,10 +285,18 @@ void QEGLPlatformContext::updateFormatFromGL()
// avoid creating an extra pbuffer surface which is apparently troublesome with some
// drivers (Mesa) when certain attributes are present (multisampling).
EGLSurface tempSurface = EGL_NO_SURFACE;
+ EGLContext tempContext = EGL_NO_CONTEXT;
if (!q_hasEglExtension(m_eglDisplay, "EGL_KHR_surfaceless_context"))
tempSurface = createTemporaryOffscreenSurface();
- if (eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, m_eglContext)) {
+ EGLBoolean ok = eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, m_eglContext);
+ if (!ok) {
+ EGLConfig config = q_configFromGLFormat(m_eglDisplay, m_format, false, EGL_PBUFFER_BIT);
+ tempContext = eglCreateContext(m_eglDisplay, config, 0, m_contextAttrs.constData());
+ if (tempContext != EGL_NO_CONTEXT)
+ ok = eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, tempContext);
+ }
+ if (ok) {
if (m_format.renderableType() == QSurfaceFormat::OpenGL
|| m_format.renderableType() == QSurfaceFormat::OpenGLES) {
const GLubyte *s = glGetString(GL_VERSION);
@@ -323,10 +334,12 @@ void QEGLPlatformContext::updateFormatFromGL()
}
eglMakeCurrent(prevDisplay, prevSurfaceDraw, prevSurfaceRead, prevContext);
} else {
- qWarning("QEGLPlatformContext: Failed to make temporary surface current, format not updated");
+ qWarning("QEGLPlatformContext: Failed to make temporary surface current, format not updated (%x)", eglGetError());
}
if (tempSurface != EGL_NO_SURFACE)
destroyTemporaryOffscreenSurface(tempSurface);
+ if (tempContext != EGL_NO_CONTEXT)
+ eglDestroyContext(m_eglDisplay, tempContext);
#endif // QT_NO_OPENGL
}
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
index 50c264e1dc..2ab7ad28d0 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
@@ -94,6 +94,7 @@ private:
bool m_swapIntervalEnvChecked;
int m_swapIntervalFromEnv;
bool m_ownsContext;
+ QVector<EGLint> m_contextAttrs;
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp b/src/platformsupport/eglconvenience/qeglplatformcursor.cpp
deleted file mode 100644
index 09243487c7..0000000000
--- a/src/platformsupport/eglconvenience/qeglplatformcursor.cpp
+++ /dev/null
@@ -1,410 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qpa/qwindowsysteminterface.h>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLShaderProgram>
-#include <QtCore/QJsonDocument>
-#include <QtCore/QJsonArray>
-#include <QtCore/QJsonObject>
-#include <QtDebug>
-
-#include <QtGui/private/qguiapplication_p.h>
-
-#include "qeglplatformcursor_p.h"
-#include "qeglplatformintegration_p.h"
-#include "qeglplatformscreen_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QEGLPlatformCursor
- \brief Mouse cursor implementation using OpenGL.
- \since 5.2
- \internal
- \ingroup qpa
- */
-
-QEGLPlatformCursor::QEGLPlatformCursor(QPlatformScreen *screen)
- : m_visible(true),
- m_screen(static_cast<QEGLPlatformScreen *>(screen)),
- m_program(0),
- m_vertexCoordEntry(0),
- m_textureCoordEntry(0),
- m_textureEntry(0),
- m_deviceListener(0),
- m_updateRequested(false)
-{
- QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR");
- if (!hideCursorVal.isEmpty())
- m_visible = hideCursorVal.toInt() == 0;
- if (!m_visible)
- return;
-
- // Try to load the cursor atlas. If this fails, m_visible is set to false and
- // paintOnScreen() and setCurrentCursor() become no-ops.
- initCursorAtlas();
-
- // initialize the cursor
-#ifndef QT_NO_CURSOR
- QCursor cursor(Qt::ArrowCursor);
- setCurrentCursor(&cursor);
-#endif
-
- m_deviceListener = new QEGLPlatformCursorDeviceListener(this);
- connect(QGuiApplicationPrivate::inputDeviceManager(), &QInputDeviceManager::deviceListChanged,
- m_deviceListener, &QEGLPlatformCursorDeviceListener::onDeviceListChanged);
- updateMouseStatus();
-}
-
-QEGLPlatformCursor::~QEGLPlatformCursor()
-{
- resetResources();
- delete m_deviceListener;
-}
-
-void QEGLPlatformCursor::updateMouseStatus()
-{
- m_visible = m_deviceListener->hasMouse();
-}
-
-bool QEGLPlatformCursorDeviceListener::hasMouse() const
-{
- return QGuiApplicationPrivate::inputDeviceManager()->deviceCount(QInputDeviceManager::DeviceTypePointer) > 0;
-}
-
-void QEGLPlatformCursorDeviceListener::onDeviceListChanged(QInputDeviceManager::DeviceType type)
-{
- if (type == QInputDeviceManager::DeviceTypePointer)
- m_cursor->updateMouseStatus();
-}
-
-void QEGLPlatformCursor::resetResources()
-{
- if (QOpenGLContext::currentContext()) {
- delete m_program;
- glDeleteTextures(1, &m_cursor.customCursorTexture);
- glDeleteTextures(1, &m_cursorAtlas.texture);
- }
- m_program = 0;
- m_cursor.customCursorTexture = 0;
- m_cursor.customCursorPending = !m_cursor.customCursorImage.isNull();
- m_cursorAtlas.texture = 0;
-}
-
-void QEGLPlatformCursor::createShaderPrograms()
-{
- static const char *textureVertexProgram =
- "attribute highp vec2 vertexCoordEntry;\n"
- "attribute highp vec2 textureCoordEntry;\n"
- "varying highp vec2 textureCoord;\n"
- "void main() {\n"
- " textureCoord = textureCoordEntry;\n"
- " gl_Position = vec4(vertexCoordEntry, 1.0, 1.0);\n"
- "}\n";
-
- static const char *textureFragmentProgram =
- "uniform sampler2D texture;\n"
- "varying highp vec2 textureCoord;\n"
- "void main() {\n"
- " gl_FragColor = texture2D(texture, textureCoord).bgra;\n"
- "}\n";
-
- m_program = new QOpenGLShaderProgram;
- m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram);
- m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram);
- m_program->link();
-
- m_vertexCoordEntry = m_program->attributeLocation("vertexCoordEntry");
- m_textureCoordEntry = m_program->attributeLocation("textureCoordEntry");
- m_textureEntry = m_program->uniformLocation("texture");
-}
-
-void QEGLPlatformCursor::createCursorTexture(uint *texture, const QImage &image)
-{
- if (!*texture)
- glGenTextures(1, texture);
- glBindTexture(GL_TEXTURE_2D, *texture);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- glTexImage2D(GL_TEXTURE_2D, 0 /* level */, GL_RGBA, image.width(), image.height(), 0 /* border */,
- GL_RGBA, GL_UNSIGNED_BYTE, image.constBits());
-}
-
-void QEGLPlatformCursor::initCursorAtlas()
-{
- static QByteArray json = qgetenv("QT_QPA_EGLFS_CURSOR");
- if (json.isEmpty())
- json = ":/cursor.json";
-
- QFile file(QString::fromUtf8(json));
- if (!file.open(QFile::ReadOnly)) {
- m_visible = false;
- return;
- }
-
- QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
- QJsonObject object = doc.object();
-
- QString atlas = object.value(QLatin1String("image")).toString();
- Q_ASSERT(!atlas.isEmpty());
-
- const int cursorsPerRow = object.value(QLatin1String("cursorsPerRow")).toDouble();
- Q_ASSERT(cursorsPerRow);
- m_cursorAtlas.cursorsPerRow = cursorsPerRow;
-
- const QJsonArray hotSpots = object.value(QLatin1String("hotSpots")).toArray();
- Q_ASSERT(hotSpots.count() == Qt::LastCursor + 1);
- for (int i = 0; i < hotSpots.count(); i++) {
- QPoint hotSpot(hotSpots[i].toArray()[0].toDouble(), hotSpots[i].toArray()[1].toDouble());
- m_cursorAtlas.hotSpots << hotSpot;
- }
-
- QImage image = QImage(atlas).convertToFormat(QImage::Format_ARGB32_Premultiplied);
- m_cursorAtlas.cursorWidth = image.width() / m_cursorAtlas.cursorsPerRow;
- m_cursorAtlas.cursorHeight = image.height() / ((Qt::LastCursor + cursorsPerRow) / cursorsPerRow);
- m_cursorAtlas.width = image.width();
- m_cursorAtlas.height = image.height();
- m_cursorAtlas.image = image;
-}
-
-#ifndef QT_NO_CURSOR
-void QEGLPlatformCursor::changeCursor(QCursor *cursor, QWindow *window)
-{
- Q_UNUSED(window);
- const QRect oldCursorRect = cursorRect();
- if (setCurrentCursor(cursor))
- update(oldCursorRect | cursorRect());
-}
-
-bool QEGLPlatformCursor::setCurrentCursor(QCursor *cursor)
-{
- if (!m_visible)
- return false;
-
- const Qt::CursorShape newShape = cursor ? cursor->shape() : Qt::ArrowCursor;
- if (m_cursor.shape == newShape && newShape != Qt::BitmapCursor)
- return false;
-
- if (m_cursor.shape == Qt::BitmapCursor) {
- m_cursor.customCursorImage = QImage();
- m_cursor.customCursorPending = false;
- }
- m_cursor.shape = newShape;
- if (newShape != Qt::BitmapCursor) { // standard cursor
- const float ws = (float)m_cursorAtlas.cursorWidth / m_cursorAtlas.width,
- hs = (float)m_cursorAtlas.cursorHeight / m_cursorAtlas.height;
- m_cursor.textureRect = QRectF(ws * (m_cursor.shape % m_cursorAtlas.cursorsPerRow),
- hs * (m_cursor.shape / m_cursorAtlas.cursorsPerRow),
- ws, hs);
- m_cursor.hotSpot = m_cursorAtlas.hotSpots[m_cursor.shape];
- m_cursor.texture = m_cursorAtlas.texture;
- m_cursor.size = QSize(m_cursorAtlas.cursorWidth, m_cursorAtlas.cursorHeight);
- } else {
- QImage image = cursor->pixmap().toImage();
- m_cursor.textureRect = QRectF(0, 0, 1, 1);
- m_cursor.hotSpot = cursor->hotSpot();
- m_cursor.texture = 0; // will get updated in the next render()
- m_cursor.size = image.size();
- m_cursor.customCursorImage = image;
- m_cursor.customCursorPending = true;
- }
-
- return true;
-}
-#endif
-
-class CursorUpdateEvent : public QEvent
-{
-public:
- CursorUpdateEvent(const QPoint &pos, const QRegion &rgn)
- : QEvent(QEvent::Type(QEvent::User + 1)),
- m_pos(pos),
- m_region(rgn)
- { }
- QPoint pos() const { return m_pos; }
- QRegion region() const { return m_region; }
-
-private:
- QPoint m_pos;
- QRegion m_region;
-};
-
-bool QEGLPlatformCursor::event(QEvent *e)
-{
- if (e->type() == QEvent::User + 1) {
- CursorUpdateEvent *ev = static_cast<CursorUpdateEvent *>(e);
- m_updateRequested = false;
- QWindowSystemInterface::handleExposeEvent(m_screen->topLevelAt(ev->pos()), ev->region());
- QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
- return true;
- }
- return QPlatformCursor::event(e);
-}
-
-void QEGLPlatformCursor::update(const QRegion &rgn)
-{
- if (!m_updateRequested) {
- // Must not flush the window system events directly from here since we are likely to
- // be a called directly from QGuiApplication's processMouseEvents. Flushing events
- // could cause reentering by dispatching more queued mouse events.
- m_updateRequested = true;
- QCoreApplication::postEvent(this, new CursorUpdateEvent(m_cursor.pos, rgn));
- }
-}
-
-QRect QEGLPlatformCursor::cursorRect() const
-{
- return QRect(m_cursor.pos - m_cursor.hotSpot, m_cursor.size);
-}
-
-QPoint QEGLPlatformCursor::pos() const
-{
- return m_cursor.pos;
-}
-
-void QEGLPlatformCursor::setPos(const QPoint &pos)
-{
- QGuiApplicationPrivate::inputDeviceManager()->setCursorPos(pos);
- const QRect oldCursorRect = cursorRect();
- m_cursor.pos = pos;
- update(oldCursorRect | cursorRect());
- m_screen->handleCursorMove(m_cursor.pos);
-}
-
-void QEGLPlatformCursor::pointerEvent(const QMouseEvent &event)
-{
- if (event.type() != QEvent::MouseMove)
- return;
- const QRect oldCursorRect = cursorRect();
- m_cursor.pos = event.screenPos().toPoint();
- update(oldCursorRect | cursorRect());
- m_screen->handleCursorMove(m_cursor.pos);
-}
-
-void QEGLPlatformCursor::paintOnScreen()
-{
- if (!m_visible)
- return;
-
- const QRectF cr = cursorRect();
- const QRect screenRect(m_screen->geometry());
- const GLfloat x1 = 2 * (cr.left() / screenRect.width()) - 1;
- const GLfloat x2 = 2 * (cr.right() / screenRect.width()) - 1;
- const GLfloat y1 = 1 - (cr.top() / screenRect.height()) * 2;
- const GLfloat y2 = 1 - (cr.bottom() / screenRect.height()) * 2;
- QRectF r(QPointF(x1, y1), QPointF(x2, y2));
-
- draw(r);
-}
-
-void QEGLPlatformCursor::draw(const QRectF &r)
-{
- if (!m_program) {
- // one time initialization
- initializeOpenGLFunctions();
-
- createShaderPrograms();
-
- if (!m_cursorAtlas.texture) {
- createCursorTexture(&m_cursorAtlas.texture, m_cursorAtlas.image);
-
- if (m_cursor.shape != Qt::BitmapCursor)
- m_cursor.texture = m_cursorAtlas.texture;
- }
- }
-
- if (m_cursor.shape == Qt::BitmapCursor && m_cursor.customCursorPending) {
- // upload the custom cursor
- createCursorTexture(&m_cursor.customCursorTexture, m_cursor.customCursorImage);
- m_cursor.texture = m_cursor.customCursorTexture;
- m_cursor.customCursorPending = false;
- }
-
- Q_ASSERT(m_cursor.texture);
-
- m_program->bind();
-
- const GLfloat x1 = r.left();
- const GLfloat x2 = r.right();
- const GLfloat y1 = r.top();
- const GLfloat y2 = r.bottom();
- const GLfloat cursorCoordinates[] = {
- x1, y2,
- x2, y2,
- x1, y1,
- x2, y1
- };
-
- const GLfloat s1 = m_cursor.textureRect.left();
- const GLfloat s2 = m_cursor.textureRect.right();
- const GLfloat t1 = m_cursor.textureRect.top();
- const GLfloat t2 = m_cursor.textureRect.bottom();
- const GLfloat textureCoordinates[] = {
- s1, t2,
- s2, t2,
- s1, t1,
- s2, t1
- };
-
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, m_cursor.texture);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-
- m_program->enableAttributeArray(m_vertexCoordEntry);
- m_program->enableAttributeArray(m_textureCoordEntry);
-
- m_program->setAttributeArray(m_vertexCoordEntry, cursorCoordinates, 2);
- m_program->setAttributeArray(m_textureCoordEntry, textureCoordinates, 2);
-
- m_program->setUniformValue(m_textureEntry, 0);
-
- glDisable(GL_CULL_FACE);
- glFrontFace(GL_CCW);
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glDisable(GL_DEPTH_TEST); // disable depth testing to make sure cursor is always on top
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
- glDisable(GL_BLEND);
-
- glBindTexture(GL_TEXTURE_2D, 0);
- m_program->disableAttributeArray(m_textureCoordEntry);
- m_program->disableAttributeArray(m_vertexCoordEntry);
-
- m_program->release();
-}
-
-QT_END_NAMESPACE
diff --git a/src/platformsupport/eglconvenience/qeglplatformcursor_p.h b/src/platformsupport/eglconvenience/qeglplatformcursor_p.h
deleted file mode 100644
index b89dd1ca43..0000000000
--- a/src/platformsupport/eglconvenience/qeglplatformcursor_p.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QEGLPLATFORMCURSOR_H
-#define QEGLPLATFORMCURSOR_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qpa/qplatformcursor.h>
-#include <qpa/qplatformscreen.h>
-#include <QtGui/QOpenGLFunctions>
-#include <QtGui/private/qinputdevicemanager_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLShaderProgram;
-class QEGLPlatformCursor;
-class QEGLPlatformScreen;
-
-class QEGLPlatformCursorDeviceListener : public QObject
-{
- Q_OBJECT
-
-public:
- QEGLPlatformCursorDeviceListener(QEGLPlatformCursor *cursor) : m_cursor(cursor) { }
- bool hasMouse() const;
-
-public slots:
- void onDeviceListChanged(QInputDeviceManager::DeviceType type);
-
-private:
- QEGLPlatformCursor *m_cursor;
-};
-
-class QEGLPlatformCursor : public QPlatformCursor, protected QOpenGLFunctions
-{
- Q_OBJECT
-public:
- QEGLPlatformCursor(QPlatformScreen *screen);
- ~QEGLPlatformCursor();
-
-#ifndef QT_NO_CURSOR
- void changeCursor(QCursor *cursor, QWindow *widget) Q_DECL_OVERRIDE;
-#endif
- void pointerEvent(const QMouseEvent &event) Q_DECL_OVERRIDE;
- QPoint pos() const Q_DECL_OVERRIDE;
- void setPos(const QPoint &pos) Q_DECL_OVERRIDE;
-
- QRect cursorRect() const;
- void paintOnScreen();
- void resetResources();
-
- void updateMouseStatus();
-
-private:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
-#ifndef QT_NO_CURSOR
- bool setCurrentCursor(QCursor *cursor);
-#endif
- void draw(const QRectF &rect);
- void update(const QRegion &region);
- void createShaderPrograms();
- void createCursorTexture(uint *texture, const QImage &image);
- void initCursorAtlas();
-
- // current cursor information
- struct Cursor {
- Cursor() : texture(0), shape(Qt::BlankCursor), customCursorTexture(0), customCursorPending(false) { }
- uint texture; // a texture from 'image' or the atlas
- Qt::CursorShape shape;
- QRectF textureRect; // normalized rect inside texture
- QSize size; // size of the cursor
- QPoint hotSpot;
- QImage customCursorImage;
- QPoint pos; // current cursor position
- uint customCursorTexture;
- bool customCursorPending;
- } m_cursor;
-
- // cursor atlas information
- struct CursorAtlas {
- CursorAtlas() : cursorsPerRow(0), texture(0), cursorWidth(0), cursorHeight(0) { }
- int cursorsPerRow;
- uint texture;
- int width, height; // width and height of the atlas
- int cursorWidth, cursorHeight; // width and height of cursors inside the atlas
- QList<QPoint> hotSpots;
- QImage image; // valid until it's uploaded
- } m_cursorAtlas;
-
- bool m_visible;
- QEGLPlatformScreen *m_screen;
- QOpenGLShaderProgram *m_program;
- int m_vertexCoordEntry;
- int m_textureCoordEntry;
- int m_textureEntry;
- QEGLPlatformCursorDeviceListener *m_deviceListener;
- bool m_updateRequested;
-};
-
-QT_END_NAMESPACE
-
-#endif // QEGLPLATFORMCURSOR_H
diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp b/src/platformsupport/eglconvenience/qeglplatformintegration.cpp
deleted file mode 100644
index 1868ff1665..0000000000
--- a/src/platformsupport/eglconvenience/qeglplatformintegration.cpp
+++ /dev/null
@@ -1,366 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/QWindow>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOffscreenSurface>
-#include <QtGui/QGuiApplication>
-#include <QtGui/private/qguiapplication_p.h>
-#include <qpa/qwindowsysteminterface.h>
-#include <qpa/qplatforminputcontextfactory_p.h>
-
-#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
-#include <QtPlatformSupport/private/qgenericunixservices_p.h>
-#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
-#include <QtPlatformSupport/private/qfbvthandler_p.h>
-#include <QtPlatformSupport/private/qopenglcompositorbackingstore_p.h>
-
-#if !defined(QT_NO_EVDEV) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
-#include <QtPlatformSupport/private/qevdevmousemanager_p.h>
-#include <QtPlatformSupport/private/qevdevkeyboardmanager_p.h>
-#include <QtPlatformSupport/private/qevdevtouchmanager_p.h>
-#endif
-
-#if !defined(QT_NO_TSLIB) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
-#include <QtPlatformSupport/private/qtslib_p.h>
-#endif
-
-#include <QtPlatformHeaders/qeglfsfunctions.h>
-
-#include "qeglplatformintegration_p.h"
-#include "qeglplatformcontext_p.h"
-#include "qeglplatformwindow_p.h"
-#include "qeglplatformscreen_p.h"
-#include "qeglplatformcursor_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QEGLPlatformIntegration
- \brief Base class for EGL-based QPlatformIntegration implementations.
- \since 5.2
- \internal
- \ingroup qpa
-
- This class provides most of the necessary platform integration for
- an EGL-based Unix system. Platform plugins must subclass this and
- reimplement the virtuals for creating platform screens and windows
- since they will most likely wish to use a subclass for these.
-
- The backing store, native interface accessors, font database,
- basic capability flags, etc. are provided out of the box, no
- further customization is needed.
-
- \note It is critical that this class' implementation of
- initialize() is called. Therefore subclasses should either avoid
- to reimplement this function or call the base class
- implementation.
- */
-
-QEGLPlatformIntegration::QEGLPlatformIntegration()
- : m_display(EGL_NO_DISPLAY),
- m_inputContext(0),
- m_fontDb(new QGenericUnixFontDatabase),
- m_services(new QGenericUnixServices),
- m_kbdMgr(0)
-{
-}
-
-QEGLPlatformIntegration::~QEGLPlatformIntegration()
-{
-}
-
-void QEGLPlatformIntegration::initialize()
-{
- m_display = eglGetDisplay(nativeDisplay());
- if (m_display == EGL_NO_DISPLAY)
- qFatal("Could not open egl display");
-
- EGLint major, minor;
- if (!eglInitialize(m_display, &major, &minor))
- qFatal("Could not initialize egl display");
-
- m_inputContext = QPlatformInputContextFactory::create();
-
- m_vtHandler.reset(new QFbVtHandler);
-}
-
-void QEGLPlatformIntegration::destroy()
-{
- foreach (QWindow *w, qGuiApp->topLevelWindows())
- w->destroy();
-
- if (m_display != EGL_NO_DISPLAY)
- eglTerminate(m_display);
-}
-
-QAbstractEventDispatcher *QEGLPlatformIntegration::createEventDispatcher() const
-{
- return createUnixEventDispatcher();
-}
-
-QPlatformServices *QEGLPlatformIntegration::services() const
-{
- return m_services.data();
-}
-
-QPlatformFontDatabase *QEGLPlatformIntegration::fontDatabase() const
-{
- return m_fontDb.data();
-}
-
-QPlatformBackingStore *QEGLPlatformIntegration::createPlatformBackingStore(QWindow *window) const
-{
- QOpenGLCompositorBackingStore *bs = new QOpenGLCompositorBackingStore(window);
- if (!window->handle())
- window->create();
- static_cast<QEGLPlatformWindow *>(window->handle())->setBackingStore(bs);
- return bs;
-}
-
-QPlatformWindow *QEGLPlatformIntegration::createPlatformWindow(QWindow *window) const
-{
- QWindowSystemInterface::flushWindowSystemEvents();
- QEGLPlatformWindow *w = createWindow(window);
- w->create();
- if (window->type() != Qt::ToolTip)
- w->requestActivateWindow();
- return w;
-}
-
-QPlatformOpenGLContext *QEGLPlatformIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
-{
- // If there is a "root" window into which raster and QOpenGLWidget content is
- // composited, all other contexts must share with its context.
- QOpenGLContext *compositingContext = QOpenGLCompositor::instance()->context();
- QPlatformOpenGLContext *share = compositingContext ? compositingContext->handle() : context->shareHandle();
- QVariant nativeHandle = context->nativeHandle();
- QPlatformOpenGLContext *platformContext = createContext(context->format(),
- share,
- display(),
- &nativeHandle);
- context->setNativeHandle(nativeHandle);
- return platformContext;
-}
-
-QPlatformOffscreenSurface *QEGLPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
-{
- QEGLPlatformScreen *screen = static_cast<QEGLPlatformScreen *>(surface->screen()->handle());
- return createOffscreenSurface(screen->display(), surface->requestedFormat(), surface);
-}
-
-bool QEGLPlatformIntegration::hasCapability(QPlatformIntegration::Capability cap) const
-{
- switch (cap) {
- case ThreadedPixmaps: return true;
- case OpenGL: return true;
- case ThreadedOpenGL: return true;
- case WindowManagement: return false;
- case RasterGLSurface: return true;
- default: return QPlatformIntegration::hasCapability(cap);
- }
-}
-
-QPlatformNativeInterface *QEGLPlatformIntegration::nativeInterface() const
-{
- return const_cast<QEGLPlatformIntegration *>(this);
-}
-
-enum ResourceType {
- EglDisplay,
- EglWindow,
- EglContext,
- EglConfig,
- NativeDisplay,
- XlibDisplay
-};
-
-static int resourceType(const QByteArray &key)
-{
- static const QByteArray names[] = { // match ResourceType
- QByteArrayLiteral("egldisplay"),
- QByteArrayLiteral("eglwindow"),
- QByteArrayLiteral("eglcontext"),
- QByteArrayLiteral("eglconfig"),
- QByteArrayLiteral("nativedisplay"),
- QByteArrayLiteral("display")
- };
- const QByteArray *end = names + sizeof(names) / sizeof(names[0]);
- const QByteArray *result = std::find(names, end, key);
- if (result == end)
- result = std::find(names, end, key.toLower());
- return int(result - names);
-}
-
-void *QEGLPlatformIntegration::nativeResourceForIntegration(const QByteArray &resource)
-{
- void *result = 0;
-
- switch (resourceType(resource)) {
- case EglDisplay:
- result = display();
- break;
- case NativeDisplay:
- result = reinterpret_cast<void*>(nativeDisplay());
- break;
- default:
- break;
- }
-
- return result;
-}
-
-void *QEGLPlatformIntegration::nativeResourceForScreen(const QByteArray &resource, QScreen *)
-{
- void *result = 0;
-
- switch (resourceType(resource)) {
- case XlibDisplay:
- // Play nice when using the x11 hooks: Be compatible with xcb that allows querying
- // the X Display pointer, which is nothing but our native display.
- result = reinterpret_cast<void*>(nativeDisplay());
- break;
- default:
- break;
- }
-
- return result;
-}
-
-void *QEGLPlatformIntegration::nativeResourceForWindow(const QByteArray &resource, QWindow *window)
-{
- void *result = 0;
-
- switch (resourceType(resource)) {
- case EglDisplay:
- if (window && window->handle())
- result = static_cast<QEGLPlatformScreen *>(window->handle()->screen())->display();
- else
- result = display();
- break;
- case EglWindow:
- if (window && window->handle())
- result = reinterpret_cast<void*>(static_cast<QEGLPlatformWindow *>(window->handle())->eglWindow());
- break;
- default:
- break;
- }
-
- return result;
-}
-
-void *QEGLPlatformIntegration::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
-{
- void *result = 0;
-
- switch (resourceType(resource)) {
- case EglContext:
- if (context->handle())
- result = static_cast<QEGLPlatformContext *>(context->handle())->eglContext();
- break;
- case EglConfig:
- if (context->handle())
- result = static_cast<QEGLPlatformContext *>(context->handle())->eglConfig();
- break;
- case EglDisplay:
- if (context->handle())
- result = static_cast<QEGLPlatformContext *>(context->handle())->eglDisplay();
- break;
- default:
- break;
- }
-
- return result;
-}
-
-static void *eglContextForContext(QOpenGLContext *context)
-{
- Q_ASSERT(context);
-
- QEGLPlatformContext *handle = static_cast<QEGLPlatformContext *>(context->handle());
- if (!handle)
- return 0;
-
- return handle->eglContext();
-}
-
-QPlatformNativeInterface::NativeResourceForContextFunction QEGLPlatformIntegration::nativeResourceFunctionForContext(const QByteArray &resource)
-{
- QByteArray lowerCaseResource = resource.toLower();
- if (lowerCaseResource == "get_egl_context")
- return NativeResourceForContextFunction(eglContextForContext);
-
- return 0;
-}
-
-QFunctionPointer QEGLPlatformIntegration::platformFunction(const QByteArray &function) const
-{
-#if !defined(QT_NO_EVDEV) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
- if (function == QEglFSFunctions::loadKeymapTypeIdentifier())
- return QFunctionPointer(loadKeymapStatic);
-#else
- Q_UNUSED(function)
-#endif
-
- return 0;
-}
-
-void QEGLPlatformIntegration::loadKeymapStatic(const QString &filename)
-{
-#if !defined(QT_NO_EVDEV) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
- QEGLPlatformIntegration *self = static_cast<QEGLPlatformIntegration *>(QGuiApplicationPrivate::platformIntegration());
- if (self->m_kbdMgr)
- self->m_kbdMgr->loadKeymap(filename);
- else
- qWarning("QEGLPlatformIntegration: Cannot load keymap, no keyboard handler found");
-#else
- Q_UNUSED(filename);
-#endif
-}
-
-void QEGLPlatformIntegration::createInputHandlers()
-{
-#if !defined(QT_NO_EVDEV) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
- m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this);
- new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this);
-#ifndef QT_NO_TSLIB
- const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_EGLFS_TSLIB");
- if (useTslib)
- new QTsLibMouseHandler(QLatin1String("TsLib"), QString() /* spec */);
- else
-#endif // QT_NO_TSLIB
- new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this);
-#endif
-}
-
-QT_END_NAMESPACE
diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h
deleted file mode 100644
index 42fbf8c8a1..0000000000
--- a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QEGLPLATFORMINTEGRATION_H
-#define QEGLPLATFORMINTEGRATION_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QVariant>
-#include <qpa/qplatformintegration.h>
-#include <qpa/qplatformnativeinterface.h>
-#include <EGL/egl.h>
-
-QT_BEGIN_NAMESPACE
-
-class QEGLPlatformWindow;
-class QEGLPlatformContext;
-class QFbVtHandler;
-class QEvdevKeyboardManager;
-
-class QEGLPlatformIntegration : public QPlatformIntegration, public QPlatformNativeInterface
-{
-public:
- QEGLPlatformIntegration();
- ~QEGLPlatformIntegration();
-
- void initialize() Q_DECL_OVERRIDE;
- void destroy() Q_DECL_OVERRIDE;
-
- EGLDisplay display() const { return m_display; }
-
- QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
- QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
- QPlatformServices *services() const Q_DECL_OVERRIDE;
- QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE { return m_inputContext; }
-
- QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
- QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE;
-
- bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
-
- QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
- // QPlatformNativeInterface
- void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE;
- void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) Q_DECL_OVERRIDE;
- void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) Q_DECL_OVERRIDE;
- void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) Q_DECL_OVERRIDE;
- NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) Q_DECL_OVERRIDE;
-
- QFunctionPointer platformFunction(const QByteArray &function) const Q_DECL_OVERRIDE;
-
- QFbVtHandler *vtHandler() { return m_vtHandler.data(); }
-
-protected:
- virtual QEGLPlatformWindow *createWindow(QWindow *window) const = 0;
- virtual QEGLPlatformContext *createContext(const QSurfaceFormat &format,
- QPlatformOpenGLContext *shareContext,
- EGLDisplay display,
- QVariant *nativeHandle) const = 0;
- virtual QPlatformOffscreenSurface *createOffscreenSurface(EGLDisplay display,
- const QSurfaceFormat &format,
- QOffscreenSurface *surface) const = 0;
-
- virtual EGLNativeDisplayType nativeDisplay() const { return EGL_DEFAULT_DISPLAY; }
-
- void createInputHandlers();
-
-private:
- static void loadKeymapStatic(const QString &filename);
-
- EGLDisplay m_display;
- QPlatformInputContext *m_inputContext;
- QScopedPointer<QPlatformFontDatabase> m_fontDb;
- QScopedPointer<QPlatformServices> m_services;
- QScopedPointer<QFbVtHandler> m_vtHandler;
- QEvdevKeyboardManager *m_kbdMgr;
-};
-
-QT_END_NAMESPACE
-
-#endif // QEGLPLATFORMINTEGRATION_H
diff --git a/src/platformsupport/eglconvenience/qeglplatformscreen.cpp b/src/platformsupport/eglconvenience/qeglplatformscreen.cpp
deleted file mode 100644
index 61f8cdd9b4..0000000000
--- a/src/platformsupport/eglconvenience/qeglplatformscreen.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qeglplatformscreen_p.h"
-#include "qeglplatformwindow_p.h"
-#include <QtGui/qwindow.h>
-#include <qpa/qwindowsysteminterface.h>
-#include <QtPlatformSupport/private/qopenglcompositor_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QEGLPlatformScreen
- \brief Base class for EGL-based platform screen implementations.
- \since 5.2
- \internal
- \ingroup qpa
- */
-
-QEGLPlatformScreen::QEGLPlatformScreen(EGLDisplay dpy)
- : m_dpy(dpy),
- m_pointerWindow(0)
-{
-}
-
-QEGLPlatformScreen::~QEGLPlatformScreen()
-{
- QOpenGLCompositor::destroy();
-}
-
-void QEGLPlatformScreen::handleCursorMove(const QPoint &pos)
-{
- const QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
- const QList<QOpenGLCompositorWindow *> windows = compositor->windows();
-
- // Generate enter and leave events like a real windowing system would do.
- if (windows.isEmpty())
- return;
-
- // First window is always fullscreen.
- if (windows.count() == 1) {
- QWindow *window = windows[0]->sourceWindow();
- if (m_pointerWindow != window) {
- m_pointerWindow = window;
- QWindowSystemInterface::handleEnterEvent(window, window->mapFromGlobal(pos), pos);
- }
- return;
- }
-
- QWindow *enter = 0, *leave = 0;
- for (int i = windows.count() - 1; i >= 0; --i) {
- QWindow *window = windows[i]->sourceWindow();
- const QRect geom = window->geometry();
- if (geom.contains(pos)) {
- if (m_pointerWindow != window) {
- leave = m_pointerWindow;
- m_pointerWindow = window;
- enter = window;
- }
- break;
- }
- }
-
- if (enter && leave)
- QWindowSystemInterface::handleEnterLeaveEvent(enter, leave, enter->mapFromGlobal(pos), pos);
-}
-
-QPixmap QEGLPlatformScreen::grabWindow(WId wid, int x, int y, int width, int height) const
-{
- QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
- const QList<QOpenGLCompositorWindow *> windows = compositor->windows();
- Q_ASSERT(!windows.isEmpty());
-
- QImage img;
-
- if (static_cast<QEGLPlatformWindow *>(windows.first()->sourceWindow()->handle())->isRaster()) {
- // Request the compositor to render everything into an FBO and read it back. This
- // is of course slow, but it's safe and reliable. It will not include the mouse
- // cursor, which is a plus.
- img = compositor->grab();
- } else {
- // Just a single OpenGL window without compositing. Do not support this case for now. Doing
- // glReadPixels is not an option since it would read from the back buffer which may have
- // undefined content when calling right after a swapBuffers (unless preserved swap is
- // available and enabled, but we have no support for that).
- qWarning("grabWindow: Not supported for non-composited OpenGL content. Use QQuickWindow::grabWindow() instead.");
- return QPixmap();
- }
-
- if (!wid) {
- const QSize screenSize = geometry().size();
- if (width < 0)
- width = screenSize.width() - x;
- if (height < 0)
- height = screenSize.height() - y;
- return QPixmap::fromImage(img).copy(x, y, width, height);
- }
-
- foreach (QOpenGLCompositorWindow *w, windows) {
- const QWindow *window = w->sourceWindow();
- if (window->winId() == wid) {
- const QRect geom = window->geometry();
- if (width < 0)
- width = geom.width() - x;
- if (height < 0)
- height = geom.height() - y;
- QRect rect(geom.topLeft() + QPoint(x, y), QSize(width, height));
- rect &= window->geometry();
- return QPixmap::fromImage(img).copy(rect);
- }
- }
-
- return QPixmap();
-}
-
-QT_END_NAMESPACE
diff --git a/src/platformsupport/eglconvenience/qeglplatformscreen_p.h b/src/platformsupport/eglconvenience/qeglplatformscreen_p.h
deleted file mode 100644
index 4a987f6860..0000000000
--- a/src/platformsupport/eglconvenience/qeglplatformscreen_p.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QEGLPLATFORMSCREEN_H
-#define QEGLPLATFORMSCREEN_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QList>
-#include <QtCore/QPoint>
-#include <QtCore/qtextstream.h>
-#include <qpa/qplatformscreen.h>
-#include <EGL/egl.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLContext;
-class QWindow;
-class QEGLPlatformWindow;
-
-class QEGLPlatformScreen : public QPlatformScreen
-{
-public:
- QEGLPlatformScreen(EGLDisplay dpy);
- ~QEGLPlatformScreen();
-
- EGLDisplay display() const { return m_dpy; }
-
- void handleCursorMove(const QPoint &pos);
-
- QPixmap grabWindow(WId wid, int x, int y, int width, int height) const Q_DECL_OVERRIDE;
-
-private:
- EGLDisplay m_dpy;
- QWindow *m_pointerWindow;
-};
-
-QT_END_NAMESPACE
-
-#endif // QEGLPLATFORMSCREEN_H
diff --git a/src/platformsupport/eglconvenience/qeglplatformwindow.cpp b/src/platformsupport/eglconvenience/qeglplatformwindow.cpp
deleted file mode 100644
index 35f38ac29a..0000000000
--- a/src/platformsupport/eglconvenience/qeglplatformwindow.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qpa/qwindowsysteminterface.h>
-#include <QtPlatformSupport/private/qopenglcompositor_p.h>
-#include <QtPlatformSupport/private/qopenglcompositorbackingstore_p.h>
-
-#include "qeglplatformwindow_p.h"
-#include "qeglplatformscreen_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QEGLPlatformWindow
- \brief Base class for EGL-based platform window implementations.
- \since 5.2
- \internal
- \ingroup qpa
-
- Lightweight class providing some basic platform window operations
- and interfacing with QOpenGLCompositorBackingStore.
-
- Almost no QPlatformWindow functions are implemented here. This is
- intentional because different platform plugins may use different
- strategies for their window management (some may force fullscreen
- windows, some may not, some may share the underlying native
- surface, some may not, etc.) and therefore it is not sensible to
- enforce anything for these functions.
-
- \note Subclasses are responsible for invoking this class'
- implementation of create() and are expected to utilize the window
- stack management functions (addWindow() etc.) in
- QOpenGLCompositor.
- */
-
-QEGLPlatformWindow::QEGLPlatformWindow(QWindow *w)
- : QPlatformWindow(w),
- m_backingStore(0),
- m_raster(false),
- m_winId(0)
-{
-}
-
-static WId newWId()
-{
- static WId id = 0;
-
- if (id == std::numeric_limits<WId>::max())
- qWarning("QEGLPlatformWindow: Out of window IDs");
-
- return ++id;
-}
-
-void QEGLPlatformWindow::create()
-{
- m_winId = newWId();
-
- // Save the original surface type before changing to OpenGLSurface.
- m_raster = (window()->surfaceType() == QSurface::RasterSurface);
- if (m_raster) // change to OpenGL, but not for RasterGLSurface
- window()->setSurfaceType(QSurface::OpenGLSurface);
-
- if (window()->type() == Qt::Desktop) {
- QRect fullscreenRect(QPoint(), screen()->availableGeometry().size());
- QPlatformWindow::setGeometry(fullscreenRect);
- QWindowSystemInterface::handleGeometryChange(window(), fullscreenRect);
- return;
- }
-}
-
-bool QEGLPlatformWindow::isRaster() const
-{
- return m_raster || window()->surfaceType() == QSurface::RasterGLSurface;
-}
-
-QWindow *QEGLPlatformWindow::sourceWindow() const
-{
- return window();
-}
-
-const QPlatformTextureList *QEGLPlatformWindow::textures() const
-{
- if (m_backingStore)
- return m_backingStore->textures();
-
- return 0;
-}
-
-void QEGLPlatformWindow::endCompositing()
-{
- if (m_backingStore)
- m_backingStore->notifyComposited();
-}
-
-WId QEGLPlatformWindow::winId() const
-{
- return m_winId;
-}
-
-void QEGLPlatformWindow::setOpacity(qreal)
-{
- if (!isRaster())
- qWarning("QEGLPlatformWindow: Cannot set opacity for non-raster windows");
-
- // Nothing to do here. The opacity is stored in the QWindow.
-}
-
-QT_END_NAMESPACE
diff --git a/src/platformsupport/eglconvenience/qeglplatformwindow_p.h b/src/platformsupport/eglconvenience/qeglplatformwindow_p.h
deleted file mode 100644
index 852d690c92..0000000000
--- a/src/platformsupport/eglconvenience/qeglplatformwindow_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QEGLPLATFORMWINDOW_H
-#define QEGLPLATFORMWINDOW_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qpa/qplatformwindow.h>
-#include <QtPlatformSupport/private/qopenglcompositor_p.h>
-#include <EGL/egl.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLCompositorBackingStore;
-class QPlatformTextureList;
-
-class QEGLPlatformWindow : public QPlatformWindow, public QOpenGLCompositorWindow
-{
-public:
- QEGLPlatformWindow(QWindow *w);
-
- virtual void create();
-
- QOpenGLCompositorBackingStore *backingStore() { return m_backingStore; }
- void setBackingStore(QOpenGLCompositorBackingStore *backingStore) { m_backingStore = backingStore; }
- bool isRaster() const;
-
- QWindow *sourceWindow() const Q_DECL_OVERRIDE;
- const QPlatformTextureList *textures() const Q_DECL_OVERRIDE;
- void endCompositing() Q_DECL_OVERRIDE;
-
- WId winId() const Q_DECL_OVERRIDE;
- void setOpacity(qreal opacity) Q_DECL_OVERRIDE;
-
- virtual EGLNativeWindowType eglWindow() const = 0;
-
-private:
- QOpenGLCompositorBackingStore *m_backingStore;
- bool m_raster;
- WId m_winId;
-};
-
-QT_END_NAMESPACE
-
-#endif // QEGLPLATFORMWINDOW_H
diff --git a/src/platformsupport/fbconvenience/qfbscreen.cpp b/src/platformsupport/fbconvenience/qfbscreen.cpp
index 566f84c9ea..d00954375d 100644
--- a/src/platformsupport/fbconvenience/qfbscreen.cpp
+++ b/src/platformsupport/fbconvenience/qfbscreen.cpp
@@ -206,10 +206,11 @@ void QFbScreen::generateRects()
}
#endif
}
- foreach (const QRect &rect, remainingScreen.rects())
+ const QVector<QRect> remainingScreenRects = remainingScreen.rects();
+ mCachedRects.reserve(mCachedRects.count() + remainingScreenRects.count());
+ foreach (const QRect &rect, remainingScreenRects)
mCachedRects += QPair<QRect, int>(rect, -1);
mIsUpToDate = true;
- return;
}
QRegion QFbScreen::doRedraw()
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 112bb8e0a6..022bc8bec2 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -44,6 +44,7 @@
#include <QtGui/private/qfontengine_ft_p.h>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qhighdpiscaling_p.h>
#include <QtGui/qguiapplication.h>
@@ -553,10 +554,8 @@ QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintin
break;
}
- if (QGuiApplication::platformNativeInterface()->nativeResourceForScreen("nofonthinting",
- QGuiApplication::primaryScreen())) {
+ if (QHighDpiScaling::isActive())
return QFontEngine::HintNone;
- }
int hint_style = 0;
if (FcPatternGetInteger (match, FC_HINT_STYLE, 0, &hint_style) == FcResultMatch) {
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index be70092010..75c4065d66 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -48,18 +48,6 @@
QT_BEGIN_NAMESPACE
-namespace {
-class AutoReleasePool
-{
-public:
- AutoReleasePool(): pool([[NSAutoreleasePool alloc] init]) {}
- ~AutoReleasePool() { [pool release]; }
-
-private:
- NSAutoreleasePool *pool;
-};
-}
-
// this could become a list of all languages used for each writing
// system, instead of using the single most common language.
static const char *languageForWritingSystem[] = {
@@ -453,7 +441,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
Q_UNUSED(style);
Q_UNUSED(script);
- AutoReleasePool pool;
+ QMacAutoReleasePool pool;
static QHash<QString, QStringList> fallbackLists;
diff --git a/src/platformsupport/input/evdevtablet/qevdevtablet.cpp b/src/platformsupport/input/evdevtablet/qevdevtablet.cpp
index c59f0f390a..c6f952c64d 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtablet.cpp
+++ b/src/platformsupport/input/evdevtablet/qevdevtablet.cpp
@@ -292,7 +292,7 @@ void QEvdevTabletHandler::readData()
QEvdevTabletHandlerThread::QEvdevTabletHandlerThread(const QString &spec, QObject *parent)
- : QThread(parent), m_spec(spec), m_handler(0)
+ : QDaemonThread(parent), m_spec(spec), m_handler(0)
{
start();
}
diff --git a/src/platformsupport/input/evdevtablet/qevdevtablet_p.h b/src/platformsupport/input/evdevtablet/qevdevtablet_p.h
index f9682290d9..f546f9a88a 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtablet_p.h
+++ b/src/platformsupport/input/evdevtablet/qevdevtablet_p.h
@@ -48,6 +48,7 @@
#include <QObject>
#include <QString>
#include <QThread>
+#include <QtCore/private/qthread_p.h>
QT_BEGIN_NAMESPACE
@@ -68,7 +69,7 @@ private:
QEvdevTabletData *d;
};
-class QEvdevTabletHandlerThread : public QThread
+class QEvdevTabletHandlerThread : public QDaemonThread
{
public:
explicit QEvdevTabletHandlerThread(const QString &spec, QObject *parent = 0);
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
index 885326e512..1ca95074b9 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
@@ -418,11 +418,11 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
m_currentData.y = qBound(hw_range_y_min, data->value, hw_range_y_max);
if (m_singleTouch)
m_contacts[m_currentSlot].y = m_currentData.y;
- if (m_typeB) {
- m_contacts[m_currentSlot].y = m_currentData.y;
- if (m_contacts[m_currentSlot].state == Qt::TouchPointStationary)
- m_contacts[m_currentSlot].state = Qt::TouchPointMoved;
- }
+ if (m_typeB) {
+ m_contacts[m_currentSlot].y = m_currentData.y;
+ if (m_contacts[m_currentSlot].state == Qt::TouchPointStationary)
+ m_contacts[m_currentSlot].state = Qt::TouchPointMoved;
+ }
} else if (data->code == ABS_MT_TRACKING_ID) {
m_currentData.trackingId = data->value;
if (m_typeB) {
@@ -642,7 +642,7 @@ void QEvdevTouchScreenData::reportPoints()
QEvdevTouchScreenHandlerThread::QEvdevTouchScreenHandlerThread(const QString &device, const QString &spec, QObject *parent)
- : QThread(parent), m_device(device), m_spec(spec), m_handler(0)
+ : QDaemonThread(parent), m_device(device), m_spec(spec), m_handler(0)
{
start();
}
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
index a6d3a860f5..8e7dfe59bb 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
@@ -49,6 +49,7 @@
#include <QString>
#include <QList>
#include <QThread>
+#include <QtCore/private/qthread_p.h>
#include <qpa/qwindowsysteminterface.h>
#if !defined(QT_NO_MTDEV)
@@ -80,7 +81,7 @@ private:
#endif
};
-class QEvdevTouchScreenHandlerThread : public QThread
+class QEvdevTouchScreenHandlerThread : public QDaemonThread
{
public:
explicit QEvdevTouchScreenHandlerThread(const QString &device, const QString &spec, QObject *parent = 0);
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
index c040dab5e1..d155cecd89 100644
--- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
+++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
@@ -1431,7 +1431,9 @@ bool AtSpiAdaptor::accessibleInterface(QAccessibleInterface *interface, const QS
QSpiObjectReference(connection, QDBusObjectPath(QSPI_OBJECT_PATH_ROOT))));
} else if (function == QLatin1String("GetChildren")) {
QSpiObjectReferenceArray children;
- for (int i = 0; i < interface->childCount(); ++i) {
+ const int numChildren = interface->childCount();
+ children.reserve(numChildren);
+ for (int i = 0; i < numChildren; ++i) {
QString childPath = pathForInterface(interface->child(i));
QSpiObjectReference ref(connection, QDBusObjectPath(childPath));
children << ref;
@@ -1507,7 +1509,7 @@ QSpiRelationArray AtSpiAdaptor::relationSet(QAccessibleInterface *interface, con
Q_FOREACH (const RelationPair &pair, relationInterfaces) {
// FIXME: this loop seems a bit strange... "related" always have one item when we check.
//And why is it a list, when it always have one item? And it seems to assume that the QAccessible::Relation enum maps directly to AtSpi
- QList<QSpiObjectReference> related;
+ QSpiObjectReferenceArray related;
QDBusObjectPath path = QDBusObjectPath(pathForInterface(pair.first));
related.append(QSpiObjectReference(connection, path));
@@ -1747,7 +1749,9 @@ QSpiActionArray AtSpiAdaptor::getActions(QAccessibleInterface *interface) const
{
QAccessibleActionInterface *actionInterface = interface->actionInterface();
QSpiActionArray actions;
- Q_FOREACH (const QString &actionName, QAccessibleBridgeUtils::effectiveActionNames(interface)) {
+ const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
+ actions.reserve(actionNames.size());
+ Q_FOREACH (const QString &actionName, actionNames) {
QSpiAction action;
QStringList keyBindings;
diff --git a/src/platformsupport/linuxaccessibility/cache.cpp b/src/platformsupport/linuxaccessibility/cache.cpp
index 2ece905fdf..0ccd2cba6e 100644
--- a/src/platformsupport/linuxaccessibility/cache.cpp
+++ b/src/platformsupport/linuxaccessibility/cache.cpp
@@ -78,8 +78,7 @@ void QSpiDBusCache::emitRemoveAccessible(const QSpiObjectReference& item)
QSpiAccessibleCacheArray QSpiDBusCache::GetItems()
{
- QList <QSpiAccessibleCacheItem> cacheArray;
- return cacheArray;
+ return QSpiAccessibleCacheArray();
}
QT_END_NAMESPACE
diff --git a/src/platformsupport/linuxaccessibility/dbusconnection.cpp b/src/platformsupport/linuxaccessibility/dbusconnection.cpp
index 45729fa065..637b06549a 100644
--- a/src/platformsupport/linuxaccessibility/dbusconnection.cpp
+++ b/src/platformsupport/linuxaccessibility/dbusconnection.cpp
@@ -42,6 +42,9 @@
#include <QDBusConnectionInterface>
#include "bus_interface.h"
+#include <QtGui/qguiapplication.h>
+#include <qplatformnativeinterface.h>
+
QT_BEGIN_NAMESPACE
QString A11Y_SERVICE = QStringLiteral("org.a11y.Bus");
@@ -65,6 +68,29 @@ DBusConnection::DBusConnection(QObject *parent)
// If it is registered already, setup a11y right away
if (c.interface()->isServiceRegistered(A11Y_SERVICE))
serviceRegistered();
+
+ // In addition try if there is an xatom exposing the bus address, this allows applications run as root to work
+ QString address = getAddressFromXCB();
+ if (!address.isEmpty()) {
+ m_enabled = true;
+ connectA11yBus(address);
+ }
+}
+
+QString DBusConnection::getAddressFromXCB()
+{
+ QGuiApplication *app = qobject_cast<QGuiApplication *>(QCoreApplication::instance());
+ if (!app)
+ return QString();
+ QPlatformNativeInterface *platformNativeInterface = app->platformNativeInterface();
+ QByteArray *addressByteArray = reinterpret_cast<QByteArray*>(
+ platformNativeInterface->nativeResourceForIntegration(QByteArrayLiteral("AtspiBus")));
+ if (addressByteArray) {
+ QString address = QString::fromLatin1(*addressByteArray);
+ delete addressByteArray;
+ return address;
+ }
+ return QString();
}
// We have the a11y registry on the session bus.
diff --git a/src/platformsupport/linuxaccessibility/dbusconnection_p.h b/src/platformsupport/linuxaccessibility/dbusconnection_p.h
index a0bd6450bf..30707a3f95 100644
--- a/src/platformsupport/linuxaccessibility/dbusconnection_p.h
+++ b/src/platformsupport/linuxaccessibility/dbusconnection_p.h
@@ -68,6 +68,7 @@ Q_SIGNALS:
void enabledChanged(bool enabled);
private Q_SLOTS:
+ QString getAddressFromXCB();
void serviceRegistered();
void serviceUnregistered();
void connectA11yBus(const QString &address);
diff --git a/src/platformsupport/linuxaccessibility/struct_marshallers_p.h b/src/platformsupport/linuxaccessibility/struct_marshallers_p.h
index 7788ceb7cc..61d79e6daa 100644
--- a/src/platformsupport/linuxaccessibility/struct_marshallers_p.h
+++ b/src/platformsupport/linuxaccessibility/struct_marshallers_p.h
@@ -46,7 +46,7 @@
// We mean it.
//
-#include <QtCore/qlist.h>
+#include <QtCore/qvector.h>
#include <QtCore/qpair.h>
#include <QtDBus/QDBusArgument>
#include <QtDBus/QDBusConnection>
@@ -55,8 +55,8 @@
#ifndef QT_NO_ACCESSIBILITY
QT_BEGIN_NAMESPACE
-typedef QList <int> QSpiIntList;
-typedef QList <uint> QSpiUIntList;
+typedef QVector<int> QSpiIntList;
+typedef QVector<uint> QSpiUIntList;
// FIXME: make this copy on write
struct QSpiObjectReference
@@ -68,26 +68,29 @@ struct QSpiObjectReference
QSpiObjectReference(const QDBusConnection& connection, const QDBusObjectPath& path)
: service(connection.baseService()), path(path) {}
};
+Q_DECLARE_TYPEINFO(QSpiObjectReference, Q_MOVABLE_TYPE); // QDBusObjectPath is movable, even though it
+ // cannot be marked that way until Qt 6
QDBusArgument &operator<<(QDBusArgument &argument, const QSpiObjectReference &address);
const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiObjectReference &address);
-typedef QList <QSpiObjectReference> QSpiObjectReferenceArray;
+typedef QVector<QSpiObjectReference> QSpiObjectReferenceArray;
struct QSpiAccessibleCacheItem
{
QSpiObjectReference path;
QSpiObjectReference application;
QSpiObjectReference parent;
- QList <QSpiObjectReference> children;
+ QSpiObjectReferenceArray children;
QStringList supportedInterfaces;
QString name;
uint role;
QString description;
QSpiUIntList state;
};
+Q_DECLARE_TYPEINFO(QSpiAccessibleCacheItem, Q_MOVABLE_TYPE);
-typedef QList <QSpiAccessibleCacheItem> QSpiAccessibleCacheArray;
+typedef QVector<QSpiAccessibleCacheItem> QSpiAccessibleCacheArray;
QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAccessibleCacheItem &item);
const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAccessibleCacheItem &item);
@@ -98,8 +101,9 @@ struct QSpiAction
QString description;
QString keyBinding;
};
+Q_DECLARE_TYPEINFO(QSpiAction, Q_MOVABLE_TYPE);
-typedef QList <QSpiAction> QSpiActionArray;
+typedef QVector<QSpiAction> QSpiActionArray;
QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAction &action);
const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAction &action);
@@ -109,14 +113,15 @@ struct QSpiEventListener
QString listenerAddress;
QString eventName;
};
+Q_DECLARE_TYPEINFO(QSpiEventListener, Q_MOVABLE_TYPE);
-typedef QList <QSpiEventListener> QSpiEventListenerArray;
+typedef QVector<QSpiEventListener> QSpiEventListenerArray;
QDBusArgument &operator<<(QDBusArgument &argument, const QSpiEventListener &action);
const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiEventListener &action);
-typedef QPair < unsigned int, QList < QSpiObjectReference > > QSpiRelationArrayEntry;
-typedef QList< QSpiRelationArrayEntry > QSpiRelationArray;
+typedef QPair<unsigned int, QSpiObjectReferenceArray> QSpiRelationArrayEntry;
+typedef QVector<QSpiRelationArrayEntry> QSpiRelationArray;
//a(iisv)
struct QSpiTextRange {
@@ -125,18 +130,22 @@ struct QSpiTextRange {
QString contents;
QVariant v;
};
-typedef QList <QSpiTextRange> QSpiTextRangeList;
+Q_DECLARE_TYPEINFO(QSpiTextRange, Q_MOVABLE_TYPE);
+
+typedef QVector<QSpiTextRange> QSpiTextRangeList;
typedef QMap <QString, QString> QSpiAttributeSet;
enum QSpiAppUpdateType {
QSPI_APP_UPDATE_ADDED = 0,
QSPI_APP_UPDATE_REMOVED = 1
};
+Q_DECLARE_TYPEINFO(QSpiAppUpdateType, Q_PRIMITIVE_TYPE);
struct QSpiAppUpdate {
int type; /* Is an application added or removed */
QString address; /* D-Bus address of application added or removed */
};
+Q_DECLARE_TYPEINFO(QSpiAppUpdate, Q_MOVABLE_TYPE);
QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAppUpdate &update);
const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAppUpdate &update);
@@ -150,6 +159,7 @@ struct QSpiDeviceEvent {
QString text;
bool isText;
};
+Q_DECLARE_TYPEINFO(QSpiDeviceEvent, Q_MOVABLE_TYPE);
QDBusArgument &operator<<(QDBusArgument &argument, const QSpiDeviceEvent &event);
const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiDeviceEvent &event);
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index ba328bfb41..2e17c3f63c 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -678,7 +678,7 @@ QPlatformTheme *QGenericUnixTheme::createUnixTheme(const QString &name)
#endif
if (name == QLatin1String(QGnomeTheme::name))
return new QGnomeTheme;
- return new QGenericUnixTheme;
+ return Q_NULLPTR;
}
QStringList QGenericUnixTheme::themeNames()
@@ -710,8 +710,7 @@ QStringList QGenericUnixTheme::themeNames()
if (!session.isEmpty() && session != QLatin1String("default") && !result.contains(session))
result.push_back(session);
} // desktopSettingsAware
- if (result.isEmpty())
- result.push_back(QLatin1String(QGenericUnixTheme::name));
+ result.append(QLatin1String(QGenericUnixTheme::name));
return result;
}