diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoanativeinterface.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 95 |
1 files changed, 4 insertions, 91 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 7dc5e9099d..58bda2706a 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// 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 #include <AppKit/AppKit.h> @@ -62,6 +26,7 @@ #include <QtGui/qguiapplication.h> #include <qdebug.h> +#include <QtGui/private/qmacmimeregistry_p.h> #include <QtGui/private/qcoregraphics_p.h> #if QT_CONFIG(vulkan) @@ -100,49 +65,16 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter return NativeResourceForIntegrationFunction(QCocoaNativeInterface::registerTouchWindow); if (resource.toLower() == "setembeddedinforeignview") return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setEmbeddedInForeignView); - if (resource.toLower() == "setcontentborderthickness") - return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setContentBorderThickness); if (resource.toLower() == "registercontentborderarea") return NativeResourceForIntegrationFunction(QCocoaNativeInterface::registerContentBorderArea); if (resource.toLower() == "setcontentborderareaenabled") return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setContentBorderAreaEnabled); - if (resource.toLower() == "setnstoolbar") - return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setNSToolbar); if (resource.toLower() == "testcontentborderposition") return NativeResourceForIntegrationFunction(QCocoaNativeInterface::testContentBorderPosition); return nullptr; } -QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard() -{ - // Note: starting with macOS 10.14, the KeyboardSetupAssistant app bundle no - // longer contains the "Background.png" image. This function then returns a - // null pixmap. - const int ExpectedImageWidth = 242; - const int ExpectedImageHeight = 414; - QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier( - CFSTR("com.apple.KeyboardSetupAssistant"), nullptr); - if (urls && CFArrayGetCount(urls) > 0) { - CFURLRef url = (CFURLRef)CFArrayGetValueAtIndex(urls, 0); - QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, url); - if (bundle) { - url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("png"), nullptr); - if (url) { - QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithURL(url, nullptr); - QCFType<CGImageRef> image = CGImageSourceCreateImageAtIndex(imageSource, 0, nullptr); - if (image) { - int width = CGImageGetWidth(image); - int height = CGImageGetHeight(image); - if (width == ExpectedImageWidth && height == ExpectedImageHeight) - return QPixmap::fromImage(qt_mac_toQImage(image)); - } - } - } - } - return QPixmap(); -} - void QCocoaNativeInterface::clearCurrentThreadCocoaEventDispatcherInterruptFlag() { QCocoaEventDispatcher::clearCurrentThreadCocoaEventDispatcherInterruptFlag(); @@ -156,7 +88,7 @@ void QCocoaNativeInterface::onAppFocusWindowChanged(QWindow *window) void QCocoaNativeInterface::registerDraggedTypes(const QStringList &types) { - qt_mac_registerDraggedTypes(types); + QMacMimeRegistry::registerDraggedTypes(types); } void QCocoaNativeInterface::setEmbeddedInForeignView(QPlatformWindow *window, bool embedded) @@ -176,16 +108,6 @@ void QCocoaNativeInterface::registerTouchWindow(QWindow *window, bool enable) cocoaWindow->registerTouch(enable); } -void QCocoaNativeInterface::setContentBorderThickness(QWindow *window, int topThickness, int bottomThickness) -{ - if (!window) - return; - - QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle()); - if (cocoaWindow) - cocoaWindow->setContentBorderThickness(topThickness, bottomThickness); -} - void QCocoaNativeInterface::registerContentBorderArea(QWindow *window, quintptr identifier, int upper, int lower) { if (!window) @@ -206,15 +128,6 @@ void QCocoaNativeInterface::setContentBorderAreaEnabled(QWindow *window, quintpt cocoaWindow->setContentBorderAreaEnabled(identifier, enable); } -void QCocoaNativeInterface::setNSToolbar(QWindow *window, void *nsToolbar) -{ - QCocoaIntegration::instance()->setToolbar(window, static_cast<NSToolbar *>(nsToolbar)); - - QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle()); - if (cocoaWindow) - cocoaWindow->updateNSToolbar(); -} - bool QCocoaNativeInterface::testContentBorderPosition(QWindow *window, int position) { if (!window) |