Qt6.5.1: Update Qt version to latest LTS

This commit is contained in:
OatmealDome
2023-05-25 17:26:45 -04:00
parent acb8c2b383
commit 2a34bd38bf
3521 changed files with 34677 additions and 40851 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,264 +0,0 @@
// 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 QANDROIDEXTRAS_H
#define QANDROIDEXTRAS_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 <jni.h>
#include <functional>
#include <QtCore/private/qglobal_p.h>
#include <QtCore/qjniobject.h>
#include <QtCore/private/qjnihelpers_p.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qmap.h>
#if QT_CONFIG(future)
#include <QtCore/qfuture.h>
#endif
QT_BEGIN_NAMESPACE
class QAndroidParcel;
class QAndroidBinderPrivate;
class QAndroidBinder;
class Q_CORE_EXPORT QAndroidBinder
{
public:
enum class CallType {
Normal = 0,
OneWay = 1
};
public:
explicit QAndroidBinder();
QAndroidBinder(const QJniObject &binder);
virtual ~QAndroidBinder();
virtual bool onTransact(int code, const QAndroidParcel &data,
const QAndroidParcel &reply, CallType flags);
bool transact(int code, const QAndroidParcel &data,
QAndroidParcel *reply = nullptr, CallType flags = CallType::Normal) const;
QJniObject handle() const;
private:
friend class QAndroidBinderPrivate;
friend class QAndroidParcelPrivate;
friend class QAndroidServicePrivate;
QSharedPointer<QAndroidBinderPrivate> d;
};
class QAndroidParcelPrivate;
class Q_CORE_EXPORT QAndroidParcel
{
public:
QAndroidParcel();
explicit QAndroidParcel(const QJniObject& parcel);
virtual ~QAndroidParcel();
void writeData(const QByteArray &data) const;
void writeVariant(const QVariant &value) const;
void writeBinder(const QAndroidBinder &binder) const;
void writeFileDescriptor(int fd) const;
QByteArray readData() const;
QVariant readVariant() const;
QAndroidBinder readBinder() const;
int readFileDescriptor() const;
QJniObject handle() const;
private:
friend class QAndroidParcelPrivate;
friend class QAndroidBinder;
QSharedPointer<QAndroidParcelPrivate> d;
};
class QAndroidActivityResultReceiverPrivate;
class Q_CORE_EXPORT QAndroidActivityResultReceiver
{
public:
QAndroidActivityResultReceiver();
virtual ~QAndroidActivityResultReceiver();
virtual void handleActivityResult(int receiverRequestCode, int resultCode,
const QJniObject &data) = 0;
private:
friend class QAndroidActivityResultReceiverPrivate;
Q_DISABLE_COPY(QAndroidActivityResultReceiver)
QScopedPointer<QAndroidActivityResultReceiverPrivate> d;
};
class Q_CORE_EXPORT QAndroidServiceConnection
{
public:
QAndroidServiceConnection();
explicit QAndroidServiceConnection(const QJniObject &serviceConnection);
virtual ~QAndroidServiceConnection();
virtual void onServiceConnected(const QString &name,
const QAndroidBinder &serviceBinder) = 0;
virtual void onServiceDisconnected(const QString &name) = 0;
QJniObject handle() const;
private:
Q_DISABLE_COPY(QAndroidServiceConnection)
QJniObject m_handle;
};
class Q_CORE_EXPORT QAndroidIntent
{
public:
QAndroidIntent();
virtual ~QAndroidIntent();
explicit QAndroidIntent(const QJniObject &intent);
explicit QAndroidIntent(const QString &action);
explicit QAndroidIntent(const QJniObject &packageContext, const char *className);
void putExtra(const QString &key, const QByteArray &data);
QByteArray extraBytes(const QString &key);
void putExtra(const QString &key, const QVariant &value);
QVariant extraVariant(const QString &key);
QJniObject handle() const;
private:
QJniObject m_handle;
};
class QAndroidServicePrivate;
class Q_CORE_EXPORT QAndroidService : public QCoreApplication
{
Q_OBJECT
public:
QAndroidService(int &argc, char **argv
#ifndef Q_QDOC
, int flags = ApplicationFlags
#endif
);
QAndroidService(int &argc, char **argv,
const std::function<QAndroidBinder*(const QAndroidIntent &intent)> & binder
#ifndef Q_QDOC
, int flags = ApplicationFlags
#endif
);
virtual ~QAndroidService();
virtual QAndroidBinder* onBind(const QAndroidIntent &intent);
private:
friend class QAndroidServicePrivate;
Q_DISABLE_COPY(QAndroidService)
QScopedPointer<QAndroidServicePrivate> d;
};
class QAndroidActivityCallbackResultReceiver: public QAndroidActivityResultReceiver
{
public:
QAndroidActivityCallbackResultReceiver();
void handleActivityResult(int receiverRequestCode, int resultCode,
const QJniObject &intent) override;
void registerCallback(int receiverRequestCode,
std::function<void(int, int, const QJniObject &)> callbackFunc);
static QAndroidActivityCallbackResultReceiver *instance();
private:
QMap<int, std::function<void(int, int, const QJniObject &data)>> callbackMap;
static QAndroidActivityCallbackResultReceiver *s_instance;
};
namespace QtAndroidPrivate
{
Q_CORE_EXPORT void startIntentSender(const QJniObject &intentSender,
int receiverRequestCode,
QAndroidActivityResultReceiver *resultReceiver = nullptr);
Q_CORE_EXPORT void startActivity(const QJniObject &intent,
int receiverRequestCode,
QAndroidActivityResultReceiver *resultReceiver = nullptr);
Q_CORE_EXPORT void startActivity(const QAndroidIntent &intent,
int receiverRequestCode,
QAndroidActivityResultReceiver *resultReceiver = nullptr);
Q_CORE_EXPORT void startActivity(const QJniObject &intent,
int receiverRequestCode,
std::function<void(int, int, const QJniObject &data)>
callbackFunc);
enum class BindFlag {
None = 0x00000000,
AutoCreate = 0x00000001,
DebugUnbind = 0x00000002,
NotForeground = 0x00000004,
AboveClient = 0x00000008,
AllowOomManagement = 0x00000010,
WaivePriority = 0x00000020,
Important = 0x00000040,
AdjustWithActivity = 0x00000080,
ExternalService = -2147483648 // 0x80000000
};
Q_DECLARE_FLAGS(BindFlags, BindFlag)
Q_CORE_EXPORT bool bindService(const QAndroidIntent &serviceIntent,
const QAndroidServiceConnection &serviceConnection,
BindFlags flags = BindFlag::None);
#if QT_CONFIG(future)
enum PermissionType {
Camera,
Microphone,
Bluetooth,
Location,
PreciseLocation,
BackgroundLocation,
PreciseBackgroundLocation,
BodySensors,
PhysicalActivity,
Contacts,
Storage,
Calendar
};
enum PermissionResult {
Undetermined,
Authorized,
Denied
};
Q_CORE_EXPORT QFuture<QtAndroidPrivate::PermissionResult>
requestPermission(QtAndroidPrivate::PermissionType permission);
Q_CORE_EXPORT QFuture<QtAndroidPrivate::PermissionResult>
requestPermission(const QString &permission);
Q_CORE_EXPORT QFuture<QtAndroidPrivate::PermissionResult>
checkPermission(QtAndroidPrivate::PermissionType permission);
Q_CORE_EXPORT QFuture<QtAndroidPrivate::PermissionResult>
checkPermission(const QString &permission);
#endif
}
QT_END_NAMESPACE
#endif // QANDROIDEXTRAS_H

View File

@@ -1,76 +0,0 @@
// 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 QCFSOCKETNOTIFIER_P_H
#define QCFSOCKETNOTIFIER_P_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/private/qglobal_p.h>
#include <QtCore/qabstracteventdispatcher.h>
#include <QtCore/qhash.h>
#include <CoreFoundation/CoreFoundation.h>
QT_BEGIN_NAMESPACE
struct MacSocketInfo {
MacSocketInfo() : socket(0), runloop(0), readNotifier(0), writeNotifier(0),
readEnabled(false), writeEnabled(false) {}
CFSocketRef socket;
CFRunLoopSourceRef runloop;
QObject *readNotifier;
QObject *writeNotifier;
bool readEnabled;
bool writeEnabled;
};
typedef QHash<int, MacSocketInfo *> MacSocketHash;
typedef void (*MaybeCancelWaitForMoreEventsFn)(QAbstractEventDispatcher *hostEventDispacher);
// The CoreFoundationSocketNotifier class implements socket notifiers support using
// CFSocket for event dispatchers running on top of the Core Foundation run loop system.
// (currently Mac and iOS)
//
// The principal functions are registerSocketNotifier() and unregisterSocketNotifier().
//
// setHostEventDispatcher() should be called at startup.
// removeSocketNotifiers() should be called at shutdown.
//
class Q_CORE_EXPORT QCFSocketNotifier
{
public:
QCFSocketNotifier();
~QCFSocketNotifier();
void setHostEventDispatcher(QAbstractEventDispatcher *hostEventDispacher);
void setMaybeCancelWaitForMoreEventsCallback(MaybeCancelWaitForMoreEventsFn callBack);
void registerSocketNotifier(QSocketNotifier *notifier);
void unregisterSocketNotifier(QSocketNotifier *notifier);
void removeSocketNotifiers();
private:
void destroyRunLoopObserver();
static void unregisterSocketInfo(MacSocketInfo *socketInfo);
static void enableSocketNotifiers(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info);
MacSocketHash macSockets;
QAbstractEventDispatcher *eventDispatcher;
MaybeCancelWaitForMoreEventsFn maybeCancelWaitForMoreEvents;
CFRunLoopObserverRef enableNotifiersObserver;
friend void qt_mac_socket_callback(CFSocketRef, CFSocketCallBackType, CFDataRef, const void *, void *);
};
QT_END_NAMESPACE
#endif

View File

@@ -1,34 +0,0 @@
// Copyright (C) 2021 Intel Corporation.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// no, this is not a misspelling of "coffeeparser"
#ifndef QCOFFPEPARSER_H
#define QCOFFPEPARSER_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 "qlibrary_p.h"
#if defined(Q_OS_WIN)
QT_BEGIN_NAMESPACE
struct QCoffPeParser
{
static QLibraryScanResult parse(QByteArrayView data, QString *errMsg);
};
QT_END_NAMESPACE
#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU)
#endif // QCOFFPEPARSER_H

View File

@@ -1,429 +0,0 @@
// 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 QCORE_MAC_P_H
#define QCORE_MAC_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "private/qglobal_p.h"
#include <QtCore/qoperatingsystemversion.h>
#ifdef Q_OS_MACOS
#include <mach/port.h>
struct mach_header;
typedef int kern_return_t;
typedef mach_port_t io_object_t;
extern "C" {
kern_return_t IOObjectRetain(io_object_t object);
kern_return_t IOObjectRelease(io_object_t object);
}
#endif
#ifndef __IMAGECAPTURE__
# define __IMAGECAPTURE__
#endif
// --------------------------------------------------------------------------
#if defined(QT_BOOTSTRAPPED)
#include <ApplicationServices/ApplicationServices.h>
#else
#include <CoreFoundation/CoreFoundation.h>
#endif
#ifdef __OBJC__
#include <Foundation/Foundation.h>
#include <functional>
#endif
#include "qstring.h"
#include "qscopedpointer.h"
#include "qpair.h"
#if defined( __OBJC__) && defined(QT_NAMESPACE)
#define QT_NAMESPACE_ALIAS_OBJC_CLASS(__KLASS__) @compatibility_alias __KLASS__ QT_MANGLE_NAMESPACE(__KLASS__)
#else
#define QT_NAMESPACE_ALIAS_OBJC_CLASS(__KLASS__)
#endif
#define QT_MAC_WEAK_IMPORT(symbol) extern "C" decltype(symbol) symbol __attribute__((weak_import));
#if defined(__OBJC__)
#define QT_DECLARE_NAMESPACED_OBJC_INTERFACE(classname, definition) \
@interface QT_MANGLE_NAMESPACE(classname) : \
definition \
@end \
QT_NAMESPACE_ALIAS_OBJC_CLASS(classname);
#else
#define QT_DECLARE_NAMESPACED_OBJC_INTERFACE(classname, definition) \
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(classname)); \
using classname = QT_MANGLE_NAMESPACE(classname);
#endif
#define QT_FORWARD_DECLARE_OBJC_ENUM(name, type) \
typedef type name;
Q_FORWARD_DECLARE_OBJC_CLASS(NSObject);
Q_FORWARD_DECLARE_OBJC_CLASS(NSString);
// @compatibility_alias doesn't work with categories or their methods
#define QtExtras QT_MANGLE_NAMESPACE(QtExtras)
QT_BEGIN_NAMESPACE
template <typename T, typename U, auto RetainFunction, auto ReleaseFunction>
class QAppleRefCounted
{
public:
QAppleRefCounted() : value() {}
QAppleRefCounted(const T &t) : value(t) {}
QAppleRefCounted(T &&t) noexcept(std::is_nothrow_move_constructible<T>::value)
: value(std::move(t)) {}
QAppleRefCounted(QAppleRefCounted &&other)
noexcept(std::is_nothrow_move_assignable<T>::value &&
std::is_nothrow_move_constructible<T>::value)
: value(qExchange(other.value, T())) {}
QAppleRefCounted(const QAppleRefCounted &other) : value(other.value) { if (value) RetainFunction(value); }
~QAppleRefCounted() { if (value) ReleaseFunction(value); }
operator T() const { return value; }
void swap(QAppleRefCounted &other) noexcept(noexcept(qSwap(value, other.value)))
{ qSwap(value, other.value); }
QAppleRefCounted &operator=(const QAppleRefCounted &other)
{ QAppleRefCounted copy(other); swap(copy); return *this; }
QAppleRefCounted &operator=(QAppleRefCounted &&other)
noexcept(std::is_nothrow_move_assignable<T>::value &&
std::is_nothrow_move_constructible<T>::value)
{ QAppleRefCounted moved(std::move(other)); swap(moved); return *this; }
T *operator&() { return &value; }
protected:
T value;
};
#ifdef Q_OS_MACOS
class QMacRootLevelAutoReleasePool
{
public:
QMacRootLevelAutoReleasePool();
~QMacRootLevelAutoReleasePool();
private:
QScopedPointer<QMacAutoReleasePool> pool;
};
#endif
/*
Helper class that automates reference counting for CFtypes.
After constructing the QCFType object, it can be copied like a
value-based type.
Note that you must own the object you are wrapping.
This is typically the case if you get the object from a Core
Foundation function with the word "Create" or "Copy" in it. If
you got the object from a "Get" function, either retain it or use
constructFromGet(). One exception to this rule is the
HIThemeGet*Shape functions, which in reality are "Copy" functions.
*/
template <typename T>
class QCFType : public QAppleRefCounted<T, CFTypeRef, CFRetain, CFRelease>
{
using Base = QAppleRefCounted<T, CFTypeRef, CFRetain, CFRelease>;
public:
using Base::Base;
explicit QCFType(CFTypeRef r) : Base(static_cast<T>(r)) {}
template <typename X> X as() const { return reinterpret_cast<X>(this->value); }
static QCFType constructFromGet(const T &t)
{
if (t)
CFRetain(t);
return QCFType<T>(t);
}
};
#ifdef Q_OS_MACOS
template <typename T>
class QIOType : public QAppleRefCounted<T, io_object_t, IOObjectRetain, IOObjectRelease>
{
using QAppleRefCounted<T, io_object_t, IOObjectRetain, IOObjectRelease>::QAppleRefCounted;
};
#endif
class Q_CORE_EXPORT QCFString : public QCFType<CFStringRef>
{
public:
using QCFType<CFStringRef>::QCFType;
inline QCFString(const QString &str) : QCFType<CFStringRef>(0), string(str) {}
inline QCFString(const CFStringRef cfstr = 0) : QCFType<CFStringRef>(cfstr) {}
inline QCFString(const QCFType<CFStringRef> &other) : QCFType<CFStringRef>(other) {}
operator QString() const;
operator CFStringRef() const;
private:
QString string;
};
#ifdef Q_OS_MACOS
Q_CORE_EXPORT bool qt_mac_applicationIsInDarkMode();
Q_CORE_EXPORT bool qt_mac_runningUnderRosetta();
Q_CORE_EXPORT std::optional<uint32_t> qt_mac_sipConfiguration();
Q_CORE_EXPORT void qt_mac_ensureResponsible();
#endif
#ifndef QT_NO_DEBUG_STREAM
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool);
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QCFString &string);
#endif
Q_CORE_EXPORT bool qt_apple_isApplicationExtension();
Q_CORE_EXPORT bool qt_apple_isSandboxed();
#if !defined(QT_BOOTSTRAPPED) && defined(__OBJC__)
QT_END_NAMESPACE
@interface NSObject (QtSandboxHelpers)
- (id)qt_valueForPrivateKey:(NSString *)key;
@end
QT_BEGIN_NAMESPACE
#endif
#if !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WATCHOS)
QT_END_NAMESPACE
# if defined(Q_OS_MACOS)
Q_FORWARD_DECLARE_OBJC_CLASS(NSApplication);
using AppleApplication = NSApplication;
# else
Q_FORWARD_DECLARE_OBJC_CLASS(UIApplication);
using AppleApplication = UIApplication;
# endif
QT_BEGIN_NAMESPACE
Q_CORE_EXPORT AppleApplication *qt_apple_sharedApplication();
#endif
// --------------------------------------------------------------------------
#if !defined(QT_BOOTSTRAPPED)
#define QT_USE_APPLE_UNIFIED_LOGGING
QT_END_NAMESPACE
#include <os/log.h>
QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT AppleUnifiedLogger
{
public:
static bool messageHandler(QtMsgType msgType, const QMessageLogContext &context, const QString &message,
const QString &subsystem = QString());
static bool willMirrorToStderr();
private:
static os_log_type_t logTypeForMessageType(QtMsgType msgType);
static os_log_t cachedLog(const QString &subsystem, const QString &category);
};
#endif
// --------------------------------------------------------------------------
#if !defined(QT_BOOTSTRAPPED)
QT_END_NAMESPACE
#include <os/activity.h>
QT_BEGIN_NAMESPACE
template <typename T> using QAppleOsType = QAppleRefCounted<T, void *, os_retain, os_release>;
class Q_CORE_EXPORT QAppleLogActivity
{
public:
QAppleLogActivity() : activity(nullptr) {}
QAppleLogActivity(os_activity_t activity) : activity(activity) {}
~QAppleLogActivity() { if (activity) leave(); }
Q_DISABLE_COPY(QAppleLogActivity)
QAppleLogActivity(QAppleLogActivity &&other)
: activity(qExchange(other.activity, nullptr)), state(other.state)
{
}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QAppleLogActivity)
QAppleLogActivity &&enter()
{
if (activity)
os_activity_scope_enter(static_cast<os_activity_t>(*this), &state);
return std::move(*this);
}
void leave()
{
if (activity)
os_activity_scope_leave(&state);
}
operator os_activity_t()
{
return reinterpret_cast<os_activity_t>(static_cast<void *>(activity));
}
void swap(QAppleLogActivity &other)
{
activity.swap(other.activity);
std::swap(state, other.state);
}
private:
// Work around API_AVAILABLE not working for templates by using void*
QAppleOsType<void *> activity;
os_activity_scope_state_s state;
};
#define QT_APPLE_LOG_ACTIVITY_CREATE(condition, description, parent) []() { \
if (!(condition)) \
return QAppleLogActivity(); \
return QAppleLogActivity(os_activity_create(description, parent, OS_ACTIVITY_FLAG_DEFAULT)); \
}()
#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT_3(condition, description, parent) QT_APPLE_LOG_ACTIVITY_CREATE(condition, description, parent)
#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT_2(description, parent) QT_APPLE_LOG_ACTIVITY_WITH_PARENT_3(true, description, parent)
#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT(...) QT_OVERLOADED_MACRO(QT_APPLE_LOG_ACTIVITY_WITH_PARENT, __VA_ARGS__)
QT_MAC_WEAK_IMPORT(_os_activity_current);
#define QT_APPLE_LOG_ACTIVITY_2(condition, description) QT_APPLE_LOG_ACTIVITY_CREATE(condition, description, OS_ACTIVITY_CURRENT)
#define QT_APPLE_LOG_ACTIVITY_1(description) QT_APPLE_LOG_ACTIVITY_2(true, description)
#define QT_APPLE_LOG_ACTIVITY(...) QT_OVERLOADED_MACRO(QT_APPLE_LOG_ACTIVITY, __VA_ARGS__)
#define QT_APPLE_SCOPED_LOG_ACTIVITY(...) QAppleLogActivity scopedLogActivity = QT_APPLE_LOG_ACTIVITY(__VA_ARGS__).enter();
#endif // !defined(QT_BOOTSTRAPPED)
// -------------------------------------------------------------------------
class Q_CORE_EXPORT QMacNotificationObserver
{
public:
QMacNotificationObserver() {}
#if defined( __OBJC__)
template<typename Functor>
QMacNotificationObserver(NSObject *object, NSNotificationName name, Functor callback) {
observer = [[NSNotificationCenter defaultCenter] addObserverForName:name
object:object queue:nil usingBlock:^(NSNotification *) {
callback();
}
];
}
#endif
QMacNotificationObserver(const QMacNotificationObserver &other) = delete;
QMacNotificationObserver(QMacNotificationObserver &&other)
: observer(qExchange(other.observer, nullptr))
{
}
QMacNotificationObserver &operator=(const QMacNotificationObserver &other) = delete;
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QMacNotificationObserver)
void swap(QMacNotificationObserver &other) noexcept
{
qt_ptr_swap(observer, other.observer);
}
void remove();
~QMacNotificationObserver() { remove(); }
private:
NSObject *observer = nullptr;
};
QT_END_NAMESPACE
QT_DECLARE_NAMESPACED_OBJC_INTERFACE(KeyValueObserver, NSObject)
QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QMacKeyValueObserver
{
public:
using Callback = std::function<void()>;
QMacKeyValueObserver() = default;
#if defined( __OBJC__)
// Note: QMacKeyValueObserver must not outlive the object observed!
QMacKeyValueObserver(NSObject *object, NSString *keyPath, Callback callback,
NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew)
: object(object), keyPath(keyPath), callback(new Callback(callback))
{
addObserver(options);
}
#endif
QMacKeyValueObserver(const QMacKeyValueObserver &other);
QMacKeyValueObserver(QMacKeyValueObserver &&other) noexcept { swap(other); }
~QMacKeyValueObserver() { removeObserver(); }
QMacKeyValueObserver &operator=(const QMacKeyValueObserver &other)
{
QMacKeyValueObserver tmp(other);
swap(tmp);
return *this;
}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QMacKeyValueObserver)
void removeObserver();
void swap(QMacKeyValueObserver &other) noexcept
{
qt_ptr_swap(object, other.object);
qt_ptr_swap(keyPath, other.keyPath);
callback.swap(other.callback);
}
private:
#if defined( __OBJC__)
void addObserver(NSKeyValueObservingOptions options);
#endif
NSObject *object = nullptr;
NSString *keyPath = nullptr;
std::unique_ptr<Callback> callback;
static KeyValueObserver *observer;
};
// -------------------------------------------------------------------------
class Q_CORE_EXPORT QMacVersion
{
public:
enum VersionTarget {
ApplicationBinary,
QtLibraries
};
static QOperatingSystemVersion buildSDK(VersionTarget target = ApplicationBinary);
static QOperatingSystemVersion deploymentTarget(VersionTarget target = ApplicationBinary);
static QOperatingSystemVersion currentRuntime();
private:
QMacVersion() = default;
using VersionTuple = QPair<QOperatingSystemVersion, QOperatingSystemVersion>;
static VersionTuple versionsForImage(const mach_header *machHeader);
static VersionTuple applicationVersion();
static VersionTuple libraryVersion();
};
// -------------------------------------------------------------------------
QT_END_NAMESPACE
#endif // QCORE_MAC_P_H

View File

@@ -1,39 +0,0 @@
// 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 QCOREGLOBALDATA_P_H
#define QCOREGLOBALDATA_P_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/private/qglobal_p.h>
#include "QtCore/qstringlist.h"
#include "QtCore/qreadwritelock.h"
#include "QtCore/qhash.h"
#include "QtCore/qbytearray.h"
#include "QtCore/qmutex.h"
QT_BEGIN_NAMESPACE
struct QCoreGlobalData
{
QCoreGlobalData();
~QCoreGlobalData();
QHash<QString, QStringList> dirSearchPaths;
QReadWriteLock dirSearchPathsLock;
static QCoreGlobalData *instance();
};
QT_END_NAMESPACE
#endif // QCOREGLOBALDATA_P_H

View File

@@ -1,241 +0,0 @@
// 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
/****************************************************************************
**
** Copyright (c) 2007-2008, Apple, Inc.
**
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
**
** * Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution.
**
** * Neither the name of Apple, Inc. nor the names of its contributors
** may be used to endorse or promote products derived from this software
** without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************/
#ifndef QEVENTDISPATCHER_CF_P_H
#define QEVENTDISPATCHER_CF_P_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/qabstracteventdispatcher.h>
#include <QtCore/private/qtimerinfo_unix_p.h>
#include <QtCore/private/qcfsocketnotifier_p.h>
#include <QtCore/private/qcore_mac_p.h>
#include <QtCore/qdebug.h>
#include <QtCore/qloggingcategory.h>
#include <CoreFoundation/CoreFoundation.h>
Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(RunLoopModeTracker));
QT_BEGIN_NAMESPACE
namespace QtPrivate {
Q_CORE_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcEventDispatcher);
Q_CORE_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcEventDispatcherTimers)
}
class QEventDispatcherCoreFoundation;
template <class T = QEventDispatcherCoreFoundation>
class RunLoopSource
{
public:
typedef bool (T::*CallbackFunction)();
enum { kHighestPriority = 0 } RunLoopSourcePriority;
RunLoopSource(T *delegate, CallbackFunction callback)
: m_delegate(delegate), m_callback(callback)
{
CFRunLoopSourceContext context = {};
context.info = this;
context.perform = RunLoopSource::process;
m_source = CFRunLoopSourceCreate(kCFAllocatorDefault, kHighestPriority, &context);
Q_ASSERT(m_source);
}
~RunLoopSource()
{
CFRunLoopSourceInvalidate(m_source);
CFRelease(m_source);
}
void addToMode(CFStringRef mode, CFRunLoopRef runLoop = 0)
{
if (!runLoop)
runLoop = CFRunLoopGetCurrent();
CFRunLoopAddSource(runLoop, m_source, mode);
}
void signal() { CFRunLoopSourceSignal(m_source); }
private:
static void process(void *info)
{
RunLoopSource *self = static_cast<RunLoopSource *>(info);
((self->m_delegate)->*(self->m_callback))();
}
T *m_delegate;
CallbackFunction m_callback;
CFRunLoopSourceRef m_source;
};
template <class T = QEventDispatcherCoreFoundation>
class RunLoopObserver
{
public:
typedef void (T::*CallbackFunction) (CFRunLoopActivity activity);
RunLoopObserver(T *delegate, CallbackFunction callback, CFOptionFlags activities)
: m_delegate(delegate), m_callback(callback)
{
CFRunLoopObserverContext context = {};
context.info = this;
m_observer = CFRunLoopObserverCreate(kCFAllocatorDefault, activities, true, 0, process, &context);
Q_ASSERT(m_observer);
}
~RunLoopObserver()
{
CFRunLoopObserverInvalidate(m_observer);
CFRelease(m_observer);
}
void addToMode(CFStringRef mode, CFRunLoopRef runLoop = 0)
{
if (!runLoop)
runLoop = CFRunLoopGetCurrent();
if (!CFRunLoopContainsObserver(runLoop, m_observer, mode))
CFRunLoopAddObserver(runLoop, m_observer, mode);
}
void removeFromMode(CFStringRef mode, CFRunLoopRef runLoop = 0)
{
if (!runLoop)
runLoop = CFRunLoopGetCurrent();
if (CFRunLoopContainsObserver(runLoop, m_observer, mode))
CFRunLoopRemoveObserver(runLoop, m_observer, mode);
}
private:
static void process(CFRunLoopObserverRef, CFRunLoopActivity activity, void *info)
{
RunLoopObserver *self = static_cast<RunLoopObserver *>(info);
((self->m_delegate)->*(self->m_callback))(activity);
}
T *m_delegate;
CallbackFunction m_callback;
CFRunLoopObserverRef m_observer;
};
class Q_CORE_EXPORT QEventDispatcherCoreFoundation : public QAbstractEventDispatcher
{
Q_OBJECT
public:
explicit QEventDispatcherCoreFoundation(QObject *parent = nullptr);
void startingUp() override;
~QEventDispatcherCoreFoundation();
bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
void registerSocketNotifier(QSocketNotifier *notifier) override;
void unregisterSocketNotifier(QSocketNotifier *notifier) override;
void registerTimer(int timerId, qint64 interval, Qt::TimerType timerType, QObject *object) override;
bool unregisterTimer(int timerId) override;
bool unregisterTimers(QObject *object) override;
QList<QAbstractEventDispatcher::TimerInfo> registeredTimers(QObject *object) const override;
int remainingTime(int timerId) override;
void wakeUp() override;
void interrupt() override;
protected:
QEventLoop *currentEventLoop() const;
virtual bool processPostedEvents();
struct ProcessEventsState
{
ProcessEventsState(QEventLoop::ProcessEventsFlags f)
: flags(f.toInt()), wasInterrupted(false)
, processedPostedEvents(false), processedTimers(false)
, deferredWakeUp(false), deferredUpdateTimers(false) {}
QAtomicInt flags;
QAtomicInteger<char> wasInterrupted;
QAtomicInteger<char> processedPostedEvents;
QAtomicInteger<char> processedTimers;
QAtomicInteger<char> deferredWakeUp;
bool deferredUpdateTimers;
};
ProcessEventsState m_processEvents;
private:
RunLoopSource<> m_postedEventsRunLoopSource;
RunLoopObserver<> m_runLoopActivityObserver;
QT_MANGLE_NAMESPACE(RunLoopModeTracker) *m_runLoopModeTracker;
QTimerInfoList m_timerInfoList;
CFRunLoopTimerRef m_runLoopTimer;
CFRunLoopTimerRef m_blockedRunLoopTimer;
QCFType<CFRunLoopRef> m_runLoop;
bool m_overdueTimerScheduled;
QCFSocketNotifier m_cfSocketNotifier;
void processTimers(CFRunLoopTimerRef);
void handleRunLoopActivity(CFRunLoopActivity activity);
void updateTimers();
void invalidateTimer();
};
QT_END_NAMESPACE
#endif // QEVENTDISPATCHER_CF_P_H

View File

@@ -1,127 +0,0 @@
// Copyright (C) 2021 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 QEVENTDISPATCHER_WASM_P_H
#define QEVENTDISPATCHER_WASM_P_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 "qabstracteventdispatcher.h"
#include "private/qtimerinfo_unix_p.h"
#include <QtCore/qloggingcategory.h>
#include <QtCore/qwaitcondition.h>
#include <mutex>
#include <optional>
#include <tuple>
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(lcEventDispatcher);
Q_DECLARE_LOGGING_CATEGORY(lcEventDispatcherTimers)
class Q_CORE_EXPORT QEventDispatcherWasm : public QAbstractEventDispatcher
{
Q_OBJECT
public:
QEventDispatcherWasm();
~QEventDispatcherWasm();
bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
void registerSocketNotifier(QSocketNotifier *notifier) override;
void unregisterSocketNotifier(QSocketNotifier *notifier) override;
void registerTimer(int timerId, qint64 interval, Qt::TimerType timerType, QObject *object) override;
bool unregisterTimer(int timerId) override;
bool unregisterTimers(QObject *object) override;
QList<QAbstractEventDispatcher::TimerInfo> registeredTimers(QObject *object) const override;
int remainingTime(int timerId) override;
void interrupt() override;
void wakeUp() override;
static void socketSelect(int timeout, int socket, bool waitForRead, bool waitForWrite,
bool *selectForRead, bool *selectForWrite, bool *socketDisconnect);
protected:
virtual void processWindowSystemEvents(QEventLoop::ProcessEventsFlags flags);
private:
bool isMainThreadEventDispatcher();
bool isSecondaryThreadEventDispatcher();
static bool isValidEventDispatcherPointer(QEventDispatcherWasm *eventDispatcher);
void handleApplicationExec();
void handleDialogExec();
bool wait(int timeout = -1);
bool wakeEventDispatcherThread();
static void callProcessEvents(void *eventDispatcher);
void processTimers();
void updateNativeTimer();
static void callProcessTimers(void *eventDispatcher);
static void setEmscriptenSocketCallbacks();
static void clearEmscriptenSocketCallbacks();
static void socketError(int fd, int err, const char* msg, void *context);
static void socketOpen(int fd, void *context);
static void socketListen(int fd, void *context);
static void socketConnection(int fd, void *context);
static void socketMessage(int fd, void *context);
static void socketClose(int fd, void *context);
static void setSocketState(int socket, bool setReadyRead, bool setReadyWrite);
static void clearSocketState(int socket);
void waitForSocketState(int timeout, int socket, bool checkRead, bool checkWrite,
bool *selectForRead, bool *selectForWrite, bool *socketDisconnect);
static void run(std::function<void(void)> fn);
static void runAsync(std::function<void(void)> fn);
static void runOnMainThread(std::function<void(void)> fn);
static void runOnMainThreadAsync(std::function<void(void)> fn);
static QEventDispatcherWasm *g_mainThreadEventDispatcher;
bool m_interrupted = false;
bool m_processTimers = false;
bool m_pendingProcessEvents = false;
QTimerInfoList *m_timerInfo = new QTimerInfoList();
long m_timerId = 0;
uint64_t m_timerTargetTime = 0;
#if QT_CONFIG(thread)
std::mutex m_mutex;
bool m_wakeUpCalled = false;
std::condition_variable m_moreEvents;
static QVector<QEventDispatcherWasm *> g_secondaryThreadEventDispatchers;
static std::mutex g_staticDataMutex;
// Note on mutex usage: the global g_staticDataMutex protects the global (g_ prefixed) data,
// while the per eventdispatcher m_mutex protects the state accociated with blocking and waking
// that eventdispatcher thread. The locking order is g_staticDataMutex first, then m_mutex.
#endif
static std::multimap<int, QSocketNotifier *> g_socketNotifiers;
struct SocketReadyState {
QEventDispatcherWasm *waiter = nullptr;
bool waitForReadyRead = false;
bool waitForReadyWrite = false;
bool readyRead = false;
bool readyWrite = false;
};
static std::map<int, SocketReadyState> g_socketState;
};
#endif // QEVENTDISPATCHER_WASM_P_H

View File

@@ -1,149 +0,0 @@
// 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 QEVENTDISPATCHER_WIN_P_H
#define QEVENTDISPATCHER_WIN_P_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/qabstracteventdispatcher.h"
#include "QtCore/qt_windows.h"
#include "QtCore/qhash.h"
#include "QtCore/qatomic.h"
#include "qabstracteventdispatcher_p.h"
QT_BEGIN_NAMESPACE
class QEventDispatcherWin32Private;
// forward declaration
LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
quint64 qt_msectime();
class Q_CORE_EXPORT QEventDispatcherWin32 : public QAbstractEventDispatcher
{
Q_OBJECT
Q_DECLARE_PRIVATE(QEventDispatcherWin32)
public:
explicit QEventDispatcherWin32(QObject *parent = nullptr);
~QEventDispatcherWin32();
bool QT_ENSURE_STACK_ALIGNED_FOR_SSE processEvents(QEventLoop::ProcessEventsFlags flags) override;
void registerSocketNotifier(QSocketNotifier *notifier) override;
void unregisterSocketNotifier(QSocketNotifier *notifier) override;
void registerTimer(int timerId, qint64 interval, Qt::TimerType timerType, QObject *object) override;
bool unregisterTimer(int timerId) override;
bool unregisterTimers(QObject *object) override;
QList<TimerInfo> registeredTimers(QObject *object) const override;
int remainingTime(int timerId) override;
void wakeUp() override;
void interrupt() override;
void startingUp() override;
void closingDown() override;
bool event(QEvent *e) override;
HWND internalHwnd();
protected:
QEventDispatcherWin32(QEventDispatcherWin32Private &dd, QObject *parent = nullptr);
virtual void sendPostedEvents();
void doUnregisterSocketNotifier(QSocketNotifier *notifier);
private:
friend LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
};
struct QSockNot {
QSocketNotifier *obj;
int fd;
};
typedef QHash<int, QSockNot *> QSNDict;
struct QSockFd {
long event;
long mask;
bool selected;
explicit inline QSockFd(long ev = 0, long ma = 0) : event(ev), mask(ma), selected(false) { }
};
typedef QHash<int, QSockFd> QSFDict;
struct WinTimerInfo { // internal timer info
QObject *dispatcher;
int timerId;
qint64 interval;
Qt::TimerType timerType;
quint64 timeout; // - when to actually fire
QObject *obj; // - object to receive events
bool inTimerEvent;
UINT fastTimerId;
};
class QZeroTimerEvent : public QTimerEvent
{
public:
explicit inline QZeroTimerEvent(int timerId)
: QTimerEvent(timerId)
{ t = QEvent::ZeroTimerEvent; }
};
typedef QHash<int, WinTimerInfo*> WinTimerDict; // fast dict of timers
class Q_CORE_EXPORT QEventDispatcherWin32Private : public QAbstractEventDispatcherPrivate
{
Q_DECLARE_PUBLIC(QEventDispatcherWin32)
public:
QEventDispatcherWin32Private();
~QEventDispatcherWin32Private();
QAtomicInt interrupt;
// internal window handle used for socketnotifiers/timers/etc
HWND internalHwnd;
// for controlling when to send posted events
UINT_PTR sendPostedEventsTimerId;
QAtomicInt wakeUps;
void startPostedEventsTimer();
// timers
WinTimerDict timerDict;
void registerTimer(WinTimerInfo *t);
void unregisterTimer(WinTimerInfo *t);
void sendTimerEvent(int timerId);
// socket notifiers
QSNDict sn_read;
QSNDict sn_write;
QSNDict sn_except;
QSFDict active_fd;
bool activateNotifiersPosted;
void postActivateSocketNotifiers();
void doWsaAsyncSelect(int socket, long event);
bool closingDown = false;
QList<MSG> queuedUserInputEvents;
QList<MSG> queuedSocketEvents;
};
QT_END_NAMESPACE
#endif // QEVENTDISPATCHER_WIN_P_H

View File

@@ -1,52 +0,0 @@
// Copyright (C) 2022 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 QFACTORYCACHEREGISTRATION_P_H
#define QFACTORYCACHEREGISTRATION_P_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/qglobal.h>
#if !defined(QT_BOOTSTRAPPED) && defined(Q_OS_WIN) && !defined(Q_CC_CLANG) && QT_CONFIG(cpp_winrt)
# define QT_USE_FACTORY_CACHE_REGISTRATION
#endif
#ifdef QT_USE_FACTORY_CACHE_REGISTRATION
#include <winrt/base.h>
QT_BEGIN_NAMESPACE
namespace detail {
class QWinRTFactoryCacheRegistration
{
public:
Q_CORE_EXPORT explicit QWinRTFactoryCacheRegistration(QFunctionPointer clearFunction);
Q_CORE_EXPORT ~QWinRTFactoryCacheRegistration();
Q_CORE_EXPORT static void clearAllCaches();
Q_DISABLE_COPY_MOVE(QWinRTFactoryCacheRegistration)
private:
QWinRTFactoryCacheRegistration **m_prevNext = nullptr;
QWinRTFactoryCacheRegistration *m_next = nullptr;
QFunctionPointer m_clearFunction;
};
inline QWinRTFactoryCacheRegistration reg([]() noexcept { winrt::clear_factory_cache(); });
}
QT_END_NAMESPACE
#endif
#endif // QFACTORYCACHEREGISTRATION_P_H

View File

@@ -1,116 +0,0 @@
// 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 QFILESYSTEMWATCHER_FSEVENTS_P_H
#define QFILESYSTEMWATCHER_FSEVENTS_P_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 "qfilesystemwatcher_p.h"
#include <QtCore/qhash.h>
#include <QtCore/qmutex.h>
#include <QtCore/qsocketnotifier.h>
#include <QtCore/qthread.h>
#include <dispatch/dispatch.h>
#include <CoreServices/CoreServices.h>
QT_REQUIRE_CONFIG(filesystemwatcher);
QT_BEGIN_NAMESPACE
class QFseventsFileSystemWatcherEngine : public QFileSystemWatcherEngine
{
Q_OBJECT
public:
~QFseventsFileSystemWatcherEngine();
static QFseventsFileSystemWatcherEngine *create(QObject *parent);
QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories);
void processEvent(ConstFSEventStreamRef streamRef, size_t numEvents, char **eventPaths, const FSEventStreamEventFlags eventFlags[], const FSEventStreamEventId eventIds[]);
Q_SIGNALS:
void emitFileChanged(const QString &path, bool removed);
void emitDirectoryChanged(const QString &path, bool removed);
void scheduleStreamRestart();
private slots:
void doEmitFileChanged(const QString &path, bool removed);
void doEmitDirectoryChanged(const QString &path, bool removed);
bool restartStream();
private:
struct Info {
QString origPath;
timespec ctime;
mode_t mode;
QString watchedPath;
Info(): mode(0)
{
ctime.tv_sec = 0;
ctime.tv_nsec = 0;
}
Info(const QString &origPath, const timespec &ctime, mode_t mode, const QString &watchedPath)
: origPath(origPath)
, ctime(ctime)
, mode(mode)
, watchedPath(watchedPath)
{}
};
typedef QHash<QString, Info> InfoByName;
typedef QHash<QString, InfoByName> FilesByPath;
struct DirInfo {
Info dirInfo;
InfoByName entries;
};
typedef QHash<QString, DirInfo> DirsByName;
typedef QHash<QString, qint64> PathRefCounts;
struct WatchingState {
// These fields go hand-in-hand. FSEvents watches paths, and there is no use in watching
// the same path multiple times. So, the "refcount" on a path is the number of watched
// files that have the same path, plus the number of directories that have the same path.
//
// If the stream fails to start after adding files/directories, the watcher will try to
// keep watching files/directories that it was already watching. It does that by restoring
// the previous WatchingState and restarting the stream.
FilesByPath watchedFiles;
DirsByName watchedDirectories;
PathRefCounts watchedPaths;
};
QFseventsFileSystemWatcherEngine(QObject *parent);
bool startStream();
void stopStream(bool isStopped = false);
InfoByName scanForDirEntries(const QString &path);
bool derefPath(const QString &watchedPath);
bool checkDir(DirsByName::iterator &it);
bool rescanDirs(const QString &path);
bool rescanFiles(InfoByName &filesInPath);
bool rescanFiles(const QString &path);
QMutex lock;
dispatch_queue_t queue;
FSEventStreamRef stream;
FSEventStreamEventId lastReceivedEvent;
WatchingState watchingState;
};
QT_END_NAMESPACE
#endif // QFILESYSTEMWATCHER_FSEVENTS_P_H

View File

@@ -1,58 +0,0 @@
// 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 QFILESYSTEMWATCHER_KQUEUE_P_H
#define QFILESYSTEMWATCHER_KQUEUE_P_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 "qfilesystemwatcher_p.h"
#include <QtCore/qhash.h>
#include <QtCore/qmutex.h>
#include <QtCore/qsocketnotifier.h>
#include <QtCore/qthread.h>
QT_REQUIRE_CONFIG(filesystemwatcher);
struct kevent;
QT_BEGIN_NAMESPACE
class QKqueueFileSystemWatcherEngine : public QFileSystemWatcherEngine
{
Q_OBJECT
public:
~QKqueueFileSystemWatcherEngine();
static QKqueueFileSystemWatcherEngine *create(QObject *parent);
QStringList addPaths(const QStringList &paths, QStringList *files,
QStringList *directories) override;
QStringList removePaths(const QStringList &paths, QStringList *files,
QStringList *directories) override;
private Q_SLOTS:
void readFromKqueue();
private:
QKqueueFileSystemWatcherEngine(int kqfd, QObject *parent);
int kqfd;
QHash<QString, int> pathToID;
QHash<int, QString> idToPath;
QSocketNotifier notifier;
};
QT_END_NAMESPACE
#endif // QFILESYSTEMWATCHER_KQUEUE_P_H

View File

@@ -1,141 +0,0 @@
// 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 QFILESYSTEMWATCHER_WIN_P_H
#define QFILESYSTEMWATCHER_WIN_P_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 "qfilesystemwatcher_p.h"
#include <QtCore/qdatetime.h>
#include <QtCore/qfile.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
#include <QtCore/qmutex.h>
#include <QtCore/qthread.h>
QT_BEGIN_NAMESPACE
class QWindowsFileSystemWatcherEngineThread;
class QWindowsRemovableDriveListener;
// Even though QWindowsFileSystemWatcherEngine is derived of QThread
// via QFileSystemWatcher, it does not start a thread.
// Instead QWindowsFileSystemWatcher creates QWindowsFileSystemWatcherEngineThreads
// to do the actually watching.
class QWindowsFileSystemWatcherEngine : public QFileSystemWatcherEngine
{
Q_OBJECT
public:
explicit QWindowsFileSystemWatcherEngine(QObject *parent);
~QWindowsFileSystemWatcherEngine();
QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) override;
QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) override;
class Handle
{
public:
Qt::HANDLE handle;
uint flags;
Handle();
};
class PathInfo {
public:
QString absolutePath;
QString path;
bool isDir;
// fileinfo bits
uint ownerId;
uint groupId;
QFile::Permissions permissions;
QDateTime lastModified;
PathInfo &operator=(const QFileInfo &fileInfo)
{
ownerId = fileInfo.ownerId();
groupId = fileInfo.groupId();
permissions = fileInfo.permissions();
lastModified = fileInfo.lastModified();
return *this;
}
bool operator!=(const QFileInfo &fileInfo) const
{
return (ownerId != fileInfo.ownerId()
|| groupId != fileInfo.groupId()
|| permissions != fileInfo.permissions()
|| lastModified != fileInfo.lastModified());
}
};
signals:
void driveLockForRemoval(const QString &);
void driveLockForRemovalFailed(const QString &);
void driveRemoved(const QString &);
private:
QList<QWindowsFileSystemWatcherEngineThread *> threads;
QWindowsRemovableDriveListener *m_driveListener = nullptr;
};
class QFileSystemWatcherPathKey : public QString
{
public:
QFileSystemWatcherPathKey() {}
explicit QFileSystemWatcherPathKey(const QString &other) : QString(other) {}
QFileSystemWatcherPathKey(const QFileSystemWatcherPathKey &other) : QString(other) {}
bool operator==(const QFileSystemWatcherPathKey &other) const { return !compare(other, Qt::CaseInsensitive); }
};
Q_DECLARE_TYPEINFO(QFileSystemWatcherPathKey, Q_RELOCATABLE_TYPE);
inline size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed = 0)
{
return qHash(key.toCaseFolded(), seed);
}
class QWindowsFileSystemWatcherEngineThread : public QThread
{
Q_OBJECT
public:
typedef QHash<QFileSystemWatcherPathKey, QWindowsFileSystemWatcherEngine::Handle> HandleForDirHash;
typedef QHash<QFileSystemWatcherPathKey, QWindowsFileSystemWatcherEngine::PathInfo> PathInfoHash;
QWindowsFileSystemWatcherEngineThread();
~QWindowsFileSystemWatcherEngineThread();
void run() override;
void stop();
void wakeup();
QMutex mutex;
QList<Qt::HANDLE> handles;
int msg;
HandleForDirHash handleForDir;
QHash<Qt::HANDLE, PathInfoHash> pathInfoForHandle;
Q_SIGNALS:
void fileChanged(const QString &path, bool removed);
void directoryChanged(const QString &path, bool removed);
};
QT_END_NAMESPACE
#endif // QFILESYSTEMWATCHER_WIN_P_H

View File

@@ -1,159 +0,0 @@
// Copyright (C) 2020 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 QFUNCTIONS_WINRT_P_H
#define QFUNCTIONS_WINRT_P_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/private/qglobal_p.h>
#if defined(Q_OS_WIN) && defined(Q_CC_MSVC)
#include <QtCore/QCoreApplication>
#include <QtCore/QThread>
#include <QtCore/QAbstractEventDispatcher>
#include <QtCore/QElapsedTimer>
#include <QtCore/qt_windows.h>
#include <wrl.h>
#include <windows.foundation.h>
// Convenience macros for handling HRESULT values
#define RETURN_IF_FAILED(msg, ret) \
if (FAILED(hr)) { \
qErrnoWarning(hr, msg); \
ret; \
}
#define RETURN_IF_FAILED_WITH_ARGS(msg, ret, ...) \
if (FAILED(hr)) { \
qErrnoWarning(hr, msg, __VA_ARGS__); \
ret; \
}
#define RETURN_HR_IF_FAILED(msg) RETURN_IF_FAILED(msg, return hr)
#define RETURN_OK_IF_FAILED(msg) RETURN_IF_FAILED(msg, return S_OK)
#define RETURN_FALSE_IF_FAILED(msg) RETURN_IF_FAILED(msg, return false)
#define RETURN_VOID_IF_FAILED(msg) RETURN_IF_FAILED(msg, return)
#define RETURN_HR_IF_FAILED_WITH_ARGS(msg, ...) RETURN_IF_FAILED_WITH_ARGS(msg, return hr, __VA_ARGS__)
#define RETURN_OK_IF_FAILED_WITH_ARGS(msg, ...) RETURN_IF_FAILED_WITH_ARGS(msg, return S_OK, __VA_ARGS__)
#define RETURN_FALSE_IF_FAILED_WITH_ARGS(msg, ...) RETURN_IF_FAILED_WITH_ARGS(msg, return false, __VA_ARGS__)
#define RETURN_VOID_IF_FAILED_WITH_ARGS(msg, ...) RETURN_IF_FAILED_WITH_ARGS(msg, return, __VA_ARGS__)
#define Q_ASSERT_SUCCEEDED(hr) \
Q_ASSERT_X(SUCCEEDED(hr), Q_FUNC_INFO, qPrintable(qt_error_string(hr)));
QT_BEGIN_NAMESPACE
namespace QWinRTFunctions {
// Synchronization methods
enum AwaitStyle
{
YieldThread = 0,
ProcessThreadEvents = 1,
ProcessMainThreadEvents = 2
};
using EarlyExitConditionFunction = std::function<bool(void)>;
template<typename T>
static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, AwaitStyle awaitStyle,
uint timeout, EarlyExitConditionFunction func)
{
Microsoft::WRL::ComPtr<ABI::Windows::Foundation::IAsyncInfo> asyncInfo;
HRESULT hr = asyncOp.As(&asyncInfo);
if (FAILED(hr))
return hr;
AsyncStatus status;
QElapsedTimer t;
if (timeout)
t.start();
switch (awaitStyle) {
case ProcessMainThreadEvents:
while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started) {
QCoreApplication::processEvents();
if (func && func())
return E_ABORT;
if (timeout && t.hasExpired(timeout))
return HRESULT_FROM_WIN32(ERROR_TIMEOUT);
}
break;
case ProcessThreadEvents:
if (QAbstractEventDispatcher *dispatcher = QThread::currentThread()->eventDispatcher()) {
while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started) {
dispatcher->processEvents(QEventLoop::AllEvents);
if (func && func())
return E_ABORT;
if (timeout && t.hasExpired(timeout))
return HRESULT_FROM_WIN32(ERROR_TIMEOUT);
}
break;
}
// fall through
default:
case YieldThread:
while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started) {
QThread::yieldCurrentThread();
if (timeout && t.hasExpired(timeout))
return HRESULT_FROM_WIN32(ERROR_TIMEOUT);
}
break;
}
if (FAILED(hr) || status != AsyncStatus::Completed) {
HRESULT ec;
hr = asyncInfo->get_ErrorCode(&ec);
if (FAILED(hr))
return hr;
hr = asyncInfo->Close();
if (FAILED(hr))
return hr;
return ec;
}
return hr;
}
template<typename T>
static inline HRESULT await(const Microsoft::WRL::ComPtr<T> &asyncOp,
AwaitStyle awaitStyle = YieldThread, uint timeout = 0,
EarlyExitConditionFunction func = nullptr)
{
HRESULT hr = _await_impl(asyncOp, awaitStyle, timeout, func);
if (FAILED(hr))
return hr;
return asyncOp->GetResults();
}
template<typename T, typename U>
static inline HRESULT await(const Microsoft::WRL::ComPtr<T> &asyncOp, U *results,
AwaitStyle awaitStyle = YieldThread, uint timeout = 0,
EarlyExitConditionFunction func = nullptr)
{
HRESULT hr = _await_impl(asyncOp, awaitStyle, timeout, func);
if (FAILED(hr))
return hr;
return asyncOp->GetResults(results);
}
} // QWinRTFunctions
QT_END_NAMESPACE
#endif // Q_OS_WIN && Q_CC_MSVC
#endif // QFUNCTIONS_WINRT_P_H

View File

@@ -1,154 +0,0 @@
// Copyright (C) 2021 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 QJNIHELPERS_H
#define QJNIHELPERS_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 <jni.h>
#include <functional>
#include <QtCore/private/qglobal_p.h>
#include <QtCore/qcoreapplication_platform.h>
QT_BEGIN_NAMESPACE
Q_DECLARE_JNI_TYPE(Activity, "Landroid/app/Activity;")
Q_DECLARE_JNI_TYPE(Service, "Landroid/app/Service;")
namespace QtAndroidPrivate
{
class Q_CORE_EXPORT ActivityResultListener
{
public:
virtual ~ActivityResultListener();
virtual bool handleActivityResult(jint requestCode, jint resultCode, jobject data) = 0;
};
class Q_CORE_EXPORT NewIntentListener
{
public:
virtual ~NewIntentListener();
virtual bool handleNewIntent(JNIEnv *env, jobject intent) = 0;
};
class Q_CORE_EXPORT ResumePauseListener
{
public:
virtual ~ResumePauseListener();
virtual void handlePause();
virtual void handleResume();
};
class Q_CORE_EXPORT GenericMotionEventListener
{
public:
virtual ~GenericMotionEventListener();
virtual bool handleGenericMotionEvent(jobject event) = 0;
};
class Q_CORE_EXPORT KeyEventListener
{
public:
virtual ~KeyEventListener();
virtual bool handleKeyEvent(jobject event) = 0;
};
class Q_CORE_EXPORT OnBindListener
{
public:
virtual ~OnBindListener() {}
virtual jobject onBind(jobject intent) = 0;
};
Q_CORE_EXPORT QtJniTypes::Activity activity();
Q_CORE_EXPORT QtJniTypes::Service service();
Q_CORE_EXPORT QtJniTypes::Context context();
Q_CORE_EXPORT JavaVM *javaVM();
Q_CORE_EXPORT jint initJNI(JavaVM *vm, JNIEnv *env);
Q_CORE_EXPORT jclass findClass(const char *className, JNIEnv *env);
jobject classLoader();
Q_CORE_EXPORT jint androidSdkVersion();
bool registerPermissionNatives();
bool registerNativeInterfaceNatives();
Q_CORE_EXPORT void handleActivityResult(jint requestCode, jint resultCode, jobject data);
Q_CORE_EXPORT void registerActivityResultListener(ActivityResultListener *listener);
Q_CORE_EXPORT void unregisterActivityResultListener(ActivityResultListener *listener);
Q_CORE_EXPORT void handleNewIntent(JNIEnv *env, jobject intent);
Q_CORE_EXPORT void registerNewIntentListener(NewIntentListener *listener);
Q_CORE_EXPORT void unregisterNewIntentListener(NewIntentListener *listener);
Q_CORE_EXPORT void handlePause();
Q_CORE_EXPORT void handleResume();
Q_CORE_EXPORT void registerResumePauseListener(ResumePauseListener *listener);
Q_CORE_EXPORT void unregisterResumePauseListener(ResumePauseListener *listener);
Q_CORE_EXPORT void registerGenericMotionEventListener(GenericMotionEventListener *listener);
Q_CORE_EXPORT void unregisterGenericMotionEventListener(GenericMotionEventListener *listener);
Q_CORE_EXPORT void registerKeyEventListener(KeyEventListener *listener);
Q_CORE_EXPORT void unregisterKeyEventListener(KeyEventListener *listener);
Q_CORE_EXPORT void waitForServiceSetup();
Q_CORE_EXPORT int acuqireServiceSetup(int flags);
Q_CORE_EXPORT void setOnBindListener(OnBindListener *listener);
Q_CORE_EXPORT jobject callOnBindListener(jobject intent);
Q_CORE_EXPORT bool acquireAndroidDeadlockProtector();
Q_CORE_EXPORT void releaseAndroidDeadlockProtector();
}
#define Q_JNI_FIND_AND_CHECK_CLASS(CLASS_NAME) \
clazz = env.findClass(CLASS_NAME); \
if (!clazz) { \
__android_log_print(ANDROID_LOG_FATAL, m_qtTag, QtAndroid::classErrorMsgFmt(), CLASS_NAME);\
return JNI_FALSE; \
}
#define Q_JNI_GET_AND_CHECK_METHOD(ID, CLASS, METHOD_NAME, METHOD_SIGNATURE) \
ID = env.findMethod(CLASS, METHOD_NAME, METHOD_SIGNATURE); \
if (!ID) { \
__android_log_print(ANDROID_LOG_FATAL, m_qtTag, QtAndroid::methodErrorMsgFmt(), \
METHOD_NAME, METHOD_SIGNATURE); \
return JNI_FALSE; \
}
#define Q_JNI_GET_AND_CHECK_STATIC_METHOD(ID, CLASS, METHOD_NAME, METHOD_SIGNATURE) \
ID = env.findStaticMethod(CLASS, METHOD_NAME, METHOD_SIGNATURE); \
if (!ID) { \
__android_log_print(ANDROID_LOG_FATAL, m_qtTag, QtAndroid::methodErrorMsgFmt(), \
METHOD_NAME, METHOD_SIGNATURE); \
return JNI_FALSE; \
}
#define Q_JNI_GET_AND_CHECK_FIELD(ID, CLASS, FIELD_NAME, FIELD_SIGNATURE) \
ID = env.findField(CLASS, FIELD_NAME, FIELD_SIGNATURE); \
if (!ID) { \
__android_log_print(ANDROID_LOG_FATAL, m_qtTag, QtAndroid::fieldErrorMsgFmt(), \
FIELD_NAME, FIELD_SIGNATURE); \
return JNI_FALSE; \
}
#define Q_JNI_GET_AND_CHECK_STATIC_FIELD(ID, CLASS, FIELD_NAME, FIELD_SIGNATURE) \
ID = env.findStaticField(CLASS, FIELD_NAME, FIELD_SIGNATURE); \
if (!ID) { \
__android_log_print(ANDROID_LOG_FATAL, m_qtTag, QtAndroid::fieldErrorMsgFmt(), \
FIELD_NAME, FIELD_SIGNATURE); \
return JNI_FALSE; \
}
QT_END_NAMESPACE
#endif // QJNIHELPERS_H

View File

@@ -1,39 +0,0 @@
// Copyright (C) 2016 Intel Corporation.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QMACHPARSER_P_H
#define QMACHPARSER_P_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 "qlibrary_p.h"
QT_REQUIRE_CONFIG(library);
#if defined(Q_OF_MACH_O)
QT_BEGIN_NAMESPACE
class QString;
class QLibraryPrivate;
class Q_AUTOTEST_EXPORT QMachOParser
{
public:
static QLibraryScanResult parse(const char *m_s, ulong fdlen, QString *errorString);
};
QT_END_NAMESPACE
#endif // defined(Q_OF_MACH_O)
#endif // QMACHPARSER_P_H

View File

@@ -1,62 +0,0 @@
// Copyright (C) 2021 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 QNTDLL_P_H
#define QNTDLL_P_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/private/qglobal_p.h>
#include <winternl.h>
QT_BEGIN_NAMESPACE
// keep the following structure as is, taken from
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntddk/ns-ntddk-_file_fs_sector_size_information
// Unfortunately we can't include the ntddk.h header, so we duplicate the code here.
typedef struct _FILE_FS_SECTOR_SIZE_INFORMATION {
ULONG LogicalBytesPerSector;
ULONG PhysicalBytesPerSectorForAtomicity;
ULONG PhysicalBytesPerSectorForPerformance;
ULONG FileSystemEffectivePhysicalBytesPerSectorForAtomicity;
ULONG Flags;
ULONG ByteOffsetForSectorAlignment;
ULONG ByteOffsetForPartitionAlignment;
} FILE_FS_SECTOR_SIZE_INFORMATION, *PFILE_FS_SECTOR_SIZE_INFORMATION;
#if !defined(Q_CC_MINGW)
// keep the following enumeration as is, taken from
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ne-wdm-_fsinfoclass
// Unfortunately we can't include the wdm.h header, so we duplicate the code here.
typedef enum _FSINFOCLASS {
FileFsVolumeInformation,
FileFsLabelInformation,
FileFsSizeInformation,
FileFsDeviceInformation,
FileFsAttributeInformation,
FileFsControlInformation,
FileFsFullSizeInformation,
FileFsObjectIdInformation,
FileFsDriverPathInformation,
FileFsVolumeFlagsInformation,
FileFsSectorSizeInformation,
FileFsDataCopyInformation,
FileFsMetadataSizeInformation,
FileFsFullSizeInformationEx,
FileFsMaximumInformation
} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
#endif
QT_END_NAMESPACE
#endif // QNTDLL_P_H

View File

@@ -1,27 +0,0 @@
// Copyright (C) 2017 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 QOPERATINGSYSTEMVERSION_WIN_P_H
#define QOPERATINGSYSTEMVERSION_WIN_P_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/private/qglobal_p.h>
#include <qt_windows.h>
QT_BEGIN_NAMESPACE
OSVERSIONINFOEX qWindowsVersionInfo();
QT_END_NAMESPACE
#endif // QOPERATINGSYSTEMVERSION_WIN_P_H

View File

@@ -1,160 +0,0 @@
// Copyright (C) 2021 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 QSTDWEB_P_H
#define QSTDWEB_P_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 <private/qglobal_p.h>
#include <emscripten/val.h>
#include <cstdint>
#include <functional>
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
namespace qstdweb {
// DOM API in C++, implemented using emscripten val.h and bind.h.
// This is private API and can be extended and changed as needed.
// The API mirrors that of the native API, with some extensions
// to ease usage from C++ code.
class ArrayBuffer;
class Blob;
class File;
class FileList;
class FileReader;
class Uint8Array;
class EventCallback;
class Q_CORE_EXPORT ArrayBuffer {
public:
explicit ArrayBuffer(uint32_t size);
explicit ArrayBuffer(const emscripten::val &arrayBuffer);
uint32_t byteLength() const;
emscripten::val val();
private:
friend class Uint8Array;
emscripten::val m_arrayBuffer = emscripten::val::undefined();
};
class Q_CORE_EXPORT Blob {
public:
explicit Blob(const emscripten::val &blob);
uint32_t size() const;
static Blob copyFrom(const char *buffer, uint32_t size);
emscripten::val val();
std::string type() const;
private:
friend class FileReader;
emscripten::val m_blob = emscripten::val::undefined();
};
class Q_CORE_EXPORT File {
public:
File() = default;
explicit File(const emscripten::val &file);
Blob slice(uint64_t begin, uint64_t end) const;
std::string name() const;
uint64_t size() const;
std::string type() const;
void stream(uint32_t offset, uint32_t length, char *buffer, const std::function<void ()> &completed) const;
void stream(char *buffer, const std::function<void ()> &completed) const;
emscripten::val val();
private:
emscripten::val m_file = emscripten::val::undefined();
};
class Q_CORE_EXPORT FileList {
public:
FileList() = default;
explicit FileList(const emscripten::val &fileList);
int length() const;
File item(int index) const;
File operator[](int index) const;
emscripten::val val();
private:
emscripten::val m_fileList = emscripten::val::undefined();
};
class Q_CORE_EXPORT FileReader {
public:
ArrayBuffer result() const;
void readAsArrayBuffer(const Blob &blob) const;
void onLoad(const std::function<void(emscripten::val)> &onLoad);
void onError(const std::function<void(emscripten::val)> &onError);
void onAbort(const std::function<void(emscripten::val)> &onAbort);
emscripten::val val();
private:
emscripten::val m_fileReader = emscripten::val::global("FileReader").new_();
std::unique_ptr<EventCallback> m_onLoad;
std::unique_ptr<EventCallback> m_onError;
std::unique_ptr<EventCallback> m_onAbort;
};
class Q_CORE_EXPORT Uint8Array {
public:
static Uint8Array heap();
explicit Uint8Array(const emscripten::val &uint8Array);
explicit Uint8Array(const ArrayBuffer &buffer);
explicit Uint8Array(uint32_t size);
Uint8Array(const ArrayBuffer &buffer, uint32_t offset, uint32_t length);
Uint8Array(const char *buffer, uint32_t size);
ArrayBuffer buffer() const;
uint32_t length() const;
void set(const Uint8Array &source);
void copyTo(char *destination) const;
static void copy(char *destination, const Uint8Array &source);
static Uint8Array copyFrom(const char *buffer, uint32_t size);
emscripten::val val();
private:
static emscripten::val heap_();
static emscripten::val constructor_();
emscripten::val m_uint8Array = emscripten::val::undefined();
};
class Q_CORE_EXPORT EventCallback
{
public:
EventCallback() = default;
~EventCallback();
EventCallback(EventCallback const&) = delete;
EventCallback& operator=(EventCallback const&) = delete;
EventCallback(emscripten::val element, const std::string &name,
const std::function<void(emscripten::val)> &fn);
static void activate(emscripten::val event);
private:
static std::string contextPropertyName(const std::string &eventName);
emscripten::val m_element = emscripten::val::undefined();
std::string m_eventName;
std::function<void(emscripten::val)> m_fn;
};
}
QT_END_NAMESPACE
#endif

View File

@@ -1,79 +0,0 @@
// 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 QSYSTEMLIBRARY_P_H
#define QSYSTEMLIBRARY_P_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/private/qglobal_p.h>
#ifdef Q_OS_WIN
# include <QtCore/qstring.h>
# include <qt_windows.h>
QT_BEGIN_NAMESPACE
class QSystemLibrary
{
public:
explicit QSystemLibrary(const QString &libraryName)
{
m_libraryName = libraryName;
m_handle = 0;
m_didLoad = false;
}
explicit QSystemLibrary(const wchar_t *libraryName)
{
m_libraryName = QString::fromWCharArray(libraryName);
m_handle = 0;
m_didLoad = false;
}
bool load(bool onlySystemDirectory = true)
{
m_handle = load((const wchar_t *)m_libraryName.utf16(), onlySystemDirectory);
m_didLoad = true;
return (m_handle != 0);
}
bool isLoaded()
{
return (m_handle != 0);
}
QFunctionPointer resolve(const char *symbol)
{
if (!m_didLoad)
load();
if (!m_handle)
return 0;
return QFunctionPointer(GetProcAddress(m_handle, symbol));
}
static QFunctionPointer resolve(const QString &libraryName, const char *symbol)
{
return QSystemLibrary(libraryName).resolve(symbol);
}
static Q_CORE_EXPORT HINSTANCE load(const wchar_t *lpFileName, bool onlySystemDirectory = true);
private:
HINSTANCE m_handle;
QString m_libraryName;
bool m_didLoad;
};
QT_END_NAMESPACE
#endif // Q_OS_WIN
#endif // QSYSTEMLIBRARY_P_H

View File

@@ -1,49 +0,0 @@
// 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
/*
* This is a precompiled header file for use in Xcode / Mac GCC /
* GCC >= 3.4 / VC to greatly speed the building of Qt. It may also be
* of use to people developing their own project, but it is probably
* better to define your own header. Use of this header is currently
* UNSUPPORTED.
*/
#if defined __cplusplus
// for rand_s, _CRT_RAND_S must be #defined before #including stdlib.h.
// put it at the beginning so some indirect inclusion doesn't break it
#ifndef _CRT_RAND_S
#define _CRT_RAND_S
#endif
#include <stdlib.h>
#include <qglobal.h>
#ifdef Q_OS_WIN
# ifdef Q_CC_MINGW
// <unistd.h> must be included before any other header pulls in <time.h>.
# include <unistd.h> // Define _POSIX_THREAD_SAFE_FUNCTIONS to obtain localtime_r()
# endif
# define _POSIX_
# include <limits.h>
# undef _POSIX_
# if defined(Q_CC_CLANG) && defined(Q_CC_MSVC)
// See https://bugs.llvm.org/show_bug.cgi?id=41226
# include <wchar.h>
__declspec(selectany) auto *__wmemchr_symbol_loader_value = wmemchr(L"", L'0', 0);
# endif
# endif
# include <qcoreapplication.h>
# include <qcoreevent.h>
# include <qiodevice.h>
# include <qlist.h>
# include <qvariant.h> /* All moc generated code has this include */
# include <qobject.h>
# if QT_CONFIG(regularexpression)
# include <qregularexpression.h>
# endif
# include <qscopedpointer.h>
# include <qshareddata.h>
# include <qstring.h>
# include <qstringlist.h>
# include <qtimer.h>
#endif

View File

@@ -1,109 +0,0 @@
// Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Rafael Roquetto <rafael.roquetto@kdab.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QTRACE_P_H
#define QTRACE_P_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.
//
/*
* The Qt tracepoints API consists of only five macros:
*
* - Q_TRACE(tracepoint, args...)
* Fires 'tracepoint' if it is enabled.
*
* - Q_TRACE_EXIT(tracepoint, args...)
* Fires 'tracepoint' if it is enabled when the current scope exists.
*
* - Q_TRACE_SCOPE(tracepoint, args...)
* Wrapper around Q_TRACE/_EXIT to trace entry and exit. First it traces
* `${tracepoint}_entry` and then `${tracepoint}_exit` on scope exit.
*
* - Q_UNCONDITIONAL_TRACE(tracepoint, args...)
* Fires 'tracepoint' unconditionally: no check is performed to query
* whether 'tracepoint' is enabled.
*
* - Q_TRACE_ENABLED(tracepoint)
* Returns 'true' if 'tracepoint' is enabled; false otherwise.
*
* When using LTTNG, Q_TRACE, Q_UNCONDITIONAL_TRACE and Q_TRACE_ENABLED map
* ultimately to tracepoint(), do_tracepoint() and tracepoint_enabled(),
* respectively, described on the lttng-ust manpage (man 3 lttng-ust).
*
* On ETW, Q_TRACE() and Q_UNCONDITIONAL_TRACE() are equivalent, ultimately
* amounting to a call to TraceLoggingWrite(), whereas Q_TRACE_ENABLED()
* wraps around TraceLoggingProviderEnabled().
*
* A tracepoint provider is defined in a separate file, that follows the
* following format:
*
* tracepoint_name(arg_type arg_name, ...)
*
* For instance:
*
* qcoreapplication_ctor(int argc, const char * const argv)
* qcoreapplication_foo(int argc, const char[10] argv)
* qcoreapplication_baz(const char[len] some_string, unsigned int len)
* qcoreapplication_qstring(const QString &foo)
* qcoreapplication_qrect(const QRect &rect)
*
* The provider file is then parsed by src/tools/tracegen, which can be
* switched to output either ETW or LTTNG tracepoint definitions. The provider
* name is deduced to be basename(provider_file).
*
* To use the above (inside qtcore), you need to include
* <providername_tracepoints_p.h>. After that, the following call becomes
* possible:
*
* Q_TRACE(qcoreapplication_qrect, myRect);
*
* Currently, all C++ primitive non-pointer types are supported for
* arguments. Additionally, char * is supported, and is assumed to
* be a NULL-terminated string. Finally, the following subset of Qt types also
* currently supported:
*
* - QString
* - QByteArray
* - QUrl
* - QRect
*
* Dynamic arrays are supported using the syntax illustrated by
* qcoreapplication_baz above.
*/
#include <QtCore/private/qglobal_p.h>
#include <QtCore/qscopeguard.h>
QT_BEGIN_NAMESPACE
#if defined(Q_TRACEPOINT) && !defined(QT_BOOTSTRAPPED)
# define Q_HAS_TRACEPOINTS 1
# define Q_TRACE(x, ...) QtPrivate::trace_ ## x(__VA_ARGS__)
# define Q_TRACE_EXIT(x, ...) \
const auto qTraceExit_ ## x ## __COUNTER__ = qScopeGuard([&]() { Q_TRACE(x, __VA_ARGS__); });
# define Q_TRACE_SCOPE(x, ...) \
Q_TRACE(x ## _entry, __VA_ARGS__); \
Q_TRACE_EXIT(x ## _exit);
# define Q_UNCONDITIONAL_TRACE(x, ...) QtPrivate::do_trace_ ## x(__VA_ARGS__)
# define Q_TRACE_ENABLED(x) QtPrivate::trace_ ## x ## _enabled()
#else
# define Q_HAS_TRACEPOINTS 0
# define Q_TRACE(x, ...)
# define Q_TRACE_EXIT(x, ...)
# define Q_TRACE_SCOPE(x, ...)
# define Q_UNCONDITIONAL_TRACE(x, ...)
# define Q_TRACE_ENABLED(x) false
#endif // defined(Q_TRACEPOINT) && !defined(QT_BOOTSTRAPPED)
QT_END_NAMESPACE
#endif // QTRACE_P_H

View File

@@ -1,40 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// Copyright (C) 2016 Intel Corporation.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QVARIANT_P_H
#define QVARIANT_P_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/qglobal.h>
#include <QtCore/qvariant.h>
#include <QtCore/private/qmetatype_p.h>
QT_BEGIN_NAMESPACE
template <class T>
inline void v_construct(QVariant::Private *x, const T &t)
{
if constexpr (QVariant::Private::CanUseInternalSpace<T>) {
new (&x->data) T(t);
x->is_shared = false;
} else {
x->data.shared = QVariant::PrivateShared::create(QtPrivate::qMetaTypeInterfaceForType<T>());
new (x->data.shared->data()) T(t);
x->is_shared = true;
}
}
QT_END_NAMESPACE
#endif // QVARIANT_P_H

View File

@@ -1,97 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// Copyright (C) 2021 Alex Trotsenko <alex1973tr@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWINDOWSPIPEREADER_P_H
#define QWINDOWSPIPEREADER_P_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 <qobject.h>
#include <qmutex.h>
#include <private/qringbuffer_p.h>
#include <qt_windows.h>
QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QWindowsPipeReader : public QObject
{
Q_OBJECT
public:
explicit QWindowsPipeReader(QObject *parent = nullptr);
~QWindowsPipeReader();
void setHandle(HANDLE hPipeReadEnd);
void startAsyncRead();
void stop();
void drainAndStop();
void stopAndClear();
void setMaxReadBufferSize(qint64 size);
qint64 maxReadBufferSize() const { return readBufferMaxSize; }
bool isPipeClosed() const { return pipeBroken; }
qint64 bytesAvailable() const;
qint64 read(char *data, qint64 maxlen);
qint64 readLine(char *data, qint64 maxlen);
qint64 skip(qint64 maxlen);
bool canReadLine() const;
DWORD checkPipeState();
bool checkForReadyRead() { return consumePendingAndEmit(false); }
bool isReadOperationActive() const;
HANDLE syncEvent() const { return syncHandle; }
Q_SIGNALS:
void winError(ulong, const QString &);
void readyRead();
void pipeClosed();
protected:
bool event(QEvent *e) override;
private:
enum State { Stopped, Running, Draining };
void startAsyncReadHelper(QMutexLocker<QMutex> *locker);
void startAsyncReadLocked();
void cancelAsyncRead(State newState);
static void CALLBACK waitCallback(PTP_CALLBACK_INSTANCE instance, PVOID context,
PTP_WAIT wait, TP_WAIT_RESULT waitResult);
bool readCompleted(DWORD errorCode, DWORD numberOfBytesRead);
bool waitForNotification();
bool consumePendingAndEmit(bool allowWinActPosting);
bool consumePending();
HANDLE handle;
HANDLE eventHandle;
HANDLE syncHandle;
PTP_WAIT waitObject;
OVERLAPPED overlapped;
qint64 readBufferMaxSize;
QRingBuffer readBuffer;
qint64 actualReadBufferSize;
qint64 pendingReadBytes;
mutable QMutex mutex;
DWORD lastError;
State state;
bool readSequenceStarted;
bool pipeBroken;
bool readyReadPending;
bool winEventActPosted;
};
QT_END_NAMESPACE
#endif // QWINDOWSPIPEREADER_P_H

View File

@@ -1,83 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// Copyright (C) 2021 Alex Trotsenko <alex1973tr@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWINDOWSPIPEWRITER_P_H
#define QWINDOWSPIPEWRITER_P_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 <qobject.h>
#include <qmutex.h>
#include <private/qringbuffer_p.h>
#include <qt_windows.h>
QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QWindowsPipeWriter : public QObject
{
Q_OBJECT
public:
explicit QWindowsPipeWriter(HANDLE pipeWriteEnd, QObject *parent = nullptr);
~QWindowsPipeWriter();
void setHandle(HANDLE hPipeWriteEnd);
void write(const QByteArray &ba);
void write(const char *data, qint64 size);
void stop();
bool checkForWrite() { return consumePendingAndEmit(false); }
qint64 bytesToWrite() const;
bool isWriteOperationActive() const;
HANDLE syncEvent() const { return syncHandle; }
Q_SIGNALS:
void bytesWritten(qint64 bytes);
void writeFailed();
protected:
bool event(QEvent *e) override;
private:
enum CompletionState { NoError, ErrorDetected, WriteDisabled };
template <typename... Args>
inline void writeImpl(Args... args);
void startAsyncWriteHelper(QMutexLocker<QMutex> *locker);
void startAsyncWriteLocked();
static void CALLBACK waitCallback(PTP_CALLBACK_INSTANCE instance, PVOID context,
PTP_WAIT wait, TP_WAIT_RESULT waitResult);
bool writeCompleted(DWORD errorCode, DWORD numberOfBytesWritten);
void notifyCompleted(QMutexLocker<QMutex> *locker);
bool consumePendingAndEmit(bool allowWinActPosting);
HANDLE handle;
HANDLE eventHandle;
HANDLE syncHandle;
PTP_WAIT waitObject;
OVERLAPPED overlapped;
QRingBuffer writeBuffer;
qint64 pendingBytesWrittenValue;
mutable QMutex mutex;
DWORD lastError;
CompletionState completionState;
bool stopped;
bool writeSequenceStarted;
bool bytesWrittenPending;
bool winEventActPosted;
};
QT_END_NAMESPACE
#endif // QWINDOWSPIPEWRITER_P_H

View File

@@ -1,48 +0,0 @@
// Copyright (C) 2017 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 QWINEVENTNOTIFIER_P_H
#define QWINEVENTNOTIFIER_P_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 "qwineventnotifier.h"
#include <private/qobject_p.h>
#include <QtCore/qatomic.h>
#include <QtCore/qt_windows.h>
QT_BEGIN_NAMESPACE
class QWinEventNotifierPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QWinEventNotifier)
public:
QWinEventNotifierPrivate() : QWinEventNotifierPrivate(0, false) {}
QWinEventNotifierPrivate(HANDLE h, bool e);
virtual ~QWinEventNotifierPrivate();
static void CALLBACK waitCallback(PTP_CALLBACK_INSTANCE instance, PVOID context,
PTP_WAIT wait, TP_WAIT_RESULT waitResult);
HANDLE handleToEvent;
PTP_WAIT waitObject = NULL;
enum PostingState { NotPosted = 0, Posted, IgnorePosted };
QAtomicInt winEventActPosted;
bool enabled;
bool registered;
};
QT_END_NAMESPACE
#endif // QWINEVENTNOTIFIER_P_H

View File

@@ -1,54 +0,0 @@
// Copyright (C) 2019 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 QWINREGISTRY_H
#define QWINREGISTRY_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/qpair.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringview.h>
#include <QtCore/qt_windows.h>
#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QWinRegistryKey
{
public:
Q_DISABLE_COPY(QWinRegistryKey)
QWinRegistryKey();
explicit QWinRegistryKey(HKEY parentHandle, QStringView subKey,
REGSAM permissions = KEY_READ, REGSAM access = 0);
~QWinRegistryKey();
QWinRegistryKey(QWinRegistryKey &&other) noexcept
: m_key(qExchange(other.m_key, nullptr)) {}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QWinRegistryKey)
void swap(QWinRegistryKey &other) noexcept { qSwap(m_key, other.m_key); }
bool isValid() const { return m_key != nullptr; }
operator HKEY() const { return m_key; }
void close();
QString stringValue(QStringView subKey) const;
QPair<DWORD, bool> dwordValue(QStringView subKey) const;
private:
HKEY m_key;
};
QT_END_NAMESPACE
#endif // QWINREGISTRY_H

View File

@@ -1 +0,0 @@
#include "qshareddata.h"

View File

@@ -1 +0,0 @@
#include "qglobal.h"

View File

@@ -1 +0,0 @@
#include "qglobal.h"

View File

@@ -1 +0,0 @@
#include "qglobal.h"

View File

@@ -1 +0,0 @@
#include "qjnienvironment.h"

View File

@@ -1 +0,0 @@
#include "qjniobject.h"

View File

@@ -1 +0,0 @@
#include "qglobal.h"

View File

@@ -1 +0,0 @@
#include "qjsonarray.h"

View File

@@ -1,69 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// Copyright (C) 2011 Thiago Macieira <thiago@kde.org>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QATOMIC_BOOTSTRAP_H
#define QATOMIC_BOOTSTRAP_H
#include <QtCore/qgenericatomic.h>
QT_BEGIN_NAMESPACE
#if 0
// silence syncqt warnings
QT_END_NAMESPACE
#pragma qt_sync_skip_header_check
#pragma qt_sync_stop_processing
#endif
#define Q_ATOMIC_INT8_IS_SUPPORTED
template<> struct QAtomicOpsSupport<1> { enum { IsSupported = 1 }; };
#define Q_ATOMIC_INT16_IS_SUPPORTED
template<> struct QAtomicOpsSupport<2> { enum { IsSupported = 1 }; };
#define Q_ATOMIC_INT32_IS_SUPPORTED
#define Q_ATOMIC_INT64_IS_SUPPORTED
template<> struct QAtomicOpsSupport<8> { enum { IsSupported = 1 }; };
template <typename T> struct QAtomicOps: QGenericAtomicOps<QAtomicOps<T> >
{
typedef T Type;
static bool ref(T &_q_value) noexcept
{
return ++_q_value != 0;
}
static bool deref(T &_q_value) noexcept
{
return --_q_value != 0;
}
static bool testAndSetRelaxed(T &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) noexcept
{
if (currentValue)
*currentValue = _q_value;
if (_q_value == expectedValue) {
_q_value = newValue;
return true;
}
return false;
}
static T fetchAndStoreRelaxed(T &_q_value, T newValue) noexcept
{
T tmp = _q_value;
_q_value = newValue;
return tmp;
}
template <typename AdditiveType> static
T fetchAndAddRelaxed(T &_q_value, AdditiveType valueToAdd) noexcept
{
T returnValue = _q_value;
_q_value += valueToAdd;
return returnValue;
}
};
QT_END_NAMESPACE
#endif // QATOMIC_BOOTSTRAP_H

View File

@@ -1,112 +0,0 @@
// Copyright (C) 2018 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
//
// 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.
//
// Despite its file name, this really is not a public header.
// It is an implementation detail of the private bootstrap library.
//
#if 0
// silence syncqt warnings
#pragma qt_sync_skip_header_check
#pragma qt_sync_stop_processing
#endif
#ifdef QT_BOOTSTRAPPED
#ifndef QT_NO_EXCEPTIONS
#define QT_NO_EXCEPTIONS
#endif
#define QT_NO_USING_NAMESPACE
#define QT_NO_DEPRECATED
// Keep feature-test macros in alphabetic order by feature name:
#define QT_FEATURE_alloca 1
#define QT_FEATURE_alloca_h -1
#ifdef _WIN32
# define QT_FEATURE_alloca_malloc_h 1
#else
# define QT_FEATURE_alloca_malloc_h -1
#endif
#define QT_FEATURE_cborstreamreader -1
#define QT_FEATURE_cborstreamwriter 1
#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1
#define QT_FEATURE_cxx11_random (__has_include(<random>) ? 1 : -1)
#define QT_FEATURE_cxx17_filesystem -1
#define QT_NO_DATASTREAM
#define QT_FEATURE_datestring 1
#define QT_FEATURE_datetimeparser -1
#define QT_FEATURE_easingcurve -1
#define QT_FEATURE_etw -1
#if defined(__linux__) || defined(__GLIBC__)
#define QT_FEATURE_getauxval (__has_include(<sys/auxv.h>) ? 1 : -1)
#else
#define QT_FEATURE_getauxval -1
#endif
#define QT_FEATURE_getentropy -1
#define QT_NO_GEOM_VARIANT
#define QT_FEATURE_hijricalendar -1
#define QT_FEATURE_icu -1
#define QT_FEATURE_islamiccivilcalendar -1
#define QT_FEATURE_jalalicalendar -1
#define QT_FEATURE_journald -1
#define QT_FEATURE_futimens -1
#define QT_FEATURE_futimes -1
#define QT_FEATURE_future -1
#define QT_FEATURE_itemmodel -1
#define QT_FEATURE_library -1
#ifdef __linux__
# define QT_FEATURE_linkat 1
#else
# define QT_FEATURE_linkat -1
#endif
#define QT_FEATURE_lttng -1
#define QT_NO_QOBJECT
#define QT_FEATURE_process -1
#define QT_FEATURE_regularexpression 1
#ifdef __GLIBC_PREREQ
# define QT_FEATURE_renameat2 (__GLIBC_PREREQ(2, 28) ? 1 : -1)
#else
# define QT_FEATURE_renameat2 -1
#endif
#define QT_FEATURE_shortcut -1
#define QT_FEATURE_signaling_nan -1
#define QT_FEATURE_slog2 -1
#ifdef __GLIBC_PREREQ
# define QT_FEATURE_statx (__GLIBC_PREREQ(2, 28) ? 1 : -1)
#else
# define QT_FEATURE_statx -1
#endif
#define QT_FEATURE_syslog -1
#define QT_NO_SYSTEMLOCALE
#define QT_FEATURE_temporaryfile 1
#define QT_FEATURE_textdate 1
#define QT_FEATURE_thread -1
#define QT_FEATURE_timezone -1
#define QT_FEATURE_topleveldomain -1
#define QT_NO_TRANSLATION
#define QT_FEATURE_translation -1
#define QT_NO_COMPRESS
// rcc.pro will DEFINES+= this
#ifndef QT_FEATURE_zstd
#define QT_FEATURE_zstd -1
#endif
#define QT_FEATURE_commandlineparser 1
#define QT_FEATURE_settings -1
#define QT_NO_TEMPORARYFILE
#endif // QT_BOOTSTRAPPED

View File

@@ -1,159 +0,0 @@
// 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 QFUNCTIONS_VXWORKS_H
#define QFUNCTIONS_VXWORKS_H
#include <QtCore/qglobal.h>
#ifdef Q_OS_VXWORKS
#include <unistd.h>
#include <pthread.h>
#include <dirent.h>
#include <signal.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#if defined(_WRS_KERNEL)
#include <sys/times.h>
#else
#include <sys/time.h>
#endif
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <netinet/in.h>
// VxWorks has public header mbuf.h which defines following variables for DKM.
// Let's undef those to because they overlap with Qt variable names-
// File mbuf.h is included in headers <netinet/in.h> <net/if.h>, so make sure
// that those are included before undef's.
#if defined(mbuf)
# undef mbuf
#endif
#if defined(m_data)
# undef m_data
#endif
#if defined(m_type)
# undef m_type
#endif
#if defined(m_next)
# undef m_next
#endif
#if defined(m_len)
# undef m_len
#endif
#if defined(m_flags)
# undef m_flags
#endif
#if defined(m_hdr)
# undef m_hdr
#endif
#if defined(m_ext)
# undef m_ext
#endif
#if defined(m_act)
# undef m_act
#endif
#if defined(m_nextpkt)
# undef m_nextpkt
#endif
#if defined(m_pkthdr)
# undef m_pkthdr
#endif
QT_BEGIN_NAMESPACE
#ifdef QT_BUILD_CORE_LIB
#endif
QT_END_NAMESPACE
#ifndef RTLD_LOCAL
#define RTLD_LOCAL 0
#endif
#ifndef NSIG
#define NSIG _NSIGS
#endif
#ifdef __cplusplus
extern "C" {
#endif
// isascii is missing (sometimes!!)
#ifndef isascii
inline int isascii(int c) { return (c & 0x7f); }
#endif
// no lfind() - used by the TIF image format
void *lfind(const void* key, const void* base, size_t* elements, size_t size,
int (*compare)(const void*, const void*));
// no rand_r(), but rand()
// NOTE: this implementation is wrong for multi threaded applications,
// but there is no way to get it right on VxWorks (in kernel mode)
#if defined(_WRS_KERNEL)
int rand_r(unsigned int * /*seedp*/);
#endif
// no usleep() support
int usleep(unsigned int);
#if defined(VXWORKS_DKM) || defined(VXWORKS_RTP)
int gettimeofday(struct timeval *, void *);
#else
// gettimeofday() is declared, but is missing from the library.
// It IS however defined in the Curtis-Wright X11 libraries, so
// we have to make the symbol 'weak'
int gettimeofday(struct timeval *tv, void /*struct timezone*/ *) __attribute__((weak));
#endif
// getpagesize() not available
int getpagesize();
// symlinks are not supported (lstat is now just a call to stat - see qplatformdefs.h)
int symlink(const char *, const char *);
ssize_t readlink(const char *, char *, size_t);
// there's no truncate(), but ftruncate() support...
int truncate(const char *path, off_t length);
// VxWorks doesn't know about passwd & friends.
// in order to avoid patching the unix fs path everywhere
// we introduce some dummy functions that simulate a single
// 'root' user on the system.
uid_t getuid();
gid_t getgid();
uid_t geteuid();
struct passwd {
char *pw_name; /* user name */
char *pw_passwd; /* user password */
uid_t pw_uid; /* user ID */
gid_t pw_gid; /* group ID */
char *pw_gecos; /* real name */
char *pw_dir; /* home directory */
char *pw_shell; /* shell program */
};
struct group {
char *gr_name; /* group name */
char *gr_passwd; /* group password */
gid_t gr_gid; /* group ID */
char **gr_mem; /* group members */
};
struct passwd *getpwuid(uid_t uid);
struct group *getgrgid(gid_t gid);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // Q_OS_VXWORKS
#endif // QFUNCTIONS_VXWORKS_H

File diff suppressed because it is too large Load Diff

View File

@@ -1,90 +0,0 @@
// Copyright (C) 2021 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 QJNI_ENVIRONMENT_H
#define QJNI_ENVIRONMENT_H
#include <QtCore/QScopedPointer>
#if defined(Q_QDOC) || defined(Q_OS_ANDROID)
#include <jni.h>
#include <QtCore/qjnitypes.h>
QT_BEGIN_NAMESPACE
class QJniEnvironmentPrivate;
class Q_CORE_EXPORT QJniEnvironment
{
public:
QJniEnvironment();
~QJniEnvironment();
bool isValid() const;
JNIEnv *operator->() const;
JNIEnv &operator*() const;
JNIEnv *jniEnv() const;
jclass findClass(const char *className);
template<typename Class>
jclass findClass() { return findClass(QtJniTypes::className<Class>().data()); }
jmethodID findMethod(jclass clazz, const char *methodName, const char *signature);
template<typename ...Args>
jmethodID findMethod(jclass clazz, const char *methodName) {
constexpr auto signature = QtJniTypes::methodSignature<Args...>();
return findMethod(clazz, methodName, signature.data());
}
jmethodID findStaticMethod(jclass clazz, const char *methodName, const char *signature);
template<typename ...Args>
jmethodID findStaticMethod(jclass clazz, const char *methodName) {
constexpr auto signature = QtJniTypes::methodSignature<Args...>();
return findStaticMethod(clazz, methodName, signature.data());
}
jfieldID findField(jclass clazz, const char *fieldName, const char *signature);
template<typename T>
jfieldID findField(jclass clazz, const char *fieldName) {
constexpr auto signature = QtJniTypes::fieldSignature<T>();
return findField(clazz, fieldName, signature.data());
}
jfieldID findStaticField(jclass clazz, const char *fieldName, const char *signature);
template<typename T>
jfieldID findStaticField(jclass clazz, const char *fieldName) {
constexpr auto signature = QtJniTypes::fieldSignature<T>();
return findStaticField(clazz, fieldName, signature.data());
}
static JavaVM *javaVM();
bool registerNativeMethods(const char *className, const JNINativeMethod methods[], int size);
bool registerNativeMethods(jclass clazz, const JNINativeMethod methods[], int size);
bool registerNativeMethods(const char *className, std::initializer_list<JNINativeMethod> methods)
{
return registerNativeMethods(className, std::data(methods), methods.size());
}
bool registerNativeMethods(jclass clazz, std::initializer_list<JNINativeMethod> methods)
{
return registerNativeMethods(clazz, std::data(methods), methods.size());
}
#if QT_DEPRECATED_SINCE(6, 2)
// ### Qt 7: remove
QT_DEPRECATED_VERSION_X_6_2("Use the overload with a const JNINativeMethod[] instead.")
bool registerNativeMethods(const char *className, JNINativeMethod methods[], int size);
#endif
enum class OutputMode {
Silent,
Verbose
};
bool checkAndClearExceptions(OutputMode outputMode = OutputMode::Verbose);
static bool checkAndClearExceptions(JNIEnv *env, OutputMode outputMode = OutputMode::Verbose);
private:
Q_DISABLE_COPY_MOVE(QJniEnvironment)
QScopedPointer<QJniEnvironmentPrivate> d;
};
QT_END_NAMESPACE
#endif
#endif // QJNI_ENVIRONMENT_H

View File

@@ -1,636 +0,0 @@
// Copyright (C) 2022 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 QJNIOBJECT_H
#define QJNIOBJECT_H
#include <QtCore/qsharedpointer.h>
#if defined(Q_QDOC) || defined(Q_OS_ANDROID)
#include <jni.h>
#include <QtCore/qjnienvironment.h>
#include <QtCore/qjnitypes.h>
QT_BEGIN_NAMESPACE
class QJniObjectPrivate;
class Q_CORE_EXPORT QJniObject
{
public:
QJniObject();
explicit QJniObject(const char *className);
explicit QJniObject(const char *className, const char *signature, ...);
template<typename ...Args
#ifndef Q_QDOC
, std::enable_if_t<!std::disjunction_v<QtJniTypes::IsStringType<std::decay_t<Args>>...>>* = nullptr
#endif
>
explicit QJniObject(const char *className, Args &&...args)
: QJniObject(className, QtJniTypes::constructorSignature<Args...>().data(),
std::forward<Args>(args)...)
{}
explicit QJniObject(jclass clazz);
explicit QJniObject(jclass clazz, const char *signature, ...);
template<typename ...Args
#ifndef Q_QDOC
, std::enable_if_t<!std::disjunction_v<QtJniTypes::IsStringType<std::decay_t<Args>>...>>* = nullptr
#endif
>
explicit QJniObject(jclass clazz, Args &&...args)
: QJniObject(clazz, QtJniTypes::constructorSignature<Args...>().data(),
std::forward<Args>(args)...)
{}
QJniObject(jobject globalRef);
inline QJniObject(QtJniTypes::Object wrapper) noexcept : QJniObject(jobject(wrapper)) {}
~QJniObject();
template<typename Class, typename ...Args>
static inline QJniObject construct(Args &&...args)
{
return QJniObject(QtJniTypes::className<Class>().data(),
QtJniTypes::constructorSignature<Args...>().data(),
std::forward<Args>(args)...);
}
jobject object() const;
template <typename T> T object() const
{
QtJniTypes::assertObjectType<T>();
return static_cast<T>(javaObject());
}
jclass objectClass() const;
QByteArray className() const;
template <typename Ret, typename ...Args>
auto callMethod(const char *methodName, const char *signature, Args &&...args) const
{
if constexpr (QtJniTypes::isObjectType<Ret>()) {
return callObjectMethod(methodName, signature, std::forward<Args>(args)...);
} else {
QtJniTypes::assertPrimitiveType<Ret>();
QJniEnvironment env;
jmethodID id = getCachedMethodID(env.jniEnv(), methodName, signature);
if (id) {
if constexpr (std::is_same<Ret, void>::value) {
callVoidMethodV(env.jniEnv(), id, std::forward<Args>(args)...);
env.checkAndClearExceptions();
} else {
Ret res{};
callMethodForType<Ret>(env.jniEnv(), res, object(), id, std::forward<Args>(args)...);
if (env.checkAndClearExceptions())
res = {};
return res;
}
}
if constexpr (!std::is_same<Ret, void>::value)
return Ret{};
}
}
template <typename Ret, typename ...Args>
auto callMethod(const char *methodName, Args &&...args) const
{
constexpr auto signature = QtJniTypes::methodSignature<Ret, Args...>();
if constexpr (std::is_same<Ret, void>::value) {
callMethod<void>(methodName, signature.data(), std::forward<Args>(args)...);
} else {
return callMethod<Ret>(methodName, signature.data(), std::forward<Args>(args)...);
}
}
template <typename Ret, typename ...Args>
QJniObject callObjectMethod(const char *methodName, Args &&...args) const
{
QtJniTypes::assertObjectType<Ret>();
constexpr auto signature = QtJniTypes::methodSignature<Ret, Args...>();
return callObjectMethod(methodName, signature.data(), std::forward<Args>(args)...);
}
QJniObject callObjectMethod(const char *methodName, const char *signature, ...) const;
template <typename Ret, typename ...Args>
static auto callStaticMethod(const char *className, const char *methodName, const char *signature, Args &&...args)
{
QJniEnvironment env;
jclass clazz = QJniObject::loadClass(className, env.jniEnv());
return callStaticMethod<Ret>(clazz, methodName, signature, std::forward<Args>(args)...);
}
template <typename Ret, typename ...Args>
static auto callStaticMethod(jclass clazz, const char *methodName, const char *signature, Args &&...args)
{
QJniEnvironment env;
jmethodID id = getMethodID(env.jniEnv(), clazz, methodName, signature, true);
return callStaticMethod<Ret, Args...>(clazz, id, std::forward<Args>(args)...);
}
template <typename Ret, typename ...Args>
static auto callStaticMethod(jclass clazz, jmethodID methodId, Args &&...args)
{
if constexpr (QtJniTypes::isObjectType<Ret>()) {
return callStaticObjectMethod(clazz, methodId, std::forward<Args>(args)...);
} else {
QtJniTypes::assertPrimitiveType<Ret>();
QJniEnvironment env;
if (clazz && methodId) {
if constexpr (std::is_same<Ret, void>::value) {
callStaticMethodForVoid(env.jniEnv(), clazz, methodId, std::forward<Args>(args)...);
env.checkAndClearExceptions();
} else {
Ret res{};
callStaticMethodForType<Ret>(env.jniEnv(), res, clazz, methodId, std::forward<Args>(args)...);
if (env.checkAndClearExceptions())
res = {};
return res;
}
}
if constexpr (!std::is_same<Ret, void>::value)
return Ret{};
}
}
template <typename Ret, typename ...Args>
static auto callStaticMethod(const char *className, const char *methodName, Args &&...args)
{
QJniEnvironment env;
jclass clazz = QJniObject::loadClass(className, env.jniEnv());
return callStaticMethod<Ret, Args...>(clazz, methodName, std::forward<Args>(args)...);
}
template <typename Ret, typename ...Args>
static auto callStaticMethod(jclass clazz, const char *methodName, Args &&...args)
{
constexpr auto signature = QtJniTypes::methodSignature<Ret, Args...>();
return callStaticMethod<Ret>(clazz, methodName, signature.data(), std::forward<Args>(args)...);
}
static QJniObject callStaticObjectMethod(const char *className, const char *methodName,
const char *signature, ...);
static QJniObject callStaticObjectMethod(jclass clazz, const char *methodName,
const char *signature, ...);
static QJniObject callStaticObjectMethod(jclass clazz, jmethodID methodId, ...);
template <typename Ret, typename ...Args>
static QJniObject callStaticObjectMethod(const char *className, const char *methodName, Args &&...args)
{
QtJniTypes::assertObjectType<Ret>();
constexpr auto signature = QtJniTypes::methodSignature<Ret, Args...>();
return callStaticObjectMethod(className, methodName, signature.data(), std::forward<Args>(args)...);
}
template <typename Ret, typename ...Args>
static QJniObject callStaticObjectMethod(jclass clazz, const char *methodName, Args &&...args)
{
QtJniTypes::assertObjectType<Ret>();
constexpr auto signature = QtJniTypes::methodSignature<Ret, Args...>();
return callStaticObjectMethod(clazz, methodName, signature.data(), std::forward<Args>(args)...);
}
template <typename T> auto getField(const char *fieldName) const
{
if constexpr (QtJniTypes::isObjectType<T>()) {
return getObjectField<T>(fieldName);
} else {
QtJniTypes::assertPrimitiveType<T>();
QJniEnvironment env;
T res{};
constexpr auto signature = QtJniTypes::fieldSignature<T>();
jfieldID id = getCachedFieldID(env.jniEnv(), fieldName, signature);
if (id) {
getFieldForType<T>(env.jniEnv(), res, object(), id);
if (env.checkAndClearExceptions())
res = {};
}
return res;
}
}
template <typename T>
static auto getStaticField(const char *className, const char *fieldName)
{
if constexpr (QtJniTypes::isObjectType<T>()) {
return getStaticObjectField<T>(className, fieldName);
} else {
QtJniTypes::assertPrimitiveType<T>();
QJniEnvironment env;
jclass clazz = QJniObject::loadClass(className, env.jniEnv());
T res{};
if (!clazz)
return res;
constexpr auto signature = QtJniTypes::fieldSignature<T>();
jfieldID id = getCachedFieldID(env.jniEnv(), clazz,
QJniObject::toBinaryEncClassName(className),
fieldName,
signature, true);
if (!id)
return res;
getStaticFieldForType<T>(env.jniEnv(), res, clazz, id);
if (env.checkAndClearExceptions())
res = {};
return res;
}
}
template <typename T>
static auto getStaticField(jclass clazz, const char *fieldName)
{
if constexpr (QtJniTypes::isObjectType<T>()) {
return getStaticObjectField<T>(clazz, fieldName);
} else {
QtJniTypes::assertPrimitiveType<T>();
QJniEnvironment env;
T res{};
constexpr auto signature = QtJniTypes::fieldSignature<T>();
jfieldID id = getFieldID(env.jniEnv(), clazz, fieldName, signature, true);
if (id) {
getStaticFieldForType<T>(env.jniEnv(), res, clazz, id);
if (env.checkAndClearExceptions())
res = {};
}
return res;
}
}
template <typename Klass, typename T>
static auto getStaticField(const char *fieldName)
{
return getStaticField<T>(QtJniTypes::className<Klass>(), fieldName);
}
template <typename T>
QJniObject getObjectField(const char *fieldName) const
{
QtJniTypes::assertObjectType<T>();
constexpr auto signature = QtJniTypes::fieldSignature<T>();
return getObjectField(fieldName, signature);
}
QJniObject getObjectField(const char *fieldName, const char *signature) const;
template <typename T>
static QJniObject getStaticObjectField(const char *className, const char *fieldName)
{
QtJniTypes::assertObjectType<T>();
constexpr auto signature = QtJniTypes::fieldSignature<T>();
return getStaticObjectField(className, fieldName, signature);
}
static QJniObject getStaticObjectField(const char *className,
const char *fieldName,
const char *signature);
template <typename T>
static QJniObject getStaticObjectField(jclass clazz, const char *fieldName)
{
QtJniTypes::assertObjectType<T>();
constexpr auto signature = QtJniTypes::fieldSignature<T>();
return getStaticObjectField(clazz, fieldName, signature);
}
static QJniObject getStaticObjectField(jclass clazz, const char *fieldName,
const char *signature);
template <typename T> void setField(const char *fieldName, T value)
{
QtJniTypes::assertType<T>();
QJniEnvironment env;
constexpr auto signature = QtJniTypes::fieldSignature<T>();
jfieldID id = getCachedFieldID(env.jniEnv(), fieldName, signature);
if (id) {
setFieldForType<T>(env.jniEnv(), object(), id, value);
env.checkAndClearExceptions();
}
}
template <typename T>
void setField(const char *fieldName, const char *signature, T value)
{
QtJniTypes::assertType<T>();
QJniEnvironment env;
jfieldID id = getCachedFieldID(env.jniEnv(), fieldName, signature);
if (id) {
setFieldForType<T>(env.jniEnv(), object(), id, value);
env.checkAndClearExceptions();
}
}
template <typename T>
static void setStaticField(const char *className, const char *fieldName, T value)
{
QtJniTypes::assertType<T>();
QJniEnvironment env;
jclass clazz = QJniObject::loadClass(className, env.jniEnv());
if (!clazz)
return;
constexpr auto signature = QtJniTypes::fieldSignature<T>();
jfieldID id = getCachedFieldID(env.jniEnv(), clazz, className, fieldName,
signature, true);
if (!id)
return;
setStaticFieldForType<T>(env.jniEnv(), clazz, id, value);
env.checkAndClearExceptions();
}
template <typename T>
static void setStaticField(const char *className, const char *fieldName,
const char *signature, T value)
{
QtJniTypes::assertType<T>();
QJniEnvironment env;
jclass clazz = QJniObject::loadClass(className, env.jniEnv());
if (!clazz)
return;
jfieldID id = getCachedFieldID(env.jniEnv(), clazz, className, fieldName,
signature, true);
if (id) {
setStaticFieldForType<T>(env.jniEnv(), clazz, id, value);
env.checkAndClearExceptions();
}
}
template <typename T>
static void setStaticField(jclass clazz, const char *fieldName,
const char *signature, T value)
{
QtJniTypes::assertType<T>();
QJniEnvironment env;
jfieldID id = getFieldID(env.jniEnv(), clazz, fieldName, signature, true);
if (id) {
setStaticFieldForType<T>(env.jniEnv(), clazz, id, value);
env.checkAndClearExceptions();
}
}
template <typename T>
static void setStaticField(jclass clazz, const char *fieldName, T value)
{
QtJniTypes::assertType<T>();
QJniEnvironment env;
constexpr auto signature = QtJniTypes::fieldSignature<T>();
jfieldID id = getFieldID(env.jniEnv(), clazz, fieldName, signature, true);
if (id) {
setStaticFieldForType<T>(env.jniEnv(), clazz, id, value);
env.checkAndClearExceptions();
}
}
template <typename Klass, typename T>
static void setStaticField(const char *fieldName, T value)
{
setStaticField(QtJniTypes::className<Klass>(), fieldName, value);
}
static QJniObject fromString(const QString &string);
QString toString() const;
static bool isClassAvailable(const char *className);
bool isValid() const;
// This function takes ownership of the jobject and releases the local ref. before returning.
static QJniObject fromLocalRef(jobject lref);
template <typename T> QJniObject &operator=(T obj)
{
QtJniTypes::assertType<T>();
assign(static_cast<T>(obj));
return *this;
}
private:
struct QVaListPrivate { operator va_list &() const { return m_args; } va_list &m_args; };
QJniObject(const char *className, const char *signature, const QVaListPrivate &args);
QJniObject(jclass clazz, const char *signature, const QVaListPrivate &args);
static jclass loadClass(const QByteArray &className, JNIEnv *env, bool binEncoded = false);
static QByteArray toBinaryEncClassName(const QByteArray &className);
static QJniObject getCleanJniObject(jobject obj);
static jfieldID getCachedFieldID(JNIEnv *env, jclass clazz, const QByteArray &className,
const char *name, const char *signature,
bool isStatic = false);
jfieldID getCachedFieldID(JNIEnv *env, const char *name, const char *signature,
bool isStatic = false) const;
static jmethodID getCachedMethodID(JNIEnv *env, jclass clazz, const QByteArray &className,
const char *name, const char *signature,
bool isStatic = false);
jmethodID getCachedMethodID(JNIEnv *env, const char *name, const char *signature,
bool isStatic = false) const;
static jfieldID getFieldID(JNIEnv *env, jclass clazz, const char *name,
const char *signature, bool isStatic = false);
static jmethodID getMethodID(JNIEnv *env, jclass clazz, const char *name,
const char *signature, bool isStatic = false);
void callVoidMethodV(JNIEnv *env, jmethodID id, ...) const;
QJniObject callObjectMethodV(const char *methodName, const char *signature,
va_list args) const;
static QJniObject callStaticObjectMethodV(const char *className, const char *methodName,
const char *signature, va_list args);
static QJniObject callStaticObjectMethodV(jclass clazz, const char *methodName,
const char *signature, va_list args);
bool isSameObject(jobject obj) const;
bool isSameObject(const QJniObject &other) const;
void assign(jobject obj);
jobject javaObject() const;
friend bool operator==(const QJniObject &, const QJniObject &);
friend bool operator!=(const QJniObject&, const QJniObject&);
template<typename T>
static constexpr void callMethodForType(JNIEnv *env, T &res, jobject obj,
jmethodID id, ...)
{
va_list args = {};
va_start(args, id);
if constexpr(std::is_same<T, jboolean>::value)
res = env->CallBooleanMethodV(obj, id, args);
else if constexpr(std::is_same<T, jbyte>::value)
res = env->CallByteMethodV(obj, id, args);
else if constexpr(std::is_same<T, jchar>::value)
res = env->CallCharMethodV(obj, id, args);
else if constexpr(std::is_same<T, jshort>::value)
res = env->CallShortMethodV(obj, id, args);
else if constexpr(std::is_same<T, jint>::value)
res = env->CallIntMethodV(obj, id, args);
else if constexpr(std::is_same<T, jlong>::value)
res = env->CallLongMethodV(obj, id, args);
else if constexpr(std::is_same<T, jfloat>::value)
res = env->CallFloatMethodV(obj, id, args);
else if constexpr(std::is_same<T, jdouble>::value)
res = env->CallDoubleMethodV(obj, id, args);
else
QtJniTypes::staticAssertTypeMismatch();
va_end(args);
}
template<typename T>
static constexpr void callStaticMethodForType(JNIEnv *env, T &res, jclass clazz,
jmethodID id, ...)
{
va_list args = {};
va_start(args, id);
if constexpr(std::is_same<T, jboolean>::value)
res = env->CallStaticBooleanMethodV(clazz, id, args);
else if constexpr(std::is_same<T, jbyte>::value)
res = env->CallStaticByteMethodV(clazz, id, args);
else if constexpr(std::is_same<T, jchar>::value)
res = env->CallStaticCharMethodV(clazz, id, args);
else if constexpr(std::is_same<T, jshort>::value)
res = env->CallStaticShortMethodV(clazz, id, args);
else if constexpr(std::is_same<T, jint>::value)
res = env->CallStaticIntMethodV(clazz, id, args);
else if constexpr(std::is_same<T, jlong>::value)
res = env->CallStaticLongMethodV(clazz, id, args);
else if constexpr(std::is_same<T, jfloat>::value)
res = env->CallStaticFloatMethodV(clazz, id, args);
else if constexpr(std::is_same<T, jdouble>::value)
res = env->CallStaticDoubleMethodV(clazz, id, args);
else
QtJniTypes::staticAssertTypeMismatch();
va_end(args);
}
static void callStaticMethodForVoid(JNIEnv *env, jclass clazz, jmethodID id, ...)
{
va_list args;
va_start(args, id);
env->CallStaticVoidMethodV(clazz, id, args);
va_end(args);
}
template<typename T>
static constexpr void getFieldForType(JNIEnv *env, T &res, jobject obj,
jfieldID id)
{
if constexpr(std::is_same<T, jboolean>::value)
res = env->GetBooleanField(obj, id);
else if constexpr(std::is_same<T, jbyte>::value)
res = env->GetByteField(obj, id);
else if constexpr(std::is_same<T, jchar>::value)
res = env->GetCharField(obj, id);
else if constexpr(std::is_same<T, jshort>::value)
res = env->GetShortField(obj, id);
else if constexpr(std::is_same<T, jint>::value)
res = env->GetIntField(obj, id);
else if constexpr(std::is_same<T, jlong>::value)
res = env->GetLongField(obj, id);
else if constexpr(std::is_same<T, jfloat>::value)
res = env->GetFloatField(obj, id);
else if constexpr(std::is_same<T, jdouble>::value)
res = env->GetDoubleField(obj, id);
else
QtJniTypes::staticAssertTypeMismatch();
}
template<typename T>
static constexpr void getStaticFieldForType(JNIEnv *env, T &res, jclass clazz,
jfieldID id)
{
if constexpr(std::is_same<T, jboolean>::value)
res = env->GetStaticBooleanField(clazz, id);
else if constexpr(std::is_same<T, jbyte>::value)
res = env->GetStaticByteField(clazz, id);
else if constexpr(std::is_same<T, jchar>::value)
res = env->GetStaticCharField(clazz, id);
else if constexpr(std::is_same<T, jshort>::value)
res = env->GetStaticShortField(clazz, id);
else if constexpr(std::is_same<T, jint>::value)
res = env->GetStaticIntField(clazz, id);
else if constexpr(std::is_same<T, jlong>::value)
res = env->GetStaticLongField(clazz, id);
else if constexpr(std::is_same<T, jfloat>::value)
res = env->GetStaticFloatField(clazz, id);
else if constexpr(std::is_same<T, jdouble>::value)
res = env->GetStaticDoubleField(clazz, id);
else
QtJniTypes::staticAssertTypeMismatch();
}
template<typename T>
static constexpr void setFieldForType(JNIEnv *env, jobject obj,
jfieldID id, T value)
{
if constexpr(std::is_same<T, jboolean>::value)
env->SetBooleanField(obj, id, value);
else if constexpr(std::is_same<T, jbyte>::value)
env->SetByteField(obj, id, value);
else if constexpr(std::is_same<T, jchar>::value)
env->SetCharField(obj, id, value);
else if constexpr(std::is_same<T, jshort>::value)
env->SetShortField(obj, id, value);
else if constexpr(std::is_same<T, jint>::value)
env->SetIntField(obj, id, value);
else if constexpr(std::is_same<T, jlong>::value)
env->SetLongField(obj, id, value);
else if constexpr(std::is_same<T, jfloat>::value)
env->SetFloatField(obj, id, value);
else if constexpr(std::is_same<T, jdouble>::value)
env->SetDoubleField(obj, id, value);
else if constexpr(std::is_convertible<T, jobject>::value)
env->SetObjectField(obj, id, value);
else
QtJniTypes::staticAssertTypeMismatch();
}
template<typename T>
static constexpr void setStaticFieldForType(JNIEnv *env, jclass clazz,
jfieldID id, T value)
{
if constexpr(std::is_same<T, jboolean>::value)
env->SetStaticBooleanField(clazz, id, value);
else if constexpr(std::is_same<T, jbyte>::value)
env->SetStaticByteField(clazz, id, value);
else if constexpr(std::is_same<T, jchar>::value)
env->SetStaticCharField(clazz, id, value);
else if constexpr(std::is_same<T, jshort>::value)
env->SetStaticShortField(clazz, id, value);
else if constexpr(std::is_same<T, jint>::value)
env->SetStaticIntField(clazz, id, value);
else if constexpr(std::is_same<T, jlong>::value)
env->SetStaticLongField(clazz, id, value);
else if constexpr(std::is_same<T, jfloat>::value)
env->SetStaticFloatField(clazz, id, value);
else if constexpr(std::is_same<T, jdouble>::value)
env->SetStaticDoubleField(clazz, id, value);
else if constexpr(std::is_convertible<T, jobject>::value)
env->SetStaticObjectField(clazz, id, value);
else
QtJniTypes::staticAssertTypeMismatch();
}
friend QJniObjectPrivate;
QSharedPointer<QJniObjectPrivate> d;
};
inline bool operator==(const QJniObject &obj1, const QJniObject &obj2)
{
return obj1.isSameObject(obj2);
}
inline bool operator!=(const QJniObject &obj1, const QJniObject &obj2)
{
return !obj1.isSameObject(obj2);
}
QT_END_NAMESPACE
#endif
#endif // QJNIOBJECT_H

View File

@@ -1,388 +0,0 @@
// Copyright (C) 2022 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 QJNITYPES_H
#define QJNITYPES_H
#include <QtCore/qglobal.h>
#if defined(Q_QDOC) || defined(Q_OS_ANDROID)
#include <jni.h>
QT_BEGIN_NAMESPACE
namespace QtJniTypes
{
// a constexpr type for string literals of any character width, aware of the length
// of the string.
template<size_t N_WITH_NULL, typename BaseType = char>
struct String
{
BaseType m_data[N_WITH_NULL] = {};
constexpr String() noexcept {}
// Can be instantiated (only) with a string literal
constexpr explicit String(const BaseType (&data)[N_WITH_NULL]) noexcept
{
for (size_t i = 0; i < N_WITH_NULL - 1; ++i)
m_data[i] = data[i];
}
constexpr BaseType at(size_t i) const { return m_data[i]; }
constexpr BaseType operator[](size_t i) const { return at(i); }
static constexpr size_t size() noexcept { return N_WITH_NULL; }
constexpr operator const BaseType *() const noexcept { return m_data; }
constexpr const BaseType *data() const noexcept { return m_data; }
template<size_t N2_WITH_NULL>
constexpr bool startsWith(const BaseType (&lit)[N2_WITH_NULL]) const noexcept
{
if constexpr (N2_WITH_NULL > N_WITH_NULL) {
return false;
} else {
for (size_t i = 0; i < N2_WITH_NULL - 1; ++i) {
if (m_data[i] != lit[i])
return false;
}
}
return true;
}
constexpr bool startsWith(BaseType c) const noexcept
{
return N_WITH_NULL > 1 && m_data[0] == c;
}
template<size_t N2_WITH_NULL>
constexpr bool endsWith(const BaseType (&lit)[N2_WITH_NULL]) const noexcept
{
if constexpr (N2_WITH_NULL > N_WITH_NULL) {
return false;
} else {
for (size_t i = 0; i < N2_WITH_NULL; ++i) {
if (m_data[N_WITH_NULL - i - 1] != lit[N2_WITH_NULL - i - 1])
return false;
}
}
return true;
}
constexpr bool endsWith(BaseType c) const noexcept
{
return N_WITH_NULL > 1 && m_data[N_WITH_NULL - 2] == c;
}
template<size_t N2_WITH_NULL>
friend inline constexpr bool operator==(const String<N_WITH_NULL> &lhs,
const String<N2_WITH_NULL> &rhs) noexcept
{
if constexpr (N_WITH_NULL != N2_WITH_NULL) {
return false;
} else {
for (size_t i = 0; i < N_WITH_NULL - 1; ++i) {
if (lhs.at(i) != rhs.at(i))
return false;
}
}
return true;
}
template<size_t N2_WITH_NULL>
friend inline constexpr bool operator!=(const String<N_WITH_NULL> &lhs,
const String<N2_WITH_NULL> &rhs) noexcept
{
return !operator==(lhs, rhs);
}
template<size_t N2_WITH_NULL>
friend inline constexpr bool operator==(const String<N_WITH_NULL> &lhs,
const BaseType (&rhs)[N2_WITH_NULL]) noexcept
{
return operator==(lhs, String<N2_WITH_NULL>(rhs));
}
template<size_t N2_WITH_NULL>
friend inline constexpr bool operator==(const BaseType (&lhs)[N2_WITH_NULL],
const String<N_WITH_NULL> &rhs) noexcept
{
return operator==(String<N2_WITH_NULL>(lhs), rhs);
}
template<size_t N2_WITH_NULL>
friend inline constexpr bool operator!=(const String<N_WITH_NULL> &lhs,
const BaseType (&rhs)[N2_WITH_NULL]) noexcept
{
return operator!=(lhs, String<N2_WITH_NULL>(rhs));
}
template<size_t N2_WITH_NULL>
friend inline constexpr bool operator!=(const BaseType (&lhs)[N2_WITH_NULL],
const String<N_WITH_NULL> &rhs) noexcept
{
return operator!=(String<N2_WITH_NULL>(lhs), rhs);
}
template<size_t N2_WITH_NULL>
friend inline constexpr auto operator+(const String<N_WITH_NULL> &lhs,
const String<N2_WITH_NULL> &rhs) noexcept
{
char data[N_WITH_NULL + N2_WITH_NULL - 1] = {};
for (size_t i = 0; i < N_WITH_NULL - 1; ++i)
data[i] = lhs[i];
for (size_t i = 0; i < N2_WITH_NULL - 1; ++i)
data[N_WITH_NULL - 1 + i] = rhs[i];
return String<N_WITH_NULL + N2_WITH_NULL - 1>(data);
}
};
// Helper types that allow us to disable variadic overloads that would conflict
// with overloads that take a const char*.
template<typename T, size_t N = 0> struct IsStringType : std::false_type {};
template<> struct IsStringType<const char*, 0> : std::true_type {};
template<size_t N> struct IsStringType<String<N>> : std::true_type {};
template<size_t N> struct IsStringType<const char[N]> : std::true_type {};
template<bool flag = false>
static void staticAssertTypeMismatch()
{
static_assert(flag, "The used type is not supported by this template call. "
"Use a JNI based type instead.");
}
template<typename T>
constexpr auto typeSignature()
{
if constexpr(std::is_same<T, jobject>::value)
return String("Ljava/lang/Object;");
else if constexpr(std::is_same<T, jclass>::value)
return String("Ljava/lang/Class;");
else if constexpr(std::is_same<T, jstring>::value)
return String("Ljava/lang/String;");
else if constexpr(std::is_same<T, jobjectArray>::value)
return String("[Ljava/lang/Object;");
else if constexpr(std::is_same<T, jthrowable>::value)
return String("Ljava/lang/Throwable;");
else if constexpr(std::is_same<T, jbooleanArray>::value)
return String("[Z");
else if constexpr(std::is_same<T, jbyteArray>::value)
return String("[B");
else if constexpr(std::is_same<T, jshortArray>::value)
return String("[S");
else if constexpr(std::is_same<T, jintArray>::value)
return String("[I");
else if constexpr(std::is_same<T, jlongArray>::value)
return String("[J");
else if constexpr(std::is_same<T, jfloatArray>::value)
return String("[F");
else if constexpr(std::is_same<T, jdoubleArray>::value)
return String("[D");
else if constexpr(std::is_same<T, jcharArray>::value)
return String("[C");
else if constexpr(std::is_same<T, jboolean>::value)
return String("Z");
else if constexpr(std::is_same<T, bool>::value)
return String("Z");
else if constexpr(std::is_same<T, jbyte>::value)
return String("B");
else if constexpr(std::is_same<T, jchar>::value)
return String("C");
else if constexpr(std::is_same<T, char>::value)
return String("C");
else if constexpr(std::is_same<T, jshort>::value)
return String("S");
else if constexpr(std::is_same<T, short>::value)
return String("S");
else if constexpr(std::is_same<T, jint>::value)
return String("I");
else if constexpr(std::is_same<T, int>::value)
return String("I");
else if constexpr(std::is_same<T, uint>::value)
return String("I");
else if constexpr(std::is_same<T, jlong>::value)
return String("J");
else if constexpr(std::is_same<T, long>::value)
return String("J");
else if constexpr(std::is_same<T, jfloat>::value)
return String("F");
else if constexpr(std::is_same<T, float>::value)
return String("F");
else if constexpr(std::is_same<T, jdouble>::value)
return String("D");
else if constexpr(std::is_same<T, double>::value)
return String("D");
else if constexpr(std::is_same<T, void>::value)
return String("V");
else if constexpr(IsStringType<T>::value)
static_assert(!IsStringType<T>::value, "Don't use a literal type, call data!");
else
staticAssertTypeMismatch();
}
template<bool flag = false>
static void staticAssertClassNotRegistered()
{
static_assert(flag, "Class not registered, use Q_DECLARE_JNI_CLASS");
}
template<typename T>
constexpr auto className()
{
if constexpr(std::is_same<T, jstring>::value)
return String("java/lang/String");
else
staticAssertClassNotRegistered();
}
template<typename T>
static constexpr bool isPrimitiveType()
{
return typeSignature<T>().size() == 2;
}
template<typename T>
static constexpr bool isObjectType()
{
if constexpr(std::is_convertible<T, jobject>::value) {
return true;
} else {
constexpr auto signature = typeSignature<T>();
return (signature.startsWith('L') || signature.startsWith('['))
&& signature.endsWith(';');
}
}
template<typename T>
static constexpr void assertPrimitiveType()
{
static_assert(isPrimitiveType<T>(), "Type needs to be a primitive JNI type!");
}
template<typename T>
static constexpr void assertObjectType()
{
static_assert(isObjectType<T>(),
"Type needs to be a JNI object type (convertible to jobject, or with "
"an object type signature registered)!");
}
template<typename T>
static constexpr void assertType()
{
static_assert(isPrimitiveType<T>() || isObjectType<T>(),
"Type needs to be a JNI type!");
}
template<typename R, typename ...Args>
static constexpr auto methodSignature()
{
return (String("(") +
... + typeSignature<std::decay_t<Args>>())
+ String(")")
+ typeSignature<R>();
}
template<typename T>
static constexpr auto fieldSignature()
{
return QtJniTypes::typeSignature<T>();
}
template<typename ...Args>
static constexpr auto constructorSignature()
{
return methodSignature<void, Args...>();
}
template<typename Ret, typename ...Args>
static constexpr auto nativeMethodSignature(Ret (*)(JNIEnv *, jobject, Args...))
{
return methodSignature<Ret, Args...>();
}
template<typename Ret, typename ...Args>
static constexpr auto nativeMethodSignature(Ret (*)(JNIEnv *, jclass, Args...))
{
return methodSignature<Ret, Args...>();
}
// A generic thin wrapper around jobject, convertible to jobject.
// We need this as a baseclass so that QJniObject can be implicitly
// constructed from the various subclasses - we can't provide an
// operator QJniObject() here as the class is not declared.
struct Object
{
jobject _object;
constexpr operator jobject() const { return _object; }
};
} // namespace QtJniTypes
#define Q_DECLARE_JNI_TYPE_HELPER(Type) \
namespace QtJniTypes { \
struct Type : Object \
{ \
constexpr Type(jobject o) noexcept : Object{o} {} \
}; \
} \
#define Q_DECLARE_JNI_TYPE(Type, Signature) \
Q_DECLARE_JNI_TYPE_HELPER(Type) \
template<> \
constexpr auto QtJniTypes::typeSignature<QtJniTypes::Type>() \
{ \
static_assert((Signature[0] == 'L' || Signature[0] == '[') \
&& Signature[sizeof(Signature) - 2] == ';', \
"Type signature needs to start with 'L' or '['" \
" and end with ';'"); \
return QtJniTypes::String(Signature); \
} \
#define Q_DECLARE_JNI_CLASS(Type, Signature) \
Q_DECLARE_JNI_TYPE_HELPER(Type) \
template<> \
constexpr auto QtJniTypes::className<QtJniTypes::Type>() \
{ \
return QtJniTypes::String(Signature); \
} \
template<> \
constexpr auto QtJniTypes::typeSignature<QtJniTypes::Type>() \
{ \
return QtJniTypes::String("L") \
+ QtJniTypes::String(Signature) \
+ QtJniTypes::String(";"); \
} \
#define Q_DECLARE_JNI_NATIVE_METHOD(...) \
QT_OVERLOADED_MACRO(QT_DECLARE_JNI_NATIVE_METHOD, __VA_ARGS__) \
#define QT_DECLARE_JNI_NATIVE_METHOD_2(Method, Name) \
namespace QtJniMethods { \
static constexpr auto Method##_signature = \
QtJniTypes::nativeMethodSignature(Method); \
static const JNINativeMethod Method##_method = { \
#Name, Method##_signature.data(), \
reinterpret_cast<void *>(Method) \
}; \
} \
#define QT_DECLARE_JNI_NATIVE_METHOD_1(Method) \
QT_DECLARE_JNI_NATIVE_METHOD_2(Method, Method) \
#define Q_JNI_NATIVE_METHOD(Method) QtJniMethods::Method##_method
#define Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(...) \
QT_OVERLOADED_MACRO(QT_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE, __VA_ARGS__) \
#define QT_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE_2(Method, Name) \
static inline constexpr auto Method##_signature = QtJniTypes::nativeMethodSignature(Method); \
static inline const JNINativeMethod Method##_method = { \
#Name, Method##_signature.data(), reinterpret_cast<void *>(Method) \
};
#define QT_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE_1(Method) \
QT_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE_2(Method, Method) \
#define Q_JNI_NATIVE_SCOPED_METHOD(Method, Scope) Scope::Method##_method
QT_END_NAMESPACE
#endif
#endif // QJNITYPES_H

View File

@@ -1,103 +0,0 @@
// 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 QT_WINDOWS_H
#define QT_WINDOWS_H
#if 0
#pragma qt_sync_skip_header_check
#pragma qt_sync_stop_processing
#endif
#ifndef WINVER
# define WINVER 0x0A00 // _WIN32_WINNT_WIN10
#endif
#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0A00
#endif
#ifndef _WIN32_IE
# define _WIN32_IE 0x0A00
#endif
#ifndef NTDDI_VERSION
# define NTDDI_VERSION 0x0A00000B // NTDDI_WIN10_CO
#endif
#ifndef NOMINMAX
# define NOMINMAX
#endif
#include <windows.h>
// already defined when compiled with WINVER >= 0x0500
#ifndef SPI_SETMENUANIMATION
#define SPI_SETMENUANIMATION 0x1003
#endif
#ifndef SPI_SETMENUFADE
#define SPI_SETMENUFADE 0x1013
#endif
#ifndef SPI_SETCOMBOBOXANIMATION
#define SPI_SETCOMBOBOXANIMATION 0x1005
#endif
#ifndef SPI_SETTOOLTIPANIMATION
#define SPI_SETTOOLTIPANIMATION 0x1017
#endif
#ifndef SPI_SETTOOLTIPFADE
#define SPI_SETTOOLTIPFADE 0x1019
#endif
#ifndef SPI_SETUIEFFECTS
#define SPI_SETUIEFFECTS 0x103F
#endif
#ifndef SPI_GETMENUANIMATION
#define SPI_GETMENUANIMATION 0x1002
#endif
#ifndef SPI_GETMENUFADE
#define SPI_GETMENUFADE 0x1012
#endif
#ifndef SPI_GETCOMBOBOXANIMATION
#define SPI_GETCOMBOBOXANIMATION 0x1004
#endif
#ifndef SPI_GETTOOLTIPANIMATION
#define SPI_GETTOOLTIPANIMATION 0x1016
#endif
#ifndef SPI_GETTOOLTIPFADE
#define SPI_GETTOOLTIPFADE 0x1018
#endif
#ifndef SPI_GETUIEFFECTS
#define SPI_GETUIEFFECTS 0x103E
#endif
#ifndef SPI_GETKEYBOARDCUES
#define SPI_GETKEYBOARDCUES 0x100A
#endif
#ifndef SPI_GETGRADIENTCAPTIONS
#define SPI_GETGRADIENTCAPTIONS 0x1008
#endif
#ifndef IDC_HAND
#define IDC_HAND MAKEINTRESOURCE(32649)
#endif
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A
#endif
#ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x020E
#endif
#ifndef ETO_PDY
#define ETO_PDY 0x2000
#endif
#ifndef COLOR_GRADIENTACTIVECAPTION
#define COLOR_GRADIENTACTIVECAPTION 27
#endif
#ifndef COLOR_GRADIENTINACTIVECAPTION
#define COLOR_GRADIENTINACTIVECAPTION 28
#endif
// already defined when compiled with WINVER >= 0x0600
#ifndef SPI_GETFLATMENU
#define SPI_GETFLATMENU 0x1022
#endif
#ifndef CS_DROPSHADOW
#define CS_DROPSHADOW 0x00020000
#endif
#ifndef CLEARTYPE_QUALITY
#define CLEARTYPE_QUALITY 5
#endif
#endif // QT_WINDOWS_H

View File

@@ -1,33 +0,0 @@
// 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 QDEVICEDISCOVERY_DUMMY_H
#define QDEVICEDISCOVERY_DUMMY_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 "qdevicediscovery_p.h"
QT_BEGIN_NAMESPACE
class QDeviceDiscoveryDummy : public QDeviceDiscovery
{
Q_OBJECT
public:
QDeviceDiscoveryDummy(QDeviceTypes types, QObject *parent = nullptr);
QStringList scanConnectedDevices() override;
};
QT_END_NAMESPACE
#endif // QDEVICEDISCOVERY_DUMMY_H

View File

@@ -1,36 +0,0 @@
// 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 QDEVICEDISCOVERY_STATIC_H
#define QDEVICEDISCOVERY_STATIC_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 "qdevicediscovery_p.h"
QT_BEGIN_NAMESPACE
class QDeviceDiscoveryStatic : public QDeviceDiscovery
{
Q_OBJECT
public:
QDeviceDiscoveryStatic(QDeviceTypes types, QObject *parent = nullptr);
QStringList scanConnectedDevices() override;
private:
bool checkDeviceType(const QString &device);
};
QT_END_NAMESPACE
#endif // QDEVICEDISCOVERY_STATIC_H

View File

@@ -1,192 +0,0 @@
// 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 ATSPIADAPTOR_H
#define ATSPIADAPTOR_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 <atspi/atspi-constants.h>
#include <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qsharedpointer.h>
#include <QtDBus/qdbusvirtualobject.h>
#include <QtGui/qaccessible.h>
#include "dbusconnection_p.h"
#include "qspi_struct_marshallers_p.h"
QT_REQUIRE_CONFIG(accessibility);
QT_BEGIN_NAMESPACE
class QAccessibleInterface;
class QSpiAccessibleInterface;
class QSpiApplicationAdaptor;
class AtSpiAdaptor :public QDBusVirtualObject
{
Q_OBJECT
public:
explicit AtSpiAdaptor(DBusConnection *connection, QObject *parent = nullptr);
~AtSpiAdaptor();
void registerApplication();
QString introspect(const QString &path) const override;
bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) override;
void notify(QAccessibleEvent *event);
void init();
void checkInitializedAndEnabled();
public Q_SLOTS:
void eventListenerRegistered(const QString &bus, const QString &path);
void eventListenerDeregistered(const QString &bus, const QString &path);
void windowActivated(QObject* window, bool active);
private:
void updateEventListeners();
void setBitFlag(const QString &flag);
// sending messages
QVariantList packDBusSignalArguments(const QString &type, int data1, int data2, const QVariant &variantData) const;
bool sendDBusSignal(const QString &path, const QString &interface, const QString &name, const QVariantList &arguments) const;
QVariant variantForPath(const QString &path) const;
void sendFocusChanged(QAccessibleInterface *interface) const;
void notifyAboutCreation(QAccessibleInterface *interface) const;
void notifyAboutDestruction(QAccessibleInterface *interface) const;
void childrenChanged(QAccessibleInterface *interface) const;
// handlers for the different accessible interfaces
bool applicationInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
bool accessibleInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
bool componentInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
bool actionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
bool textInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
bool editableTextInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
bool valueInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
bool tableInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
void sendReply(const QDBusConnection &connection, const QDBusMessage &message, const QVariant &argument) const;
QAccessibleInterface *interfaceFromPath(const QString& dbusPath) const;
QString pathForInterface(QAccessibleInterface *interface) const;
QString pathForObject(QObject *object) const;
void notifyStateChange(QAccessibleInterface *interface, const QString& state, int value);
// accessible helper functions
AtspiRole getRole(QAccessibleInterface *interface) const;
QSpiRelationArray relationSet(QAccessibleInterface *interface, const QDBusConnection &connection) const;
QStringList accessibleInterfaces(QAccessibleInterface *interface) const;
// component helper functions
static QRect getExtents(QAccessibleInterface *interface, uint coordType);
static QRect translateRectToWindowCoordinates(QAccessibleInterface *interface, const QRect &rect);
// action helper functions
QSpiActionArray getActions(QAccessibleInterface *interface) const;
// text helper functions
QVariantList getAttributes(QAccessibleInterface *, int offset, bool includeDefaults) const;
QString getAttributeValue(QAccessibleInterface *, int offset, const QString &attributeName) const;
QList<QVariant> getCharacterExtents(QAccessibleInterface *, int offset, uint coordType) const;
QList<QVariant> getRangeExtents(QAccessibleInterface *, int startOffset, int endOffset, uint coordType) const;
QAccessible::TextBoundaryType qAccessibleBoundaryType(int atspiTextBoundaryType) const;
static bool inheritsQAction(QObject *object);
// private vars
QSpiObjectReference accessibilityRegistry;
DBusConnection *m_dbus;
QSpiApplicationAdaptor *m_applicationAdaptor;
/// Assigned from the accessibility registry.
int m_applicationId;
// Bit fields - which updates to send
// AT-SPI has some events that we do not care about:
// document
// document-load-complete
// document-load-stopped
// document-reload
uint sendFocus : 1;
// mouse abs/rel/button
// all of object
uint sendObject : 1;
uint sendObject_active_descendant_changed : 1;
uint sendObject_attributes_changed : 1;
uint sendObject_bounds_changed : 1;
uint sendObject_children_changed : 1;
// uint sendObject_children_changed_add : 1;
// uint sendObject_children_changed_remove : 1;
uint sendObject_column_deleted : 1;
uint sendObject_column_inserted : 1;
uint sendObject_column_reordered : 1;
uint sendObject_link_selected : 1;
uint sendObject_model_changed : 1;
uint sendObject_property_change : 1;
uint sendObject_property_change_accessible_description : 1;
uint sendObject_property_change_accessible_name : 1;
uint sendObject_property_change_accessible_parent : 1;
uint sendObject_property_change_accessible_role : 1;
uint sendObject_property_change_accessible_table_caption : 1;
uint sendObject_property_change_accessible_table_column_description : 1;
uint sendObject_property_change_accessible_table_column_header : 1;
uint sendObject_property_change_accessible_table_row_description : 1;
uint sendObject_property_change_accessible_table_row_header : 1;
uint sendObject_property_change_accessible_table_summary : 1;
uint sendObject_property_change_accessible_value : 1;
uint sendObject_row_deleted : 1;
uint sendObject_row_inserted : 1;
uint sendObject_row_reordered : 1;
uint sendObject_selection_changed : 1;
uint sendObject_state_changed : 1;
uint sendObject_text_attributes_changed : 1;
uint sendObject_text_bounds_changed : 1;
uint sendObject_text_caret_moved : 1;
uint sendObject_text_changed : 1;
// uint sendObject_text_changed_delete : 1;
// uint sendObject_text_changed_insert : 1;
uint sendObject_text_selection_changed : 1;
uint sendObject_value_changed : 1;
uint sendObject_visible_data_changed : 1;
// we don't implement terminal
// terminal-application_changed/charwidth_changed/columncount_changed/line_changed/linecount_changed
uint sendWindow : 1;
uint sendWindow_activate : 1;
uint sendWindow_close: 1;
uint sendWindow_create : 1;
uint sendWindow_deactivate : 1;
// uint sendWindow_desktop_create : 1;
// uint sendWindow_desktop_destroy : 1;
uint sendWindow_lower : 1;
uint sendWindow_maximize : 1;
uint sendWindow_minimize : 1;
uint sendWindow_move : 1;
uint sendWindow_raise : 1;
uint sendWindow_reparent : 1;
uint sendWindow_resize : 1;
uint sendWindow_restore : 1;
uint sendWindow_restyle : 1;
uint sendWindow_shade : 1;
uint sendWindow_unshade : 1;
};
QT_END_NAMESPACE
#endif

View File

@@ -1,192 +0,0 @@
// Copyright (C) 2021 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 CS_TDR_P_H
#define CS_TDR_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/private/qglobal_p.h>
#ifdef Q_OS_WIN
#include <qt_windows.h>
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
// Buffer Definitions:
//
// cbuffer ConstantBuffer
// {
//
// uint zero; // Offset: 0 Size: 4
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim HLSL Bind Count
// ------------------------------ ---------- ------- ----------- -------------- ------
// uav UAV uint buf u0 1
// ConstantBuffer cbuffer NA NA cb0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Input
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// no Output
cs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer CB0[1], immediateIndexed
dcl_uav_typed_buffer (uint,uint,uint,uint) u0
dcl_input vThreadID.x
dcl_thread_group 256, 1, 1
loop
breakc_nz cb0[0].x
store_uav_typed u0.xyzw, vThreadID.xxxx, cb0[0].xxxx
endloop
ret
// Approximately 5 instruction slots used
#endif
inline constexpr BYTE g_killDeviceByTimingOut[] =
{
68, 88, 66, 67, 217, 62,
220, 38, 136, 51, 86, 245,
161, 96, 18, 35, 141, 17,
26, 13, 1, 0, 0, 0,
164, 2, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0,
100, 1, 0, 0, 116, 1,
0, 0, 132, 1, 0, 0,
8, 2, 0, 0, 82, 68,
69, 70, 40, 1, 0, 0,
1, 0, 0, 0, 144, 0,
0, 0, 2, 0, 0, 0,
60, 0, 0, 0, 0, 5,
83, 67, 0, 1, 0, 0,
0, 1, 0, 0, 82, 68,
49, 49, 60, 0, 0, 0,
24, 0, 0, 0, 32, 0,
0, 0, 40, 0, 0, 0,
36, 0, 0, 0, 12, 0,
0, 0, 0, 0, 0, 0,
124, 0, 0, 0, 4, 0,
0, 0, 4, 0, 0, 0,
1, 0, 0, 0, 255, 255,
255, 255, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 128, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 117, 97,
118, 0, 67, 111, 110, 115,
116, 97, 110, 116, 66, 117,
102, 102, 101, 114, 0, 171,
128, 0, 0, 0, 1, 0,
0, 0, 168, 0, 0, 0,
16, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
208, 0, 0, 0, 0, 0,
0, 0, 4, 0, 0, 0,
2, 0, 0, 0, 220, 0,
0, 0, 0, 0, 0, 0,
255, 255, 255, 255, 0, 0,
0, 0, 255, 255, 255, 255,
0, 0, 0, 0, 122, 101,
114, 111, 0, 100, 119, 111,
114, 100, 0, 171, 0, 0,
19, 0, 1, 0, 1, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
213, 0, 0, 0, 77, 105,
99, 114, 111, 115, 111, 102,
116, 32, 40, 82, 41, 32,
72, 76, 83, 76, 32, 83,
104, 97, 100, 101, 114, 32,
67, 111, 109, 112, 105, 108,
101, 114, 32, 49, 48, 46,
49, 0, 73, 83, 71, 78,
8, 0, 0, 0, 0, 0,
0, 0, 8, 0, 0, 0,
79, 83, 71, 78, 8, 0,
0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 83, 72,
69, 88, 124, 0, 0, 0,
80, 0, 5, 0, 31, 0,
0, 0, 106, 8, 0, 1,
89, 0, 0, 4, 70, 142,
32, 0, 0, 0, 0, 0,
1, 0, 0, 0, 156, 8,
0, 4, 0, 224, 17, 0,
0, 0, 0, 0, 68, 68,
0, 0, 95, 0, 0, 2,
18, 0, 2, 0, 155, 0,
0, 4, 0, 1, 0, 0,
1, 0, 0, 0, 1, 0,
0, 0, 48, 0, 0, 1,
3, 0, 4, 4, 10, 128,
32, 0, 0, 0, 0, 0,
0, 0, 0, 0, 164, 0,
0, 7, 242, 224, 17, 0,
0, 0, 0, 0, 6, 0,
2, 0, 6, 128, 32, 0,
0, 0, 0, 0, 0, 0,
0, 0, 22, 0, 0, 1,
62, 0, 0, 1, 83, 84,
65, 84, 148, 0, 0, 0,
5, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 2, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
1, 0, 0, 0
};
#endif // Q_OS_WIN
#endif // CS_TDR_P_H

View File

@@ -1,61 +0,0 @@
// Copyright (C) 2020 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 DBUSCONNECTION_H
#define DBUSCONNECTION_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/QObject>
#include <QtCore/QString>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusVariant>
#include <QtCore/private/qglobal_p.h>
Q_MOC_INCLUDE(<QtDBus/QDBusError>)
QT_BEGIN_NAMESPACE
class QDBusServiceWatcher;
class DBusConnection : public QObject
{
Q_OBJECT
public:
DBusConnection(QObject *parent = nullptr);
QDBusConnection connection() const;
bool isEnabled() const { return m_enabled; }
Q_SIGNALS:
// Emitted when the global accessibility status changes to enabled
void enabledChanged(bool enabled);
private Q_SLOTS:
QString getAddressFromXCB();
void serviceRegistered();
void serviceUnregistered();
void connectA11yBus(const QString &address);
void dbusError(const QDBusError &error);
private:
QString getAccessibilityBusAddress() const;
QDBusServiceWatcher *dbusWatcher;
QDBusConnection m_a11yConnection;
bool m_enabled;
};
QT_END_NAMESPACE
#endif // DBUSCONNECTION_H

View File

@@ -1,78 +0,0 @@
// Copyright (C) 2021 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 QAPPLEKEYMAPPER_H
#define QAPPLEKEYMAPPER_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.
//
#ifdef Q_OS_MACOS
#include <Carbon/Carbon.h>
#endif
#include <QtCore/QList>
#include <QtCore/QHash>
#include <QtGui/QKeyEvent>
#include <QtCore/private/qcore_mac_p.h>
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QAppleKeyMapper
{
public:
static Qt::KeyboardModifiers queryKeyboardModifiers();
QList<int> possibleKeys(const QKeyEvent *event) const;
static Qt::Key fromNSString(Qt::KeyboardModifiers qtMods, NSString *characters,
NSString *charactersIgnoringModifiers, QString &text);
#ifdef Q_OS_MACOS
static Qt::KeyboardModifiers fromCocoaModifiers(NSEventModifierFlags cocoaModifiers);
static NSEventModifierFlags toCocoaModifiers(Qt::KeyboardModifiers);
static QChar toCocoaKey(Qt::Key key);
static Qt::Key fromCocoaKey(QChar keyCode);
#else
static Qt::Key fromUIKitKey(NSString *keyCode);
static Qt::KeyboardModifiers fromUIKitModifiers(ulong uikitModifiers);
static ulong toUIKitModifiers(Qt::KeyboardModifiers);
#endif
private:
#ifdef Q_OS_MACOS
static constexpr int kNumModifierCombinations = 16;
struct KeyMap : std::array<char32_t, kNumModifierCombinations>
{
// Initialize first element to a sentinel that allows us
// to distinguish an uninitialized map from an initialized.
// Using 0 would not allow us to map U+0000 (NUL), however
// unlikely that is.
KeyMap() : std::array<char32_t, 16>{Qt::Key_unknown} {}
};
bool updateKeyboard();
using VirtualKeyCode = unsigned short;
const KeyMap &keyMapForKey(VirtualKeyCode virtualKey) const;
QCFType<TISInputSourceRef> m_currentInputSource = nullptr;
enum { NullMode, UnicodeMode, OtherMode } m_keyboardMode = NullMode;
const UCKeyboardLayout *m_keyboardLayoutFormat = nullptr;
KeyboardLayoutKind m_keyboardKind = kKLKCHRuchrKind;
mutable QHash<VirtualKeyCode, KeyMap> m_keyMap;
#endif
};
QT_END_NAMESPACE
#endif

View File

@@ -1,86 +0,0 @@
// Copyright (C) 2017 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 QCOREGRAPHICS_P_H
#define QCOREGRAPHICS_P_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/private/qcore_mac_p.h>
#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/qregion.h>
#include <QtGui/qpalette.h>
#include <CoreGraphics/CoreGraphics.h>
#if defined(__OBJC__) && defined(Q_OS_MACOS)
#include <AppKit/AppKit.h>
#define HAVE_APPKIT
#endif
QT_BEGIN_NAMESPACE
Q_GUI_EXPORT CGBitmapInfo qt_mac_bitmapInfoForImage(const QImage &image);
#ifdef HAVE_APPKIT
Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size);
QT_END_NAMESPACE
// @compatibility_alias doesn't work with categories or their methods
#define imageFromQImage QT_MANGLE_NAMESPACE(imageFromQImage)
#define imageFromQIcon QT_MANGLE_NAMESPACE(imageFromQIcon)
@interface NSImage (QtExtras)
+ (instancetype)imageFromQImage:(const QT_PREPEND_NAMESPACE(QImage) &)image;
+ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon;
+ (instancetype)imageFromQIcon:(const QT_PREPEND_NAMESPACE(QIcon) &)icon withSize:(int)size;
@end
QT_BEGIN_NAMESPACE
#endif
Q_GUI_EXPORT CGImageRef qt_mac_toCGImage(const QImage &qImage);
Q_GUI_EXPORT CGImageRef qt_mac_toCGImageMask(const QImage &qImage);
Q_GUI_EXPORT QImage qt_mac_toQImage(CGImageRef image);
Q_GUI_EXPORT void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage);
Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
#ifdef HAVE_APPKIT
Q_GUI_EXPORT QColor qt_mac_toQColor(const NSColor *color);
Q_GUI_EXPORT QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal);
#endif
Q_GUI_EXPORT QColor qt_mac_toQColor(CGColorRef color);
Q_GUI_EXPORT QBrush qt_mac_toQBrush(CGColorRef color);
class Q_GUI_EXPORT QMacCGContext
{
public:
QMacCGContext() = default;
QMacCGContext(QPaintDevice *pdev);
QMacCGContext(QPainter *p);
operator CGContextRef() { return context; }
private:
void initialize(QPaintDevice *paintDevice);
void initialize(const QImage *, QPainter *painter = nullptr);
QCFType<CGContextRef> context;
};
QT_END_NAMESPACE
#undef HAVE_APPKIT
#endif // QCOREGRAPHICS_P_H

View File

@@ -1,83 +0,0 @@
// 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 QCORETEXTFONTDATABASE_H
#define QCORETEXTFONTDATABASE_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 <qglobal.h>
#include <qpa/qplatformfontdatabase.h>
#include <qpa/qplatformtheme.h>
#include <private/qcore_mac_p.h>
Q_FORWARD_DECLARE_CF_TYPE(CTFontDescriptor);
Q_FORWARD_DECLARE_CF_TYPE(CTFont);
QT_DECL_METATYPE_EXTERN_TAGGED(QCFType<CGFontRef>, QCFType_CGFontRef, Q_GUI_EXPORT)
QT_DECL_METATYPE_EXTERN_TAGGED(QCFType<CFURLRef>, QCFType_CFURLRef, Q_GUI_EXPORT)
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QCoreTextFontDatabase : public QPlatformFontDatabase
{
public:
QCoreTextFontDatabase();
~QCoreTextFontDatabase();
void populateFontDatabase() override;
bool populateFamilyAliases(const QString &missingFamily) override;
void populateFamily(const QString &familyName) override;
void invalidate() override;
QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override;
QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont = nullptr) override;
void releaseHandle(void *handle) override;
bool isPrivateFontFamily(const QString &family) const override;
QFont defaultFont() const override;
bool fontsAlwaysScalable() const override;
QList<int> standardSizes() const override;
// For iOS and macOS platform themes
QFont *themeFont(QPlatformTheme::Font) const;
private:
void populateThemeFonts();
void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString(), QFontDatabasePrivate::ApplicationFont *applicationFont = nullptr);
static CFArrayRef fallbacksForFamily(const QString &family);
QHash<QPlatformTheme::Font, QFont *> m_themeFonts;
QHash<QString, QList<QCFType<CTFontDescriptorRef>>> m_systemFontDescriptors;
QHash<QChar::Script, QString> m_hardcodedFallbackFonts;
mutable QSet<QString> m_privateFamilies;
bool m_hasPopulatedAliases;
#if defined(Q_OS_MACOS)
QMacNotificationObserver m_fontSetObserver;
#endif
};
// Split out into separate template class so that the compiler doesn't have
// to generate code for each override in QCoreTextFontDatabase for each T.
template <class T>
class Q_GUI_EXPORT QCoreTextFontDatabaseEngineFactory : public QCoreTextFontDatabase
{
public:
QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
};
QT_END_NAMESPACE
#endif // QCORETEXTFONTDATABASE_H

View File

@@ -1,147 +0,0 @@
// 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
/*
This file was originally created by qdbusxml2cpp version 0.8
Command line was:
qdbusxml2cpp -a dbusmenu ../../3rdparty/dbus-ifaces/dbus-menu.xml
However it is maintained manually.
It is also not part of the public API. This header file may change from
version to version without notice, or even be removed.
*/
#ifndef DBUSMENUADAPTOR_H
#define DBUSMENUADAPTOR_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 <QObject>
#include <QDBusAbstractAdaptor>
#include <private/qdbusmenutypes_p.h>
QT_BEGIN_NAMESPACE
/*
* Adaptor class for interface com.canonical.dbusmenu
*/
class QDBusMenuAdaptor: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "com.canonical.dbusmenu")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"com.canonical.dbusmenu\">\n"
" <property access=\"read\" type=\"u\" name=\"Version\">\n"
" </property>\n"
" <property access=\"read\" type=\"s\" name=\"TextDirection\">\n"
" </property>\n"
" <property access=\"read\" type=\"s\" name=\"Status\">\n"
" </property>\n"
" <property access=\"read\" type=\"as\" name=\"IconThemePath\">\n"
" </property>\n"
" <method name=\"GetLayout\">\n"
" <annotation value=\"QDBusMenuLayoutItem\" name=\"org.qtproject.QtDBus.QtTypeName.Out1\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"parentId\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"recursionDepth\"/>\n"
" <arg direction=\"in\" type=\"as\" name=\"propertyNames\"/>\n"
" <arg direction=\"out\" type=\"u\" name=\"revision\"/>\n"
" <arg direction=\"out\" type=\"(ia{sv}av)\" name=\"layout\"/>\n"
" </method>\n"
" <method name=\"GetGroupProperties\">\n"
" <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
" <annotation value=\"QDBusMenuItemList\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
" <arg direction=\"in\" type=\"ai\" name=\"ids\"/>\n"
" <arg direction=\"in\" type=\"as\" name=\"propertyNames\"/>\n"
" <arg direction=\"out\" type=\"a(ia{sv})\" name=\"properties\"/>\n"
" </method>\n"
" <method name=\"GetProperty\">\n"
" <arg direction=\"in\" type=\"i\" name=\"id\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"name\"/>\n"
" <arg direction=\"out\" type=\"v\" name=\"value\"/>\n"
" </method>\n"
" <method name=\"Event\">\n"
" <arg direction=\"in\" type=\"i\" name=\"id\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"eventId\"/>\n"
" <arg direction=\"in\" type=\"v\" name=\"data\"/>\n"
" <arg direction=\"in\" type=\"u\" name=\"timestamp\"/>\n"
" </method>\n"
" <method name=\"EventGroup\">\n"
" <annotation value=\"QList&lt;QDBusMenuEvent&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
" <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
" <arg direction=\"in\" type=\"a(isvu)\" name=\"events\"/>\n"
" <arg direction=\"out\" type=\"ai\" name=\"idErrors\"/>\n"
" </method>\n"
" <method name=\"AboutToShow\">\n"
" <arg direction=\"in\" type=\"i\" name=\"id\"/>\n"
" <arg direction=\"out\" type=\"b\" name=\"needUpdate\"/>\n"
" </method>\n"
" <method name=\"AboutToShowGroup\">\n"
" <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
" <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
" <annotation value=\"QList&lt;int&gt;\" name=\"org.qtproject.QtDBus.QtTypeName.Out1\"/>\n"
" <arg direction=\"in\" type=\"ai\" name=\"ids\"/>\n"
" <arg direction=\"out\" type=\"ai\" name=\"updatesNeeded\"/>\n"
" <arg direction=\"out\" type=\"ai\" name=\"idErrors\"/>\n"
" </method>\n"
" <signal name=\"ItemsPropertiesUpdated\">\n"
" <annotation value=\"QDBusMenuItemList\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
" <annotation value=\"QDBusMenuItemKeysList\" name=\"org.qtproject.QtDBus.QtTypeName.In1\"/>\n"
" <arg direction=\"out\" type=\"a(ia{sv})\" name=\"updatedProps\"/>\n"
" <arg direction=\"out\" type=\"a(ias)\" name=\"removedProps\"/>\n"
" </signal>\n"
" <signal name=\"LayoutUpdated\">\n"
" <arg direction=\"out\" type=\"u\" name=\"revision\"/>\n"
" <arg direction=\"out\" type=\"i\" name=\"parent\"/>\n"
" </signal>\n"
" <signal name=\"ItemActivationRequested\">\n"
" <arg direction=\"out\" type=\"i\" name=\"id\"/>\n"
" <arg direction=\"out\" type=\"u\" name=\"timestamp\"/>\n"
" </signal>\n"
" </interface>\n"
"")
public:
QDBusMenuAdaptor(QDBusPlatformMenu *topLevelMenu);
virtual ~QDBusMenuAdaptor();
public: // PROPERTIES
Q_PROPERTY(QString Status READ status)
QString status() const;
Q_PROPERTY(QString TextDirection READ textDirection)
QString textDirection() const;
Q_PROPERTY(uint Version READ version)
uint version() const;
public Q_SLOTS: // METHODS
bool AboutToShow(int id);
QList<int> AboutToShowGroup(const QList<int> &ids, QList<int> &idErrors);
void Event(int id, const QString &eventId, const QDBusVariant &data, uint timestamp);
QList<int> EventGroup(const QDBusMenuEventList &events);
QDBusMenuItemList GetGroupProperties(const QList<int> &ids, const QStringList &propertyNames);
uint GetLayout(int parentId, int recursionDepth, const QStringList &propertyNames, QDBusMenuLayoutItem &layout);
QDBusVariant GetProperty(int id, const QString &name);
Q_SIGNALS: // SIGNALS
void ItemActivationRequested(int id, uint timestamp);
void ItemsPropertiesUpdated(const QDBusMenuItemList &updatedProps, const QDBusMenuItemKeysList &removedProps);
void LayoutUpdated(uint revision, int parent);
private:
QDBusPlatformMenu *m_topLevelMenu;
};
QT_END_NAMESPACE
#endif // DBUSMENUADAPTOR_H

View File

@@ -1,56 +0,0 @@
// Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDBUSMENUBAR_P_H
#define QDBUSMENUBAR_P_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 <private/qdbusplatformmenu_p.h>
#include <private/qdbusmenuadaptor_p.h>
#include <QtCore/QHash>
#include <QtCore/QString>
#include <QtGui/QWindow>
QT_BEGIN_NAMESPACE
class QDBusMenuBar : public QPlatformMenuBar
{
Q_OBJECT
public:
QDBusMenuBar();
virtual ~QDBusMenuBar();
void insertMenu(QPlatformMenu *menu, QPlatformMenu *before) override;
void removeMenu(QPlatformMenu *menu) override;
void syncMenu(QPlatformMenu *menu) override;
void handleReparent(QWindow *newParentWindow) override;
QPlatformMenu *menuForTag(quintptr tag) const override;
QPlatformMenu *createMenu() const override;
private:
QDBusPlatformMenu *m_menu;
QDBusMenuAdaptor *m_menuAdaptor;
QHash<quintptr, QDBusPlatformMenuItem *> m_menuItems;
uint m_windowId;
QString m_objectPath;
QDBusPlatformMenuItem *menuItemForMenu(QPlatformMenu *menu);
static void updateMenuItem(QDBusPlatformMenuItem *item, QPlatformMenu *menu);
void registerMenuBar();
void unregisterMenuBar();
};
QT_END_NAMESPACE
#endif // QDBUSMENUBAR_P_H

View File

@@ -1,68 +0,0 @@
// Copyright (C) 2020 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 QDBUSMENUCONNECTION_H
#define QDBUSMENUCONNECTION_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/QString>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusVariant>
#include <QtGui/qtgui-config.h>
#include <QtCore/private/qglobal_p.h>
Q_MOC_INCLUDE(<QtDBus/QDBusError>)
QT_BEGIN_NAMESPACE
class QDBusServiceWatcher;
#ifndef QT_NO_SYSTEMTRAYICON
class QDBusTrayIcon;
#endif // QT_NO_SYSTEMTRAYICON
class QDBusMenuConnection : public QObject
{
Q_OBJECT
public:
QDBusMenuConnection(QObject *parent = nullptr, const QString &serviceName = QString());
~QDBusMenuConnection();
QDBusConnection connection() const { return m_connection; }
QDBusServiceWatcher *dbusWatcher() const { return m_dbusWatcher; }
bool isStatusNotifierHostRegistered() const { return m_statusNotifierHostRegistered; }
#ifndef QT_NO_SYSTEMTRAYICON
bool registerTrayIconMenu(QDBusTrayIcon *item);
void unregisterTrayIconMenu(QDBusTrayIcon *item);
bool registerTrayIcon(QDBusTrayIcon *item);
bool registerTrayIconWithWatcher(QDBusTrayIcon *item);
void unregisterTrayIcon(QDBusTrayIcon *item);
#endif // QT_NO_SYSTEMTRAYICON
Q_SIGNALS:
#ifndef QT_NO_SYSTEMTRAYICON
void trayIconRegistered();
#endif // QT_NO_SYSTEMTRAYICON
private Q_SLOTS:
void dbusError(const QDBusError &error);
private:
QString m_serviceName;
QDBusConnection m_connection;
QDBusServiceWatcher *m_dbusWatcher;
bool m_statusNotifierHostRegistered;
};
QT_END_NAMESPACE
#endif // QDBUSMENUCONNECTION_H

View File

@@ -1,84 +0,0 @@
// Copyright (C) 2016 Dmitry Shachnev <mitya57@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/*
* This file was originally created by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -p qdbusmenuregistrarproxy ../../3rdparty/dbus-ifaces/com.canonical.AppMenu.Registrar.xml
*
* However it is maintained manually.
*/
#ifndef QDBUSMENUREGISTRARPROXY_P_H
#define QDBUSMENUREGISTRARPROXY_P_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/QObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QString>
#include <QtCore/QVariant>
#include <QtDBus/QDBusAbstractInterface>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusReply>
#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
/*
* Proxy class for interface com.canonical.AppMenu.Registrar
*/
class QDBusMenuRegistrarInterface : public QDBusAbstractInterface
{
Q_OBJECT
public:
static inline const char *staticInterfaceName()
{
return "com.canonical.AppMenu.Registrar";
}
public:
explicit QDBusMenuRegistrarInterface(const QString &service,
const QString &path,
const QDBusConnection &connection,
QObject *parent = nullptr);
~QDBusMenuRegistrarInterface();
public Q_SLOTS: // METHODS
QDBusPendingReply<QString, QDBusObjectPath> GetMenuForWindow(uint windowId)
{
return asyncCall(QStringLiteral("GetMenuForWindow"), windowId);
}
QDBusReply<QString> GetMenuForWindow(uint windowId, QDBusObjectPath &menuObjectPath)
{
QDBusMessage reply = call(QDBus::Block, QStringLiteral("GetMenuForWindow"), windowId);
QList<QVariant> arguments = reply.arguments();
if (reply.type() == QDBusMessage::ReplyMessage && arguments.size() == 2)
menuObjectPath = qdbus_cast<QDBusObjectPath>(arguments.at(1));
return reply;
}
QDBusPendingReply<> RegisterWindow(uint windowId, const QDBusObjectPath &menuObjectPath)
{
return asyncCall(QStringLiteral("RegisterWindow"), windowId, menuObjectPath);
}
QDBusPendingReply<> UnregisterWindow(uint windowId)
{
return asyncCall(QStringLiteral("UnregisterWindow"), windowId);
}
};
QT_END_NAMESPACE
#endif // QDBUSMENUREGISTRARPROXY_P_H

View File

@@ -1,120 +0,0 @@
// Copyright (C) 2020 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 QDBUSMENUTYPES_H
#define QDBUSMENUTYPES_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QObject>
#include <QString>
#include <QDBusArgument>
#include <QDBusConnection>
#include <QDBusObjectPath>
#include <QPixmap>
#include <private/qglobal_p.h>
QT_BEGIN_NAMESPACE
class QDBusPlatformMenu;
class QDBusPlatformMenuItem;
class QDBusMenuItem;
typedef QList<QDBusMenuItem> QDBusMenuItemList;
typedef QList<QStringList> QDBusMenuShortcut;
class QDBusMenuItem
{
public:
QDBusMenuItem() { }
QDBusMenuItem(const QDBusPlatformMenuItem *item);
static QDBusMenuItemList items(const QList<int> &ids, const QStringList &propertyNames);
static QString convertMnemonic(const QString &label);
#ifndef QT_NO_SHORTCUT
static QDBusMenuShortcut convertKeySequence(const QKeySequence &sequence);
#endif
static void registerDBusTypes();
int m_id;
QVariantMap m_properties;
};
Q_DECLARE_TYPEINFO(QDBusMenuItem, Q_RELOCATABLE_TYPE);
const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuItem &item);
const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuItem &item);
class QDBusMenuItemKeys
{
public:
int id;
QStringList properties;
};
Q_DECLARE_TYPEINFO(QDBusMenuItemKeys, Q_RELOCATABLE_TYPE);
const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuItemKeys &keys);
const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuItemKeys &keys);
typedef QList<QDBusMenuItemKeys> QDBusMenuItemKeysList;
class QDBusMenuLayoutItem
{
public:
uint populate(int id, int depth, const QStringList &propertyNames, const QDBusPlatformMenu *topLevelMenu);
void populate(const QDBusPlatformMenu *menu, int depth, const QStringList &propertyNames);
void populate(const QDBusPlatformMenuItem *item, int depth, const QStringList &propertyNames);
int m_id;
QVariantMap m_properties;
QList<QDBusMenuLayoutItem> m_children;
};
Q_DECLARE_TYPEINFO(QDBusMenuLayoutItem, Q_RELOCATABLE_TYPE);
const QDBusArgument &operator<<(QDBusArgument &arg, const QDBusMenuLayoutItem &);
const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuLayoutItem &item);
typedef QList<QDBusMenuLayoutItem> QDBusMenuLayoutItemList;
class QDBusMenuEvent
{
public:
int m_id;
QString m_eventId;
QDBusVariant m_data;
uint m_timestamp;
};
Q_DECLARE_TYPEINFO(QDBusMenuEvent, Q_RELOCATABLE_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;
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const QDBusMenuItem &item);
QDebug operator<<(QDebug d, const QDBusMenuLayoutItem &item);
#endif
QT_END_NAMESPACE
QT_DECL_METATYPE_EXTERN(QDBusMenuItem, Q_GUI_EXPORT)
QT_DECL_METATYPE_EXTERN(QDBusMenuItemList, Q_GUI_EXPORT)
QT_DECL_METATYPE_EXTERN(QDBusMenuItemKeys, Q_GUI_EXPORT)
QT_DECL_METATYPE_EXTERN(QDBusMenuItemKeysList, Q_GUI_EXPORT)
QT_DECL_METATYPE_EXTERN(QDBusMenuLayoutItem, Q_GUI_EXPORT)
QT_DECL_METATYPE_EXTERN(QDBusMenuLayoutItemList, Q_GUI_EXPORT)
QT_DECL_METATYPE_EXTERN(QDBusMenuEvent, Q_GUI_EXPORT)
QT_DECL_METATYPE_EXTERN(QDBusMenuEventList, Q_GUI_EXPORT)
QT_DECL_METATYPE_EXTERN(QDBusMenuShortcut, Q_GUI_EXPORT)
#endif

View File

@@ -1,155 +0,0 @@
// 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 QDBUSPLATFORMMENU_H
#define QDBUSPLATFORMMENU_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.
//
//
// W A R N I N G
// -------------
//
// This file is part of the DBus menu support and is not meant to be used
// in applications. Usage of this API may make your code
// source and binary incompatible with future versions of Qt.
//
#include <qpa/qplatformmenu.h>
#include <QLoggingCategory>
#include "qdbusmenutypes_p.h"
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(qLcMenu)
class QDBusPlatformMenu;
class QDBusPlatformMenuItem : public QPlatformMenuItem
{
Q_OBJECT
public:
QDBusPlatformMenuItem();
~QDBusPlatformMenuItem();
const QString text() const { return m_text; }
void setText(const QString &text) override;
QIcon icon() const { return m_icon; }
void setIcon(const QIcon &icon) override;
const QPlatformMenu *menu() const { return m_subMenu; }
void setMenu(QPlatformMenu *menu) override;
bool isEnabled() const { return m_isEnabled; }
void setEnabled(bool enabled) override;
bool isVisible() const { return m_isVisible; }
void setVisible(bool isVisible) override;
bool isSeparator() const { return m_isSeparator; }
void setIsSeparator(bool isSeparator) override;
void setFont(const QFont &font) override { Q_UNUSED(font); }
void setRole(MenuRole role) override;
bool isCheckable() const { return m_isCheckable; }
void setCheckable(bool checkable) override;
bool isChecked() const { return m_isChecked; }
void setChecked(bool isChecked) override;
bool hasExclusiveGroup() const { return m_hasExclusiveGroup; }
void setHasExclusiveGroup(bool hasExclusiveGroup) override;
#if QT_CONFIG(shortcut)
QKeySequence shortcut() const { return m_shortcut; }
void setShortcut(const QKeySequence& shortcut) override;
#endif
void setIconSize(int size) override { Q_UNUSED(size); }
void setNativeContents(WId item) override { Q_UNUSED(item); }
int dbusID() const { return m_dbusID; }
void trigger();
static QDBusPlatformMenuItem *byId(int id);
static QList<const QDBusPlatformMenuItem *> byIds(const QList<int> &ids);
private:
QString m_text;
QIcon m_icon;
QPlatformMenu *m_subMenu;
MenuRole m_role : 4;
bool m_isEnabled : 1;
bool m_isVisible : 1;
bool m_isSeparator : 1;
bool m_isCheckable : 1;
bool m_isChecked : 1;
bool m_hasExclusiveGroup : 1;
short /*unused*/ : 6;
short m_dbusID : 16;
#if QT_CONFIG(shortcut)
QKeySequence m_shortcut;
#endif
};
class QDBusPlatformMenu : public QPlatformMenu
{
Q_OBJECT
public:
QDBusPlatformMenu();
~QDBusPlatformMenu();
void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) override;
void removeMenuItem(QPlatformMenuItem *menuItem) override;
void syncSubMenu(const QDBusPlatformMenu *menu);
void syncMenuItem(QPlatformMenuItem *menuItem) override;
void syncSeparatorsCollapsible(bool enable) override { Q_UNUSED(enable); }
const QString text() const { return m_text; }
void setText(const QString &text) override;
QIcon icon() const { return m_icon; }
void setIcon(const QIcon &icon) override;
bool isEnabled() const override { return m_isEnabled; }
void setEnabled(bool enabled) override;
bool isVisible() const { return m_isVisible; }
void setVisible(bool visible) override;
void setMinimumWidth(int width) override { Q_UNUSED(width); }
void setFont(const QFont &font) override { Q_UNUSED(font); }
void setMenuType(MenuType type) override { Q_UNUSED(type); }
void setContainingMenuItem(QDBusPlatformMenuItem *item);
void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) override;
void dismiss() override { } // Closes this and all its related menu popups
QPlatformMenuItem *menuItemAt(int position) const override;
QPlatformMenuItem *menuItemForTag(quintptr tag) const override;
const QList<QDBusPlatformMenuItem *> items() const;
QPlatformMenuItem *createMenuItem() const override;
QPlatformMenu *createSubMenu() const override;
uint revision() const { return m_revision; }
void emitUpdated();
signals:
void updated(uint revision, int dbusId);
void propertiesUpdated(QDBusMenuItemList updatedProps, QDBusMenuItemKeysList removedProps);
void popupRequested(int id, uint timestamp);
private:
QString m_text;
QIcon m_icon;
bool m_isEnabled;
bool m_isVisible;
uint m_revision;
QHash<quintptr, QDBusPlatformMenuItem *> m_itemsByTag;
QList<QDBusPlatformMenuItem *> m_items;
QDBusPlatformMenuItem *m_containingMenuItem;
};
QT_END_NAMESPACE
#endif

View File

@@ -1,132 +0,0 @@
// 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 QDBUSTRAYICON_H
#define QDBUSTRAYICON_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 <QtGui/private/qtguiglobal_p.h>
QT_REQUIRE_CONFIG(systemtrayicon);
#include <QIcon>
#include <QTemporaryFile>
#include <QTimer>
#include "QtGui/qpa/qplatformsystemtrayicon.h"
#include "private/qdbusmenuconnection_p.h"
QT_BEGIN_NAMESPACE
class QStatusNotifierItemAdaptor;
class QDBusMenuAdaptor;
class QDBusPlatformMenu;
class QXdgNotificationInterface;
class QDBusTrayIcon: public QPlatformSystemTrayIcon
{
Q_OBJECT
Q_PROPERTY(QString category READ category NOTIFY categoryChanged)
Q_PROPERTY(QString status READ status NOTIFY statusChanged)
Q_PROPERTY(QString tooltip READ tooltip NOTIFY tooltipChanged)
Q_PROPERTY(QString iconName READ iconName NOTIFY iconChanged)
Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
Q_PROPERTY(bool isRequestingAttention READ isRequestingAttention NOTIFY attention)
Q_PROPERTY(QString attentionTitle READ attentionTitle NOTIFY attention)
Q_PROPERTY(QString attentionMessage READ attentionMessage NOTIFY attention)
Q_PROPERTY(QString attentionIconName READ attentionIconName NOTIFY attention)
Q_PROPERTY(QIcon attentionIcon READ attentionIcon NOTIFY attention)
Q_PROPERTY(QDBusPlatformMenu *menu READ menu NOTIFY menuChanged)
Q_MOC_INCLUDE(<private/qdbusplatformmenu_p.h>)
public:
QDBusTrayIcon();
virtual ~QDBusTrayIcon();
QDBusMenuConnection * dBusConnection();
void init() override;
void cleanup() override;
void updateIcon(const QIcon &icon) override;
void updateToolTip(const QString &tooltip) override;
void updateMenu(QPlatformMenu *menu) override;
QPlatformMenu *createMenu() const override;
void showMessage(const QString &title, const QString &msg,
const QIcon &icon, MessageIcon iconType, int msecs) override;
bool isSystemTrayAvailable() const override;
bool supportsMessages() const override { return true; }
QRect geometry() const override { return QRect(); }
QString category() const { return m_category; }
QString status() const { return m_status; }
QString tooltip() const { return m_tooltip; }
QString iconName() const { return m_iconName; }
const QIcon & icon() const { return m_icon; }
bool isRequestingAttention() const { return m_attentionTimer.isActive(); }
QString attentionTitle() const { return m_messageTitle; }
QString attentionMessage() const { return m_message; }
QString attentionIconName() const { return m_attentionIconName; }
const QIcon & attentionIcon() const { return m_attentionIcon; }
QString instanceId() const { return m_instanceId; }
QDBusPlatformMenu *menu() { return m_menu; }
signals:
void categoryChanged();
void statusChanged(QString arg);
void tooltipChanged();
void iconChanged();
void attention();
void menuChanged();
private Q_SLOTS:
void attentionTimerExpired();
void actionInvoked(uint id, const QString &action);
void notificationClosed(uint id, uint reason);
void watcherServiceRegistered(const QString &serviceName);
private:
void setStatus(const QString &status);
QTemporaryFile *tempIcon(const QIcon &icon);
private:
QDBusMenuConnection* m_dbusConnection;
QStatusNotifierItemAdaptor *m_adaptor;
QDBusMenuAdaptor *m_menuAdaptor;
QDBusPlatformMenu *m_menu;
QXdgNotificationInterface *m_notifier;
QString m_instanceId;
QString m_category;
QString m_defaultStatus;
QString m_status;
QString m_tooltip;
QString m_messageTitle;
QString m_message;
QIcon m_icon;
QTemporaryFile *m_tempIcon;
QString m_iconName;
QIcon m_attentionIcon;
QTemporaryFile *m_tempAttentionIcon;
QString m_attentionIconName;
QTimer m_attentionTimer;
bool m_registered;
};
QT_END_NAMESPACE
#endif // QDBUSTRAYICON_H

View File

@@ -1,73 +0,0 @@
// Copyright (C) 2009 Marco Martin <notmart@gmail.com>
// 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 QDBUSTRAYTYPES_P_H
#define QDBUSTRAYTYPES_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtGui/private/qtguiglobal_p.h>
QT_REQUIRE_CONFIG(systemtrayicon);
#include <QObject>
#include <QString>
#include <QDBusArgument>
#include <QDBusConnection>
#include <QDBusObjectPath>
#include <QPixmap>
QT_BEGIN_NAMESPACE
// Custom message type to send icons across D-Bus
struct QXdgDBusImageStruct
{
QXdgDBusImageStruct() { }
QXdgDBusImageStruct(int w, int h)
: width(w), height(h), data(width * height * 4, 0) { }
int width;
int height;
QByteArray data;
};
Q_DECLARE_TYPEINFO(QXdgDBusImageStruct, Q_RELOCATABLE_TYPE);
using QXdgDBusImageVector = QList<QXdgDBusImageStruct>;
QXdgDBusImageVector iconToQXdgDBusImageVector(const QIcon &icon);
// Custom message type to send tooltips across D-Bus
struct QXdgDBusToolTipStruct
{
QString icon;
QXdgDBusImageVector image;
QString title;
QString subTitle;
};
Q_DECLARE_TYPEINFO(QXdgDBusToolTipStruct, Q_RELOCATABLE_TYPE);
const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusImageStruct &icon);
const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusImageStruct &icon);
const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusImageVector &iconVector);
const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusImageVector &iconVector);
const QDBusArgument &operator<<(QDBusArgument &argument, const QXdgDBusToolTipStruct &toolTip);
const QDBusArgument &operator>>(const QDBusArgument &argument, QXdgDBusToolTipStruct &toolTip);
QT_END_NAMESPACE
QT_DECL_METATYPE_EXTERN(QXdgDBusImageStruct, Q_GUI_EXPORT)
QT_DECL_METATYPE_EXTERN(QXdgDBusImageVector, Q_GUI_EXPORT)
QT_DECL_METATYPE_EXTERN(QXdgDBusToolTipStruct, Q_GUI_EXPORT)
#endif // QDBUSTRAYTYPES_P_H

View File

@@ -1,179 +0,0 @@
// Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDRAWHELPER_MIPS_DSP_P_H
#define QDRAWHELPER_MIPS_DSP_P_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 <private/qdrawhelper_p.h>
QT_BEGIN_NAMESPACE
#if defined(QT_COMPILER_SUPPORTS_MIPS_DSP)
extern "C" void qt_memfill32_asm_mips_dsp(quint32 *dest, quint32 value, qsizetype count);
extern "C" void comp_func_SourceOver_asm_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha);
extern "C" void comp_func_solid_DestinationOver_dsp_asm_x2(uint *dest, int length, uint color);
extern "C" void comp_func_solid_Source_dsp_asm_x2(uint *dest, int length, uint color, uint const_alpha);
extern "C" void comp_func_DestinationOver_dsp_asm_x2(uint *dest, const uint *src, int length, uint const_alpha);
extern "C" void comp_func_solid_SourceIn_dsp_asm_x2(uint *dest, int length, uint color, uint const_alpha);
extern "C" void comp_func_SourceIn_dsp_asm_x2(uint *dest, const uint *src, int length, uint const_alpha);
extern "C" void comp_func_solid_DestinationIn_dsp_asm_x2(uint *dest, int length, uint a);
extern "C" void comp_func_DestinationIn_dsp_asm_x2(uint *dest, const uint *src, int length, uint const_alpha);
extern "C" void comp_func_DestinationOut_dsp_asm_x2(uint *dest, const uint *src, int length, uint const_alpha);
extern "C" void comp_func_solid_SourceAtop_dsp_asm_x2(uint *dest, int length, uint color, uint const_alpha);
extern "C" void comp_func_SourceAtop_dsp_asm_x2(uint *dest, const uint *src, int length, uint const_alpha);
extern "C" void comp_func_solid_DestinationAtop_dsp_asm_x2(uint *dest, int length, uint color, uint const_alpha);
extern "C" void comp_func_DestinationAtop_dsp_asm_x2(uint *dest, const uint *src, int length, uint const_alpha);
extern "C" void comp_func_solid_XOR_dsp_asm_x2(uint *dest, int length, uint color, uint const_alpha);
extern "C" void comp_func_XOR_dsp_asm_x2(uint *dest, const uint *src, int length, uint const_alpha);
extern "C" void comp_func_solid_SourceOut_dsp_asm_x2(uint *dest, int length, uint color, uint const_alpha);
extern "C" void comp_func_SourceOut_dsp_asm_x2(uint *dest, const uint *src, int length, uint const_alpha);
extern "C" void comp_func_Source_dsp_asm_x2(uint *dest, const uint *src, int length, uint const_alpha);
extern "C" void qt_blend_argb32_on_argb32_mips_dsp_asm_x2(uint *dest, const uint *src, int length, uint const_alpha);
extern "C" void qt_blend_argb32_on_argb32_const_alpha_256_mips_dsp_asm(uint *dest, const uint *src, int length);
extern "C" void qt_blend_rgb16_on_rgb16_const_alpha_256_mips_dsp_asm(quint16 *dest, const quint16 *src, int length);
extern "C" void qt_blend_rgb16_on_rgb16_mips_dsp_asm(quint16 *dest, const quint16 *src, int length, uint const_alpha);
extern "C" uint * destfetchARGB32_asm_mips_dsp(uint *buffer, const uint *data, int length);
extern "C" uint * qt_destStoreARGB32_asm_mips_dsp(uint *buffer, const uint *data, int length);
extern "C" uint * fetchUntransformed_888_asm_mips_dsp(uint *buffer, const uchar *line, int length);
extern "C" uint * fetchUntransformed_444_asm_mips_dsp(uint *buffer, const uchar *line, int length);
extern "C" uint * fetchUntransformed_argb8565_premultiplied_asm_mips_dsp(uint *buffer, const uchar *line, int length);
void qt_blend_argb32_on_argb32_mips_dsp(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
int w, int h,
int const_alpha);
void qt_blend_rgb32_on_rgb32_mips_dsp(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
int w, int h,
int const_alpha);
void qt_blend_rgb16_on_rgb16_mips_dsp(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
int w, int h,
int const_alpha);
void comp_func_Source_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha);
uint * QT_FASTCALL qt_destFetchARGB32_mips_dsp(uint *buffer,
QRasterBuffer *rasterBuffer,
int x, int y, int length);
void QT_FASTCALL qt_destStoreARGB32_mips_dsp(QRasterBuffer *rasterBuffer, int x, int y,
const uint *buffer, int length);
void QT_FASTCALL comp_func_solid_Source_mips_dsp(uint *dest, int length, uint color, uint const_alpha);
void QT_FASTCALL comp_func_solid_SourceOver_mips_dsp(uint *dest, int length, uint color, uint const_alpha);
void QT_FASTCALL comp_func_solid_DestinationOver_mips_dsp(uint *dest, int length, uint color, uint const_alpha);
void QT_FASTCALL comp_func_solid_SourceOver_mips_dsp(uint *dest, int length, uint color, uint const_alpha);
void QT_FASTCALL comp_func_solid_DestinationOver_mips_dsp(uint *dest, int length, uint color, uint const_alpha);
void QT_FASTCALL comp_func_DestinationOver_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha);
void QT_FASTCALL comp_func_solid_SourceIn_mips_dsp(uint *dest, int length, uint color, uint const_alpha);
void QT_FASTCALL comp_func_SourceIn_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha);
void QT_FASTCALL comp_func_solid_DestinationIn_mips_dsp(uint *dest, int length, uint color, uint const_alpha);
void QT_FASTCALL comp_func_DestinationIn_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha);
void QT_FASTCALL comp_func_solid_DestinationOut_mips_dsp(uint *dest, int length, uint color, uint const_alpha);
void QT_FASTCALL comp_func_DestinationOut_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha);
void QT_FASTCALL comp_func_solid_SourceAtop_mips_dsp(uint *dest, int length, uint color, uint const_alpha);
void QT_FASTCALL comp_func_SourceAtop_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha);
void QT_FASTCALL comp_func_solid_DestinationAtop_mips_dsp(uint *dest, int length, uint color, uint const_alpha);
void QT_FASTCALL comp_func_DestinationAtop_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha);
void QT_FASTCALL comp_func_solid_XOR_mips_dsp(uint *dest, int length, uint color, uint const_alpha);
void QT_FASTCALL comp_func_solid_SourceOut_mips_dsp(uint *dest, int length, uint color, uint const_alpha);
void QT_FASTCALL comp_func_SourceOut_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha);
void QT_FASTCALL comp_func_XOR_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha);
const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer,
const Operator *,
const QSpanData *data,
int y, int x, int length);
const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer,
const Operator *,
const QSpanData *data,
int y, int x, int length);
const uint * QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (uint *buffer,
const Operator *,
const QSpanData *data,
int y, int x, int length);
#if defined(__MIPS_DSPR2__)
extern "C" void qt_blend_rgb16_on_rgb16_mips_dspr2_asm(quint16 *dest, const quint16 *src, int length, uint const_alpha);
void qt_blend_rgb16_on_rgb16_mips_dspr2(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
int w, int h,
int const_alpha);
const uint *QT_FASTCALL qt_fetchUntransformedRGB16_mips_dspr2(uint *buffer, const Operator *,
const QSpanData *data, int y, int x,
int length);
#endif // defined(__MIPS_DSPR2__)
#endif // QT_COMPILER_SUPPORTS_MIPS_DSP
QT_END_NAMESPACE
#endif // QDRAWHELPER_MIPS_DSP_P_H

View File

@@ -1,91 +0,0 @@
// Copyright (C) 2020 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 QEGLCONVENIENCE_H
#define QEGLCONVENIENCE_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 <QtGui/qsurfaceformat.h>
#include <QtCore/qlist.h>
#include <QtCore/qsize.h>
#include <QtGui/private/qt_egl_p.h>
QT_BEGIN_NAMESPACE
Q_GUI_EXPORT QList<EGLint> q_createConfigAttributesFromFormat(const QSurfaceFormat &format);
Q_GUI_EXPORT bool q_reduceConfigAttributes(QList<EGLint> *configAttributes);
Q_GUI_EXPORT EGLConfig q_configFromGLFormat(EGLDisplay display,
const QSurfaceFormat &format,
bool highestPixelFormat = false,
int surfaceType = EGL_WINDOW_BIT);
Q_GUI_EXPORT QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config,
const QSurfaceFormat &referenceFormat = {});
Q_GUI_EXPORT bool q_hasEglExtension(EGLDisplay display,const char* extensionName);
Q_GUI_EXPORT void q_printEglConfig(EGLDisplay display, EGLConfig config);
#ifdef Q_OS_UNIX
Q_GUI_EXPORT QSizeF q_physicalScreenSizeFromFb(int framebufferDevice,
const QSize &screenSize = {});
Q_GUI_EXPORT QSize q_screenSizeFromFb(int framebufferDevice);
Q_GUI_EXPORT int q_screenDepthFromFb(int framebufferDevice);
Q_GUI_EXPORT qreal q_refreshRateFromFb(int framebufferDevice);
#endif
class Q_GUI_EXPORT QEglConfigChooser
{
public:
QEglConfigChooser(EGLDisplay display);
virtual ~QEglConfigChooser();
EGLDisplay display() const { return m_display; }
void setSurfaceType(EGLint surfaceType) { m_surfaceType = surfaceType; }
EGLint surfaceType() const { return m_surfaceType; }
void setSurfaceFormat(const QSurfaceFormat &format) { m_format = format; }
QSurfaceFormat surfaceFormat() const { return m_format; }
void setIgnoreColorChannels(bool ignore) { m_ignore = ignore; }
bool ignoreColorChannels() const { return m_ignore; }
EGLConfig chooseConfig();
protected:
virtual bool filterConfig(EGLConfig config) const;
QSurfaceFormat m_format;
EGLDisplay m_display;
EGLint m_surfaceType;
bool m_ignore;
int m_confAttrRed;
int m_confAttrGreen;
int m_confAttrBlue;
int m_confAttrAlpha;
};
QT_END_NAMESPACE
#endif //QEGLCONVENIENCE_H

View File

@@ -1,44 +0,0 @@
// Copyright (C) 2020 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 QEGLPBUFFER_H
#define QEGLPBUFFER_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/qplatformoffscreensurface.h>
#include <QtGui/private/qeglplatformcontext_p.h>
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QEGLPbuffer : public QPlatformOffscreenSurface
{
public:
QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface,
QEGLPlatformContext::Flags flags = { });
~QEGLPbuffer();
QSurfaceFormat format() const override { return m_format; }
bool isValid() const override;
EGLSurface pbuffer() const { return m_pbuffer; }
private:
QSurfaceFormat m_format;
EGLDisplay m_display;
EGLSurface m_pbuffer;
bool m_hasSurfaceless;
};
QT_END_NAMESPACE
#endif // QEGLPBUFFER_H

View File

@@ -1,111 +0,0 @@
// Copyright (C) 2020 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 QEGLPLATFORMCONTEXT_H
#define QEGLPLATFORMCONTEXT_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/qtextstream.h>
#include <qpa/qplatformwindow.h>
#include <qpa/qplatformopenglcontext.h>
#include <QtCore/qvariant.h>
#include <QtGui/private/qt_egl_p.h>
#include <QtGui/private/qopenglcontext_p.h>
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QEGLPlatformContext : public QPlatformOpenGLContext,
public QNativeInterface::QEGLContext
{
public:
enum Flag {
NoSurfaceless = 0x01
};
Q_DECLARE_FLAGS(Flags, Flag)
QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
EGLConfig *config = nullptr, Flags flags = { });
template <typename T>
static QOpenGLContext *createFrom(EGLContext context, EGLDisplay contextDisplay,
EGLDisplay platformDisplay, QOpenGLContext *shareContext)
{
if (!context)
return nullptr;
// A context belonging to a given EGLDisplay cannot be used with another one
if (contextDisplay != platformDisplay) {
qWarning("QEGLPlatformContext: Cannot adopt context from different display");
return nullptr;
}
QPlatformOpenGLContext *shareHandle = shareContext ? shareContext->handle() : nullptr;
auto *resultingContext = new QOpenGLContext;
auto *contextPrivate = QOpenGLContextPrivate::get(resultingContext);
auto *platformContext = new T;
platformContext->adopt(context, contextDisplay, shareHandle);
contextPrivate->adopt(platformContext);
return resultingContext;
}
~QEGLPlatformContext();
void initialize() override;
bool makeCurrent(QPlatformSurface *surface) override;
void doneCurrent() override;
void swapBuffers(QPlatformSurface *surface) override;
QFunctionPointer getProcAddress(const char *procName) override;
QSurfaceFormat format() const override;
bool isSharing() const override { return m_shareContext != EGL_NO_CONTEXT; }
bool isValid() const override { return m_eglContext != EGL_NO_CONTEXT; }
EGLContext nativeContext() const override { return eglContext(); }
EGLConfig config() const override { return eglConfig(); }
EGLDisplay display() const override { return eglDisplay(); }
EGLContext eglContext() const;
EGLDisplay eglDisplay() const;
EGLConfig eglConfig() const;
protected:
QEGLPlatformContext() {} // For adoption
virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) = 0;
virtual EGLSurface createTemporaryOffscreenSurface();
virtual void destroyTemporaryOffscreenSurface(EGLSurface surface);
virtual void runGLChecks();
private:
void adopt(EGLContext context, EGLDisplay display, QPlatformOpenGLContext *shareContext);
void updateFormatFromGL();
EGLContext m_eglContext;
EGLContext m_shareContext;
EGLDisplay m_eglDisplay;
EGLConfig m_eglConfig;
QSurfaceFormat m_format;
EGLenum m_api;
int m_swapInterval = -1;
bool m_swapIntervalEnvChecked = false;
int m_swapIntervalFromEnv = -1;
Flags m_flags;
bool m_ownsContext = false;
QList<EGLint> m_contextAttrs;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QEGLPlatformContext::Flags)
QT_END_NAMESPACE
#endif //QEGLPLATFORMCONTEXT_H

View File

@@ -1,175 +0,0 @@
// Copyright (C) 2020 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 QEGLSTREAMCONVENIENCE_H
#define QEGLSTREAMCONVENIENCE_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 <QtGui/qtguiglobal.h>
#include <QtGui/private/qt_egl_p.h>
// This provides runtime EGLDevice/Output/Stream support even when eglext.h in
// the sysroot is not up-to-date.
#ifndef EGL_VERSION_1_5
typedef intptr_t EGLAttrib;
#endif
#ifndef EGL_EXT_platform_base
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
#endif
#ifndef EGL_EXT_device_base
typedef void *EGLDeviceEXT;
#define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0))
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
#endif
#ifndef EGL_EXT_output_base
typedef void *EGLOutputLayerEXT;
typedef void *EGLOutputPortEXT;
#define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0)
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
#endif
#ifndef EGL_KHR_stream
typedef void *EGLStreamKHR;
typedef quint64 EGLuint64KHR;
#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
#define EGL_STREAM_STATE_KHR 0x3214
#define EGL_STREAM_STATE_CREATED_KHR 0x3215
#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
#define EGL_BAD_STREAM_KHR 0x321B
#define EGL_BAD_STATE_KHR 0x321C
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
#endif
#ifndef EGL_KHR_stream_fifo
#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
#endif
#ifndef EGL_KHR_stream_producer_eglsurface
#define EGL_STREAM_BIT_KHR 0x0800
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
#endif
#ifndef EGL_KHR_stream_cross_process_fd
typedef int EGLNativeFileDescriptorKHR;
#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
#endif
#ifndef EGL_KHR_stream_consumer_gltexture
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
#endif
#ifndef EGL_EXT_stream_consumer_egloutput
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
#endif
#ifndef EGL_EXT_platform_device
#define EGL_PLATFORM_DEVICE_EXT 0x313F
#endif
#ifndef EGL_EXT_device_drm
#define EGL_DRM_DEVICE_FILE_EXT 0x3233
#endif
#ifndef EGL_EXT_output_drm
#define EGL_DRM_CRTC_EXT 0x3234
#define EGL_DRM_PLANE_EXT 0x3235
#endif
#ifndef EGL_PLATFORM_X11_KHR
#define EGL_PLATFORM_X11_KHR 0x31D5
#endif
#ifndef EGL_NV_stream_attrib
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBNVPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
#endif
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QEGLStreamConvenience
{
public:
QEGLStreamConvenience();
void initialize(EGLDisplay dpy);
PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display;
PFNEGLQUERYDEVICESEXTPROC query_devices;
PFNEGLQUERYDEVICESTRINGEXTPROC query_device_string;
PFNEGLCREATESTREAMKHRPROC create_stream;
PFNEGLCREATESTREAMATTRIBNVPROC create_stream_attrib_nv;
PFNEGLSETSTREAMATTRIBNVPROC set_stream_attrib_nv;
PFNEGLQUERYSTREAMATTRIBNVPROC query_stream_attrib_nv;
PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC acquire_stream_attrib_nv;
PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC release_stream_attrib_nv;
PFNEGLDESTROYSTREAMKHRPROC destroy_stream;
PFNEGLSTREAMATTRIBKHRPROC stream_attrib;
PFNEGLQUERYSTREAMKHRPROC query_stream;
PFNEGLQUERYSTREAMU64KHRPROC query_stream_u64;
PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC create_stream_producer_surface;
PFNEGLSTREAMCONSUMEROUTPUTEXTPROC stream_consumer_output;
PFNEGLGETOUTPUTLAYERSEXTPROC get_output_layers;
PFNEGLGETOUTPUTPORTSEXTPROC get_output_ports;
PFNEGLOUTPUTLAYERATTRIBEXTPROC output_layer_attrib;
PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC query_output_layer_attrib;
PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC query_output_layer_string;
PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC query_output_port_attrib;
PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC query_output_port_string;
PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC get_stream_file_descriptor;
PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC create_stream_from_file_descriptor;
PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC stream_consumer_gltexture;
PFNEGLSTREAMCONSUMERACQUIREKHRPROC stream_consumer_acquire;
PFNEGLSTREAMCONSUMERRELEASEKHRPROC stream_consumer_release;
bool initialized;
bool has_egl_platform_device;
bool has_egl_device_base;
bool has_egl_stream;
bool has_egl_stream_producer_eglsurface;
bool has_egl_stream_consumer_egloutput;
bool has_egl_output_drm;
bool has_egl_output_base;
bool has_egl_stream_cross_process_fd;
bool has_egl_stream_consumer_gltexture;
};
QT_END_NAMESPACE
#endif

View File

@@ -1,122 +0,0 @@
// 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 QFONTENGINE_CORETEXT_P_H
#define QFONTENGINE_CORETEXT_P_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 <private/qfontengine_p.h>
#include <private/qcore_mac_p.h>
#include <QtCore/qloggingcategory.h>
#ifdef Q_OS_MACOS
#include <ApplicationServices/ApplicationServices.h>
#else
#include <CoreText/CoreText.h>
#include <CoreGraphics/CoreGraphics.h>
#endif
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QCoreTextFontEngine : public QFontEngine
{
Q_GADGET
public:
QCoreTextFontEngine(CTFontRef font, const QFontDef &def);
QCoreTextFontEngine(CGFontRef font, const QFontDef &def);
~QCoreTextFontEngine();
glyph_t glyphIndex(uint ucs4) const override;
bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
void recalcAdvances(QGlyphLayout *, ShaperFlags) const override;
glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
glyph_metrics_t boundingBox(glyph_t glyph) override;
QFixed capHeight() const override;
QFixed xHeight() const override;
qreal maxCharWidth() const override;
QFixed averageCharWidth() const override;
void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int numGlyphs,
QPainterPath *path, QTextItem::RenderFlags) override;
bool canRender(const QChar *string, int len) const override;
int synthesized() const override { return synthesisFlags; }
bool supportsHorizontalSubPixelPositions() const override { return true; }
bool supportsVerticalSubPixelPositions() const override { return false; }
QFixed lineThickness() const override;
QFixed underlinePosition() const override;
void draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight);
FaceId faceId() const override;
bool getSfntTableData(uint /*tag*/, uchar * /*buffer*/, uint * /*length*/) const override;
void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override;
QImage alphaMapForGlyph(glyph_t, const QFixedPoint &subPixelPosition) override;
QImage alphaMapForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &t) override;
QImage alphaRGBMapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t) override;
glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, const QFixedPoint &, const QTransform &matrix, GlyphFormat) override;
QImage bitmapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t, const QColor &color) override;
QFixed emSquareSize() const override;
void doKerning(QGlyphLayout *g, ShaperFlags flags) const override;
bool supportsTransformation(const QTransform &transform) const override;
bool expectsGammaCorrectedBlending() const override;
QFontEngine *cloneWithSize(qreal pixelSize) const override;
Qt::HANDLE handle() const override;
int glyphMargin(QFontEngine::GlyphFormat format) override { Q_UNUSED(format); return 0; }
QFontEngine::Properties properties() const override;
enum FontSmoothing { Disabled, Subpixel, Grayscale };
Q_ENUM(FontSmoothing);
static FontSmoothing fontSmoothing();
static qreal fontSmoothingGamma();
static bool ct_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *length);
static QFont::Weight qtWeightFromCFWeight(float value);
static QCoreTextFontEngine *create(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference);
protected:
QCoreTextFontEngine(const QFontDef &def);
void init();
QImage imageForGlyph(glyph_t glyph, const QFixedPoint &subPixelPosition, const QTransform &m, const QColor &color = QColor());
void loadAdvancesForGlyphs(QVarLengthArray<CGGlyph> &cgGlyphs, QGlyphLayout *glyphs) const;
bool hasColorGlyphs() const;
bool shouldAntialias() const;
bool shouldSmoothFont() const;
void initializeHeightMetrics() const override;
QCFType<CTFontRef> ctfont;
QCFType<CGFontRef> cgFont;
int synthesisFlags;
CGAffineTransform transform;
QFixed avgCharWidth;
QFixed underlineThickness;
QFixed underlinePos;
QFontEngine::FaceId face_id;
mutable bool kerningPairsLoaded;
};
CGAffineTransform Q_GUI_EXPORT qt_transform_from_fontdef(const QFontDef &fontDef);
QT_END_NAMESPACE
#endif // QFONTENGINE_CORETEXT_P_H

View File

@@ -1,57 +0,0 @@
// Copyright (C) 2020 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 QGLXCONVENIENCE_H
#define QGLXCONVENIENCE_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.h>
#include <QtGui/qsurfaceformat.h>
#include <QtCore/private/qglobal_p.h>
#include <X11/Xlib.h>
#include <GL/glx.h>
QT_BEGIN_NAMESPACE
enum QGlxFlags
{
QGLX_SUPPORTS_SRGB = 0x01
};
Q_GUI_EXPORT QList<int> qglx_buildSpec(const QSurfaceFormat &format,
int drawableBit = GLX_WINDOW_BIT,
int flags = 0);
Q_GUI_EXPORT XVisualInfo *qglx_findVisualInfo(Display *display, int screen,
QSurfaceFormat *format,
int drawableBit = GLX_WINDOW_BIT,
int flags = 0);
Q_GUI_EXPORT GLXFBConfig qglx_findConfig(Display *display, int screen,
QSurfaceFormat format,
bool highestPixelFormat = false,
int drawableBit = GLX_WINDOW_BIT,
int flags = 0);
Q_GUI_EXPORT void qglx_surfaceFormatFromGLXFBConfig(QSurfaceFormat *format, Display *display,
GLXFBConfig config, int flags = 0);
Q_GUI_EXPORT void qglx_surfaceFormatFromVisualInfo(QSurfaceFormat *format, Display *display,
XVisualInfo *visualInfo, int flags = 0);
Q_GUI_EXPORT bool qglx_reduceFormat(QSurfaceFormat *format);
QT_END_NAMESPACE
#endif // QGLXCONVENIENCE_H

View File

@@ -1,63 +0,0 @@
// 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 QMACMIME_H
#define QMACMIME_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 <QtGui/private/qtguiglobal_p.h>
#include <CoreFoundation/CoreFoundation.h>
QT_BEGIN_NAMESPACE
// Duplicate of QMacPasteboardMime in QtMacExtras. Keep in sync!
class Q_GUI_EXPORT QMacInternalPasteboardMime {
char type;
public:
enum QMacPasteboardMimeType { MIME_DND=0x01,
MIME_CLIP=0x02,
MIME_QT_CONVERTOR=0x04,
MIME_QT3_CONVERTOR=0x08,
MIME_ALL=MIME_DND|MIME_CLIP
};
explicit QMacInternalPasteboardMime(char);
virtual ~QMacInternalPasteboardMime();
static void initializeMimeTypes();
static void destroyMimeTypes();
static QList<QMacInternalPasteboardMime*> all(uchar);
static QMacInternalPasteboardMime *convertor(uchar, const QString &mime, QString flav);
static QString flavorToMime(uchar, QString flav);
virtual QString convertorName() = 0;
virtual bool canConvert(const QString &mime, QString flav) = 0;
virtual QString mimeFor(QString flav) = 0;
virtual QString flavorFor(const QString &mime) = 0;
virtual QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav) = 0;
virtual QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav) = 0;
virtual int count(QMimeData *mimeData);
};
Q_GUI_EXPORT void qt_mac_addToGlobalMimeList(QMacInternalPasteboardMime *macMime);
Q_GUI_EXPORT void qt_mac_removeFromGlobalMimeList(QMacInternalPasteboardMime *macMime);
Q_GUI_EXPORT void qt_mac_registerDraggedTypes(const QStringList &types);
Q_GUI_EXPORT const QStringList& qt_mac_enabledDraggedTypes();
QT_END_NAMESPACE
#endif

View File

@@ -1,107 +0,0 @@
// 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 QOPENGL_P_H
#define QOPENGL_P_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 <QtGui/private/qtguiglobal_p.h>
#include <qopengl.h>
#include <private/qopenglcontext_p.h>
#include <QtCore/qset.h>
#include <QtCore/qstring.h>
#include <QtCore/qversionnumber.h>
QT_BEGIN_NAMESPACE
class QJsonDocument;
class Q_GUI_EXPORT QOpenGLExtensionMatcher
{
public:
QOpenGLExtensionMatcher();
bool match(const QByteArray &extension) const
{
return m_extensions.contains(extension);
}
QSet<QByteArray> extensions() const { return m_extensions; }
private:
QSet<QByteArray> m_extensions;
};
class Q_GUI_EXPORT QOpenGLConfig
{
public:
struct Q_GUI_EXPORT Gpu {
Gpu() : vendorId(0), deviceId(0) {}
bool isValid() const { return deviceId || !glVendor.isEmpty(); }
bool equals(const Gpu &other) const {
return vendorId == other.vendorId && deviceId == other.deviceId && driverVersion == other.driverVersion
&& driverDescription == other.driverDescription && glVendor == other.glVendor;
}
uint vendorId;
uint deviceId;
QVersionNumber driverVersion;
QByteArray driverDescription;
QByteArray glVendor;
static Gpu fromDevice(uint vendorId, uint deviceId, QVersionNumber driverVersion, const QByteArray &driverDescription) {
Gpu gpu;
gpu.vendorId = vendorId;
gpu.deviceId = deviceId;
gpu.driverVersion = driverVersion;
gpu.driverDescription = driverDescription;
return gpu;
}
static Gpu fromGLVendor(const QByteArray &glVendor) {
Gpu gpu;
gpu.glVendor = glVendor;
return gpu;
}
static Gpu fromContext();
};
static QSet<QString> gpuFeatures(const Gpu &gpu,
const QString &osName, const QVersionNumber &kernelVersion, const QString &osVersion,
const QJsonDocument &doc);
static QSet<QString> gpuFeatures(const Gpu &gpu,
const QString &osName, const QVersionNumber &kernelVersion, const QString &osVersion,
const QString &fileName);
static QSet<QString> gpuFeatures(const Gpu &gpu, const QJsonDocument &doc);
static QSet<QString> gpuFeatures(const Gpu &gpu, const QString &fileName);
};
inline bool operator==(const QOpenGLConfig::Gpu &a, const QOpenGLConfig::Gpu &b)
{
return a.equals(b);
}
inline bool operator!=(const QOpenGLConfig::Gpu &a, const QOpenGLConfig::Gpu &b)
{
return !a.equals(b);
}
inline size_t qHash(const QOpenGLConfig::Gpu &gpu, size_t seed = 0)
{
return (qHash(gpu.vendorId) + qHash(gpu.deviceId) + qHash(gpu.driverVersion)) ^ seed;
}
QT_END_NAMESPACE
#endif // QOPENGL_H

View File

@@ -1,266 +0,0 @@
// 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 QOPENGLCONTEXT_P_H
#define QOPENGLCONTEXT_P_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 <QtGui/private/qtguiglobal_p.h>
#ifndef QT_NO_OPENGL
#include <qopengl.h>
#include "qopenglcontext.h"
#include <private/qobject_p.h>
#include <qmutex.h>
#include <QtCore/QByteArray>
#include <QtCore/QHash>
#include <QtCore/QSet>
QT_BEGIN_NAMESPACE
class QOpenGLFunctions;
class QOpenGLContext;
class QOpenGLFramebufferObject;
class QOpenGLMultiGroupSharedResource;
class Q_GUI_EXPORT QOpenGLSharedResource
{
public:
QOpenGLSharedResource(QOpenGLContextGroup *group);
virtual ~QOpenGLSharedResource() = 0;
QOpenGLContextGroup *group() const { return m_group; }
// schedule the resource for deletion at an appropriate time
void free();
protected:
// the resource's share group no longer exists, invalidate the resource
virtual void invalidateResource() = 0;
// a valid context in the group is current, free the resource
virtual void freeResource(QOpenGLContext *context) = 0;
private:
QOpenGLContextGroup *m_group;
friend class QOpenGLContextGroup;
friend class QOpenGLContextGroupPrivate;
friend class QOpenGLMultiGroupSharedResource;
Q_DISABLE_COPY_MOVE(QOpenGLSharedResource)
};
class Q_GUI_EXPORT QOpenGLSharedResourceGuard : public QOpenGLSharedResource
{
public:
typedef void (*FreeResourceFunc)(QOpenGLFunctions *functions, GLuint id);
QOpenGLSharedResourceGuard(QOpenGLContext *context, GLuint id, FreeResourceFunc func)
: QOpenGLSharedResource(context->shareGroup())
, m_id(id)
, m_func(func)
{
}
~QOpenGLSharedResourceGuard() override;
GLuint id() const { return m_id; }
protected:
void invalidateResource() override
{
m_id = 0;
}
void freeResource(QOpenGLContext *context) override;
private:
GLuint m_id;
FreeResourceFunc m_func;
};
class Q_GUI_EXPORT QOpenGLContextGroupPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QOpenGLContextGroup)
public:
QOpenGLContextGroupPrivate()
: m_context(nullptr)
, m_refs(0)
{
}
~QOpenGLContextGroupPrivate() override;
void addContext(QOpenGLContext *ctx);
void removeContext(QOpenGLContext *ctx);
void cleanup();
void deletePendingResources(QOpenGLContext *ctx);
QOpenGLContext *m_context;
QList<QOpenGLContext *> m_shares;
QRecursiveMutex m_mutex;
QHash<QOpenGLMultiGroupSharedResource *, QOpenGLSharedResource *> m_resources;
QAtomicInt m_refs;
QList<QOpenGLSharedResource *> m_sharedResources;
QList<QOpenGLSharedResource *> m_pendingDeletion;
};
class Q_GUI_EXPORT QOpenGLMultiGroupSharedResource
{
public:
QOpenGLMultiGroupSharedResource();
~QOpenGLMultiGroupSharedResource();
void insert(QOpenGLContext *context, QOpenGLSharedResource *value);
void cleanup(QOpenGLContextGroup *group, QOpenGLSharedResource *value);
QOpenGLSharedResource *value(QOpenGLContext *context);
QList<QOpenGLSharedResource *> resources() const;
template <typename T>
T *value(QOpenGLContext *context) {
QOpenGLContextGroup *group = context->shareGroup();
// Have to use our own mutex here, not the group's, since
// m_groups has to be protected too against any concurrent access.
QMutexLocker locker(&m_mutex);
T *resource = static_cast<T *>(group->d_func()->m_resources.value(this, nullptr));
if (!resource) {
resource = new T(context);
insert(context, resource);
}
return resource;
}
private:
QAtomicInt active;
QList<QOpenGLContextGroup *> m_groups;
QRecursiveMutex m_mutex;
};
class QPaintEngineEx;
class QOpenGLFunctions;
class QOpenGLTextureHelper;
class QOpenGLVertexArrayObjectHelper;
class Q_GUI_EXPORT QOpenGLContextVersionFunctionHelper
{
public:
virtual ~QOpenGLContextVersionFunctionHelper();
};
class Q_GUI_EXPORT QOpenGLContextPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QOpenGLContext)
public:
QOpenGLContextPrivate()
: platformGLContext(nullptr)
, shareContext(nullptr)
, shareGroup(nullptr)
, screen(nullptr)
, surface(nullptr)
, functions(nullptr)
, textureFunctions(nullptr)
, versionFunctions(nullptr)
, vaoHelper(nullptr)
, vaoHelperDestroyCallback(nullptr)
, max_texture_size(-1)
, workaround_brokenFBOReadBack(false)
, workaround_brokenTexSubImage(false)
, workaround_missingPrecisionQualifiers(false)
, active_engine(nullptr)
, qgl_current_fbo_invalid(false)
, qgl_current_fbo(nullptr)
, defaultFboRedirect(0)
{
requestedFormat = QSurfaceFormat::defaultFormat();
}
~QOpenGLContextPrivate() override;
void adopt(QPlatformOpenGLContext *);
QSurfaceFormat requestedFormat;
QPlatformOpenGLContext *platformGLContext;
QOpenGLContext *shareContext;
QOpenGLContextGroup *shareGroup;
QScreen *screen;
QSurface *surface;
QOpenGLFunctions *functions;
mutable QSet<QByteArray> extensionNames;
QOpenGLTextureHelper* textureFunctions;
std::function<void()> textureFunctionsDestroyCallback;
QOpenGLContextVersionFunctionHelper *versionFunctions;
QOpenGLVertexArrayObjectHelper *vaoHelper;
using QOpenGLVertexArrayObjectHelperDestroyCallback_t = void (*)(QOpenGLVertexArrayObjectHelper *);
QOpenGLVertexArrayObjectHelperDestroyCallback_t vaoHelperDestroyCallback;
GLint max_texture_size;
bool workaround_brokenFBOReadBack;
bool workaround_brokenTexSubImage;
bool workaround_missingPrecisionQualifiers;
QPaintEngineEx *active_engine;
bool qgl_current_fbo_invalid;
// Set and unset in QOpenGLFramebufferObject::bind()/unbind().
// (Only meaningful for QOGLFBO since an FBO might be bound by other means)
// Saves us from querying the driver for the current FBO in most paths.
QOpenGLFramebufferObject *qgl_current_fbo;
GLuint defaultFboRedirect;
static QOpenGLContext *setCurrentContext(QOpenGLContext *context);
int maxTextureSize();
static QOpenGLContextPrivate *get(QOpenGLContext *context)
{
return context ? context->d_func() : nullptr;
}
#if !defined(QT_NO_DEBUG)
static bool toggleMakeCurrentTracker(QOpenGLContext *context, bool value)
{
QMutexLocker locker(&makeCurrentTrackerMutex);
bool old = makeCurrentTracker.value(context, false);
makeCurrentTracker.insert(context, value);
return old;
}
static void cleanMakeCurrentTracker(QOpenGLContext *context)
{
QMutexLocker locker(&makeCurrentTrackerMutex);
makeCurrentTracker.remove(context);
}
static QHash<QOpenGLContext *, bool> makeCurrentTracker;
static QMutex makeCurrentTrackerMutex;
#endif
void _q_screenDestroyed(QObject *object);
};
Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context);
Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
QT_END_NAMESPACE
#endif // QT_NO_OPENGL
#endif // QOPENGLCONTEXT_P_H

View File

@@ -1,127 +0,0 @@
// 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 QOPENGL_EXTENSIONS_P_H
#define QOPENGL_EXTENSIONS_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of the Qt OpenGL classes. This header file may change from
// version to version without notice, or even be removed.
//
// We mean it.
//
#include <QtGui/private/qtguiglobal_p.h>
#include "qopenglextrafunctions.h"
QT_BEGIN_NAMESPACE
class QOpenGLExtensionsPrivate;
class Q_GUI_EXPORT QOpenGLExtensions : public QOpenGLExtraFunctions
{
Q_DECLARE_PRIVATE(QOpenGLExtensions)
public:
QOpenGLExtensions();
QOpenGLExtensions(QOpenGLContext *context);
~QOpenGLExtensions() {}
enum OpenGLExtension {
TextureRectangle = 0x00000001,
GenerateMipmap = 0x00000002,
TextureCompression = 0x00000004,
MirroredRepeat = 0x00000008,
FramebufferMultisample = 0x00000010,
StencilTwoSide = 0x00000020,
StencilWrap = 0x00000040,
PackedDepthStencil = 0x00000080,
NVFloatBuffer = 0x00000100,
PixelBufferObject = 0x00000200,
FramebufferBlit = 0x00000400,
BGRATextureFormat = 0x00000800,
DDSTextureCompression = 0x00001000,
ETC1TextureCompression = 0x00002000,
PVRTCTextureCompression = 0x00004000,
ElementIndexUint = 0x00008000,
Depth24 = 0x00010000,
SRGBFrameBuffer = 0x00020000,
MapBuffer = 0x00040000,
GeometryShaders = 0x00080000,
MapBufferRange = 0x00100000,
Sized8Formats = 0x00200000,
DiscardFramebuffer = 0x00400000,
Sized16Formats = 0x00800000,
TextureSwizzle = 0x01000000,
StandardDerivatives = 0x02000000,
ASTCTextureCompression = 0x04000000,
ETC2TextureCompression = 0x08000000
};
Q_DECLARE_FLAGS(OpenGLExtensions, OpenGLExtension)
OpenGLExtensions openGLExtensions();
bool hasOpenGLExtension(QOpenGLExtensions::OpenGLExtension extension) const;
GLvoid *glMapBuffer(GLenum target, GLenum access);
void glGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data);
void glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
void flushShared();
QOpenGLExtensionsPrivate *d() const;
private:
static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != nullptr; }
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLExtensions::OpenGLExtensions)
class QOpenGLExtensionsPrivate : public QOpenGLExtraFunctionsPrivate
{
public:
explicit QOpenGLExtensionsPrivate(QOpenGLContext *ctx);
GLvoid* (QOPENGLF_APIENTRYP MapBuffer)(GLenum target, GLenum access);
void (QOPENGLF_APIENTRYP GetBufferSubData)(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data);
void (QOPENGLF_APIENTRYP DiscardFramebuffer)(GLenum target, GLsizei numAttachments, const GLenum *attachments);
bool flushVendorChecked;
bool flushIsSufficientToSyncContexts;
};
inline QOpenGLExtensionsPrivate *QOpenGLExtensions::d() const
{
return static_cast<QOpenGLExtensionsPrivate *>(d_ptr);
}
inline GLvoid *QOpenGLExtensions::glMapBuffer(GLenum target, GLenum access)
{
Q_D(QOpenGLExtensions);
Q_ASSERT(QOpenGLExtensions::isInitialized(d));
GLvoid *result = d->MapBuffer(target, access);
Q_OPENGL_FUNCTIONS_DEBUG
return result;
}
inline void QOpenGLExtensions::glGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data)
{
Q_D(QOpenGLExtensions);
Q_ASSERT(QOpenGLExtensions::isInitialized(d));
d->GetBufferSubData(target, offset, size, data);
Q_OPENGL_FUNCTIONS_DEBUG
}
inline void QOpenGLExtensions::glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments)
{
Q_D(QOpenGLExtensions);
Q_ASSERT(QOpenGLExtensions::isInitialized(d));
d->DiscardFramebuffer(target,numAttachments, attachments);
Q_OPENGL_FUNCTIONS_DEBUG
}
QT_END_NAMESPACE
#endif // QOPENGL_EXTENSIONS_P_H

View File

@@ -1,113 +0,0 @@
// 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 QOPENGLPROGRAMBINARYCACHE_P_H
#define QOPENGLPROGRAMBINARYCACHE_P_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 <QtGui/qtguiglobal.h>
#include <QtCore/qcache.h>
#include <QtCore/qmutex.h>
#include <QtCore/QLoggingCategory>
#include <QtGui/private/qopenglcontext_p.h>
#include <QtGui/private/qshader_p.h>
QT_BEGIN_NAMESPACE
// These classes are also used by the OpenGL backend of QRhi. They must
// therefore stay independent from QOpenGLShader(Program). Must rely only on
// QOpenGLContext/Functions.
Q_GUI_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcOpenGLProgramDiskCache)
class Q_GUI_EXPORT QOpenGLProgramBinaryCache
{
public:
struct Q_GUI_EXPORT ShaderDesc {
ShaderDesc() { }
ShaderDesc(QShader::Stage stage, const QByteArray &source = QByteArray())
: stage(stage), source(source)
{ }
QShader::Stage stage;
QByteArray source;
};
struct Q_GUI_EXPORT ProgramDesc {
QList<ShaderDesc> shaders;
QByteArray cacheKey() const;
};
QOpenGLProgramBinaryCache();
bool load(const QByteArray &cacheKey, uint programId);
void save(const QByteArray &cacheKey, uint programId);
private:
QString cacheFileName(const QByteArray &cacheKey) const;
bool verifyHeader(const QByteArray &buf) const;
bool setProgramBinary(uint programId, uint blobFormat, const void *p, uint blobSize);
QString m_globalCacheDir;
QString m_localCacheDir;
QString m_currentCacheDir;
bool m_cacheWritable;
struct MemCacheEntry {
MemCacheEntry(const void *p, int size, uint format)
: blob(reinterpret_cast<const char *>(p), size),
format(format)
{ }
QByteArray blob;
uint format;
};
QCache<QByteArray, MemCacheEntry> m_memCache;
#if QT_CONFIG(opengles2)
void (QOPENGLF_APIENTRYP programBinaryOES)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
void (QOPENGLF_APIENTRYP getProgramBinaryOES)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
void initializeProgramBinaryOES(QOpenGLContext *context);
bool m_programBinaryOESInitialized = false;
#endif
QMutex m_mutex;
};
// While unlikely, one application can in theory use contexts with different versions
// or profiles. Therefore any version- or extension-specific checks must be done on a
// per-context basis, not just once per process. QOpenGLSharedResource enables this,
// although it's once-per-sharing-context-group, not per-context. Still, this should
// be good enough in practice.
class Q_GUI_EXPORT QOpenGLProgramBinarySupportCheck : public QOpenGLSharedResource
{
public:
QOpenGLProgramBinarySupportCheck(QOpenGLContext *context);
void invalidateResource() override { }
void freeResource(QOpenGLContext *) override { }
bool isSupported() const { return m_supported; }
private:
bool m_supported;
};
class QOpenGLProgramBinarySupportCheckWrapper
{
public:
QOpenGLProgramBinarySupportCheck *get(QOpenGLContext *context)
{
return m_resource.value<QOpenGLProgramBinarySupportCheck>(context);
}
private:
QOpenGLMultiGroupSharedResource m_resource;
};
QT_END_NAMESPACE
#endif

View File

@@ -1,46 +0,0 @@
// Copyright (C) 2020 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 QRASTERBACKINGSTORE_P_H
#define QRASTERBACKINGSTORE_P_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/qplatformbackingstore.h>
#include <private/qglobal_p.h>
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QRasterBackingStore : public QPlatformBackingStore
{
public:
QRasterBackingStore(QWindow *window);
~QRasterBackingStore();
void resize(const QSize &size, const QRegion &staticContents) override;
bool scroll(const QRegion &area, int dx, int dy) override;
void beginPaint(const QRegion &region) override;
QPaintDevice *paintDevice() override;
QImage toImage() const override;
protected:
virtual QImage::Format format() const;
QImage m_image;
QSize m_requestedSize;
};
QT_END_NAMESPACE
#endif // QRASTERBACKINGSTORE_P_H

View File

@@ -1,33 +0,0 @@
// Copyright (C) 2022 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 QRHIBACKINGSTORE_H
#define QRHIBACKINGSTORE_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 <QtGui/private/qrasterbackingstore_p.h>
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QRhiBackingStore : public QRasterBackingStore
{
public:
QRhiBackingStore(QWindow *window);
~QRhiBackingStore();
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
};
QT_END_NAMESPACE
#endif // QRHIBACKINGSTORE_H

View File

@@ -1,45 +0,0 @@
// Copyright (C) 2019 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 QRHID3D11_H
#define QRHID3D11_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 <private/qrhi_p.h>
// no d3d includes here, to prevent precompiled header mess due to COM
QT_BEGIN_NAMESPACE
struct Q_GUI_EXPORT QRhiD3D11InitParams : public QRhiInitParams
{
bool enableDebugLayer = false;
int framesUntilKillingDeviceViaTdr = -1;
bool repeatDeviceKill = false;
};
struct Q_GUI_EXPORT QRhiD3D11NativeHandles : public QRhiNativeHandles
{
// to import a device and a context
void *dev = nullptr;
void *context = nullptr;
// alternatively, to specify the device feature level and/or the adapter to use
int featureLevel = 0;
quint32 adapterLuidLow = 0;
qint32 adapterLuidHigh = 0;
};
QT_END_NAMESPACE
#endif

View File

@@ -1,798 +0,0 @@
// Copyright (C) 2019 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 QRHID3D11_P_H
#define QRHID3D11_P_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 "qrhid3d11_p.h"
#include "qrhi_p_p.h"
#include "qshaderdescription_p.h"
#include <QWindow>
#include <d3d11_1.h>
#include <dxgi1_6.h>
QT_BEGIN_NAMESPACE
struct QD3D11Buffer : public QRhiBuffer
{
QD3D11Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size);
~QD3D11Buffer();
void destroy() override;
bool create() override;
QRhiBuffer::NativeBuffer nativeBuffer() override;
char *beginFullDynamicBufferUpdateForCurrentFrame() override;
void endFullDynamicBufferUpdateForCurrentFrame() override;
ID3D11UnorderedAccessView *unorderedAccessView();
ID3D11Buffer *buffer = nullptr;
char *dynBuf = nullptr;
bool hasPendingDynamicUpdates = false;
ID3D11UnorderedAccessView *uav = nullptr;
uint generation = 0;
friend class QRhiD3D11;
};
struct QD3D11RenderBuffer : public QRhiRenderBuffer
{
QD3D11RenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
int sampleCount, QRhiRenderBuffer::Flags flags,
QRhiTexture::Format backingFormatHint);
~QD3D11RenderBuffer();
void destroy() override;
bool create() override;
QRhiTexture::Format backingFormat() const override;
ID3D11Texture2D *tex = nullptr;
ID3D11DepthStencilView *dsv = nullptr;
ID3D11RenderTargetView *rtv = nullptr;
DXGI_FORMAT dxgiFormat;
DXGI_SAMPLE_DESC sampleDesc;
uint generation = 0;
friend class QRhiD3D11;
};
struct QD3D11Texture : public QRhiTexture
{
QD3D11Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
int arraySize, int sampleCount, Flags flags);
~QD3D11Texture();
void destroy() override;
bool create() override;
bool createFrom(NativeTexture src) override;
NativeTexture nativeTexture() override;
bool prepareCreate(QSize *adjustedSize = nullptr);
bool finishCreate();
ID3D11UnorderedAccessView *unorderedAccessViewForLevel(int level);
ID3D11Resource *textureResource() const
{
if (tex)
return tex;
return tex3D;
}
ID3D11Texture2D *tex = nullptr;
ID3D11Texture3D *tex3D = nullptr;
bool owns = true;
ID3D11ShaderResourceView *srv = nullptr;
DXGI_FORMAT dxgiFormat;
uint mipLevelCount = 0;
DXGI_SAMPLE_DESC sampleDesc;
ID3D11UnorderedAccessView *perLevelViews[QRhi::MAX_MIP_LEVELS];
uint generation = 0;
friend class QRhiD3D11;
};
struct QD3D11Sampler : public QRhiSampler
{
QD3D11Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
AddressMode u, AddressMode v, AddressMode w);
~QD3D11Sampler();
void destroy() override;
bool create() override;
ID3D11SamplerState *samplerState = nullptr;
uint generation = 0;
friend class QRhiD3D11;
};
struct QD3D11RenderPassDescriptor : public QRhiRenderPassDescriptor
{
QD3D11RenderPassDescriptor(QRhiImplementation *rhi);
~QD3D11RenderPassDescriptor();
void destroy() override;
bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() const override;
QVector<quint32> serializedFormat() const override;
};
struct QD3D11RenderTargetData
{
QD3D11RenderTargetData(QRhiImplementation *)
{
for (int i = 0; i < MAX_COLOR_ATTACHMENTS; ++i)
rtv[i] = nullptr;
}
QD3D11RenderPassDescriptor *rp = nullptr;
QSize pixelSize;
float dpr = 1;
int sampleCount = 1;
int colorAttCount = 0;
int dsAttCount = 0;
static const int MAX_COLOR_ATTACHMENTS = 8;
ID3D11RenderTargetView *rtv[MAX_COLOR_ATTACHMENTS];
ID3D11DepthStencilView *dsv = nullptr;
QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList;
};
struct QD3D11SwapChainRenderTarget : public QRhiSwapChainRenderTarget
{
QD3D11SwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
~QD3D11SwapChainRenderTarget();
void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
int sampleCount() const override;
QD3D11RenderTargetData d;
};
struct QD3D11TextureRenderTarget : public QRhiTextureRenderTarget
{
QD3D11TextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
~QD3D11TextureRenderTarget();
void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
int sampleCount() const override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
bool create() override;
QD3D11RenderTargetData d;
bool ownsRtv[QD3D11RenderTargetData::MAX_COLOR_ATTACHMENTS];
ID3D11RenderTargetView *rtv[QD3D11RenderTargetData::MAX_COLOR_ATTACHMENTS];
bool ownsDsv = false;
ID3D11DepthStencilView *dsv = nullptr;
friend class QRhiD3D11;
};
struct QD3D11ShaderResourceBindings : public QRhiShaderResourceBindings
{
QD3D11ShaderResourceBindings(QRhiImplementation *rhi);
~QD3D11ShaderResourceBindings();
void destroy() override;
bool create() override;
void updateResources(UpdateFlags flags) override;
bool hasDynamicOffset = false;
QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
uint generation = 0;
// Keep track of the generation number of each referenced QRhi* to be able
// to detect that the batched bindings are out of date.
struct BoundUniformBufferData {
quint64 id;
uint generation;
};
struct BoundSampledTextureData {
int count;
struct {
quint64 texId;
uint texGeneration;
quint64 samplerId;
uint samplerGeneration;
} d[QRhiShaderResourceBinding::Data::MAX_TEX_SAMPLER_ARRAY_SIZE];
};
struct BoundStorageImageData {
quint64 id;
uint generation;
};
struct BoundStorageBufferData {
quint64 id;
uint generation;
};
struct BoundResourceData {
union {
BoundUniformBufferData ubuf;
BoundSampledTextureData stex;
BoundStorageImageData simage;
BoundStorageBufferData sbuf;
};
};
QVarLengthArray<BoundResourceData, 8> boundResourceData;
bool vsubufsPresent = false;
bool fsubufsPresent = false;
bool csubufsPresent = false;
bool vssamplersPresent = false;
bool fssamplersPresent = false;
bool cssamplersPresent = false;
bool csUAVsPresent = false;
QRhiBatchedBindings<ID3D11Buffer *> vsubufs;
QRhiBatchedBindings<UINT> vsubuforigbindings;
QRhiBatchedBindings<UINT> vsubufoffsets;
QRhiBatchedBindings<UINT> vsubufsizes;
QRhiBatchedBindings<ID3D11Buffer *> fsubufs;
QRhiBatchedBindings<UINT> fsubuforigbindings;
QRhiBatchedBindings<UINT> fsubufoffsets;
QRhiBatchedBindings<UINT> fsubufsizes;
QRhiBatchedBindings<ID3D11Buffer *> csubufs;
QRhiBatchedBindings<UINT> csubuforigbindings;
QRhiBatchedBindings<UINT> csubufoffsets;
QRhiBatchedBindings<UINT> csubufsizes;
QRhiBatchedBindings<ID3D11SamplerState *> vssamplers;
QRhiBatchedBindings<ID3D11ShaderResourceView *> vsshaderresources;
QRhiBatchedBindings<ID3D11SamplerState *> fssamplers;
QRhiBatchedBindings<ID3D11ShaderResourceView *> fsshaderresources;
QRhiBatchedBindings<ID3D11SamplerState *> cssamplers;
QRhiBatchedBindings<ID3D11ShaderResourceView *> csshaderresources;
QRhiBatchedBindings<ID3D11UnorderedAccessView *> csUAVs;
friend class QRhiD3D11;
};
Q_DECLARE_TYPEINFO(QD3D11ShaderResourceBindings::BoundResourceData, Q_RELOCATABLE_TYPE);
struct QD3D11GraphicsPipeline : public QRhiGraphicsPipeline
{
QD3D11GraphicsPipeline(QRhiImplementation *rhi);
~QD3D11GraphicsPipeline();
void destroy() override;
bool create() override;
ID3D11DepthStencilState *dsState = nullptr;
ID3D11BlendState *blendState = nullptr;
struct {
ID3D11VertexShader *shader = nullptr;
QShader::NativeResourceBindingMap nativeResourceBindingMap;
} vs;
struct {
ID3D11PixelShader *shader = nullptr;
QShader::NativeResourceBindingMap nativeResourceBindingMap;
} fs;
ID3D11InputLayout *inputLayout = nullptr;
D3D11_PRIMITIVE_TOPOLOGY d3dTopology = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
ID3D11RasterizerState *rastState = nullptr;
uint generation = 0;
friend class QRhiD3D11;
};
struct QD3D11ComputePipeline : public QRhiComputePipeline
{
QD3D11ComputePipeline(QRhiImplementation *rhi);
~QD3D11ComputePipeline();
void destroy() override;
bool create() override;
struct {
ID3D11ComputeShader *shader = nullptr;
QShader::NativeResourceBindingMap nativeResourceBindingMap;
} cs;
uint generation = 0;
friend class QRhiD3D11;
};
struct QD3D11SwapChain;
struct QD3D11CommandBuffer : public QRhiCommandBuffer
{
QD3D11CommandBuffer(QRhiImplementation *rhi);
~QD3D11CommandBuffer();
void destroy() override;
// these must be kept at a reasonably low value otherwise sizeof Command explodes
static const int MAX_DYNAMIC_OFFSET_COUNT = 8;
static const int MAX_VERTEX_BUFFER_BINDING_COUNT = 8;
struct Command {
enum Cmd {
ResetShaderResources,
SetRenderTarget,
Clear,
Viewport,
Scissor,
BindVertexBuffers,
BindIndexBuffer,
BindGraphicsPipeline,
BindShaderResources,
StencilRef,
BlendConstants,
Draw,
DrawIndexed,
UpdateSubRes,
CopySubRes,
ResolveSubRes,
GenMip,
DebugMarkBegin,
DebugMarkEnd,
DebugMarkMsg,
BindComputePipeline,
Dispatch
};
enum ClearFlag { Color = 1, Depth = 2, Stencil = 4 };
Cmd cmd;
// QRhi*/QD3D11* references should be kept at minimum (so no
// QRhiTexture/Buffer/etc. pointers).
union Args {
struct {
QRhiRenderTarget *rt;
} setRenderTarget;
struct {
QRhiRenderTarget *rt;
int mask;
float c[4];
float d;
quint32 s;
} clear;
struct {
float x, y, w, h;
float d0, d1;
} viewport;
struct {
int x, y, w, h;
} scissor;
struct {
int startSlot;
int slotCount;
ID3D11Buffer *buffers[MAX_VERTEX_BUFFER_BINDING_COUNT];
UINT offsets[MAX_VERTEX_BUFFER_BINDING_COUNT];
UINT strides[MAX_VERTEX_BUFFER_BINDING_COUNT];
} bindVertexBuffers;
struct {
ID3D11Buffer *buffer;
quint32 offset;
DXGI_FORMAT format;
} bindIndexBuffer;
struct {
QD3D11GraphicsPipeline *ps;
} bindGraphicsPipeline;
struct {
QD3D11ShaderResourceBindings *srb;
bool offsetOnlyChange;
int dynamicOffsetCount;
uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT * 2]; // binding, offsetInConstants
} bindShaderResources;
struct {
QD3D11GraphicsPipeline *ps;
quint32 ref;
} stencilRef;
struct {
QD3D11GraphicsPipeline *ps;
float c[4];
} blendConstants;
struct {
QD3D11GraphicsPipeline *ps;
quint32 vertexCount;
quint32 instanceCount;
quint32 firstVertex;
quint32 firstInstance;
} draw;
struct {
QD3D11GraphicsPipeline *ps;
quint32 indexCount;
quint32 instanceCount;
quint32 firstIndex;
qint32 vertexOffset;
quint32 firstInstance;
} drawIndexed;
struct {
ID3D11Resource *dst;
UINT dstSubRes;
bool hasDstBox;
D3D11_BOX dstBox;
const void *src; // must come from retain*()
UINT srcRowPitch;
} updateSubRes;
struct {
ID3D11Resource *dst;
UINT dstSubRes;
UINT dstX;
UINT dstY;
UINT dstZ;
ID3D11Resource *src;
UINT srcSubRes;
bool hasSrcBox;
D3D11_BOX srcBox;
} copySubRes;
struct {
ID3D11Resource *dst;
UINT dstSubRes;
ID3D11Resource *src;
UINT srcSubRes;
DXGI_FORMAT format;
} resolveSubRes;
struct {
ID3D11ShaderResourceView *srv;
} genMip;
struct {
char s[64];
} debugMark;
struct {
QD3D11ComputePipeline *ps;
} bindComputePipeline;
struct {
UINT x;
UINT y;
UINT z;
} dispatch;
} args;
};
enum PassType {
NoPass,
RenderPass,
ComputePass
};
QRhiBackendCommandList<Command> commands;
PassType recordingPass;
QRhiRenderTarget *currentTarget;
QRhiGraphicsPipeline *currentGraphicsPipeline;
QRhiComputePipeline *currentComputePipeline;
uint currentPipelineGeneration;
QRhiShaderResourceBindings *currentGraphicsSrb;
QRhiShaderResourceBindings *currentComputeSrb;
uint currentSrbGeneration;
ID3D11Buffer *currentIndexBuffer;
quint32 currentIndexOffset;
DXGI_FORMAT currentIndexFormat;
ID3D11Buffer *currentVertexBuffers[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
quint32 currentVertexOffsets[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
QVarLengthArray<QByteArray, 4> dataRetainPool;
QVarLengthArray<QRhiBufferData, 4> bufferDataRetainPool;
QVarLengthArray<QImage, 4> imageRetainPool;
// relies heavily on implicit sharing (no copies of the actual data will be made)
const uchar *retainData(const QByteArray &data) {
dataRetainPool.append(data);
return reinterpret_cast<const uchar *>(dataRetainPool.last().constData());
}
const uchar *retainBufferData(const QRhiBufferData &data) {
bufferDataRetainPool.append(data);
return reinterpret_cast<const uchar *>(bufferDataRetainPool.last().constData());
}
const uchar *retainImage(const QImage &image) {
imageRetainPool.append(image);
return imageRetainPool.last().constBits();
}
void resetCommands() {
commands.reset();
dataRetainPool.clear();
bufferDataRetainPool.clear();
imageRetainPool.clear();
}
void resetState() {
recordingPass = NoPass;
currentTarget = nullptr;
resetCommands();
resetCachedState();
}
void resetCachedState() {
currentGraphicsPipeline = nullptr;
currentComputePipeline = nullptr;
currentPipelineGeneration = 0;
currentGraphicsSrb = nullptr;
currentComputeSrb = nullptr;
currentSrbGeneration = 0;
currentIndexBuffer = nullptr;
currentIndexOffset = 0;
currentIndexFormat = DXGI_FORMAT_R16_UINT;
memset(currentVertexBuffers, 0, sizeof(currentVertexBuffers));
memset(currentVertexOffsets, 0, sizeof(currentVertexOffsets));
}
};
struct QD3D11SwapChain : public QRhiSwapChain
{
QD3D11SwapChain(QRhiImplementation *rhi);
~QD3D11SwapChain();
void destroy() override;
QRhiCommandBuffer *currentFrameCommandBuffer() override;
QRhiRenderTarget *currentFrameRenderTarget() override;
QSize surfacePixelSize() override;
bool isFormatSupported(Format f) override;
QRhiSwapChainHdrInfo hdrInfo() override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
bool createOrResize() override;
void releaseBuffers();
bool newColorBuffer(const QSize &size, DXGI_FORMAT format, DXGI_SAMPLE_DESC sampleDesc,
ID3D11Texture2D **tex, ID3D11RenderTargetView **rtv) const;
QWindow *window = nullptr;
QSize pixelSize;
QD3D11SwapChainRenderTarget rt;
QD3D11CommandBuffer cb;
DXGI_FORMAT colorFormat;
DXGI_FORMAT srgbAdjustedColorFormat;
IDXGISwapChain *swapChain = nullptr;
UINT swapChainFlags = 0;
static const int BUFFER_COUNT = 2;
ID3D11Texture2D *backBufferTex;
ID3D11RenderTargetView *backBufferRtv;
ID3D11Texture2D *msaaTex[BUFFER_COUNT];
ID3D11RenderTargetView *msaaRtv[BUFFER_COUNT];
DXGI_SAMPLE_DESC sampleDesc;
int currentFrameSlot = 0;
int frameCount = 0;
QD3D11RenderBuffer *ds = nullptr;
bool timestampActive[BUFFER_COUNT];
ID3D11Query *timestampDisjointQuery[BUFFER_COUNT];
ID3D11Query *timestampQuery[BUFFER_COUNT * 2];
UINT swapInterval = 1;
};
class QRhiD3D11 : public QRhiImplementation
{
public:
QRhiD3D11(QRhiD3D11InitParams *params, QRhiD3D11NativeHandles *importDevice = nullptr);
bool create(QRhi::Flags flags) override;
void destroy() override;
QRhiGraphicsPipeline *createGraphicsPipeline() override;
QRhiComputePipeline *createComputePipeline() override;
QRhiShaderResourceBindings *createShaderResourceBindings() override;
QRhiBuffer *createBuffer(QRhiBuffer::Type type,
QRhiBuffer::UsageFlags usage,
int size) override;
QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
const QSize &pixelSize,
int sampleCount,
QRhiRenderBuffer::Flags flags,
QRhiTexture::Format backingFormatHint) override;
QRhiTexture *createTexture(QRhiTexture::Format format,
const QSize &pixelSize,
int depth,
int arraySize,
int sampleCount,
QRhiTexture::Flags flags) override;
QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
QRhiSampler::Filter minFilter,
QRhiSampler::Filter mipmapMode,
QRhiSampler:: AddressMode u,
QRhiSampler::AddressMode v,
QRhiSampler::AddressMode w) override;
QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
QRhiTextureRenderTarget::Flags flags) override;
QRhiSwapChain *createSwapChain() override;
QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
QRhi::FrameOpResult finish() override;
void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
void beginPass(QRhiCommandBuffer *cb,
QRhiRenderTarget *rt,
const QColor &colorClearValue,
const QRhiDepthStencilClearValue &depthStencilClearValue,
QRhiResourceUpdateBatch *resourceUpdates,
QRhiCommandBuffer::BeginPassFlags flags) override;
void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
void setGraphicsPipeline(QRhiCommandBuffer *cb,
QRhiGraphicsPipeline *ps) override;
void setShaderResources(QRhiCommandBuffer *cb,
QRhiShaderResourceBindings *srb,
int dynamicOffsetCount,
const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
void setVertexInput(QRhiCommandBuffer *cb,
int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
QRhiBuffer *indexBuf, quint32 indexOffset,
QRhiCommandBuffer::IndexFormat indexFormat) override;
void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
quint32 instanceCount, quint32 firstIndex,
qint32 vertexOffset, quint32 firstInstance) override;
void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
void debugMarkEnd(QRhiCommandBuffer *cb) override;
void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
void beginComputePass(QRhiCommandBuffer *cb,
QRhiResourceUpdateBatch *resourceUpdates,
QRhiCommandBuffer::BeginPassFlags flags) override;
void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
void beginExternal(QRhiCommandBuffer *cb) override;
void endExternal(QRhiCommandBuffer *cb) override;
QList<int> supportedSampleCounts() const override;
int ubufAlignment() const override;
bool isYUpInFramebuffer() const override;
bool isYUpInNDC() const override;
bool isClipDepthZeroToOne() const override;
QMatrix4x4 clipSpaceCorrMatrix() const override;
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
bool isFeatureSupported(QRhi::Feature feature) const override;
int resourceLimit(QRhi::ResourceLimit limit) const override;
const QRhiNativeHandles *nativeHandles() override;
QRhiDriverInfo driverInfo() const override;
QRhiMemAllocStats graphicsMemoryAllocationStatistics() override;
bool makeThreadLocalNativeContextCurrent() override;
void releaseCachedResources() override;
bool isDeviceLost() const override;
QByteArray pipelineCacheData() override;
void setPipelineCacheData(const QByteArray &data) override;
void enqueueSubresUpload(QD3D11Texture *texD, QD3D11CommandBuffer *cbD,
int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc);
void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates);
void updateShaderResourceBindings(QD3D11ShaderResourceBindings *srbD,
const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[]);
void executeBufferHostWrites(QD3D11Buffer *bufD);
void bindShaderResources(QD3D11ShaderResourceBindings *srbD,
const uint *dynOfsPairs, int dynOfsPairCount,
bool offsetOnlyChange);
void resetShaderResources();
void executeCommandBuffer(QD3D11CommandBuffer *cbD, QD3D11SwapChain *timestampSwapChain = nullptr);
DXGI_SAMPLE_DESC effectiveSampleCount(int sampleCount) const;
void finishActiveReadbacks();
void reportLiveObjects(ID3D11Device *device);
void clearShaderCache();
QByteArray compileHlslShaderSource(const QShader &shader, QShader::Variant shaderVariant, uint flags,
QString *error, QShaderKey *usedShaderKey);
QRhi::Flags rhiFlags;
bool debugLayer = false;
bool importedDeviceAndContext = false;
ID3D11Device *dev = nullptr;
ID3D11DeviceContext1 *context = nullptr;
D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL(0);
LUID adapterLuid = {};
ID3DUserDefinedAnnotation *annotations = nullptr;
IDXGIAdapter1 *activeAdapter = nullptr;
IDXGIFactory1 *dxgiFactory = nullptr;
bool supportsFlipSwapchain = false;
bool supportsAllowTearing = false;
bool forceFlipDiscard = false;
bool deviceLost = false;
QRhiD3D11NativeHandles nativeHandlesStruct;
QRhiDriverInfo driverInfoStruct;
struct {
int vsHighestActiveVertexBufferBinding = -1;
bool vsHasIndexBufferBound = false;
int vsHighestActiveSrvBinding = -1;
int fsHighestActiveSrvBinding = -1;
int csHighestActiveSrvBinding = -1;
int csHighestActiveUavBinding = -1;
QD3D11SwapChain *currentSwapChain = nullptr;
} contextState;
struct OffscreenFrame {
OffscreenFrame(QRhiImplementation *rhi) : cbWrapper(rhi) { }
bool active = false;
QD3D11CommandBuffer cbWrapper;
} ofr;
struct TextureReadback {
QRhiReadbackDescription desc;
QRhiReadbackResult *result;
ID3D11Texture2D *stagingTex;
quint32 byteSize;
quint32 bpl;
QSize pixelSize;
QRhiTexture::Format format;
};
QVarLengthArray<TextureReadback, 2> activeTextureReadbacks;
struct BufferReadback {
QRhiBufferReadbackResult *result;
quint32 byteSize;
ID3D11Buffer *stagingBuf;
};
QVarLengthArray<BufferReadback, 2> activeBufferReadbacks;
struct Shader {
Shader() = default;
Shader(IUnknown *s, const QByteArray &bytecode, const QShader::NativeResourceBindingMap &rbm)
: s(s), bytecode(bytecode), nativeResourceBindingMap(rbm) { }
IUnknown *s;
QByteArray bytecode;
QShader::NativeResourceBindingMap nativeResourceBindingMap;
};
QHash<QRhiShaderStage, Shader> m_shaderCache;
struct DeviceCurse {
DeviceCurse(QRhiD3D11 *impl) : q(impl) { }
QRhiD3D11 *q;
int framesToActivate = -1;
bool permanent = false;
int framesLeft = 0;
ID3D11ComputeShader *cs = nullptr;
void initResources();
void releaseResources();
void activate();
} deviceCurse;
// This is what gets exposed as the "pipeline cache", not that that concept
// applies anyway. Here we are just storing the DX bytecode for a shader so
// we can skip the HLSL->DXBC compilation when the QShader has HLSL source
// code and the same shader source has already been compiled before.
// m_shaderCache seemingly does the same, but this here does not care about
// the ID3D11*Shader, this is just about the bytecode and about allowing
// the data to be serialized to persistent storage and then reloaded in
// future runs of the app, or when creating another QRhi, etc.
struct BytecodeCacheKey {
QByteArray sourceHash;
QByteArray target;
QByteArray entryPoint;
uint compileFlags;
};
QHash<BytecodeCacheKey, QByteArray> m_bytecodeCache;
};
Q_DECLARE_TYPEINFO(QRhiD3D11::TextureReadback, Q_RELOCATABLE_TYPE);
Q_DECLARE_TYPEINFO(QRhiD3D11::BufferReadback, Q_RELOCATABLE_TYPE);
inline bool operator==(const QRhiD3D11::BytecodeCacheKey &a, const QRhiD3D11::BytecodeCacheKey &b) noexcept
{
return a.sourceHash == b.sourceHash
&& a.target == b.target
&& a.entryPoint == b.entryPoint
&& a.compileFlags == b.compileFlags;
}
inline bool operator!=(const QRhiD3D11::BytecodeCacheKey &a, const QRhiD3D11::BytecodeCacheKey &b) noexcept
{
return !(a == b);
}
inline size_t qHash(const QRhiD3D11::BytecodeCacheKey &k, size_t seed = 0) noexcept
{
return qHash(k.sourceHash, seed) ^ qHash(k.target) ^ qHash(k.entryPoint) ^ k.compileFlags;
}
QT_END_NAMESPACE
#endif

View File

@@ -1,47 +0,0 @@
// Copyright (C) 2019 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 QRHIGLES2_H
#define QRHIGLES2_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 <private/qrhi_p.h>
#include <QtGui/qsurfaceformat.h>
QT_BEGIN_NAMESPACE
class QOpenGLContext;
class QOffscreenSurface;
class QSurface;
class QWindow;
struct Q_GUI_EXPORT QRhiGles2InitParams : public QRhiInitParams
{
QRhiGles2InitParams();
QSurfaceFormat format;
QSurface *fallbackSurface = nullptr;
QWindow *window = nullptr;
QOpenGLContext *shareContext = nullptr;
static QOffscreenSurface *newFallbackSurface(const QSurfaceFormat &format = QSurfaceFormat::defaultFormat());
};
struct Q_GUI_EXPORT QRhiGles2NativeHandles : public QRhiNativeHandles
{
QOpenGLContext *context = nullptr;
};
QT_END_NAMESPACE
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,45 +0,0 @@
// Copyright (C) 2019 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 QRHIMETAL_H
#define QRHIMETAL_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 <private/qrhi_p.h>
Q_FORWARD_DECLARE_OBJC_CLASS(MTLDevice);
Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandQueue);
Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandBuffer);
Q_FORWARD_DECLARE_OBJC_CLASS(MTLRenderCommandEncoder);
QT_BEGIN_NAMESPACE
struct Q_GUI_EXPORT QRhiMetalInitParams : public QRhiInitParams
{
};
struct Q_GUI_EXPORT QRhiMetalNativeHandles : public QRhiNativeHandles
{
MTLDevice *dev = nullptr;
MTLCommandQueue *cmdQueue = nullptr;
};
struct Q_GUI_EXPORT QRhiMetalCommandBufferNativeHandles : public QRhiNativeHandles
{
MTLCommandBuffer *commandBuffer = nullptr;
MTLRenderCommandEncoder *encoder = nullptr;
};
QT_END_NAMESPACE
#endif

View File

@@ -1,466 +0,0 @@
// Copyright (C) 2019 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 QRHIMETAL_P_H
#define QRHIMETAL_P_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 "qrhimetal_p.h"
#include "qrhi_p_p.h"
#include <QWindow>
QT_BEGIN_NAMESPACE
static const int QMTL_FRAMES_IN_FLIGHT = 2;
// have to hide the ObjC stuff, this header cannot contain MTL* at all
struct QMetalBufferData;
struct QMetalBuffer : public QRhiBuffer
{
QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size);
~QMetalBuffer();
void destroy() override;
bool create() override;
QRhiBuffer::NativeBuffer nativeBuffer() override;
char *beginFullDynamicBufferUpdateForCurrentFrame() override;
void endFullDynamicBufferUpdateForCurrentFrame() override;
QMetalBufferData *d;
uint generation = 0;
int lastActiveFrameSlot = -1;
friend class QRhiMetal;
friend struct QMetalShaderResourceBindings;
};
struct QMetalRenderBufferData;
struct QMetalRenderBuffer : public QRhiRenderBuffer
{
QMetalRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
int sampleCount, QRhiRenderBuffer::Flags flags,
QRhiTexture::Format backingFormatHint);
~QMetalRenderBuffer();
void destroy() override;
bool create() override;
QRhiTexture::Format backingFormat() const override;
QMetalRenderBufferData *d;
int samples = 1;
uint generation = 0;
int lastActiveFrameSlot = -1;
friend class QRhiMetal;
};
struct QMetalTextureData;
struct QMetalTexture : public QRhiTexture
{
QMetalTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
int arraySize, int sampleCount, Flags flags);
~QMetalTexture();
void destroy() override;
bool create() override;
bool createFrom(NativeTexture src) override;
NativeTexture nativeTexture() override;
bool prepareCreate(QSize *adjustedSize = nullptr);
QMetalTextureData *d;
int mipLevelCount = 0;
int samples = 1;
uint generation = 0;
int lastActiveFrameSlot = -1;
friend class QRhiMetal;
friend struct QMetalShaderResourceBindings;
friend struct QMetalTextureData;
};
struct QMetalSamplerData;
struct QMetalSampler : public QRhiSampler
{
QMetalSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
AddressMode u, AddressMode v, AddressMode w);
~QMetalSampler();
void destroy() override;
bool create() override;
QMetalSamplerData *d;
uint generation = 0;
int lastActiveFrameSlot = -1;
friend class QRhiMetal;
friend struct QMetalShaderResourceBindings;
};
struct QMetalRenderPassDescriptor : public QRhiRenderPassDescriptor
{
QMetalRenderPassDescriptor(QRhiImplementation *rhi);
~QMetalRenderPassDescriptor();
void destroy() override;
bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() const override;
QVector<quint32> serializedFormat() const override;
void updateSerializedFormat();
// there is no MTLRenderPassDescriptor here as one will be created for each pass in beginPass()
// but the things needed for the render pipeline descriptor have to be provided
static const int MAX_COLOR_ATTACHMENTS = 8;
int colorAttachmentCount = 0;
bool hasDepthStencil = false;
int colorFormat[MAX_COLOR_ATTACHMENTS];
int dsFormat;
QVector<quint32> serializedFormatData;
};
struct QMetalRenderTargetData;
struct QMetalSwapChainRenderTarget : public QRhiSwapChainRenderTarget
{
QMetalSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
~QMetalSwapChainRenderTarget();
void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
int sampleCount() const override;
QMetalRenderTargetData *d;
};
struct QMetalTextureRenderTarget : public QRhiTextureRenderTarget
{
QMetalTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
~QMetalTextureRenderTarget();
void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
int sampleCount() const override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
bool create() override;
QMetalRenderTargetData *d;
friend class QRhiMetal;
};
struct QMetalShaderResourceBindings : public QRhiShaderResourceBindings
{
QMetalShaderResourceBindings(QRhiImplementation *rhi);
~QMetalShaderResourceBindings();
void destroy() override;
bool create() override;
void updateResources(UpdateFlags flags) override;
QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
int maxBinding = -1;
struct BoundUniformBufferData {
quint64 id;
uint generation;
};
struct BoundSampledTextureData {
int count;
struct {
quint64 texId;
uint texGeneration;
quint64 samplerId;
uint samplerGeneration;
} d[QRhiShaderResourceBinding::Data::MAX_TEX_SAMPLER_ARRAY_SIZE];
};
struct BoundStorageImageData {
quint64 id;
uint generation;
};
struct BoundStorageBufferData {
quint64 id;
uint generation;
};
struct BoundResourceData {
union {
BoundUniformBufferData ubuf;
BoundSampledTextureData stex;
BoundStorageImageData simage;
BoundStorageBufferData sbuf;
};
};
QVarLengthArray<BoundResourceData, 8> boundResourceData;
uint generation = 0;
friend class QRhiMetal;
};
struct QMetalGraphicsPipelineData;
struct QMetalGraphicsPipeline : public QRhiGraphicsPipeline
{
QMetalGraphicsPipeline(QRhiImplementation *rhi);
~QMetalGraphicsPipeline();
void destroy() override;
bool create() override;
QMetalGraphicsPipelineData *d;
uint generation = 0;
int lastActiveFrameSlot = -1;
friend class QRhiMetal;
};
struct QMetalComputePipelineData;
struct QMetalComputePipeline : public QRhiComputePipeline
{
QMetalComputePipeline(QRhiImplementation *rhi);
~QMetalComputePipeline();
void destroy() override;
bool create() override;
QMetalComputePipelineData *d;
uint generation = 0;
int lastActiveFrameSlot = -1;
friend class QRhiMetal;
};
struct QMetalCommandBufferData;
struct QMetalSwapChain;
struct QMetalCommandBuffer : public QRhiCommandBuffer
{
QMetalCommandBuffer(QRhiImplementation *rhi);
~QMetalCommandBuffer();
void destroy() override;
QMetalCommandBufferData *d = nullptr;
QRhiMetalCommandBufferNativeHandles nativeHandlesStruct;
enum PassType {
NoPass,
RenderPass,
ComputePass
};
// per-pass (render or compute command encoder) persistent state
PassType recordingPass;
QRhiRenderTarget *currentTarget;
// per-pass (render or compute command encoder) volatile (cached) state
QRhiGraphicsPipeline *currentGraphicsPipeline;
QRhiComputePipeline *currentComputePipeline;
uint currentPipelineGeneration;
QRhiShaderResourceBindings *currentGraphicsSrb;
QRhiShaderResourceBindings *currentComputeSrb;
uint currentSrbGeneration;
int currentResSlot;
QRhiBuffer *currentIndexBuffer;
quint32 currentIndexOffset;
QRhiCommandBuffer::IndexFormat currentIndexFormat;
int currentCullMode;
int currentTriangleFillMode;
int currentFrontFaceWinding;
QPair<float, float> currentDepthBiasValues;
const QRhiNativeHandles *nativeHandles();
void resetState();
void resetPerPassState();
void resetPerPassCachedState();
};
struct QMetalSwapChainData;
struct QMetalSwapChain : public QRhiSwapChain
{
QMetalSwapChain(QRhiImplementation *rhi);
~QMetalSwapChain();
void destroy() override;
QRhiCommandBuffer *currentFrameCommandBuffer() override;
QRhiRenderTarget *currentFrameRenderTarget() override;
QSize surfacePixelSize() override;
bool isFormatSupported(Format f) override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
bool createOrResize() override;
virtual QRhiSwapChainHdrInfo hdrInfo() override;
void chooseFormats();
QWindow *window = nullptr;
QSize pixelSize;
int currentFrameSlot = 0; // 0..QMTL_FRAMES_IN_FLIGHT-1
int frameCount = 0;
int samples = 1;
QMetalSwapChainRenderTarget rtWrapper;
QMetalCommandBuffer cbWrapper;
QMetalRenderBuffer *ds = nullptr;
QMetalSwapChainData *d = nullptr;
};
struct QRhiMetalData;
class QRhiMetal : public QRhiImplementation
{
public:
QRhiMetal(QRhiMetalInitParams *params, QRhiMetalNativeHandles *importDevice = nullptr);
~QRhiMetal();
static bool probe(QRhiMetalInitParams *params);
bool create(QRhi::Flags flags) override;
void destroy() override;
QRhiGraphicsPipeline *createGraphicsPipeline() override;
QRhiComputePipeline *createComputePipeline() override;
QRhiShaderResourceBindings *createShaderResourceBindings() override;
QRhiBuffer *createBuffer(QRhiBuffer::Type type,
QRhiBuffer::UsageFlags usage,
int size) override;
QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
const QSize &pixelSize,
int sampleCount,
QRhiRenderBuffer::Flags flags,
QRhiTexture::Format backingFormatHint) override;
QRhiTexture *createTexture(QRhiTexture::Format format,
const QSize &pixelSize,
int depth,
int arraySize,
int sampleCount,
QRhiTexture::Flags flags) override;
QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
QRhiSampler::Filter minFilter,
QRhiSampler::Filter mipmapMode,
QRhiSampler:: AddressMode u,
QRhiSampler::AddressMode v,
QRhiSampler::AddressMode w) override;
QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
QRhiTextureRenderTarget::Flags flags) override;
QRhiSwapChain *createSwapChain() override;
QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
QRhi::FrameOpResult finish() override;
void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
void beginPass(QRhiCommandBuffer *cb,
QRhiRenderTarget *rt,
const QColor &colorClearValue,
const QRhiDepthStencilClearValue &depthStencilClearValue,
QRhiResourceUpdateBatch *resourceUpdates,
QRhiCommandBuffer::BeginPassFlags flags) override;
void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
void setGraphicsPipeline(QRhiCommandBuffer *cb,
QRhiGraphicsPipeline *ps) override;
void setShaderResources(QRhiCommandBuffer *cb,
QRhiShaderResourceBindings *srb,
int dynamicOffsetCount,
const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
void setVertexInput(QRhiCommandBuffer *cb,
int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
QRhiBuffer *indexBuf, quint32 indexOffset,
QRhiCommandBuffer::IndexFormat indexFormat) override;
void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
quint32 instanceCount, quint32 firstIndex,
qint32 vertexOffset, quint32 firstInstance) override;
void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
void debugMarkEnd(QRhiCommandBuffer *cb) override;
void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
void beginComputePass(QRhiCommandBuffer *cb,
QRhiResourceUpdateBatch *resourceUpdates,
QRhiCommandBuffer::BeginPassFlags flags) override;
void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
void beginExternal(QRhiCommandBuffer *cb) override;
void endExternal(QRhiCommandBuffer *cb) override;
QList<int> supportedSampleCounts() const override;
int ubufAlignment() const override;
bool isYUpInFramebuffer() const override;
bool isYUpInNDC() const override;
bool isClipDepthZeroToOne() const override;
QMatrix4x4 clipSpaceCorrMatrix() const override;
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
bool isFeatureSupported(QRhi::Feature feature) const override;
int resourceLimit(QRhi::ResourceLimit limit) const override;
const QRhiNativeHandles *nativeHandles() override;
QRhiDriverInfo driverInfo() const override;
QRhiMemAllocStats graphicsMemoryAllocationStatistics() override;
bool makeThreadLocalNativeContextCurrent() override;
void releaseCachedResources() override;
bool isDeviceLost() const override;
QByteArray pipelineCacheData() override;
void setPipelineCacheData(const QByteArray &data) override;
void executeDeferredReleases(bool forced = false);
void finishActiveReadbacks(bool forced = false);
qsizetype subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const;
void enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEncPtr,
int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc,
qsizetype *curOfs);
void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates);
void executeBufferHostWritesForSlot(QMetalBuffer *bufD, int slot);
void executeBufferHostWritesForCurrentFrame(QMetalBuffer *bufD);
static const int SUPPORTED_STAGES = 3;
void enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD,
QMetalCommandBuffer *cbD,
int dynamicOffsetCount,
const QRhiCommandBuffer::DynamicOffset *dynamicOffsets,
bool offsetOnlyChange,
const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[SUPPORTED_STAGES]);
int effectiveSampleCount(int sampleCount) const;
bool importedDevice = false;
bool importedCmdQueue = false;
QMetalSwapChain *currentSwapChain = nullptr;
QSet<QMetalSwapChain *> swapchains;
QRhiMetalNativeHandles nativeHandlesStruct;
QRhiDriverInfo driverInfoStruct;
struct {
int maxTextureSize = 4096;
bool baseVertexAndInstance = true;
QVector<int> supportedSampleCounts;
bool isAppleGPU = false;
int maxThreadGroupSize = 512;
} caps;
QRhiMetalData *d = nullptr;
};
QT_END_NAMESPACE
#endif

View File

@@ -1,995 +0,0 @@
// Copyright (C) 2019 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 QRHIVULKAN_P_H
#define QRHIVULKAN_P_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 "qrhivulkan_p.h"
#include "qrhi_p_p.h"
QT_BEGIN_NAMESPACE
class QVulkanFunctions;
class QVulkanDeviceFunctions;
static const int QVK_FRAMES_IN_FLIGHT = 2;
static const int QVK_DESC_SETS_PER_POOL = 128;
static const int QVK_UNIFORM_BUFFERS_PER_POOL = 256;
static const int QVK_COMBINED_IMAGE_SAMPLERS_PER_POOL = 256;
static const int QVK_STORAGE_BUFFERS_PER_POOL = 128;
static const int QVK_STORAGE_IMAGES_PER_POOL = 128;
static const int QVK_MAX_ACTIVE_TIMESTAMP_PAIRS = 16;
// no vk_mem_alloc.h available here, void* is good enough
typedef void * QVkAlloc;
typedef void * QVkAllocator;
struct QVkBuffer : public QRhiBuffer
{
QVkBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, int size);
~QVkBuffer();
void destroy() override;
bool create() override;
QRhiBuffer::NativeBuffer nativeBuffer() override;
char *beginFullDynamicBufferUpdateForCurrentFrame() override;
void endFullDynamicBufferUpdateForCurrentFrame() override;
VkBuffer buffers[QVK_FRAMES_IN_FLIGHT];
QVkAlloc allocations[QVK_FRAMES_IN_FLIGHT];
struct DynamicUpdate {
int offset;
QRhiBufferData data;
};
QVarLengthArray<DynamicUpdate, 16> pendingDynamicUpdates[QVK_FRAMES_IN_FLIGHT];
VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
struct UsageState {
VkAccessFlags access = 0;
VkPipelineStageFlags stage = 0;
};
UsageState usageState[QVK_FRAMES_IN_FLIGHT];
int lastActiveFrameSlot = -1;
uint generation = 0;
friend class QRhiVulkan;
};
Q_DECLARE_TYPEINFO(QVkBuffer::DynamicUpdate, Q_RELOCATABLE_TYPE);
struct QVkTexture;
struct QVkRenderBuffer : public QRhiRenderBuffer
{
QVkRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
int sampleCount, Flags flags,
QRhiTexture::Format backingFormatHint);
~QVkRenderBuffer();
void destroy() override;
bool create() override;
QRhiTexture::Format backingFormat() const override;
VkDeviceMemory memory = VK_NULL_HANDLE;
VkImage image = VK_NULL_HANDLE;
VkImageView imageView = VK_NULL_HANDLE;
VkSampleCountFlagBits samples;
QVkTexture *backingTexture = nullptr;
VkFormat vkformat;
int lastActiveFrameSlot = -1;
uint generation = 0;
friend class QRhiVulkan;
};
struct QVkTexture : public QRhiTexture
{
QVkTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
int arraySize, int sampleCount, Flags flags);
~QVkTexture();
void destroy() override;
bool create() override;
bool createFrom(NativeTexture src) override;
NativeTexture nativeTexture() override;
void setNativeLayout(int layout) override;
bool prepareCreate(QSize *adjustedSize = nullptr);
bool finishCreate();
VkImageView imageViewForLevel(int level);
VkImage image = VK_NULL_HANDLE;
VkImageView imageView = VK_NULL_HANDLE;
QVkAlloc imageAlloc = nullptr;
VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
VkImageView perLevelImageViews[QRhi::MAX_MIP_LEVELS];
bool owns = true;
struct UsageState {
// no tracking of subresource layouts (some operations can keep
// subresources in different layouts for some time, but that does not
// need to be kept track of)
VkImageLayout layout;
VkAccessFlags access;
VkPipelineStageFlags stage;
};
UsageState usageState;
VkFormat vkformat;
uint mipLevelCount = 0;
VkSampleCountFlagBits samples;
int lastActiveFrameSlot = -1;
uint generation = 0;
friend class QRhiVulkan;
};
struct QVkSampler : public QRhiSampler
{
QVkSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
AddressMode u, AddressMode v, AddressMode w);
~QVkSampler();
void destroy() override;
bool create() override;
VkSampler sampler = VK_NULL_HANDLE;
int lastActiveFrameSlot = -1;
uint generation = 0;
friend class QRhiVulkan;
};
struct QVkRenderPassDescriptor : public QRhiRenderPassDescriptor
{
QVkRenderPassDescriptor(QRhiImplementation *rhi);
~QVkRenderPassDescriptor();
void destroy() override;
bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() const override;
QVector<quint32> serializedFormat() const override;
const QRhiNativeHandles *nativeHandles() override;
void updateSerializedFormat();
VkRenderPass rp = VK_NULL_HANDLE;
bool ownsRp = false;
QVarLengthArray<VkAttachmentDescription, 8> attDescs;
QVarLengthArray<VkAttachmentReference, 8> colorRefs;
QVarLengthArray<VkAttachmentReference, 8> resolveRefs;
QVarLengthArray<VkSubpassDependency, 2> subpassDeps;
bool hasDepthStencil = false;
VkAttachmentReference dsRef;
QVector<quint32> serializedFormatData;
QRhiVulkanRenderPassNativeHandles nativeHandlesStruct;
int lastActiveFrameSlot = -1;
};
struct QVkRenderTargetData
{
VkFramebuffer fb = VK_NULL_HANDLE;
QVkRenderPassDescriptor *rp = nullptr;
QSize pixelSize;
float dpr = 1;
int sampleCount = 1;
int colorAttCount = 0;
int dsAttCount = 0;
int resolveAttCount = 0;
QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList;
static const int MAX_COLOR_ATTACHMENTS = 8;
};
struct QVkSwapChainRenderTarget : public QRhiSwapChainRenderTarget
{
QVkSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
~QVkSwapChainRenderTarget();
void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
int sampleCount() const override;
QVkRenderTargetData d;
};
struct QVkTextureRenderTarget : public QRhiTextureRenderTarget
{
QVkTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
~QVkTextureRenderTarget();
void destroy() override;
QSize pixelSize() const override;
float devicePixelRatio() const override;
int sampleCount() const override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
bool create() override;
QVkRenderTargetData d;
VkImageView rtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS];
VkImageView resrtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS];
int lastActiveFrameSlot = -1;
friend class QRhiVulkan;
};
struct QVkShaderResourceBindings : public QRhiShaderResourceBindings
{
QVkShaderResourceBindings(QRhiImplementation *rhi);
~QVkShaderResourceBindings();
void destroy() override;
bool create() override;
void updateResources(UpdateFlags flags) override;
QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
bool hasSlottedResource = false;
bool hasDynamicOffset = false;
int poolIndex = -1;
VkDescriptorSetLayout layout = VK_NULL_HANDLE;
VkDescriptorSet descSets[QVK_FRAMES_IN_FLIGHT]; // multiple sets to support dynamic buffers
int lastActiveFrameSlot = -1;
uint generation = 0;
// Keep track of the generation number of each referenced QRhi* to be able
// to detect that the underlying descriptor set became out of date and they
// need to be written again with the up-to-date VkBuffer etc. objects.
struct BoundUniformBufferData {
quint64 id;
uint generation;
};
struct BoundSampledTextureData {
int count;
struct {
quint64 texId;
uint texGeneration;
quint64 samplerId;
uint samplerGeneration;
} d[QRhiShaderResourceBinding::Data::MAX_TEX_SAMPLER_ARRAY_SIZE];
};
struct BoundStorageImageData {
quint64 id;
uint generation;
};
struct BoundStorageBufferData {
quint64 id;
uint generation;
};
struct BoundResourceData {
union {
BoundUniformBufferData ubuf;
BoundSampledTextureData stex;
BoundStorageImageData simage;
BoundStorageBufferData sbuf;
};
};
QVarLengthArray<BoundResourceData, 8> boundResourceData[QVK_FRAMES_IN_FLIGHT];
friend class QRhiVulkan;
};
Q_DECLARE_TYPEINFO(QVkShaderResourceBindings::BoundResourceData, Q_RELOCATABLE_TYPE);
struct QVkGraphicsPipeline : public QRhiGraphicsPipeline
{
QVkGraphicsPipeline(QRhiImplementation *rhi);
~QVkGraphicsPipeline();
void destroy() override;
bool create() override;
VkPipelineLayout layout = VK_NULL_HANDLE;
VkPipeline pipeline = VK_NULL_HANDLE;
int lastActiveFrameSlot = -1;
uint generation = 0;
friend class QRhiVulkan;
};
struct QVkComputePipeline : public QRhiComputePipeline
{
QVkComputePipeline(QRhiImplementation *rhi);
~QVkComputePipeline();
void destroy() override;
bool create() override;
VkPipelineLayout layout = VK_NULL_HANDLE;
VkPipeline pipeline = VK_NULL_HANDLE;
int lastActiveFrameSlot = -1;
uint generation = 0;
friend class QRhiVulkan;
};
struct QVkCommandBuffer : public QRhiCommandBuffer
{
QVkCommandBuffer(QRhiImplementation *rhi);
~QVkCommandBuffer();
void destroy() override;
const QRhiNativeHandles *nativeHandles();
VkCommandBuffer cb = VK_NULL_HANDLE; // primary
QRhiVulkanCommandBufferNativeHandles nativeHandlesStruct;
enum PassType {
NoPass,
RenderPass,
ComputePass
};
void resetState() {
recordingPass = NoPass;
passUsesSecondaryCb = false;
currentTarget = nullptr;
activeSecondaryCbStack.clear();
resetCommands();
resetCachedState();
}
void resetCachedState() {
currentGraphicsPipeline = nullptr;
currentComputePipeline = nullptr;
currentPipelineGeneration = 0;
currentGraphicsSrb = nullptr;
currentComputeSrb = nullptr;
currentSrbGeneration = 0;
currentDescSetSlot = -1;
currentIndexBuffer = VK_NULL_HANDLE;
currentIndexOffset = 0;
currentIndexFormat = VK_INDEX_TYPE_UINT16;
memset(currentVertexBuffers, 0, sizeof(currentVertexBuffers));
memset(currentVertexOffsets, 0, sizeof(currentVertexOffsets));
inExternal = false;
}
PassType recordingPass;
bool passUsesSecondaryCb;
QRhiRenderTarget *currentTarget;
QRhiGraphicsPipeline *currentGraphicsPipeline;
QRhiComputePipeline *currentComputePipeline;
uint currentPipelineGeneration;
QRhiShaderResourceBindings *currentGraphicsSrb;
QRhiShaderResourceBindings *currentComputeSrb;
uint currentSrbGeneration;
int currentDescSetSlot;
VkBuffer currentIndexBuffer;
quint32 currentIndexOffset;
VkIndexType currentIndexFormat;
static const int VERTEX_INPUT_RESOURCE_SLOT_COUNT = 32;
VkBuffer currentVertexBuffers[VERTEX_INPUT_RESOURCE_SLOT_COUNT];
quint32 currentVertexOffsets[VERTEX_INPUT_RESOURCE_SLOT_COUNT];
QVarLengthArray<VkCommandBuffer, 4> activeSecondaryCbStack;
bool inExternal;
struct {
QHash<QRhiResource *, QPair<VkAccessFlags, bool> > writtenResources;
void reset() {
writtenResources.clear();
}
} computePassState;
struct Command {
enum Cmd {
CopyBuffer,
CopyBufferToImage,
CopyImage,
CopyImageToBuffer,
ImageBarrier,
BufferBarrier,
BlitImage,
BeginRenderPass,
EndRenderPass,
BindPipeline,
BindDescriptorSet,
BindVertexBuffer,
BindIndexBuffer,
SetViewport,
SetScissor,
SetBlendConstants,
SetStencilRef,
Draw,
DrawIndexed,
DebugMarkerBegin,
DebugMarkerEnd,
DebugMarkerInsert,
TransitionPassResources,
Dispatch,
ExecuteSecondary
};
Cmd cmd;
union Args {
struct {
VkBuffer src;
VkBuffer dst;
VkBufferCopy desc;
} copyBuffer;
struct {
VkBuffer src;
VkImage dst;
VkImageLayout dstLayout;
int count;
int bufferImageCopyIndex;
} copyBufferToImage;
struct {
VkImage src;
VkImageLayout srcLayout;
VkImage dst;
VkImageLayout dstLayout;
VkImageCopy desc;
} copyImage;
struct {
VkImage src;
VkImageLayout srcLayout;
VkBuffer dst;
VkBufferImageCopy desc;
} copyImageToBuffer;
struct {
VkPipelineStageFlags srcStageMask;
VkPipelineStageFlags dstStageMask;
int count;
int index;
} imageBarrier;
struct {
VkPipelineStageFlags srcStageMask;
VkPipelineStageFlags dstStageMask;
int count;
int index;
} bufferBarrier;
struct {
VkImage src;
VkImageLayout srcLayout;
VkImage dst;
VkImageLayout dstLayout;
VkFilter filter;
VkImageBlit desc;
} blitImage;
struct {
VkRenderPassBeginInfo desc;
int clearValueIndex;
bool useSecondaryCb;
} beginRenderPass;
struct {
} endRenderPass;
struct {
VkPipelineBindPoint bindPoint;
VkPipeline pipeline;
} bindPipeline;
struct {
VkPipelineBindPoint bindPoint;
VkPipelineLayout pipelineLayout;
VkDescriptorSet descSet;
int dynamicOffsetCount;
int dynamicOffsetIndex;
} bindDescriptorSet;
struct {
int startBinding;
int count;
int vertexBufferIndex;
int vertexBufferOffsetIndex;
} bindVertexBuffer;
struct {
VkBuffer buf;
VkDeviceSize ofs;
VkIndexType type;
} bindIndexBuffer;
struct {
VkViewport viewport;
} setViewport;
struct {
VkRect2D scissor;
} setScissor;
struct {
float c[4];
} setBlendConstants;
struct {
uint32_t ref;
} setStencilRef;
struct {
uint32_t vertexCount;
uint32_t instanceCount;
uint32_t firstVertex;
uint32_t firstInstance;
} draw;
struct {
uint32_t indexCount;
uint32_t instanceCount;
uint32_t firstIndex;
int32_t vertexOffset;
uint32_t firstInstance;
} drawIndexed;
struct {
VkDebugMarkerMarkerInfoEXT marker;
int markerNameIndex;
} debugMarkerBegin;
struct {
} debugMarkerEnd;
struct {
VkDebugMarkerMarkerInfoEXT marker;
int markerNameIndex;
} debugMarkerInsert;
struct {
int trackerIndex;
} transitionResources;
struct {
int x, y, z;
} dispatch;
struct {
VkCommandBuffer cb;
} executeSecondary;
} args;
};
QRhiBackendCommandList<Command> commands;
QVarLengthArray<QRhiPassResourceTracker, 8> passResTrackers;
int currentPassResTrackerIndex;
void resetCommands() {
commands.reset();
resetPools();
passResTrackers.clear();
currentPassResTrackerIndex = -1;
}
void resetPools() {
pools.clearValue.clear();
pools.bufferImageCopy.clear();
pools.dynamicOffset.clear();
pools.vertexBuffer.clear();
pools.vertexBufferOffset.clear();
pools.debugMarkerData.clear();
pools.imageBarrier.clear();
pools.bufferBarrier.clear();
}
struct {
QVarLengthArray<VkClearValue, 4> clearValue;
QVarLengthArray<VkBufferImageCopy, 16> bufferImageCopy;
QVarLengthArray<uint32_t, 4> dynamicOffset;
QVarLengthArray<VkBuffer, 4> vertexBuffer;
QVarLengthArray<VkDeviceSize, 4> vertexBufferOffset;
QVarLengthArray<QByteArray, 4> debugMarkerData;
QVarLengthArray<VkImageMemoryBarrier, 8> imageBarrier;
QVarLengthArray<VkBufferMemoryBarrier, 8> bufferBarrier;
} pools;
friend class QRhiVulkan;
};
struct QVkSwapChain : public QRhiSwapChain
{
QVkSwapChain(QRhiImplementation *rhi);
~QVkSwapChain();
void destroy() override;
QRhiCommandBuffer *currentFrameCommandBuffer() override;
QRhiRenderTarget *currentFrameRenderTarget() override;
QSize surfacePixelSize() override;
bool isFormatSupported(Format f) override;
QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() override;
bool createOrResize() override;
bool ensureSurface();
static const quint32 EXPECTED_MAX_BUFFER_COUNT = 4;
QWindow *window = nullptr;
QSize pixelSize;
bool supportsReadback = false;
VkSwapchainKHR sc = VK_NULL_HANDLE;
int bufferCount = 0;
VkSurfaceKHR surface = VK_NULL_HANDLE;
VkSurfaceKHR lastConnectedSurface = VK_NULL_HANDLE;
VkFormat colorFormat = VK_FORMAT_B8G8R8A8_UNORM;
VkColorSpaceKHR colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
QVkRenderBuffer *ds = nullptr;
VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT;
QVarLengthArray<VkPresentModeKHR, 8> supportedPresentationModes;
VkDeviceMemory msaaImageMem = VK_NULL_HANDLE;
QVkSwapChainRenderTarget rtWrapper;
QVkCommandBuffer cbWrapper;
struct ImageResources {
VkImage image = VK_NULL_HANDLE;
VkImageView imageView = VK_NULL_HANDLE;
VkFramebuffer fb = VK_NULL_HANDLE;
VkImage msaaImage = VK_NULL_HANDLE;
VkImageView msaaImageView = VK_NULL_HANDLE;
enum LastUse {
ScImageUseNone,
ScImageUseRender,
ScImageUseTransferSource
};
LastUse lastUse = ScImageUseNone;
};
QVarLengthArray<ImageResources, EXPECTED_MAX_BUFFER_COUNT> imageRes;
struct FrameResources {
VkFence imageFence = VK_NULL_HANDLE;
bool imageFenceWaitable = false;
VkSemaphore imageSem = VK_NULL_HANDLE;
VkSemaphore drawSem = VK_NULL_HANDLE;
bool imageAcquired = false;
bool imageSemWaitable = false;
VkFence cmdFence = VK_NULL_HANDLE;
bool cmdFenceWaitable = false;
VkCommandBuffer cmdBuf = VK_NULL_HANDLE; // primary
int timestampQueryIndex = -1;
} frameRes[QVK_FRAMES_IN_FLIGHT];
quint32 currentImageIndex = 0; // index in imageRes
quint32 currentFrameSlot = 0; // index in frameRes
int frameCount = 0;
friend class QRhiVulkan;
};
class QRhiVulkan : public QRhiImplementation
{
public:
QRhiVulkan(QRhiVulkanInitParams *params, QRhiVulkanNativeHandles *importParams = nullptr);
bool create(QRhi::Flags flags) override;
void destroy() override;
QRhiGraphicsPipeline *createGraphicsPipeline() override;
QRhiComputePipeline *createComputePipeline() override;
QRhiShaderResourceBindings *createShaderResourceBindings() override;
QRhiBuffer *createBuffer(QRhiBuffer::Type type,
QRhiBuffer::UsageFlags usage,
int size) override;
QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
const QSize &pixelSize,
int sampleCount,
QRhiRenderBuffer::Flags flags,
QRhiTexture::Format backingFormatHint) override;
QRhiTexture *createTexture(QRhiTexture::Format format,
const QSize &pixelSize,
int depth,
int arraySize,
int sampleCount,
QRhiTexture::Flags flags) override;
QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
QRhiSampler::Filter minFilter,
QRhiSampler::Filter mipmapMode,
QRhiSampler:: AddressMode u,
QRhiSampler::AddressMode v,
QRhiSampler::AddressMode w) override;
QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
QRhiTextureRenderTarget::Flags flags) override;
QRhiSwapChain *createSwapChain() override;
QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
QRhi::FrameOpResult finish() override;
void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
void beginPass(QRhiCommandBuffer *cb,
QRhiRenderTarget *rt,
const QColor &colorClearValue,
const QRhiDepthStencilClearValue &depthStencilClearValue,
QRhiResourceUpdateBatch *resourceUpdates,
QRhiCommandBuffer::BeginPassFlags flags) override;
void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
void setGraphicsPipeline(QRhiCommandBuffer *cb,
QRhiGraphicsPipeline *ps) override;
void setShaderResources(QRhiCommandBuffer *cb,
QRhiShaderResourceBindings *srb,
int dynamicOffsetCount,
const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
void setVertexInput(QRhiCommandBuffer *cb,
int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
QRhiBuffer *indexBuf, quint32 indexOffset,
QRhiCommandBuffer::IndexFormat indexFormat) override;
void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
quint32 instanceCount, quint32 firstIndex,
qint32 vertexOffset, quint32 firstInstance) override;
void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
void debugMarkEnd(QRhiCommandBuffer *cb) override;
void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
void beginComputePass(QRhiCommandBuffer *cb,
QRhiResourceUpdateBatch *resourceUpdates,
QRhiCommandBuffer::BeginPassFlags flags) override;
void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
void beginExternal(QRhiCommandBuffer *cb) override;
void endExternal(QRhiCommandBuffer *cb) override;
QList<int> supportedSampleCounts() const override;
int ubufAlignment() const override;
bool isYUpInFramebuffer() const override;
bool isYUpInNDC() const override;
bool isClipDepthZeroToOne() const override;
QMatrix4x4 clipSpaceCorrMatrix() const override;
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
bool isFeatureSupported(QRhi::Feature feature) const override;
int resourceLimit(QRhi::ResourceLimit limit) const override;
const QRhiNativeHandles *nativeHandles() override;
QRhiDriverInfo driverInfo() const override;
QRhiMemAllocStats graphicsMemoryAllocationStatistics() override;
bool makeThreadLocalNativeContextCurrent() override;
void releaseCachedResources() override;
bool isDeviceLost() const override;
QByteArray pipelineCacheData() override;
void setPipelineCacheData(const QByteArray &data) override;
VkResult createDescriptorPool(VkDescriptorPool *pool);
bool allocateDescriptorSet(VkDescriptorSetAllocateInfo *allocInfo, VkDescriptorSet *result, int *resultPoolIndex);
uint32_t chooseTransientImageMemType(VkImage img, uint32_t startIndex);
bool createTransientImage(VkFormat format, const QSize &pixelSize, VkImageUsageFlags usage,
VkImageAspectFlags aspectMask, VkSampleCountFlagBits samples,
VkDeviceMemory *mem, VkImage *images, VkImageView *views, int count);
bool recreateSwapChain(QRhiSwapChain *swapChain);
void releaseSwapChainResources(QRhiSwapChain *swapChain);
VkFormat optimalDepthStencilFormat();
VkSampleCountFlagBits effectiveSampleCount(int sampleCount);
bool createDefaultRenderPass(QVkRenderPassDescriptor *rpD,
bool hasDepthStencil,
VkSampleCountFlagBits samples,
VkFormat colorFormat);
bool createOffscreenRenderPass(QVkRenderPassDescriptor *rpD,
const QRhiColorAttachment *firstColorAttachment,
const QRhiColorAttachment *lastColorAttachment,
bool preserveColor,
bool preserveDs,
QRhiRenderBuffer *depthStencilBuffer,
QRhiTexture *depthTexture);
bool ensurePipelineCache(const void *initialData = nullptr, size_t initialDataSize = 0);
VkShaderModule createShader(const QByteArray &spirv);
void prepareNewFrame(QRhiCommandBuffer *cb);
VkCommandBuffer startSecondaryCommandBuffer(QVkRenderTargetData *rtD = nullptr);
void endAndEnqueueSecondaryCommandBuffer(VkCommandBuffer cb, QVkCommandBuffer *cbD);
QRhi::FrameOpResult startPrimaryCommandBuffer(VkCommandBuffer *cb);
QRhi::FrameOpResult endAndSubmitPrimaryCommandBuffer(VkCommandBuffer cb, VkFence cmdFence,
VkSemaphore *waitSem, VkSemaphore *signalSem);
void waitCommandCompletion(int frameSlot);
VkDeviceSize subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const;
using BufferImageCopyList = QVarLengthArray<VkBufferImageCopy, 16>;
void prepareUploadSubres(QVkTexture *texD, int layer, int level,
const QRhiTextureSubresourceUploadDescription &subresDesc,
size_t *curOfs, void *mp,
BufferImageCopyList *copyInfos);
void enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdateBatch *resourceUpdates);
void executeBufferHostWritesForSlot(QVkBuffer *bufD, int slot);
void enqueueTransitionPassResources(QVkCommandBuffer *cbD);
void recordPrimaryCommandBuffer(QVkCommandBuffer *cbD);
void trackedRegisterBuffer(QRhiPassResourceTracker *passResTracker,
QVkBuffer *bufD,
int slot,
QRhiPassResourceTracker::BufferAccess access,
QRhiPassResourceTracker::BufferStage stage);
void trackedRegisterTexture(QRhiPassResourceTracker *passResTracker,
QVkTexture *texD,
QRhiPassResourceTracker::TextureAccess access,
QRhiPassResourceTracker::TextureStage stage);
void recordTransitionPassResources(QVkCommandBuffer *cbD, const QRhiPassResourceTracker &tracker);
void activateTextureRenderTarget(QVkCommandBuffer *cbD, QVkTextureRenderTarget *rtD);
void executeDeferredReleases(bool forced = false);
void finishActiveReadbacks(bool forced = false);
void setObjectName(uint64_t object, VkDebugReportObjectTypeEXT type, const QByteArray &name, int slot = -1);
void trackedBufferBarrier(QVkCommandBuffer *cbD, QVkBuffer *bufD, int slot,
VkAccessFlags access, VkPipelineStageFlags stage);
void trackedImageBarrier(QVkCommandBuffer *cbD, QVkTexture *texD,
VkImageLayout layout, VkAccessFlags access, VkPipelineStageFlags stage);
void depthStencilExplicitBarrier(QVkCommandBuffer *cbD, QVkRenderBuffer *rbD);
void subresourceBarrier(QVkCommandBuffer *cbD, VkImage image,
VkImageLayout oldLayout, VkImageLayout newLayout,
VkAccessFlags srcAccess, VkAccessFlags dstAccess,
VkPipelineStageFlags srcStage, VkPipelineStageFlags dstStage,
int startLayer, int layerCount,
int startLevel, int levelCount);
void updateShaderResourceBindings(QRhiShaderResourceBindings *srb, int descSetIdx = -1);
void ensureCommandPoolForNewFrame();
QVulkanInstance *inst = nullptr;
QWindow *maybeWindow = nullptr;
QByteArrayList requestedDeviceExtensions;
bool importedDevice = false;
VkPhysicalDevice physDev = VK_NULL_HANDLE;
VkDevice dev = VK_NULL_HANDLE;
VkCommandPool cmdPool[QVK_FRAMES_IN_FLIGHT] = {};
int gfxQueueFamilyIdx = -1;
int gfxQueueIdx = 0;
VkQueue gfxQueue = VK_NULL_HANDLE;
quint32 timestampValidBits = 0;
bool importedAllocator = false;
QVkAllocator allocator = nullptr;
QVulkanFunctions *f = nullptr;
QVulkanDeviceFunctions *df = nullptr;
QRhi::Flags rhiFlags;
VkPhysicalDeviceFeatures physDevFeatures;
VkPhysicalDeviceProperties physDevProperties;
VkDeviceSize ubufAlign;
VkDeviceSize texbufAlign;
bool deviceLost = false;
bool releaseCachedResourcesCalledBeforeFrameStart = false;
PFN_vkCmdDebugMarkerBeginEXT vkCmdDebugMarkerBegin = nullptr;
PFN_vkCmdDebugMarkerEndEXT vkCmdDebugMarkerEnd = nullptr;
PFN_vkCmdDebugMarkerInsertEXT vkCmdDebugMarkerInsert = nullptr;
PFN_vkDebugMarkerSetObjectNameEXT vkDebugMarkerSetObjectName = nullptr;
PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR = nullptr;
PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR;
PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR;
PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR;
PFN_vkQueuePresentKHR vkQueuePresentKHR;
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR;
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR;
struct {
bool compute = false;
bool wideLines = false;
bool debugMarkers = false;
bool vertexAttribDivisor = false;
bool texture3DSliceAs2D = false;
bool tessellation = false;
bool vulkan11OrHigher = false;
bool geometryShader = false;
bool nonFillPolygonMode = false;
} caps;
VkPipelineCache pipelineCache = VK_NULL_HANDLE;
struct DescriptorPoolData {
DescriptorPoolData() { }
DescriptorPoolData(VkDescriptorPool pool_)
: pool(pool_)
{ }
VkDescriptorPool pool = VK_NULL_HANDLE;
int refCount = 0;
int allocedDescSets = 0;
};
QVarLengthArray<DescriptorPoolData, 8> descriptorPools;
QVarLengthArray<VkCommandBuffer, 4> freeSecondaryCbs[QVK_FRAMES_IN_FLIGHT];
VkQueryPool timestampQueryPool = VK_NULL_HANDLE;
QBitArray timestampQueryPoolMap;
VkFormat optimalDsFormat = VK_FORMAT_UNDEFINED;
QMatrix4x4 clipCorrectMatrix;
QVkSwapChain *currentSwapChain = nullptr;
QSet<QVkSwapChain *> swapchains;
QRhiVulkanNativeHandles nativeHandlesStruct;
QRhiDriverInfo driverInfoStruct;
struct OffscreenFrame {
OffscreenFrame(QRhiImplementation *rhi)
{
for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
cbWrapper[i] = new QVkCommandBuffer(rhi);
}
~OffscreenFrame()
{
for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i)
delete cbWrapper[i];
}
bool active = false;
QVkCommandBuffer *cbWrapper[QVK_FRAMES_IN_FLIGHT];
VkFence cmdFence = VK_NULL_HANDLE;
} ofr;
struct TextureReadback {
int activeFrameSlot = -1;
QRhiReadbackDescription desc;
QRhiReadbackResult *result;
VkBuffer stagingBuf;
QVkAlloc stagingAlloc;
quint32 byteSize;
QSize pixelSize;
QRhiTexture::Format format;
};
QVarLengthArray<TextureReadback, 2> activeTextureReadbacks;
struct BufferReadback {
int activeFrameSlot = -1;
QRhiBufferReadbackResult *result;
int byteSize;
VkBuffer stagingBuf;
QVkAlloc stagingAlloc;
};
QVarLengthArray<BufferReadback, 2> activeBufferReadbacks;
struct DeferredReleaseEntry {
enum Type {
Pipeline,
ShaderResourceBindings,
Buffer,
RenderBuffer,
Texture,
Sampler,
TextureRenderTarget,
RenderPass,
StagingBuffer,
SecondaryCommandBuffer
};
Type type;
int lastActiveFrameSlot; // -1 if not used otherwise 0..FRAMES_IN_FLIGHT-1
union {
struct {
VkPipeline pipeline;
VkPipelineLayout layout;
} pipelineState;
struct {
int poolIndex;
VkDescriptorSetLayout layout;
} shaderResourceBindings;
struct {
VkBuffer buffers[QVK_FRAMES_IN_FLIGHT];
QVkAlloc allocations[QVK_FRAMES_IN_FLIGHT];
VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
} buffer;
struct {
VkDeviceMemory memory;
VkImage image;
VkImageView imageView;
} renderBuffer;
struct {
VkImage image;
VkImageView imageView;
QVkAlloc allocation;
VkBuffer stagingBuffers[QVK_FRAMES_IN_FLIGHT];
QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
VkImageView extraImageViews[QRhi::MAX_MIP_LEVELS];
} texture;
struct {
VkSampler sampler;
} sampler;
struct {
VkFramebuffer fb;
VkImageView rtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS];
VkImageView resrtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS];
} textureRenderTarget;
struct {
VkRenderPass rp;
} renderPass;
struct {
VkBuffer stagingBuffer;
QVkAlloc stagingAllocation;
} stagingBuffer;
struct {
VkCommandBuffer cb;
} secondaryCommandBuffer;
};
};
QList<DeferredReleaseEntry> releaseQueue;
};
Q_DECLARE_TYPEINFO(QRhiVulkan::DescriptorPoolData, Q_RELOCATABLE_TYPE);
Q_DECLARE_TYPEINFO(QRhiVulkan::DeferredReleaseEntry, Q_RELOCATABLE_TYPE);
Q_DECLARE_TYPEINFO(QRhiVulkan::TextureReadback, Q_RELOCATABLE_TYPE);
Q_DECLARE_TYPEINFO(QRhiVulkan::BufferReadback, Q_RELOCATABLE_TYPE);
QT_END_NAMESPACE
#endif

View File

@@ -1,107 +0,0 @@
// 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
//
// 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.
//
/*
* This file contains AT-SPI constants and mappings between QAccessible
* and AT-SPI constants such as 'role' and 'state' enumerations.
*/
#ifndef Q_SPI_CONSTANT_MAPPINGS_H
#define Q_SPI_CONSTANT_MAPPINGS_H
#include "qspi_struct_marshallers_p.h"
#include <QtGui/private/qtguiglobal_p.h>
#include <QtGui/QAccessible>
#include <atspi/atspi-constants.h>
QT_REQUIRE_CONFIG(accessibility);
// interface names from at-spi2-core/atspi/atspi-misc-private.h
#define ATSPI_DBUS_NAME_REGISTRY "org.a11y.atspi.Registry"
#define ATSPI_DBUS_PATH_REGISTRY "/org/a11y/atspi/registry"
#define ATSPI_DBUS_INTERFACE_REGISTRY "org.a11y.atspi.Registry"
#define ATSPI_DBUS_PATH_ROOT "/org/a11y/atspi/accessible/root"
#define ATSPI_DBUS_PATH_DEC "/org/a11y/atspi/registry/deviceeventcontroller"
#define ATSPI_DBUS_INTERFACE_DEC "org.a11y.atspi.DeviceEventController"
#define ATSPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER "org.a11y.atspi.DeviceEventListener"
#define ATSPI_DBUS_INTERFACE_CACHE "org.a11y.atspi.Cache"
#define ATSPI_DBUS_INTERFACE_ACCESSIBLE "org.a11y.atspi.Accessible"
#define ATSPI_DBUS_INTERFACE_ACTION "org.a11y.atspi.Action"
#define ATSPI_DBUS_INTERFACE_APPLICATION "org.a11y.atspi.Application"
#define ATSPI_DBUS_INTERFACE_COLLECTION "org.a11y.atspi.Collection"
#define ATSPI_DBUS_INTERFACE_COMPONENT "org.a11y.atspi.Component"
#define ATSPI_DBUS_INTERFACE_DOCUMENT "org.a11y.atspi.Document"
#define ATSPI_DBUS_INTERFACE_EDITABLE_TEXT "org.a11y.atspi.EditableText"
#define ATSPI_DBUS_INTERFACE_EVENT_KEYBOARD "org.a11y.atspi.Event.Keyboard"
#define ATSPI_DBUS_INTERFACE_EVENT_MOUSE "org.a11y.atspi.Event.Mouse"
#define ATSPI_DBUS_INTERFACE_EVENT_OBJECT "org.a11y.atspi.Event.Object"
#define ATSPI_DBUS_INTERFACE_HYPERLINK "org.a11y.atspi.Hyperlink"
#define ATSPI_DBUS_INTERFACE_HYPERTEXT "org.a11y.atspi.Hypertext"
#define ATSPI_DBUS_INTERFACE_IMAGE "org.a11y.atspi.Image"
#define ATSPI_DBUS_INTERFACE_SELECTION "org.a11y.atspi.Selection"
#define ATSPI_DBUS_INTERFACE_TABLE "org.a11y.atspi.Table"
#define ATSPI_DBUS_INTERFACE_TEXT "org.a11y.atspi.Text"
#define ATSPI_DBUS_INTERFACE_VALUE "org.a11y.atspi.Value"
#define ATSPI_DBUS_INTERFACE_SOCKET "org.a11y.atspi.Socket"
// missing from at-spi2-core:
#define ATSPI_DBUS_INTERFACE_EVENT_WINDOW "org.a11y.atspi.Event.Window"
#define ATSPI_DBUS_INTERFACE_EVENT_FOCUS "org.a11y.atspi.Event.Focus"
#define QSPI_OBJECT_PATH_ACCESSIBLE "/org/a11y/atspi/accessible"
#define QSPI_OBJECT_PATH_PREFIX "/org/a11y/atspi/accessible/"
#define QSPI_OBJECT_PATH_ROOT QSPI_OBJECT_PATH_PREFIX "root"
#define QSPI_REGISTRY_NAME "org.a11y.atspi.Registry"
QT_BEGIN_NAMESPACE
struct RoleNames {
RoleNames() {}
RoleNames(AtspiRole r, const QString& n, const QString& ln)
:m_spiRole(r), m_name(n), m_localizedName(ln)
{}
AtspiRole spiRole() const {return m_spiRole;}
QString name() const {return m_name;}
QString localizedName() const {return m_localizedName;}
private:
AtspiRole m_spiRole = ATSPI_ROLE_INVALID;
QString m_name;
QString m_localizedName;
};
inline void setSpiStateBit(quint64* state, AtspiStateType spiState)
{
*state |= quint64(1) << spiState;
}
inline void unsetSpiStateBit(quint64* state, AtspiStateType spiState)
{
*state &= ~(quint64(1) << spiState);
}
quint64 spiStatesFromQState(QAccessible::State state);
QSpiUIntList spiStateSetFromSpiStates(quint64 states);
AtspiRelationType qAccessibleRelationToAtSpiRelation(QAccessible::Relation relation);
QT_END_NAMESPACE
#endif /* Q_SPI_CONSTANT_MAPPINGS_H */

View File

@@ -1,164 +0,0 @@
// 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 Q_SPI_STRUCT_MARSHALLERS_H
#define Q_SPI_STRUCT_MARSHALLERS_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 <QtGui/private/qtguiglobal_p.h>
#include <QtCore/qlist.h>
#include <QtCore/qpair.h>
#include <QtDBus/QDBusArgument>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusObjectPath>
QT_REQUIRE_CONFIG(accessibility);
QT_BEGIN_NAMESPACE
using QSpiIntList = QList<int>;
using QSpiUIntList = QList<uint>;
// FIXME: make this copy on write
struct QSpiObjectReference
{
QString service;
QDBusObjectPath path;
QSpiObjectReference();
QSpiObjectReference(const QDBusConnection& connection, const QDBusObjectPath& path)
: service(connection.baseService()), path(path) {}
};
Q_DECLARE_TYPEINFO(QSpiObjectReference, Q_RELOCATABLE_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;
struct QSpiAccessibleCacheItem
{
QSpiObjectReference path;
QSpiObjectReference application;
QSpiObjectReference parent;
QSpiObjectReferenceArray children;
QStringList supportedInterfaces;
QString name;
uint role;
QString description;
QSpiUIntList state;
};
Q_DECLARE_TYPEINFO(QSpiAccessibleCacheItem, Q_RELOCATABLE_TYPE);
typedef QList<QSpiAccessibleCacheItem> QSpiAccessibleCacheArray;
QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAccessibleCacheItem &item);
const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAccessibleCacheItem &item);
struct QSpiAction
{
QString name;
QString description;
QString keyBinding;
};
Q_DECLARE_TYPEINFO(QSpiAction, Q_RELOCATABLE_TYPE);
typedef QList<QSpiAction> QSpiActionArray;
QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAction &action);
const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAction &action);
struct QSpiEventListener
{
QString listenerAddress;
QString eventName;
};
Q_DECLARE_TYPEINFO(QSpiEventListener, Q_RELOCATABLE_TYPE);
typedef QList<QSpiEventListener> QSpiEventListenerArray;
QDBusArgument &operator<<(QDBusArgument &argument, const QSpiEventListener &action);
const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiEventListener &action);
typedef QPair<unsigned int, QSpiObjectReferenceArray> QSpiRelationArrayEntry;
typedef QList<QSpiRelationArrayEntry> QSpiRelationArray;
//a(iisv)
struct QSpiTextRange {
int startOffset;
int endOffset;
QString contents;
QVariant v;
};
Q_DECLARE_TYPEINFO(QSpiTextRange, Q_RELOCATABLE_TYPE);
typedef QList<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_RELOCATABLE_TYPE);
QDBusArgument &operator<<(QDBusArgument &argument, const QSpiAppUpdate &update);
const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiAppUpdate &update);
struct QSpiDeviceEvent {
unsigned int type;
int id;
int hardwareCode;
int modifiers;
int timestamp;
QString text;
bool isText;
};
Q_DECLARE_TYPEINFO(QSpiDeviceEvent, Q_RELOCATABLE_TYPE);
QDBusArgument &operator<<(QDBusArgument &argument, const QSpiDeviceEvent &event);
const QDBusArgument &operator>>(const QDBusArgument &argument, QSpiDeviceEvent &event);
void qSpiInitializeStructTypes();
QT_END_NAMESPACE
QT_DECL_METATYPE_EXTERN(QSpiIntList, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiUIntList, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiObjectReference, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiObjectReferenceArray, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiAccessibleCacheItem, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiAccessibleCacheArray, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiAction, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiActionArray, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiEventListener, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiEventListenerArray, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiRelationArrayEntry, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiRelationArray, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiTextRange, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiTextRangeList, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiAttributeSet, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiAppUpdate, /* not exported */)
QT_DECL_METATYPE_EXTERN(QSpiDeviceEvent, /* not exported */)
// For qdbusxml2cpp-generated code
QT_USE_NAMESPACE
#endif /* Q_SPI_STRUCT_MARSHALLERS_H */

View File

@@ -1,69 +0,0 @@
// 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 QSPIACCESSIBLEBRIDGE_H
#define QSPIACCESSIBLEBRIDGE_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 <QtGui/private/qtguiglobal_p.h>
#include <QtDBus/qdbusconnection.h>
#include <qpa/qplatformaccessibility.h>
#include <QtCore/qhash.h>
class DeviceEventControllerAdaptor;
QT_REQUIRE_CONFIG(accessibility);
QT_BEGIN_NAMESPACE
class DBusConnection;
class QSpiDBusCache;
class AtSpiAdaptor;
struct RoleNames;
class Q_GUI_EXPORT QSpiAccessibleBridge: public QObject, public QPlatformAccessibility
{
Q_OBJECT
public:
using SpiRoleMapping = QHash <QAccessible::Role, RoleNames>;
QSpiAccessibleBridge();
virtual ~QSpiAccessibleBridge();
void notifyAccessibilityUpdate(QAccessibleEvent *event) override;
QDBusConnection dBusConnection() const;
const SpiRoleMapping &spiRoleNames() const { return m_spiRoleMapping; }
static QSpiAccessibleBridge *instance();
static RoleNames namesForRole(QAccessible::Role role);
public Q_SLOTS:
void enabledChanged(bool enabled);
private:
void initializeConstantMappings();
void updateStatus();
QSpiDBusCache *cache;
DeviceEventControllerAdaptor *dec;
AtSpiAdaptor *dbusAdaptor;
DBusConnection* dbusConnection;
SpiRoleMapping m_spiRoleMapping;
};
QT_END_NAMESPACE
#endif

View File

@@ -1,62 +0,0 @@
// 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 Q_SPI_APPLICATION_H
#define Q_SPI_APPLICATION_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 <QtGui/private/qtguiglobal_p.h>
#include <QtCore/QPointer>
#include <QtCore/QQueue>
#include <QtDBus/QDBusConnection>
#include <QtGui/QAccessibleInterface>
Q_MOC_INCLUDE(<QtDBus/QDBusMessage>)
QT_REQUIRE_CONFIG(accessibility);
QT_BEGIN_NAMESPACE
/*
* Used for the root object.
*
* Uses the root object reference and reports its parent as the desktop object.
*/
class QSpiApplicationAdaptor :public QObject
{
Q_OBJECT
public:
QSpiApplicationAdaptor(const QDBusConnection &connection, QObject *parent);
virtual ~QSpiApplicationAdaptor() {}
void sendEvents(bool active);
Q_SIGNALS:
void windowActivated(QObject* window, bool active);
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
private Q_SLOTS:
void notifyKeyboardListenerCallback(const QDBusMessage& message);
void notifyKeyboardListenerError(const QDBusError& error, const QDBusMessage& message);
private:
static QKeyEvent* copyKeyEvent(QKeyEvent*);
QQueue<QPair<QPointer<QObject>, QKeyEvent*> > keyEvents;
QDBusConnection dbusConnection;
};
QT_END_NAMESPACE
#endif

View File

@@ -1,46 +0,0 @@
// 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 Q_SPI_CACHE_H
#define Q_SPI_CACHE_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 <QtGui/private/qtguiglobal_p.h>
#include <QtCore/QObject>
#include "qspi_struct_marshallers_p.h"
QT_REQUIRE_CONFIG(accessibility);
QT_BEGIN_NAMESPACE
class QSpiDBusCache : public QObject
{
Q_OBJECT
public:
explicit QSpiDBusCache(QDBusConnection c, QObject* parent = nullptr);
void emitAddAccessible(const QSpiAccessibleCacheItem& item);
void emitRemoveAccessible(const QSpiObjectReference& item);
Q_SIGNALS:
void AddAccessible(const QSpiAccessibleCacheItem &nodeAdded);
void RemoveAccessible(const QSpiObjectReference &nodeRemoved);
public Q_SLOTS:
QSpiAccessibleCacheArray GetItems();
};
QT_END_NAMESPACE
#endif /* Q_SPI_CACHE_H */

View File

@@ -1,174 +0,0 @@
// 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
/*
This file was originally created by qdbusxml2cpp version 0.8
Command line was:
qdbusxml2cpp -a statusnotifieritem ../../3rdparty/dbus-ifaces/org.kde.StatusNotifierItem.xml
However it is maintained manually.
It is also not part of the public API. This header file may change from
version to version without notice, or even be removed.
*/
#ifndef QSTATUSNOTIFIERITEMADAPTER_P_H
#define QSTATUSNOTIFIERITEMADAPTER_P_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 <private/qtguiglobal_p.h>
QT_REQUIRE_CONFIG(systemtrayicon);
#include <QObject>
#include <QDBusAbstractAdaptor>
#include <private/qdbustraytypes_p.h>
QT_BEGIN_NAMESPACE
class QDBusTrayIcon;
/*
Adaptor class for interface org.kde.StatusNotifierItem
see http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/
(also http://www.notmart.org/misc/statusnotifieritem/)
*/
class QStatusNotifierItemAdaptor: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.StatusNotifierItem")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"org.kde.StatusNotifierItem\">\n"
" <property access=\"read\" type=\"s\" name=\"Category\"/>\n"
" <property access=\"read\" type=\"s\" name=\"Id\"/>\n"
" <property access=\"read\" type=\"s\" name=\"Title\"/>\n"
" <property access=\"read\" type=\"s\" name=\"Status\"/>\n"
" <property access=\"read\" type=\"i\" name=\"WindowId\"/>\n"
" <property access=\"read\" type=\"s\" name=\"IconThemePath\"/>\n"
" <property access=\"read\" type=\"o\" name=\"Menu\"/>\n"
" <property access=\"read\" type=\"b\" name=\"ItemIsMenu\"/>\n"
" <property access=\"read\" type=\"s\" name=\"IconName\"/>\n"
" <property access=\"read\" type=\"a(iiay)\" name=\"IconPixmap\">\n"
" <annotation value=\"QXdgDBusImageVector\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
" </property>\n"
" <property access=\"read\" type=\"s\" name=\"OverlayIconName\"/>\n"
" <property access=\"read\" type=\"a(iiay)\" name=\"OverlayIconPixmap\">\n"
" <annotation value=\"QXdgDBusImageVector\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
" </property>\n"
" <property access=\"read\" type=\"s\" name=\"AttentionIconName\"/>\n"
" <property access=\"read\" type=\"a(iiay)\" name=\"AttentionIconPixmap\">\n"
" <annotation value=\"QXdgDBusImageVector\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
" </property>\n"
" <property access=\"read\" type=\"s\" name=\"AttentionMovieName\"/>\n"
" <property access=\"read\" type=\"(sa(iiay)ss)\" name=\"ToolTip\">\n"
" <annotation value=\"QXdgDBusToolTipStruct\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
" </property>\n"
" <method name=\"ProvideXdgActivationToken\">\n"
" <arg name=\"token\" type=\"s\" direction=\"in\"/>\n"
" </method>\n"
" <method name=\"ContextMenu\">\n"
" <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
" </method>\n"
" <method name=\"Activate\">\n"
" <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
" </method>\n"
" <method name=\"SecondaryActivate\">\n"
" <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
" </method>\n"
" <method name=\"Scroll\">\n"
" <arg direction=\"in\" type=\"i\" name=\"delta\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"orientation\"/>\n"
" </method>\n"
" <signal name=\"NewTitle\"/>\n"
" <signal name=\"NewIcon\"/>\n"
" <signal name=\"NewAttentionIcon\"/>\n"
" <signal name=\"NewOverlayIcon\"/>\n"
" <signal name=\"NewMenu\"/>\n"
" <signal name=\"NewToolTip\"/>\n"
" <signal name=\"NewStatus\">\n"
" <arg type=\"s\" name=\"status\"/>\n"
" </signal>\n"
" </interface>\n"
"")
public:
QStatusNotifierItemAdaptor(QDBusTrayIcon *parent);
virtual ~QStatusNotifierItemAdaptor();
public: // PROPERTIES
Q_PROPERTY(QString AttentionIconName READ attentionIconName)
QString attentionIconName() const;
Q_PROPERTY(QXdgDBusImageVector AttentionIconPixmap READ attentionIconPixmap)
QXdgDBusImageVector attentionIconPixmap() const;
Q_PROPERTY(QString AttentionMovieName READ attentionMovieName)
QString attentionMovieName() const;
Q_PROPERTY(QString Category READ category)
QString category() const;
Q_PROPERTY(QString IconName READ iconName)
QString iconName() const;
Q_PROPERTY(QXdgDBusImageVector IconPixmap READ iconPixmap)
QXdgDBusImageVector iconPixmap() const;
Q_PROPERTY(QString Id READ id)
QString id() const;
Q_PROPERTY(bool ItemIsMenu READ itemIsMenu)
bool itemIsMenu() const;
Q_PROPERTY(QDBusObjectPath Menu READ menu)
QDBusObjectPath menu() const;
Q_PROPERTY(QString OverlayIconName READ overlayIconName)
QString overlayIconName() const;
Q_PROPERTY(QXdgDBusImageVector OverlayIconPixmap READ overlayIconPixmap)
QXdgDBusImageVector overlayIconPixmap() const;
Q_PROPERTY(QString Status READ status)
QString status() const;
Q_PROPERTY(QString Title READ title)
QString title() const;
Q_PROPERTY(QXdgDBusToolTipStruct ToolTip READ toolTip)
QXdgDBusToolTipStruct toolTip() const;
public Q_SLOTS: // METHODS
void Activate(int x, int y);
void ContextMenu(int x, int y);
void ProvideXdgActivationToken(const QString &token);
void Scroll(int delta, const QString &orientation);
void SecondaryActivate(int x, int y);
Q_SIGNALS: // SIGNALS
void NewAttentionIcon();
void NewIcon();
void NewOverlayIcon();
void NewMenu();
void NewStatus(const QString &status);
void NewTitle();
void NewToolTip();
private:
QDBusTrayIcon *m_trayIcon;
};
QT_END_NAMESPACE
#endif // QSTATUSNOTIFIERITEMADAPTER_P_H

View File

@@ -1,97 +0,0 @@
// Copyright (C) 2020 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 QT_EGL_P_H
#define QT_EGL_P_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.
//
// q(data/text)stream.h must be included before any header file that defines Status
#include <QtCore/qdatastream.h>
#include <QtCore/qtextstream.h>
#include <QtCore/private/qglobal_p.h>
#ifdef QT_EGL_NO_X11
# ifndef EGL_NO_X11
# define EGL_NO_X11
# endif
# ifndef MESA_EGL_NO_X11_HEADERS
# define MESA_EGL_NO_X11_HEADERS // MESA
# endif
# if !defined(Q_OS_INTEGRITY)
# define WIN_INTERFACE_CUSTOM // NV
# endif // Q_OS_INTEGRITY
#else // QT_EGL_NO_X11
// If one has an eglplatform.h with https://github.com/KhronosGroup/EGL-Registry/pull/130
// that needs USE_X11 to be defined.
# define USE_X11
#endif
#ifdef QT_EGL_WAYLAND
# define WAYLAND // NV
#endif // QT_EGL_WAYLAND
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <stdint.h>
QT_BEGIN_NAMESPACE
namespace QtInternal {
template <class FromType, class ToType>
struct QtEglConverter
{
static inline ToType convert(FromType v)
{ return v; }
};
template <>
struct QtEglConverter<uint32_t, uintptr_t>
{
static inline uintptr_t convert(uint32_t v)
{ return v; }
};
#if QT_POINTER_SIZE > 4
template <>
struct QtEglConverter<uintptr_t, uint32_t>
{
static inline uint32_t convert(uintptr_t v)
{ return uint32_t(v); }
};
#endif
template <>
struct QtEglConverter<uint32_t, void *>
{
static inline void *convert(uint32_t v)
{ return reinterpret_cast<void *>(uintptr_t(v)); }
};
template <>
struct QtEglConverter<void *, uint32_t>
{
static inline uint32_t convert(void *v)
{ return uintptr_t(v); }
};
} // QtInternal
template <class ToType, class FromType>
static inline ToType qt_egl_cast(FromType from)
{ return QtInternal::QtEglConverter<FromType, ToType>::convert(from); }
QT_END_NAMESPACE
#endif // QT_EGL_P_H

View File

@@ -1,29 +0,0 @@
// 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
/*
* This is a precompiled header file for use in Xcode / Mac GCC /
* GCC >= 3.4 / VC to greatly speed the building of Qt. It may also be
* of use to people developing their own project, but it is probably
* better to define your own header. Use of this header is currently
* UNSUPPORTED.
*/
#include "../../corelib/global/qt_pch.h"
#if defined __cplusplus
#include <qtguiexports.h>
#include <qtguiglobal.h>
#include <qguiapplication.h>
#include <qbitmap.h>
#include <qclipboard.h>
#include <qcursor.h>
#include <qevent.h>
#include <qfont.h>
#include <qimage.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qscreen.h>
#include <qsurface.h>
#include <qwindow.h>
#endif

View File

@@ -1,392 +0,0 @@
// Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QT_MIPS_ASM_DSP_H
#define QT_MIPS_ASM_DSP_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.
//
#if 0
#pragma qt_sync_stop_processing
#endif
#ifndef Q_CLANG_QDOC
#define zero $0
#define AT $1
#define v0 $2
#define v1 $3
#define a0 $4
#define a1 $5
#define a2 $6
#define a3 $7
#define t0 $8
#define t1 $9
#define t2 $10
#define t3 $11
#define t4 $12
#define t5 $13
#define t6 $14
#define t7 $15
#define s0 $16
#define s1 $17
#define s2 $18
#define s3 $19
#define s4 $20
#define s5 $21
#define s6 $22
#define s7 $23
#define t8 $24
#define t9 $25
#define k0 $26
#define k1 $27
#define gp $28
#define sp $29
#define fp $30
#define s8 $30
#define ra $31
#endif
/*
* LEAF_MIPS32R2 - declare leaf_mips32r2 routine
*/
#define LEAF_MIPS32R2(symbol) \
.globl symbol; \
.align 2; \
.type symbol,@function; \
.ent symbol,0; \
symbol: .frame sp, 0, ra; \
.set arch=mips32r2; \
.set noreorder;
/*
* LEAF_MIPS_DSP - declare leaf_mips_dsp routine
*/
#define LEAF_MIPS_DSP(symbol) \
LEAF_MIPS32R2(symbol) \
.set dsp;
/*
* LEAF_MIPS_DSPR2 - declare leaf_mips_dspr2 routine
*/
#define LEAF_MIPS_DSPR2(symbol) \
LEAF_MIPS32R2(symbol) \
.set dspr2;
/*
* END - mark end of function
*/
#define END(function) \
.set reorder; \
.end function; \
.size function,.-function
/*
* BYTE_MUL operation on two pixels (in_1 and in_2) with two
* multiplicator bytes, repl_a1 and repl_a2, which should be
* prepered with:
* replv.ph repl_a1, a1
* replv.ph repl_a2, a2
* to became such as:
* repl_a1 = | 00 | a1 | 00 | a1 |
* repl_a2 = | 00 | a2 | 00 | a2 |
*
* rounding_factor must have following value:
* li rounding_factor, 0x00800080
*
* scratch(n) - temporary registers
*
* in_const: 1 -> (default) causes that in_1, in_2
* registers will remain unchanged after usage
* 0 -> (or anything different then 1) causes
* that registers repl_a1, repl_a2 remain
* unchanged after usage
*/
.macro BYTE_MUL_x2 in_1, in_2, out_1, out_2 \
repl_a1, repl_a2, rounding_factor, \
scratch1, scratch2, scratch3, scratch4, \
in_const = 1
muleu_s.ph.qbl \scratch1, \in_1, \repl_a1
muleu_s.ph.qbr \scratch2, \in_1, \repl_a1
muleu_s.ph.qbl \scratch3, \in_2, \repl_a2
muleu_s.ph.qbr \scratch4, \in_2, \repl_a2
.if \in_const == 1
preceu.ph.qbla \repl_a1, \scratch1
preceu.ph.qbla \repl_a2, \scratch2
preceu.ph.qbla \out_1, \scratch3
preceu.ph.qbla \out_2, \scratch4
addu \scratch1, \repl_a1, \scratch1
addu \scratch2, \repl_a2, \scratch2
.else
preceu.ph.qbla \in_1, \scratch1
preceu.ph.qbla \in_2, \scratch2
preceu.ph.qbla \out_1, \scratch3
preceu.ph.qbla \out_2, \scratch4
addu \scratch1, \in_1, \scratch1
addu \scratch2, \in_2, \scratch2
.endif
addu \out_1, \out_1, \scratch3
addu \out_2, \out_2, \scratch4
addu \scratch1, \scratch1, \rounding_factor
addu \scratch2, \scratch2, \rounding_factor
addu \scratch3, \out_1, \rounding_factor
addu \scratch4, \out_2, \rounding_factor
precrq.qb.ph \out_1, \scratch1, \scratch2
precrq.qb.ph \out_2, \scratch3, \scratch4
.endm
/*
* BYTE_MUL operation on one pixel (in_1) with
* multiplicator byte, repl_a1, which should be
* prepered with:
* replv.ph repl_a1, a1
* to became such as:
* repl_a1 = | 00 | a1 | 00 | a1 |
*
* rounding_factor must have following value:
* li rounding_factor, 0x00800080
*
* scratch(n) - temporary registers
*/
.macro BYTE_MUL in_1, out_1, \
repl_a1, rounding_factor, \
scratch1, scratch2, scratch3, scratch4
muleu_s.ph.qbl \scratch1, \in_1, \repl_a1
muleu_s.ph.qbr \scratch2, \in_1, \repl_a1
preceu.ph.qbla \scratch3, \scratch1
preceu.ph.qbla \scratch4, \scratch2
addu \scratch1, \scratch1, \scratch3
addu \scratch1, \scratch1, \rounding_factor
addu \scratch2, \scratch2, \scratch4
addu \scratch2, \scratch2, \rounding_factor
precrq.qb.ph \out_1, \scratch1, \scratch2
.endm
/*
* macro for INTERPOLATE_PIXEL_255 operation
* in_1 - First value to multiply
* mul_1 - Multiplicator byte for first value
* in_2 - Second value to multiply
* mul_2 - Multiplicator byte for second value
* rounding_factor and andi_factor should be prepared
* as:
* li rounding_factor, 0x00800080
* li andi_factor, 0xff00ff00
* scratch(n) - temporary registers
*/
.macro INTERPOLATE_PIXEL_255 in_1, mul_1, \
in_2, mul_2, \
out_1, \
rounding_factor, andi_factor \
scratch1, scratch2, scratch3, scratch4
# x part
preceu.ph.qbra \scratch1, \in_1
preceu.ph.qbra \scratch2, \in_2
mul \scratch1, \scratch1, \mul_1
mul \scratch2, \scratch2, \mul_2
# x>>8 part
preceu.ph.qbla \scratch3, \in_1
preceu.ph.qbla \scratch4, \in_2
mul \scratch3, \scratch3, \mul_1
mul \scratch4, \scratch4, \mul_2
# x part
addu \scratch1, \scratch1, \scratch2
preceu.ph.qbla \scratch2, \scratch1
addu \scratch1, \scratch1, \scratch2
addu \scratch1, \scratch1, \rounding_factor
preceu.ph.qbla \scratch1, \scratch1
# x>>8 part
addu \scratch3, \scratch3, \scratch4
preceu.ph.qbla \scratch4, \scratch3
addu \scratch3, \scratch3, \scratch4
addu \scratch3, \scratch3, \rounding_factor
and \scratch3, \scratch3, \andi_factor
or \out_1, \scratch1, \scratch3
.endm
/*
* Checks if stack offset is big enough for storing/restoring regs_num
* number of register to/from stack. Stack offset must be greater than
* or equal to the number of bytes needed for storing registers (regs_num*4).
* Since MIPS ABI allows usage of first 16 bytes of stack frame (this is
* preserved for input arguments of the functions, already stored in a0-a3),
* stack size can be further optimized by utilizing this space.
*/
.macro CHECK_STACK_OFFSET regs_num, stack_offset
.if \stack_offset < \regs_num * 4 - 16
.error "Stack offset too small."
.endif
.endm
/*
* Saves set of registers on stack. Maximum number of registers that
* can be saved on stack is limited to 14 (a0-a3, v0-v1 and s0-s7).
* Stack offset is number of bytes that are added to stack pointer (sp)
* before registers are pushed in order to provide enough space on stack
* (offset must be multiple of 4, and must be big enough, as described by
* CHECK_STACK_OFFSET macro). This macro is intended to be used in
* combination with RESTORE_REGS_FROM_STACK macro. Example:
* SAVE_REGS_ON_STACK 4, v0, v1, s0, s1
* RESTORE_REGS_FROM_STACK 4, v0, v1, s0, s1
*/
.macro SAVE_REGS_ON_STACK stack_offset = 0, r1, \
r2 = 0, r3 = 0, r4 = 0, \
r5 = 0, r6 = 0, r7 = 0, \
r8 = 0, r9 = 0, r10 = 0, \
r11 = 0, r12 = 0, r13 = 0, \
r14 = 0
.if (\stack_offset < 0) || (\stack_offset - (\stack_offset / 4) * 4)
.error "Stack offset must be positive and multiple of 4."
.endif
.if \stack_offset != 0
addiu sp, sp, -\stack_offset
.endif
sw \r1, 0(sp)
.if \r2 != 0
sw \r2, 4(sp)
.endif
.if \r3 != 0
sw \r3, 8(sp)
.endif
.if \r4 != 0
sw \r4, 12(sp)
.endif
.if \r5 != 0
CHECK_STACK_OFFSET 5, \stack_offset
sw \r5, 16(sp)
.endif
.if \r6 != 0
CHECK_STACK_OFFSET 6, \stack_offset
sw \r6, 20(sp)
.endif
.if \r7 != 0
CHECK_STACK_OFFSET 7, \stack_offset
sw \r7, 24(sp)
.endif
.if \r8 != 0
CHECK_STACK_OFFSET 8, \stack_offset
sw \r8, 28(sp)
.endif
.if \r9 != 0
CHECK_STACK_OFFSET 9, \stack_offset
sw \r9, 32(sp)
.endif
.if \r10 != 0
CHECK_STACK_OFFSET 10, \stack_offset
sw \r10, 36(sp)
.endif
.if \r11 != 0
CHECK_STACK_OFFSET 11, \stack_offset
sw \r11, 40(sp)
.endif
.if \r12 != 0
CHECK_STACK_OFFSET 12, \stack_offset
sw \r12, 44(sp)
.endif
.if \r13 != 0
CHECK_STACK_OFFSET 13, \stack_offset
sw \r13, 48(sp)
.endif
.if \r14 != 0
CHECK_STACK_OFFSET 14, \stack_offset
sw \r14, 52(sp)
.endif
.endm
/*
* Restores set of registers from stack. Maximum number of registers that
* can be restored from stack is limited to 14 (a0-a3, v0-v1 and s0-s7).
* Stack offset is number of bytes that are added to stack pointer (sp)
* after registers are restored (offset must be multiple of 4, and must
* be big enough, as described by CHECK_STACK_OFFSET macro). This macro is
* intended to be used in combination with RESTORE_REGS_FROM_STACK macro.
* Example:
* SAVE_REGS_ON_STACK 4, v0, v1, s0, s1
* RESTORE_REGS_FROM_STACK 4, v0, v1, s0, s1
*/
.macro RESTORE_REGS_FROM_STACK stack_offset = 0, r1, \
r2 = 0, r3 = 0, r4 = 0, \
r5 = 0, r6 = 0, r7 = 0, \
r8 = 0, r9 = 0, r10 = 0, \
r11 = 0, r12 = 0, r13 = 0, \
r14 = 0
.if (\stack_offset < 0) || (\stack_offset - (\stack_offset/4)*4)
.error "Stack offset must be pozitive and multiple of 4."
.endif
lw \r1, 0(sp)
.if \r2 != 0
lw \r2, 4(sp)
.endif
.if \r3 != 0
lw \r3, 8(sp)
.endif
.if \r4 != 0
lw \r4, 12(sp)
.endif
.if \r5 != 0
CHECK_STACK_OFFSET 5, \stack_offset
lw \r5, 16(sp)
.endif
.if \r6 != 0
CHECK_STACK_OFFSET 6, \stack_offset
lw \r6, 20(sp)
.endif
.if \r7 != 0
CHECK_STACK_OFFSET 7, \stack_offset
lw \r7, 24(sp)
.endif
.if \r8 != 0
CHECK_STACK_OFFSET 8, \stack_offset
lw \r8, 28(sp)
.endif
.if \r9 != 0
CHECK_STACK_OFFSET 9, \stack_offset
lw \r9, 32(sp)
.endif
.if \r10 != 0
CHECK_STACK_OFFSET 10, \stack_offset
lw \r10, 36(sp)
.endif
.if \r11 != 0
CHECK_STACK_OFFSET 11, \stack_offset
lw \r11, 40(sp)
.endif
.if \r12 != 0
CHECK_STACK_OFFSET 12, \stack_offset
lw \r12, 44(sp)
.endif
.if \r13 != 0
CHECK_STACK_OFFSET 13, \stack_offset
lw \r13, 48(sp)
.endif
.if \r14 != 0
CHECK_STACK_OFFSET 14, \stack_offset
lw \r14, 52(sp)
.endif
.if \stack_offset != 0
addiu sp, sp, \stack_offset
.endif
.endm
#endif // QT_MIPS_ASM_DSP_H

View File

@@ -1,112 +0,0 @@
// Copyright (C) 2019 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 QTEXTMARKDOWNIMPORTER_H
#define QTEXTMARKDOWNIMPORTER_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 <QtGui/qfont.h>
#include <QtGui/qtguiglobal.h>
#include <QtGui/qpalette.h>
#include <QtGui/qtextdocument.h>
#include <QtGui/qtextlist.h>
#include <QtCore/qpointer.h>
#include <QtCore/qstack.h>
#include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE
class QTextCursor;
class QTextDocument;
class QTextTable;
class Q_GUI_EXPORT QTextMarkdownImporter
{
public:
enum Feature {
FeatureCollapseWhitespace = 0x0001,
FeaturePermissiveATXHeaders = 0x0002,
FeaturePermissiveURLAutoLinks = 0x0004,
FeaturePermissiveMailAutoLinks = 0x0008,
FeatureNoIndentedCodeBlocks = 0x0010,
FeatureNoHTMLBlocks = 0x0020,
FeatureNoHTMLSpans = 0x0040,
FeatureTables = 0x0100,
FeatureStrikeThrough = 0x0200,
FeaturePermissiveWWWAutoLinks = 0x0400,
FeatureTasklists = 0x0800,
FeatureUnderline = 0x4000,
// composite flags
FeaturePermissiveAutoLinks = FeaturePermissiveMailAutoLinks
| FeaturePermissiveURLAutoLinks | FeaturePermissiveWWWAutoLinks,
FeatureNoHTML = QTextDocument::MarkdownNoHTML,
DialectCommonMark = QTextDocument::MarkdownDialectCommonMark,
DialectGitHub = QTextDocument::MarkdownDialectGitHub
};
Q_DECLARE_FLAGS(Features, Feature)
QTextMarkdownImporter(Features features);
QTextMarkdownImporter(QTextDocument::MarkdownFeatures features);
void import(QTextDocument *doc, const QString &markdown);
public:
// MD4C callbacks
int cbEnterBlock(int blockType, void* detail);
int cbLeaveBlock(int blockType, void* detail);
int cbEnterSpan(int spanType, void* detail);
int cbLeaveSpan(int spanType, void* detail);
int cbText(int textType, const char* text, unsigned size);
private:
void insertBlock();
private:
QTextDocument *m_doc = nullptr;
QTextCursor *m_cursor = nullptr;
QTextTable *m_currentTable = nullptr; // because m_cursor->currentTable() doesn't work
#if QT_CONFIG(regularexpression)
QString m_htmlAccumulator;
#endif
QString m_blockCodeLanguage;
QList<int> m_nonEmptyTableCells; // in the current row
QStack<QPointer<QTextList>> m_listStack;
QStack<QTextCharFormat> m_spanFormatStack;
QFont m_monoFont;
QPalette m_palette;
#if QT_CONFIG(regularexpression)
int m_htmlTagDepth = 0;
#endif
int m_blockQuoteDepth = 0;
int m_tableColumnCount = 0;
int m_tableRowCount = 0;
int m_tableCol = -1; // because relative cell movements (e.g. m_cursor->movePosition(QTextCursor::NextCell)) don't work
int m_paragraphMargin = 0;
int m_blockType = 0;
char m_blockCodeFence = 0;
Features m_features;
QTextImageFormat m_imageFormat;
QTextListFormat m_listFormat;
QTextBlockFormat::MarkerType m_markerType = QTextBlockFormat::MarkerType::NoMarker;
bool m_needsInsertBlock = false;
bool m_needsInsertList = false;
bool m_listItem = false; // true from the beginning of LI to the end of the first P
bool m_codeBlock = false;
bool m_imageSpan = false;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QTextMarkdownImporter::Features)
QT_END_NAMESPACE
#endif // QTEXTMARKDOWNIMPORTER_H

View File

@@ -1,62 +0,0 @@
// Copyright (C) 2019 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 QTEXTMARKDOWNWRITER_P_H
#define QTEXTMARKDOWNWRITER_P_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 <QtGui/private/qtguiglobal_p.h>
#include <QtCore/QTextStream>
#include "qtextdocument_p.h"
#include "qtextdocumentwriter.h"
QT_BEGIN_NAMESPACE
class QAbstractItemModel;
class Q_GUI_EXPORT QTextMarkdownWriter
{
public:
QTextMarkdownWriter(QTextStream &stream, QTextDocument::MarkdownFeatures features);
bool writeAll(const QTextDocument *document);
#if QT_CONFIG(itemmodel)
void writeTable(const QAbstractItemModel *table);
#endif
int writeBlock(const QTextBlock &block, bool table, bool ignoreFormat, bool ignoreEmpty);
void writeFrame(const QTextFrame *frame);
private:
struct ListInfo {
bool loose;
};
ListInfo listInfo(QTextList *list);
private:
QTextStream &m_stream;
QTextDocument::MarkdownFeatures m_features;
QMap<QTextList *, ListInfo> m_listInfo;
QString m_linePrefix;
QString m_codeBlockFence;
int m_wrappedLineIndent = 0;
int m_lastListIndent = 1;
bool m_doubleNewlineWritten = false;
bool m_indentedCodeBlock = false;
bool m_fencedCodeBlock = false;
};
QT_END_NAMESPACE
#endif // QTEXTMARKDOWNWRITER_P_H

View File

@@ -1,94 +0,0 @@
// 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 QTEXTODFWRITER_H
#define QTEXTODFWRITER_H
#include <QtGui/private/qtguiglobal_p.h>
#ifndef QT_NO_TEXTODFWRITER
//
// 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/qhash.h>
#include <QtCore/qlist.h>
#include <QtCore/qset.h>
#include <QtCore/qstack.h>
#include <QtCore/QXmlStreamWriter>
#include "qtextdocument_p.h"
#include "qtextdocumentwriter.h"
QT_BEGIN_NAMESPACE
class QTextDocumentPrivate;
class QTextCursor;
class QTextBlock;
class QIODevice;
class QXmlStreamWriter;
class QTextOdfWriterPrivate;
class QTextBlockFormat;
class QTextCharFormat;
class QTextListFormat;
class QTextFrameFormat;
class QTextTableCellFormat;
class QTextFrame;
class QTextFragment;
class QOutputStrategy;
class Q_AUTOTEST_EXPORT QTextOdfWriter {
public:
QTextOdfWriter(const QTextDocument &document, QIODevice *device);
bool writeAll();
void setCreateArchive(bool on) { m_createArchive = on; }
bool createArchive() const { return m_createArchive; }
void writeBlock(QXmlStreamWriter &writer, const QTextBlock &block);
void writeFormats(QXmlStreamWriter &writer, const QSet<int> &formatIds) const;
void writeBlockFormat(QXmlStreamWriter &writer, QTextBlockFormat format, int formatIndex) const;
void writeCharacterFormat(QXmlStreamWriter &writer, QTextCharFormat format, int formatIndex) const;
void writeListFormat(QXmlStreamWriter &writer, QTextListFormat format, int formatIndex) const;
void writeFrameFormat(QXmlStreamWriter &writer, QTextFrameFormat format, int formatIndex) const;
void writeTableFormat(QXmlStreamWriter &writer, QTextTableFormat format, int formatIndex) const;
void writeTableCellFormat(QXmlStreamWriter &writer, QTextTableCellFormat format,
int formatIndex, QList<QTextFormat> &styles) const;
void writeFrame(QXmlStreamWriter &writer, const QTextFrame *frame);
void writeInlineCharacter(QXmlStreamWriter &writer, const QTextFragment &fragment) const;
const QString officeNS, textNS, styleNS, foNS, tableNS, drawNS, xlinkNS, svgNS;
const int defaultImageResolution = 11811; // 11811 dots per meter = (about) 300 dpi
protected:
void tableCellStyleElement(QXmlStreamWriter &writer, const int &formatIndex,
const QTextTableCellFormat &format,
bool hasBorder, int tableId = 0,
const QTextTableFormat tableFormatTmp = QTextTableFormat()) const;
private:
const QTextDocument *m_document;
QIODevice *m_device;
QOutputStrategy *m_strategy;
bool m_createArchive;
QStack<QTextList *> m_listStack;
QHash<int, QList<int>> m_cellFormatsInTablesWithBorders;
QSet<int> m_tableFormatsWithBorders;
mutable QSet<int> m_tableFormatsWithColWidthConstraints;
};
QT_END_NAMESPACE
#endif // QT_NO_TEXTODFWRITER
#endif // QTEXTODFWRITER_H

View File

@@ -1,44 +0,0 @@
// Copyright (C) 2019 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 QWASMLOCALFILEACCESS_P_H
#define QWASMLOCALFILEACCESS_P_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 <private/qglobal_p.h>
#include <cstdint>
#include <functional>
QT_BEGIN_NAMESPACE
namespace QWasmLocalFileAccess {
enum FileSelectMode { SingleFile, MultipleFiles };
Q_CORE_EXPORT void openFiles(const std::string &accept, FileSelectMode fileSelectMode,
const std::function<void (int fileCount)> &fileDialogClosed,
const std::function<char *(uint64_t size, const std::string name)> &acceptFile,
const std::function<void()> &fileDataReady);
Q_CORE_EXPORT void openFile(const std::string &accept,
const std::function<void (bool fileSelected)> &fileDialogClosed,
const std::function<char *(uint64_t size, const std::string name)> &acceptFile,
const std::function<void()> &fileDataReady);
Q_CORE_EXPORT void saveFile(const char *content, size_t size, const std::string &fileNameHint);
} // namespace QWasmLocalFileAccess
QT_END_NAMESPACE
#endif // QWASMLOCALFILEACCESS_P_H

View File

@@ -1,59 +0,0 @@
// Copyright (C) 2020 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 QWINDOWSDIRECTWRITEFONTDATABASE_P_H
#define QWINDOWSDIRECTWRITEFONTDATABASE_P_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 <QtGui/qtguiglobal.h>
#include <QtGui/private/qtgui-config_p.h>
QT_REQUIRE_CONFIG(directwrite3);
#include "qwindowsfontdatabasebase_p.h"
#include <QtCore/qloggingcategory.h>
struct IDWriteFactory;
struct IDWriteFont;
struct IDWriteFontFamily;
struct IDWriteLocalizedStrings;
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QWindowsDirectWriteFontDatabase : public QWindowsFontDatabaseBase
{
Q_DISABLE_COPY_MOVE(QWindowsDirectWriteFontDatabase)
public:
QWindowsDirectWriteFontDatabase();
~QWindowsDirectWriteFontDatabase() override;
void populateFontDatabase() override;
void populateFamily(const QString &familyName) override;
QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override;
QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *font = nullptr) override;
void releaseHandle(void *handle) override;
QFont defaultFont() const override;
bool fontsAlwaysScalable() const override;
bool isPrivateFontFamily(const QString &family) const override;
private:
static QString localeString(IDWriteLocalizedStrings *names, wchar_t localeName[]);
QHash<QString, IDWriteFontFamily *> m_populatedFonts;
};
QT_END_NAMESPACE
#endif // QWINDOWSDIRECTWRITEFONTDATABASE_P_H

View File

@@ -1,43 +0,0 @@
// 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 QWINDOWSFONTDATABASEFT_H
#define QWINDOWSFONTDATABASEFT_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 <QtGui/private/qfreetypefontdatabase_p.h>
#include <QtCore/QSharedPointer>
#include <QtCore/qt_windows.h>
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QWindowsFontDatabaseFT : public QFreeTypeFontDatabase
{
public:
void populateFontDatabase() override;
void populateFamily(const QString &familyName) override;
QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize,
QFont::HintingPreference hintingPreference) override;
QStringList fallbacksForFamily(const QString &family, QFont::Style style,
QFont::StyleHint styleHint,
QChar::Script script) const override;
QString fontDir() const override;
QFont defaultFont() const override;
};
QT_END_NAMESPACE
#endif // QWINDOWSFONTDATABASEFT_H

Some files were not shown because too many files have changed in this diff Show More