Skip to content

Commit

Permalink
chore: Adapt to Qt 6.4.2
Browse files Browse the repository at this point in the history
Adapt to Qt6.4.2

Log: Adapt to Qt 6.4.2
  • Loading branch information
FeiWang1119 committed Aug 16, 2023
1 parent c97dccf commit 22997ee
Show file tree
Hide file tree
Showing 52 changed files with 4,141 additions and 16 deletions.
17 changes: 16 additions & 1 deletion src/dbackingstoreproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ void DBackingStoreProxy::flush(QWindow *window, const QRegion &region, const QPo
}
}



#ifndef QT_NO_OPENGL
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
void DOpenGLBackingStore::composeAndFlush(QWindow *window, const QRegion &region, const QPoint &offset,
Expand All @@ -119,18 +121,31 @@ void DOpenGLBackingStore::composeAndFlush(QWindow *window, const QRegion &region
{
m_proxy->composeAndFlush(window, region, offset, textures, context, translucentBackground);
}
#else
#elif QT_VERSION <= QT_VERSION_CHECK(6, 2, 4)
void DBackingStoreProxy::composeAndFlush(QWindow *window, const QRegion &region, const QPoint &offset,
QPlatformTextureList *textures,
bool translucentBackground)
{
m_proxy->composeAndFlush(window, region, offset, textures, translucentBackground);
}
#else
QPlatformBackingStore::FlushResult DBackingStoreProxy::rhiFlush(QWindow *window, qreal sourceDevicePixelRatio, const QRegion &region, const QPoint &offset, QPlatformTextureList *textures, bool translucentBackground)
{
return m_proxy->rhiFlush(window, sourceDevicePixelRatio, region, offset, textures, translucentBackground);
}
#endif

#if QT_VERSION <= QT_VERSION_CHECK(6, 2, 4)
GLuint DBackingStoreProxy::toTexture(const QRegion &dirtyRegion, QSize *textureSize, TextureFlags *flags) const
{
return m_proxy->toTexture(dirtyRegion, textureSize, flags);
}
#else
QRhiTexture *DBackingStoreProxy::toTexture(QRhiResourceUpdateBatch *resourceUpdates, const QRegion &dirtyRegion, TextureFlags *flags) const
{
return m_proxy->toTexture(resourceUpdates, dirtyRegion, flags);
}
#endif
#endif

QImage DBackingStoreProxy::toImage() const
Expand Down
10 changes: 9 additions & 1 deletion src/dbackingstoreproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,20 @@ class DBackingStoreProxy : public QPlatformBackingStore
void composeAndFlush(QWindow *window, const QRegion &region, const QPoint &offset,
QPlatformTextureList *textures, QOpenGLContext *context,
bool translucentBackground) override;
#else
#elif QT_VERSION <= QT_VERSION_CHECK(6, 2, 4)
void composeAndFlush(QWindow *window, const QRegion &region, const QPoint &offset,
QPlatformTextureList *textures,
bool translucentBackground) override;
#else
FlushResult rhiFlush(QWindow *window, qreal sourceDevicePixelRatio, const QRegion &region,
const QPoint &offset, QPlatformTextureList *textures,
bool translucentBackground) override;
#endif
#if QT_VERSION <= QT_VERSION_CHECK(6, 2, 4)
GLuint toTexture(const QRegion &dirtyRegion, QSize *textureSize, TextureFlags *flags) const override;
#else
QRhiTexture *toTexture(QRhiResourceUpdateBatch *resourceUpdates, const QRegion &dirtyRegion, TextureFlags *flags) const override;
#endif
#endif
QImage toImage() const override;
QPlatformGraphicsBuffer *graphicsBuffer() const override;
Expand Down
7 changes: 6 additions & 1 deletion xcb/dplatformintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,10 +1000,15 @@ static void startDrag(QXcbDrag *drag)
// 上一次的 actions, 导致某些小问题 (比如文管的拖拽行为不一致的问题)
// if (support_actions.size() < 2)
// return;

#if QT_VERSION <= QT_VERSION_CHECK(6, 2, 4)
xcb_change_property(drag->xcb_connection(), XCB_PROP_MODE_REPLACE, drag->connection()->clipboard()->m_owner,
drag->atom(QXcbAtom::XdndActionList), XCB_ATOM_ATOM, sizeof(xcb_atom_t) * 8,
support_actions.size(), support_actions.constData());
#else
xcb_change_property(drag->xcb_connection(), XCB_PROP_MODE_REPLACE, drag->connection()->clipboard()->m_requestor, //TODO: m_ower deleted, replaced by m_requestor ?
drag->atom(QXcbAtom::XdndActionList), XCB_ATOM_ATOM, sizeof(xcb_atom_t) * 8,
support_actions.size(), support_actions.constData());
#endif
xcb_flush(drag->xcb_connection());
}

Expand Down
33 changes: 20 additions & 13 deletions xcb/dplatformwindowhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <private/qwindow_p.h>
#include <private/qguiapplication_p.h>
#include <private/qeventpoint_p.h>
#include <qpa/qplatformcursor.h>

#include <QPainterPath>
Expand Down Expand Up @@ -604,15 +605,19 @@ bool DPlatformWindowHelper::eventFilter(QObject *watched, QEvent *event)
&& !qFuzzyCompare(posF.y(), rectF.height())
&& rectF.contains(posF)) {
m_frameWindow->unsetCursor();

#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
e->l = e->w = m_nativeWindow->window()->mapFromGlobal(e->globalPos());
qApp->sendEvent(m_nativeWindow->window(), e);
#elif QT_VERSION <= QT_VERSION_CHECK(6, 2, 4)
QScopedPointer<QMutableSinglePointEvent> mevent(QMutableSinglePointEvent::from(e->clone()));
mevent->mutablePoint().setPosition(m_nativeWindow->window()->mapFromGlobal(e->globalPosition()));
mevent->mutablePoint().setScenePosition(m_nativeWindow->window()->mapFromGlobal(e->globalPosition()));
qApp->sendEvent(m_nativeWindow->window(), mevent.data());
#else
e->l = e->w = m_nativeWindow->window()->mapFromGlobal(e->globalPos());
qApp->sendEvent(m_nativeWindow->window(), e);
QScopedPointer<QMutableSinglePointEvent> mevent(QMutableSinglePointEvent::from(e->clone()));
QMutableEventPoint::setPosition(mevent.data()->point(0), m_nativeWindow->window()->mapFromGlobal(e->globalPosition()));
QMutableEventPoint::setScenePosition(mevent.data()->point(0), m_nativeWindow->window()->mapFromGlobal(e->globalPosition()));
qApp->sendEvent(m_nativeWindow->window(), mevent.data());
#endif
return true;
}
Expand Down Expand Up @@ -694,17 +699,19 @@ bool DPlatformWindowHelper::eventFilter(QObject *watched, QEvent *event)
if (!event->isAccepted()) {
DQMouseEvent *e = static_cast<DQMouseEvent*>(event);

#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
e->l = e->w = m_nativeWindow->window()->mapFromGlobal(e->globalPos());
qApp->sendEvent(m_nativeWindow->window(), e);
#elif QT_VERSION <= QT_VERSION_CHECK(6, 2, 4)
QScopedPointer<QMutableSinglePointEvent> mevent(QMutableSinglePointEvent::from(e->clone()));
mevent->mutablePoint().setPosition(m_frameWindow->mapFromGlobal(e->globalPosition()));
mevent->mutablePoint().setScenePosition(m_frameWindow->mapFromGlobal(e->globalPosition()));
mevent->setSource(Qt::MouseEventSynthesizedByQt);
QMouseEvent *me = dynamic_cast<QMouseEvent *>(static_cast<QSinglePointEvent *>(mevent.data()));
m_frameWindow->mouseMoveEvent(me);
mevent->mutablePoint().setPosition(m_nativeWindow->window()->mapFromGlobal(e->globalPosition()));
mevent->mutablePoint().setScenePosition(m_nativeWindow->window()->mapFromGlobal(e->globalPosition()));
qApp->sendEvent(m_nativeWindow->window(), mevent.data());
#else
e->l = e->w = m_frameWindow->mapFromGlobal(e->globalPos());
QGuiApplicationPrivate::setMouseEventSource(e, Qt::MouseEventSynthesizedByQt);
m_frameWindow->mouseMoveEvent(e);
QScopedPointer<QMutableSinglePointEvent> mevent(QMutableSinglePointEvent::from(e->clone()));
QMutableEventPoint::setPosition(mevent.data()->point(0), m_nativeWindow->window()->mapFromGlobal(e->globalPosition()));
QMutableEventPoint::setScenePosition(mevent.data()->point(0), m_nativeWindow->window()->mapFromGlobal(e->globalPosition()));
qApp->sendEvent(m_nativeWindow->window(), mevent.data());
#endif
return true;
}
Expand Down
41 changes: 41 additions & 0 deletions xcb/libqt6xcbqpa-dev/6.4.2/gl_integrations/qxcbglintegration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QXCBGLINTEGRATION_H

#include "qxcbexport.h"
#include "qxcbwindow.h"

#include <QtCore/QLoggingCategory>

QT_BEGIN_NAMESPACE

class QPlatformOffscreenSurface;
class QOffscreenSurface;
class QXcbNativeInterfaceHandler;

Q_XCB_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcQpaGl)

class Q_XCB_EXPORT QXcbGlIntegration
{
public:
QXcbGlIntegration();
virtual ~QXcbGlIntegration();
virtual bool initialize(QXcbConnection *connection) = 0;

virtual bool supportsThreadedOpenGL() const { return false; }
virtual bool supportsSwitchableWidgetComposition() const { return true; }
virtual bool handleXcbEvent(xcb_generic_event_t *event, uint responseType);

virtual QXcbWindow *createWindow(QWindow *window) const = 0;
#ifndef QT_NO_OPENGL
virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const = 0;
#endif
virtual QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const = 0;

virtual QXcbNativeInterfaceHandler *nativeInterfaceHandler() const { return nullptr; }
};

QT_END_NAMESPACE

#endif //QXCBGLINTEGRATION_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QXCBGLINTEGRATIONFACTORY_H
#define QXCBGLINTEGRATIONFACTORY_H

#include <QtCore/qstringlist.h>

QT_BEGIN_NAMESPACE

class QXcbGlIntegration;

class QXcbGlIntegrationFactory
{
public:
static QXcbGlIntegration *create(const QString &name);
};

QT_END_NAMESPACE

#endif //QXCBGLINTEGRATIONFACTORY_H

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QXCBGLINTEGRATIONPLUGIN_H
#define QXCBGLINTEGRATIONPLUGIN_H

#include "qxcbexport.h"
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>

QT_BEGIN_NAMESPACE

#define QXcbGlIntegrationFactoryInterface_iid "org.qt-project.Qt.QPA.Xcb.QXcbGlIntegrationFactoryInterface.5.5"

class QXcbGlIntegration;

class Q_XCB_EXPORT QXcbGlIntegrationPlugin : public QObject
{
Q_OBJECT
public:
explicit QXcbGlIntegrationPlugin(QObject *parent = nullptr)
: QObject(parent)
{ }

virtual QXcbGlIntegration *create() = 0;
// the pattern expected by qLoadPlugin calls for a QString argument.
// we don't need it, so don't bother subclasses with it:
QXcbGlIntegration *create(const QString &) { return create(); }
};
QT_END_NAMESPACE

#endif //QXCBGLINTEGRATIONPLUGIN_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QXCBNATIVEINTERFACEHANDLER_H
#define QXCBNATIVEINTERFACEHANDLER_H

#include <QtCore/QByteArray>
#include <QtGui/qpa/qplatformnativeinterface.h>

#include "qxcbexport.h"

QT_BEGIN_NAMESPACE

class QXcbNativeInterface;
class Q_XCB_EXPORT QXcbNativeInterfaceHandler
{
public:
QXcbNativeInterfaceHandler(QXcbNativeInterface *nativeInterface);
virtual ~QXcbNativeInterfaceHandler();

virtual QPlatformNativeInterface::NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) const;
virtual QPlatformNativeInterface::NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) const;
virtual QPlatformNativeInterface::NativeResourceForScreenFunction nativeResourceFunctionForScreen(const QByteArray &resource) const;
virtual QPlatformNativeInterface::NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) const;
virtual QPlatformNativeInterface::NativeResourceForBackingStoreFunction nativeResourceFunctionForBackingStore(const QByteArray &resource) const;

virtual QFunctionPointer platformFunction(const QByteArray &function) const;
protected:
QXcbNativeInterface *m_native_interface;
};

QT_END_NAMESPACE

#endif //QXCBNATIVEINTERFACEHANDLER_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QXCBEGLCONTEXT_H
#define QXCBEGLCONTEXT_H

#include "qxcbeglwindow.h"
#include <QtGui/private/qeglplatformcontext_p.h>
#include <QtGui/private/qeglpbuffer_p.h>

QT_BEGIN_NAMESPACE

class QXcbEglContext : public QEGLPlatformContext
{
public:
using QEGLPlatformContext::QEGLPlatformContext;
QXcbEglContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share, EGLDisplay display)
: QEGLPlatformContext(glFormat, share, display, nullptr)
{
}

void swapBuffers(QPlatformSurface *surface) override
{
QEGLPlatformContext::swapBuffers(surface);
if (surface->surface()->surfaceClass() == QSurface::Window) {
QXcbWindow *platformWindow = static_cast<QXcbWindow *>(surface);
// OpenGL context might be bound to a non-gui thread use QueuedConnection to sync
// the window from the platformWindow's thread as QXcbWindow is no QObject, an
// event is sent to QXcbConnection. (this is faster than a metacall)
if (platformWindow->needsSync())
platformWindow->postSyncWindowRequest();
}
}

bool makeCurrent(QPlatformSurface *surface) override
{
return QEGLPlatformContext::makeCurrent(surface);
}

void doneCurrent() override
{
QEGLPlatformContext::doneCurrent();
}

EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override
{
if (surface->surface()->surfaceClass() == QSurface::Window)
return static_cast<QXcbEglWindow *>(surface)->eglSurface();
else
return static_cast<QEGLPbuffer *>(surface)->pbuffer();
}
};

QT_END_NAMESPACE
#endif //QXCBEGLCONTEXT_H

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QXCBINCLUDE_H
#define QXCBINCLUDE_H

#include <QtGui/QPalette>
#include <QtCore/QTextStream>
#include <QtGui/private/qmath_p.h>
#include <QtGui/private/qcssparser_p.h>
#include <QtGui/private/qtextengine_p.h>

#include <QtGui/private/qt_egl_p.h>

QT_BEGIN_NAMESPACE

QT_END_NAMESPACE

#endif //QXCBINCLUDE_H
Loading

0 comments on commit 22997ee

Please sign in to comment.