Skip to content

Commit

Permalink
Revert "Apple: Fix a few deprecation warnings after bumping deploymen…
Browse files Browse the repository at this point in the history
…t targets"

This reverts commit 2a2a301.
  • Loading branch information
AlienCowEatCake committed Oct 19, 2024
1 parent ceaacad commit e407bab
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 34 deletions.
6 changes: 0 additions & 6 deletions src/corelib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -694,12 +694,6 @@ qt_internal_extend_target(Core CONDITION UNIX
kernel/qtimerinfo_unix.cpp kernel/qtimerinfo_unix_p.h
thread/qthread_unix.cpp
)
if(APPLE)
set_source_files_properties(io/qfilesystemengine_unix.cpp PROPERTIES LANGUAGE OBJCXX)
qt_internal_extend_target(Core CONDITION
PUBLIC_LIBRARIES ${FWUniformTypeIdentifiers}
)
endif()

qt_internal_extend_target(Core CONDITION UNIX AND NOT WASM
SOURCES
Expand Down
3 changes: 2 additions & 1 deletion src/corelib/global/qsysinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,8 @@ QByteArray QSysInfo::machineUniqueId()
{
#if defined(Q_OS_DARWIN) && __has_include(<IOKit/IOKitLib.h>)
char uuid[UuidStringLen + 1];
io_service_t service = IOServiceGetMatchingService(kIOMainPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
static const mach_port_t defaultPort = 0; // Effectively kIOMasterPortDefault/kIOMainPortDefault
io_service_t service = IOServiceGetMatchingService(defaultPort, IOServiceMatching("IOPlatformExpertDevice"));
QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0);
CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman);
return QByteArray(uuid);
Expand Down
21 changes: 13 additions & 8 deletions src/corelib/io/qfilesystemengine_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
#if defined(Q_OS_DARWIN)
# include <QtCore/private/qcore_mac_p.h>
# include <CoreFoundation/CFBundle.h>
# include <UniformTypeIdentifiers/UTType.h>
# include <UniformTypeIdentifiers/UTCoreTypes.h>
# include <Foundation/Foundation.h>
# include <sys/clonefile.h>
# include <copyfile.h>
#endif

#ifdef Q_OS_MACOS
Expand All @@ -54,6 +49,15 @@
#include <MobileCoreServices/MobileCoreServices.h>
#endif

#if defined(Q_OS_DARWIN)
# include <sys/clonefile.h>
# include <copyfile.h>
// We cannot include <Foundation/Foundation.h> (it's an Objective-C header), but
// we need these declarations:
Q_FORWARD_DECLARE_OBJC_CLASS(NSString);
extern "C" NSString *NSTemporaryDirectory();
#endif

#if defined(Q_OS_LINUX)
# include <sys/ioctl.h>
# include <sys/sendfile.h>
Expand Down Expand Up @@ -123,9 +127,10 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e
QString suffix = info.suffix();

if (suffix.length() > 0) {
// First step: is it a bundle?
const auto *utType = [UTType typeWithFilenameExtension:suffix.toNSString()];
if ([utType conformsToType:UTTypeBundle])
// First step: is the extension known ?
QCFType<CFStringRef> extensionRef = suffix.toCFString();
QCFType<CFStringRef> uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL);
if (UTTypeConformsTo(uniformTypeIdentifier, kUTTypeBundle))
return true;

// Second step: check if an application knows the package type
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/kernel/qcore_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ bool qt_mac_runningUnderRosetta()
return config;
#endif

QIOType<io_registry_entry_t> nvram = IORegistryEntryFromPath(kIOMainPortDefault, "IODeviceTree:/options");
QIOType<io_registry_entry_t> nvram = IORegistryEntryFromPath(kIOMasterPortDefault, "IODeviceTree:/options");
if (!nvram) {
qWarning("Failed to locate NVRAM entry in IO registry");
return {};
Expand Down
3 changes: 1 addition & 2 deletions src/gui/platform/darwin/qutimimeconverter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <ImageIO/ImageIO.h>
#include <CoreFoundation/CoreFoundation.h>
#include <UniformTypeIdentifiers/UTCoreTypes.h>

#include <QtCore/qsystemdetection.h>
#include <QtCore/qurl.h>
Expand Down Expand Up @@ -785,7 +784,7 @@ QVariant convertToMime(const QString &mime, const QList<QByteArray> &data,

QCFType<CFMutableDataRef> data = CFDataCreateMutable(0, 0);
QCFType<CGImageDestinationRef> imageDestination = CGImageDestinationCreateWithData(data,
(CFStringRef)UTTypeTIFF.identifier, 1, 0);
kUTTypeTIFF, 1, 0);

if (!imageDestination)
return QList<QByteArray>();
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/platforms/cocoa/qcocoadrag.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include <AppKit/AppKit.h>
#include <UniformTypeIdentifiers/UTCoreTypes.h>

#include "qcocoadrag.h"
#include "qmacclipboard.h"
Expand Down Expand Up @@ -156,7 +155,8 @@
for (NSPasteboardItem *item in dragBoard.pasteboardItems) {
bool isUrl = false;
for (NSPasteboardType type in item.types) {
if ([type isEqualToString:UTTypeFileURL.identifier]) {
using NSStringRef = NSString *;
if ([type isEqualToString:NSStringRef(kUTTypeFileURL)]) {
isUrl = true;
break;
}
Expand Down
5 changes: 2 additions & 3 deletions src/plugins/platforms/cocoa/qcocoaintegration.mm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <QtGui/private/qfontengine_coretext_p.h>

#include <IOKit/graphics/IOGraphicsLib.h>
#include <UniformTypeIdentifiers/UTCoreTypes.h>

#include <inttypes.h>

Expand Down Expand Up @@ -447,8 +446,8 @@ QSurfaceFormat format() const override
return;

static bool hasDefaultApplicationIcon = [](){
NSImage *genericApplicationIcon = [NSWorkspace.sharedWorkspace
iconForContentType:UTTypeApplicationBundle];
NSImage *genericApplicationIcon = [[NSWorkspace sharedWorkspace]
iconForFileType:NSFileTypeForHFSTypeCode(kGenericApplicationIcon)];
NSImage *applicationIcon = [NSImage imageNamed:NSImageNameApplicationIcon];

NSRect rect = NSMakeRect(0, 0, 32, 32);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/platforms/cocoa/qcocoascreen.mm
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
static QString displayName(CGDirectDisplayID displayID)
{
QIOType<io_iterator_t> iterator;
if (IOServiceGetMatchingServices(kIOMainPortDefault,
if (IOServiceGetMatchingServices(kIOMasterPortDefault,
IOServiceMatching("IODisplayConnect"), &iterator))
return QString();

Expand Down
3 changes: 1 addition & 2 deletions src/plugins/platforms/cocoa/qnsview.mm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include <AppKit/AppKit.h>
#include <MetalKit/MetalKit.h>
#include <UniformTypeIdentifiers/UTCoreTypes.h>

#include "qnsview.h"
#include "qcocoawindow.h"
Expand Down Expand Up @@ -417,7 +416,7 @@ @implementation QNSView (QtExtras)

- (QCocoaWindow*)platformWindow
{
return m_platformWindow.data();;
return m_platformWindow.data();
}

@end
4 changes: 2 additions & 2 deletions src/plugins/platforms/cocoa/qnsview_dragging.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ -(void)registerDragTypes
NSPasteboardTypeRTF, NSPasteboardTypeTabularText, NSPasteboardTypeFont,
NSPasteboardTypeRuler, NSFileContentsPboardType,
NSPasteboardTypeRTFD , NSPasteboardTypeHTML,
NSPasteboardTypeURL, NSPasteboardTypePDF, UTTypeVCard.identifier,
(NSString *)kPasteboardTypeFileURLPromise,
NSPasteboardTypeURL, NSPasteboardTypePDF, (NSString *)kUTTypeVCard,
(NSString *)kPasteboardTypeFileURLPromise, (NSString *)kUTTypeInkText,
NSPasteboardTypeMultipleTextSelection, mimeTypeGeneric]];

// Add custom types supported by the application
Expand Down
6 changes: 0 additions & 6 deletions src/tools/bootstrap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@ qt_internal_extend_target(Bootstrap CONDITION UNIX
../../corelib/io/qfsfileengine_unix.cpp
../../corelib/kernel/qcore_unix.cpp
)
if(APPLE)
set_source_files_properties(../../corelib/io/qfilesystemengine_unix.cpp PROPERTIES LANGUAGE OBJCXX)
qt_internal_extend_target(Bootstrap CONDITION
PUBLIC_LIBRARIES ${FWUniformTypeIdentifiers}
)
endif()

qt_internal_extend_target(Bootstrap CONDITION WIN32
SOURCES
Expand Down

0 comments on commit e407bab

Please sign in to comment.