| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#ifndef QWAYLANDSCREEN_H |
| 6 |
#define QWAYLANDSCREEN_H |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#include <qpa/qplatformscreen.h> |
| 20 |
#include <QtWaylandClient/qtwaylandclientglobal.h> |
| 21 |
|
| 22 |
#include <QtWaylandClient/private/qwayland-wayland.h> |
| 23 |
#include <QtWaylandClient/private/qwayland-xdg-output-unstable-v1.h> |
| 24 |
|
| 25 |
|
| 26 |
QT_BEGIN_NAMESPACE |
| 27 |
|
| 28 |
namespace QtWaylandClient { |
| 29 |
|
| 30 |
class QWaylandDisplay; |
| 31 |
class QWaylandCursor; |
| 32 |
|
| 33 |
class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1 |
| 34 |
{ |
| 35 |
public: |
| 36 |
QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id); |
| 37 |
~QWaylandScreen() override; |
| 38 |
|
| 39 |
void initXdgOutput(QtWayland::zxdg_output_manager_v1 *xdgOutputManager); |
| 40 |
|
| 41 |
QWaylandDisplay *display() const; |
| 42 |
|
| 43 |
QString manufacturer() const override; |
| 44 |
QString model() const override; |
| 45 |
|
| 46 |
QRect geometry() const override; |
| 47 |
int depth() const override; |
| 48 |
QImage::Format format() const override; |
| 49 |
|
| 50 |
QSizeF physicalSize() const override; |
| 51 |
|
| 52 |
QDpi logicalDpi() const override; |
| 53 |
QList<QPlatformScreen *> virtualSiblings() const override; |
| 54 |
|
| 55 |
void setOrientationUpdateMask(Qt::ScreenOrientations mask) override; |
| 56 |
|
| 57 |
Qt::ScreenOrientation orientation() const override; |
| 58 |
int scale() const; |
| 59 |
qreal devicePixelRatio() const override; |
| 60 |
qreal refreshRate() const override; |
| 61 |
|
| 62 |
QString name() const override { return mOutputName; } |
| 63 |
|
| 64 |
#if QT_CONFIG(cursor) |
| 65 |
QPlatformCursor *cursor() const override; |
| 66 |
QWaylandCursor *waylandCursor(); |
| 67 |
#endif |
| 68 |
|
| 69 |
uint32_t outputId() const { return m_outputId; } |
| 70 |
::wl_output *output() { return QtWayland::wl_output::object(); } |
| 71 |
|
| 72 |
static QWaylandScreen *waylandScreenFromWindow(QWindow *window); |
| 73 |
static QWaylandScreen *fromWlOutput(::wl_output *output); |
| 74 |
|
| 75 |
private: |
| 76 |
void output_mode(uint32_t flags, int width, int height, int refresh) override; |
| 77 |
void output_geometry(int32_t x, int32_t y, |
| 78 |
int32_t width, int32_t height, |
| 79 |
int subpixel, |
| 80 |
const QString &make, |
| 81 |
const QString &model, |
| 82 |
int32_t transform) override; |
| 83 |
void output_scale(int32_t factor) override; |
| 84 |
void output_done() override; |
| 85 |
|
| 86 |
|
| 87 |
void zxdg_output_v1_logical_position(int32_t x, int32_t y) override; |
| 88 |
void zxdg_output_v1_logical_size(int32_t width, int32_t height) override; |
| 89 |
void zxdg_output_v1_done() override; |
| 90 |
|
| 91 |
int m_outputId; |
| 92 |
QWaylandDisplay *mWaylandDisplay = nullptr; |
| 93 |
QString mManufacturer; |
| 94 |
QString mModel; |
| 95 |
QRect mGeometry; |
| 96 |
QRect mXdgGeometry; |
| 97 |
int mScale = 1; |
| 98 |
int mDepth = 32; |
| 99 |
int mRefreshRate = 60000; |
| 100 |
int mTransform = -1; |
| 101 |
QImage::Format mFormat = QImage::Format_ARGB32_Premultiplied; |
| 102 |
QSize mPhysicalSize; |
| 103 |
QString mOutputName; |
| 104 |
Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation; |
| 105 |
|
| 106 |
#if QT_CONFIG(cursor) |
| 107 |
QScopedPointer<QWaylandCursor> mWaylandCursor; |
| 108 |
#endif |
| 109 |
}; |
| 110 |
|
| 111 |
} |
| 112 |
|
| 113 |
QT_END_NAMESPACE |
| 114 |
|
| 115 |
#endif |