10#include <qpa/qplatformintegration.h>
11#include <QtCore/private/qcore_mac_p.h>
13#include <CoreGraphics/CoreGraphics.h>
14#include <CoreVideo/CoreVideo.h>
16#import <AppKit/NSScreen.h>
17#import <Foundation/NSArray.h>
21class QCocoaIntegration;
30 QPixmap grabWindow(WId window,
int x,
int y,
int width,
int height)
const override;
66 static void initializeScreens();
67 static void updateScreens();
68 static void cleanupScreens();
70 static void updateHdrWindows();
72 static QMacNotificationObserver s_screenParameterObserver;
73 static CGDisplayReconfigurationCallBack s_displayReconfigurationCallBack;
75 static void add(CGDirectDisplayID displayId);
76 QCocoaScreen(CGDirectDisplayID displayId);
77 void update(CGDirectDisplayID displayId);
80 bool isOnline()
const;
81 bool isMirroring()
const;
84 CGDirectDisplayID displayId()
const {
return m_displayId; }
87 QRect m_availableGeometry;
88 qreal m_refreshRate = 0;
91 QImage::Format m_format;
92 QColorSpace m_colorSpace;
93 QSizeF m_physicalSize;
94 QCocoaCursor *m_cursor;
95 qreal m_devicePixelRatio = 0;
98 CVDisplayLinkRef m_displayLink =
nullptr;
99 dispatch_source_t m_displayLinkSource =
nullptr;
100 QAtomicInt m_pendingUpdateRequests;
101 QAtomicInt m_pendingDisplayLinkUpdates;
103 void maybeStopDisplayLink();
105 friend class QCocoaIntegration;
107 friend QDebug operator<<(QDebug debug,
const QCocoaScreen *screen);
110#ifndef QT_NO_DEBUG_STREAM
111QDebug operator<<(QDebug debug,
const QCocoaScreen *screen);
119#define qt_displayId QT_MANGLE_NAMESPACE(qt_displayId)
121@interface NSScreen (QtExtras)
122@property(readonly) CGDirectDisplayID qt_displayId;
qreal refreshRate() const override
Reimplement this function in subclass to return the vertical refresh rate of the screen,...
QRect availableGeometry() const override
Reimplement in subclass to return the pixel geometry of the available space This normally is the desk...
QColorSpace colorSpace() const override
static CGPoint mapToNative(const QPointF &pos, QCocoaScreen *screen=QCocoaScreen::primaryScreen())
static NSScreen * nativeScreenForDisplayId(CGDirectDisplayID displayId)
QSizeF physicalSize() const override
Reimplement this function in subclass to return the physical size of the screen, in millimeters.
QImage::Format format() const override
Reimplement in subclass to return the image format which corresponds to the screen format.
QPixmap grabWindow(WId window, int x, int y, int width, int height) const override
static QCocoaScreen * get(NSScreen *nsScreen)
QDpi logicalBaseDpi() const override
Reimplement to return the base logical DPI for the platform.
void deliverUpdateRequests()
int depth() const override
Reimplement in subclass to return current depth of the screen.
qreal devicePixelRatio() const override
Reimplement this function in subclass to return the device pixel ratio for the screen.
static CGRect mapToNative(const QRectF &rect, QCocoaScreen *screen=QCocoaScreen::primaryScreen())
NSScreen * nativeScreen() const override
QPlatformScreen::SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override
Returns a hint about this screen's subpixel layout structure.
static QCocoaScreen * primaryScreen()
The screen used as a reference for global window geometry.
static QCocoaScreen * get(CGDirectDisplayID displayId)
static QPointF mapFromNative(CGPoint pos, QCocoaScreen *screen=QCocoaScreen::primaryScreen())
QPlatformCursor * cursor() const override
Reimplement this function in subclass to return the cursor of the screen.
Qt::ScreenOrientation orientation() const override
Reimplement this function in subclass to return the current orientation of the screen,...
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
QString name() const override
QList< QPlatformScreen * > virtualSiblings() const override
Returns a list of all the platform screens that are part of the same virtual desktop.
QWindow * topLevelAt(const QPoint &point) const override
Return the given top level window for a given position.
\inmodule QtCore\reentrant