Source code

Revision control

Copy as Markdown

// Copyright (C) 2025 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 QOHOSPLATFORMSCREEN_H
#define QOHOSPLATFORMSCREEN_H
#include <qpa/qplatformscreen.h>
#include <QtGui/qpa/qplatformscreen_p.h>
#include <QtCore/qlist.h>
#include <QtGui/qpainter.h>
#include <QtCore/qtimer.h>
#include <QtCore/qwaitcondition.h>
#include <QtCore/qatomic.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/private/qohoscommon_p.h>
#include <functional>
#include <optional>
#include <qohosdisplayinfo.h>
#include "EGL/eglplatform.h"
#include "qohosplatformcursor.h"
QT_BEGIN_NAMESPACE
class QOhosPlatformWindow;
class QOhosNativeXComponent;
class QOhosPlatformScreen: public QObject, public QPlatformScreen, public QNativeInterface::Private::QOhosScreen
{
Q_OBJECT
public:
QOhosPlatformScreen(
const QOhosDisplayInfo &displayInfo,
QOhosSupplier<std::vector<QOhosPlatformScreen *>> platformScreenListSupplier);
~QOhosPlatformScreen();
static QOhosPlatformScreen *fromQScreen(QScreen *screen);
QRect geometry() const override;
QRect availableGeometry() const override;
int depth() const override;
QImage::Format format() const override;
QSizeF physicalSize() const override;
qreal pixelScalingCoefficient() const;
qreal refreshRate() const override;
QString name() const override;
QWindow *topLevelAt(const QPoint & p) const override;
QPlatformCursor *cursor() const override;
// compositor api
void notifyWindowVisibleAndActivated(QOhosPlatformWindow *window);
void removeWindow(QOhosPlatformWindow *window);
const QOhosDisplayInfo &displayInfo() const;
double displayId() const override;
QPixmap grabWindow(WId wId, int x, int y, int width, int height) const override;
void setDisplayInfo(const QOhosDisplayInfo &displayInfo);
void setAvailableGeometry(const QRect &rect);
QList<QPlatformScreen *> virtualSiblings() const override;
protected:
QDpi logicalDpi() const override;
QDpi logicalBaseDpi() const override;
Qt::ScreenOrientation orientation() const override;
Qt::ScreenOrientation nativeOrientation() const override;
private:
QRect getAvailableArea() const;
QImage::Format m_format;
int m_depth;
void releaseSurface();
QScopedPointer<QOhosPlatformCursor> m_platformCursor;
QOhosDisplayInfo m_displayInfo;
mutable std::optional<Qt::ScreenOrientation> m_nativeOrientation;
QRect m_availableGeometry;
QOhosSupplier<std::vector<QOhosPlatformScreen *>> m_platformScreenListSupplier;
};
QT_END_NAMESPACE
#endif