diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.h | 93 |
1 files changed, 33 insertions, 60 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index e3152f153c..ba1bc052fb 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -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 #ifndef QCOCOAWINDOW_H #define QCOCOAWINDOW_H @@ -75,9 +39,9 @@ class QDebug; // QCocoaWindow // // QCocoaWindow is an NSView (not an NSWindow!) in the sense -// that it relies on a NSView for all event handling and -// graphics output and does not require a NSWindow, except for -// for the window-related functions like setWindowTitle. +// that it relies on an NSView for all event handling and +// graphics output and does not require an NSWindow, except for +// the window-related functions like setWindowTitle. // // As a consequence of this it is possible to embed the QCocoaWindow // in an NSView hierarchy by getting a pointer to the "backing" @@ -194,18 +158,19 @@ public: void setWindowCursor(NSCursor *cursor); void registerTouch(bool enable); - void setContentBorderThickness(int topThickness, int bottomThickness); + void registerContentBorderArea(quintptr identifier, int upper, int lower); void setContentBorderAreaEnabled(quintptr identifier, bool enable); void setContentBorderEnabled(bool enable) override; bool testContentBorderAreaPosition(int position) const; void applyContentBorderThickness(NSWindow *window = nullptr); - void updateNSToolbar(); qreal devicePixelRatio() const override; QWindow *childWindowAt(QPoint windowPoint); bool shouldRefuseKeyWindowAndFirstResponder(); + bool windowEvent(QEvent *event) override; + QPoint bottomLeftClippedByNSWindowOffset() const override; void updateNormalGeometry(); @@ -225,7 +190,7 @@ protected: void recreateWindowIfNeeded(); QCocoaNSWindow *createNSWindow(bool shouldBePanel); - Qt::WindowState windowState() const; + Qt::WindowStates windowState() const; void applyWindowState(Qt::WindowStates newState); void toggleMaximized(); void toggleFullScreen(); @@ -251,32 +216,35 @@ public: // for QNSView void handleWindowStateChanged(HandleFlags flags = NoHandleFlags); void handleExposeEvent(const QRegion ®ion); - NSView *m_view; - QCocoaNSWindow *m_nsWindow; + static void closeAllPopups(); + static void setupPopupMonitor(); + static void removePopupMonitor(); + + NSView *m_view = nil; + QCocoaNSWindow *m_nsWindow = nil; - Qt::WindowStates m_lastReportedWindowState; - Qt::WindowModality m_windowModality; + Qt::WindowStates m_lastReportedWindowState = Qt::WindowNoState; + Qt::WindowModality m_windowModality = Qt::NonModal; static QPointer<QCocoaWindow> s_windowUnderMouse; - bool m_initialized; - bool m_inSetVisible; - bool m_inSetGeometry; - bool m_inSetStyleMask; - QCocoaMenuBar *m_menubar; + bool m_initialized = false; + bool m_inSetVisible = false; + bool m_inSetGeometry = false; + bool m_inSetStyleMask = false; - bool m_frameStrutEventsEnabled; + QCocoaMenuBar *m_menubar = nullptr; + + bool m_frameStrutEventsEnabled = false; QRect m_exposedRect; QRect m_normalGeometry; - int m_registerTouchCount; - bool m_resizableTransientParent; + int m_registerTouchCount = 0; + bool m_resizableTransientParent = false; static const int NoAlertRequest; - NSInteger m_alertRequest; + NSInteger m_alertRequest = NoAlertRequest; - bool m_drawContentBorderGradient; - int m_topContentBorderThickness; - int m_bottomContentBorderThickness; + bool m_drawContentBorderGradient = false; struct BorderRange { BorderRange(quintptr i, int u, int l) : identifier(i), upper(u), lower(l) { } @@ -290,11 +258,16 @@ public: // for QNSView QHash<quintptr, BorderRange> m_contentBorderAreas; // identifier -> uppper/lower QHash<quintptr, bool> m_enabledContentBorderAreas; // identifier -> enabled state (true/false) + static inline id s_globalMouseMonitor = 0; + static inline id s_applicationActivationObserver = 0; + #if QT_CONFIG(vulkan) VkSurfaceKHR m_vulkanSurface = nullptr; #endif }; +extern const NSNotificationName QCocoaWindowWillReleaseQNSViewNotification; + #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug debug, const QCocoaWindow *window); #endif |