18#include "private/qglobal_p.h"
20#include <QtCore/qoperatingsystemversion.h>
27typedef int kern_return_t;
28typedef mach_port_t io_object_t;
30kern_return_t IOObjectRetain(io_object_t
object);
31kern_return_t IOObjectRelease(io_object_t
object);
35#ifndef __IMAGECAPTURE__
36# define __IMAGECAPTURE__
41#if defined(QT_BOOTSTRAPPED)
42#include <ApplicationServices/ApplicationServices.h>
44#include <CoreFoundation/CoreFoundation.h>
48#include <Foundation/Foundation.h>
55#if defined( __OBJC__) && defined(QT_NAMESPACE)
56#define QT_NAMESPACE_ALIAS_OBJC_CLASS(__KLASS__) @compatibility_alias __KLASS__ QT_MANGLE_NAMESPACE(__KLASS__)
58#define QT_NAMESPACE_ALIAS_OBJC_CLASS(__KLASS__)
61#define QT_MAC_WEAK_IMPORT(symbol) extern "C" decltype(symbol) symbol __attribute__((weak_import));
64#define QT_DECLARE_NAMESPACED_OBJC_INTERFACE(classname, definition) \
65 @interface QT_MANGLE_NAMESPACE(classname) : \
68 QT_NAMESPACE_ALIAS_OBJC_CLASS(classname);
70#define QT_DECLARE_NAMESPACED_OBJC_INTERFACE(classname, definition) \
71 Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(classname)); \
72 using classname = QT_MANGLE_NAMESPACE(classname);
75#define QT_FORWARD_DECLARE_OBJC_ENUM(name, type) \
82#define QtExtras QT_MANGLE_NAMESPACE(QtExtras)
85template <
typename T,
typename U, auto RetainFunction, auto ReleaseFunction>
92 noexcept(std::is_nothrow_move_constructible<T>::value)
95 noexcept(std::is_nothrow_move_assignable<T>::value &&
96 std::is_nothrow_move_constructible<T>::value)
102 operator T()
const {
return value; }
108 noexcept(std::is_nothrow_move_assignable<T>::value &&
109 std::is_nothrow_move_constructible<T>::value)
127class QMacRootLevelAutoReleasePool
131 ~QMacRootLevelAutoReleasePool();
133 std::optional<QMacAutoReleasePool>
pool = std::nullopt;
152 using Base = QAppleRefCounted<T, CFTypeRef, CFRetain, CFRelease>;
156 template <
typename X> X
as()
const {
return reinterpret_cast<X
>(this->
value); }
161 return QCFType<T>(
t);
167class QIOType :
public QAppleRefCounted<T, io_object_t, IOObjectRetain, IOObjectRelease>
180 Q_CORE_EXPORT
operator QString()
const;
181 Q_CORE_EXPORT
operator CFStringRef()
const;
188Q_CORE_EXPORT
bool qt_mac_applicationIsInDarkMode();
189Q_CORE_EXPORT
bool qt_mac_runningUnderRosetta();
190Q_CORE_EXPORT std::optional<uint32_t> qt_mac_sipConfiguration();
191#ifdef QT_BUILD_INTERNAL
196#ifndef QT_NO_DEBUG_STREAM
203#if !defined(QT_BOOTSTRAPPED)
208@interface NSObject (QtExtras)
209- (
id)qt_valueForPrivateKey:(NSString *)key;
215#if !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WATCHOS)
217# if defined(Q_OS_MACOS)
230#if !defined(QT_BOOTSTRAPPED)
231#define QT_USE_APPLE_UNIFIED_LOGGING
247 static os_log_type_t logTypeForMessageType(
QtMsgType msgType);
255#if !defined(QT_BOOTSTRAPPED)
258#include <os/activity.h>
261template <
typename T>
using QAppleOsType = QAppleRefCounted<T, void *, os_retain, os_release>;
282 os_activity_scope_enter(
static_cast<os_activity_t
>(*
this), &
state);
283 return std::move(*
this);
289 os_activity_scope_leave(&
state);
292 operator os_activity_t()
294 return reinterpret_cast<os_activity_t
>(
static_cast<void *
>(activity));
299 activity.swap(
other.activity);
305 QAppleOsType<void *> activity;
306 os_activity_scope_state_s
state;
309#define QT_APPLE_LOG_ACTIVITY_CREATE(condition, description, parent) []() { \
311 return QAppleLogActivity(); \
312 return QAppleLogActivity(os_activity_create(description, parent, OS_ACTIVITY_FLAG_DEFAULT)); \
315#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT_3(condition, description, parent) QT_APPLE_LOG_ACTIVITY_CREATE(condition, description, parent)
316#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT_2(description, parent) QT_APPLE_LOG_ACTIVITY_WITH_PARENT_3(true, description, parent)
317#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT(...) QT_OVERLOADED_MACRO(QT_APPLE_LOG_ACTIVITY_WITH_PARENT, __VA_ARGS__)
320#define QT_APPLE_LOG_ACTIVITY_2(condition, description) QT_APPLE_LOG_ACTIVITY_CREATE(condition, description, OS_ACTIVITY_CURRENT)
321#define QT_APPLE_LOG_ACTIVITY_1(description) QT_APPLE_LOG_ACTIVITY_2(true, description)
322#define QT_APPLE_LOG_ACTIVITY(...) QT_OVERLOADED_MACRO(QT_APPLE_LOG_ACTIVITY, __VA_ARGS__)
324#define QT_APPLE_SCOPED_LOG_ACTIVITY(...) QAppleLogActivity scopedLogActivity = QT_APPLE_LOG_ACTIVITY(__VA_ARGS__).enter();
335#if defined( __OBJC__)
336 template<
typename Functor>
338 observer = [[NSNotificationCenter defaultCenter] addObserverForName:name
339 object:object queue:nil usingBlock:^(NSNotification *) {
364 NSObject *observer =
nullptr;
378#if defined( __OBJC__)
381 NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew)
384 addObserver(options);
403 void removeObserver();
409 callback.swap(
other.callback);
413#if defined( __OBJC__)
414 void addObserver(NSKeyValueObservingOptions options);
417 NSObject *
object =
nullptr;
419 std::unique_ptr<Callback> callback;
421 static KeyValueObserver *observer;
440 using VersionTuple = std::pair<QOperatingSystemVersion, QOperatingSystemVersion>;
441 static VersionTuple versionsForImage(
const mach_header *machHeader);
442 static VersionTuple applicationVersion();
443 static VersionTuple libraryVersion();
450typename std::enable_if<std::is_pointer<T>::value, T>
::type
451qt_objc_cast(
id object)
453 if ([
object isKindOfClass:[typename
std::remove_pointer<T>::
type class]])
static bool messageHandler(QtMsgType msgType, const QMessageLogContext &context, const QString &message)
static bool preventsStderrLogging()
static bool messageHandler(QtMsgType msgType, const QMessageLogContext &context, const QString &message, const QString &subsystem)
void swap(QAppleLogActivity &other)
QAppleLogActivity(os_activity_t activity)
Q_NODISCARD_CTOR QAppleRefCounted(T &&t) noexcept(std::is_nothrow_move_constructible< T >::value)
Q_NODISCARD_CTOR QAppleRefCounted(const QAppleRefCounted &other)
Q_NODISCARD_CTOR QAppleRefCounted(QAppleRefCounted &&other) noexcept(std::is_nothrow_move_assignable< T >::value &&std::is_nothrow_move_constructible< T >::value)
Q_NODISCARD_CTOR QAppleRefCounted()
void swap(QAppleRefCounted &other) noexcept(noexcept(qSwap(value, other.value)))
QAppleRefCounted & operator=(const QAppleRefCounted &other)
QAppleRefCounted & operator=(QAppleRefCounted &&other) noexcept(std::is_nothrow_move_assignable< T >::value &&std::is_nothrow_move_constructible< T >::value)
Q_NODISCARD_CTOR QAppleRefCounted(const T &t)
Q_NODISCARD_CTOR QCFString(const CFStringRef cfstr=0)
Q_NODISCARD_CTOR QCFString(const QCFType< CFStringRef > &other)
Q_NODISCARD_CTOR QCFString(const QString &str)
static QCFType constructFromGet(const T &t)
Q_NODISCARD_CTOR QCFType(CFTypeRef r)
Q_CORE_EXPORT ~QMacAutoReleasePool()
Q_NODISCARD_CTOR Q_CORE_EXPORT QMacAutoReleasePool()
QMacKeyValueObserver(QMacKeyValueObserver &&other) noexcept
QMacKeyValueObserver & operator=(const QMacKeyValueObserver &other)
std::function< void()> Callback
void swap(QMacKeyValueObserver &other) noexcept
QMacKeyValueObserver()=default
QMacNotificationObserver(const QMacNotificationObserver &other)=delete
QMacNotificationObserver(QMacNotificationObserver &&other)
~QMacNotificationObserver()
QMacNotificationObserver()
QMacNotificationObserver & operator=(const QMacNotificationObserver &other)=delete
static QOperatingSystemVersion deploymentTarget(VersionTarget target=ApplicationBinary)
static QOperatingSystemVersion currentRuntime()
static QOperatingSystemVersion buildSDK(VersionTarget target=ApplicationBinary)
\macro QT_RESTRICTED_CAST_FROM_ASCII
const QLoggingCategory & category()
[1]
static Q_CONSTINIT QBasicAtomicPointer< void(QtMsgType, const QMessageLogContext &, const QString &) messageHandler)
Combined button and popup list for selecting options.
static jboolean copy(JNIEnv *, jobject)
AppleApplication * qt_apple_sharedApplication()
#define QT_MAC_WEAK_IMPORT(symbol)
UIApplication AppleApplication
QAppleRefCounted< T, void *, os_retain, os_release > QAppleOsType
Q_CORE_EXPORT bool qt_apple_isSandboxed()
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool)
Q_CORE_EXPORT bool qt_apple_isApplicationExtension()
#define QT_DECLARE_NAMESPACED_OBJC_INTERFACE(classname, definition)
#define Q_FORWARD_DECLARE_OBJC_CLASS(classname)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint GLsizei const GLchar * message
GLsizei const GLchar *const * string
[0]
static QString keyPath(const QString &rKey)
constexpr void qt_ptr_swap(T *&lhs, T *&rhs) noexcept
QT_BEGIN_NAMESPACE constexpr void qSwap(T &value1, T &value2) noexcept(std::is_nothrow_swappable_v< T >)
#define Q_AUTOTEST_EXPORT
settings remove("monkey")