18#include "private/qglobal_p.h"
20#include <QtCore/qoperatingsystemversion.h>
25typedef int kern_return_t;
26typedef mach_port_t io_object_t;
28kern_return_t IOObjectRetain(io_object_t
object);
29kern_return_t IOObjectRelease(io_object_t
object);
33#ifndef __IMAGECAPTURE__
34# define __IMAGECAPTURE__
39#if defined(QT_BOOTSTRAPPED)
40#include <ApplicationServices/ApplicationServices.h>
42#include <CoreFoundation/CoreFoundation.h>
46#include <Foundation/Foundation.h>
54#if defined( __OBJC__) && defined(QT_NAMESPACE)
55#define QT_NAMESPACE_ALIAS_OBJC_CLASS(__KLASS__) @compatibility_alias __KLASS__ QT_MANGLE_NAMESPACE(__KLASS__)
57#define QT_NAMESPACE_ALIAS_OBJC_CLASS(__KLASS__)
60#define QT_MAC_WEAK_IMPORT(symbol) extern "C" decltype(symbol) symbol __attribute__((weak_import));
63#define QT_DECLARE_NAMESPACED_OBJC_INTERFACE(classname, definition) \
64 @interface QT_MANGLE_NAMESPACE(classname) : \
67 QT_NAMESPACE_ALIAS_OBJC_CLASS(classname);
69#define QT_DECLARE_NAMESPACED_OBJC_INTERFACE(classname, definition) \
70 Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(classname)); \
71 using classname = QT_MANGLE_NAMESPACE(classname);
74#define QT_FORWARD_DECLARE_OBJC_ENUM(name, type) \
81#define QtExtras QT_MANGLE_NAMESPACE(QtExtras)
84template <
typename T,
typename U, auto RetainFunction, auto ReleaseFunction>
91 noexcept(std::is_nothrow_move_constructible<T>::value)
94 noexcept(std::is_nothrow_move_assignable<T>::value &&
95 std::is_nothrow_move_constructible<T>::value)
101 operator T()
const {
return value; }
107 noexcept(std::is_nothrow_move_assignable<T>::value &&
108 std::is_nothrow_move_constructible<T>::value)
126class QMacRootLevelAutoReleasePool
130 ~QMacRootLevelAutoReleasePool();
155 template <
typename X>
X as()
const {
return reinterpret_cast<X>(this->
value); }
166class QIOType :
public QAppleRefCounted<T, io_object_t, IOObjectRetain, IOObjectRelease>
179 Q_CORE_EXPORT
operator QString()
const;
180 Q_CORE_EXPORT
operator CFStringRef()
const;
187Q_CORE_EXPORT
bool qt_mac_applicationIsInDarkMode();
188Q_CORE_EXPORT
bool qt_mac_runningUnderRosetta();
189Q_CORE_EXPORT std::optional<uint32_t> qt_mac_sipConfiguration();
190#ifdef QT_BUILD_INTERNAL
195#ifndef QT_NO_DEBUG_STREAM
202#if !defined(QT_BOOTSTRAPPED)
207@interface NSObject (QtSandboxHelpers)
208- (
id)qt_valueForPrivateKey:(NSString *)key;
214#if !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WATCHOS)
216# if defined(Q_OS_MACOS)
229#if !defined(QT_BOOTSTRAPPED)
230#define QT_USE_APPLE_UNIFIED_LOGGING
243 static os_log_type_t logTypeForMessageType(
QtMsgType msgType);
251#if !defined(QT_BOOTSTRAPPED)
254#include <os/activity.h>
278 os_activity_scope_enter(
static_cast<os_activity_t
>(*
this), &
state);
279 return std::move(*
this);
285 os_activity_scope_leave(&
state);
288 operator os_activity_t()
290 return reinterpret_cast<os_activity_t
>(
static_cast<void *
>(activity));
295 activity.swap(
other.activity);
302 os_activity_scope_state_s
state;
305#define QT_APPLE_LOG_ACTIVITY_CREATE(condition, description, parent) []() { \
307 return QAppleLogActivity(); \
308 return QAppleLogActivity(os_activity_create(description, parent, OS_ACTIVITY_FLAG_DEFAULT)); \
311#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT_3(condition, description, parent) QT_APPLE_LOG_ACTIVITY_CREATE(condition, description, parent)
312#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT_2(description, parent) QT_APPLE_LOG_ACTIVITY_WITH_PARENT_3(true, description, parent)
313#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT(...) QT_OVERLOADED_MACRO(QT_APPLE_LOG_ACTIVITY_WITH_PARENT, __VA_ARGS__)
316#define QT_APPLE_LOG_ACTIVITY_2(condition, description) QT_APPLE_LOG_ACTIVITY_CREATE(condition, description, OS_ACTIVITY_CURRENT)
317#define QT_APPLE_LOG_ACTIVITY_1(description) QT_APPLE_LOG_ACTIVITY_2(true, description)
318#define QT_APPLE_LOG_ACTIVITY(...) QT_OVERLOADED_MACRO(QT_APPLE_LOG_ACTIVITY, __VA_ARGS__)
320#define QT_APPLE_SCOPED_LOG_ACTIVITY(...) QAppleLogActivity scopedLogActivity = QT_APPLE_LOG_ACTIVITY(__VA_ARGS__).enter();
331#if defined( __OBJC__)
332 template<
typename Functor>
334 observer = [[NSNotificationCenter defaultCenter] addObserverForName:name
335 object:object queue:nil usingBlock:^(NSNotification *) {
360 NSObject *observer =
nullptr;
374#if defined( __OBJC__)
377 NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew)
380 addObserver(options);
399 void removeObserver();
405 callback.swap(
other.callback);
409#if defined( __OBJC__)
410 void addObserver(NSKeyValueObservingOptions options);
413 NSObject *
object =
nullptr;
415 std::unique_ptr<Callback> callback;
417 static KeyValueObserver *observer;
437 static VersionTuple versionsForImage(
const mach_header *machHeader);
438 static VersionTuple applicationVersion();
439 static VersionTuple libraryVersion();
static bool preventsStderrLogging()
static bool messageHandler(QtMsgType msgType, const QMessageLogContext &context, const QString &message, const QString &subsystem=QString())
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]
Combined button and popup list for selecting options.
static jboolean copy(JNIEnv *, jobject)
std::pair< T1, T2 > QPair
AppleApplication * qt_apple_sharedApplication()
#define QT_MAC_WEAK_IMPORT(symbol)
UIApplication AppleApplication
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
#define Q_AUTOTEST_EXPORT
settings remove("monkey")