Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QtWaylandClient::QWaylandScreen Class Reference

#include <qwaylandscreen_p.h>

+ Inheritance diagram for QtWaylandClient::QWaylandScreen:
+ Collaboration diagram for QtWaylandClient::QWaylandScreen:

Public Member Functions

 QWaylandScreen (QWaylandDisplay *waylandDisplay, int version, uint32_t id)
 
 ~QWaylandScreen () override
 
void maybeInitialize ()
 
void initXdgOutput (QWaylandXdgOutputManagerV1 *xdgOutputManager)
 
QWaylandDisplaydisplay () const
 
QString manufacturer () const override
 Reimplement this function in subclass to return the manufacturer of this screen.
 
QString model () const override
 Reimplement this function in subclass to return the model of this screen.
 
QRect geometry () const override
 Reimplement in subclass to return the pixel geometry of the screen.
 
int depth () const override
 Reimplement in subclass to return current depth of the screen.
 
QImage::Format format () const override
 Reimplement in subclass to return the image format which corresponds to the screen format.
 
QSizeF physicalSize () const override
 Reimplement this function in subclass to return the physical size of the screen, in millimeters.
 
QDpi logicalDpi () const override
 Reimplement this function in subclass to return the logical horizontal and vertical dots per inch metrics of the screen.
 
QList< QPlatformScreen * > virtualSiblings () const override
 Returns a list of all the platform screens that are part of the same virtual desktop.
 
Qt::ScreenOrientation orientation () const override
 Reimplement this function in subclass to return the current orientation of the screen, for example based on accelerometer data to determine the device orientation.
 
int scale () const
 
qreal devicePixelRatio () const override
 Reimplement this function in subclass to return the device pixel ratio for the screen.
 
qreal refreshRate () const override
 Reimplement this function in subclass to return the vertical refresh rate of the screen, in Hz.
 
QString name () const override
 
uint32_t outputId () const
 
::wl_output * output () const override
 
- Public Member Functions inherited from QPlatformScreen
 QPlatformScreen ()
 
virtual ~QPlatformScreen ()
 
virtual bool isPlaceholder () const
 
virtual QPixmap grabWindow (WId window, int x, int y, int width, int height) const
 This function is called when Qt needs to be able to grab the content of a window.
 
virtual QRect geometry () const =0
 Reimplement in subclass to return the pixel geometry of the screen.
 
virtual QRect availableGeometry () const
 Reimplement in subclass to return the pixel geometry of the available space This normally is the desktop screen minus the task manager, global menubar etc.
 
virtual int depth () const =0
 Reimplement in subclass to return current depth of the screen.
 
virtual QImage::Format format () const =0
 Reimplement in subclass to return the image format which corresponds to the screen format.
 
virtual QColorSpace colorSpace () const
 
virtual QSizeF physicalSize () const
 Reimplement this function in subclass to return the physical size of the screen, in millimeters.
 
virtual QDpi logicalDpi () const
 Reimplement this function in subclass to return the logical horizontal and vertical dots per inch metrics of the screen.
 
virtual QDpi logicalBaseDpi () const
 Reimplement to return the base logical DPI for the platform.
 
virtual qreal devicePixelRatio () const
 Reimplement this function in subclass to return the device pixel ratio for the screen.
 
virtual qreal refreshRate () const
 Reimplement this function in subclass to return the vertical refresh rate of the screen, in Hz.
 
virtual Qt::ScreenOrientation nativeOrientation () const
 Reimplement this function in subclass to return the native orientation of the screen, e.g.
 
virtual Qt::ScreenOrientation orientation () const
 Reimplement this function in subclass to return the current orientation of the screen, for example based on accelerometer data to determine the device orientation.
 
virtual QWindowtopLevelAt (const QPoint &point) const
 Return the given top level window for a given position.
 
QWindowList windows () const
 Return all windows residing on this screen.
 
virtual QList< QPlatformScreen * > virtualSiblings () const
 Returns a list of all the platform screens that are part of the same virtual desktop.
 
const QPlatformScreenscreenForPosition (const QPoint &point) const
 Find the sibling screen corresponding to globalPos.
 
QScreenscreen () const
 
virtual QString name () const
 
virtual QString manufacturer () const
 Reimplement this function in subclass to return the manufacturer of this screen.
 
virtual QString model () const
 Reimplement this function in subclass to return the model of this screen.
 
virtual QString serialNumber () const
 Reimplement this function in subclass to return the serial number of this screen.
 
virtual QPlatformCursorcursor () const
 Reimplement this function in subclass to return the cursor of the screen.
 
virtual SubpixelAntialiasingType subpixelAntialiasingTypeHint () const
 Returns a hint about this screen's subpixel layout structure.
 
virtual PowerState powerState () const
 Returns the current power state.
 
virtual void setPowerState (PowerState state)
 Sets the power state for this screen.
 
virtual QList< Modemodes () const
 Reimplement this function in subclass to return the list of modes for this screen.
 
virtual int currentMode () const
 Reimplement this function in subclass to return the index of the current mode from the modes list.
 
virtual int preferredMode () const
 Reimplement this function in subclass to return the preferred mode index from the modes list.
 

Static Public Member Functions

static QWaylandScreenwaylandScreenFromWindow (QWindow *window)
 
static QWaylandScreenfromWlOutput (::wl_output *output)
 
- Static Public Member Functions inherited from QPlatformScreen
static QPlatformScreenplatformScreenForWindow (const QWindow *window)
 
static int angleBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b)
 
static QTransform transformBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target)
 
static QRect mapBetween (Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect)
 
static QDpi overrideDpi (const QDpi &in)
 

Protected Types

enum  Event : uint { XdgOutputDoneEvent = 0x1 , OutputDoneEvent = 0x2 , XdgOutputNameEvent = 0x4 }
 

Protected Member Functions

uint requiredEvents () const
 
void output_mode (uint32_t flags, int width, int height, int refresh) override
 
void output_geometry (int32_t x, int32_t y, int32_t width, int32_t height, int subpixel, const QString &make, const QString &model, int32_t transform) override
 
void output_scale (int32_t factor) override
 
void output_done () override
 
void updateOutputProperties ()
 
void zxdg_output_v1_logical_position (int32_t x, int32_t y) override
 
void zxdg_output_v1_logical_size (int32_t width, int32_t height) override
 
void zxdg_output_v1_done () override
 
void zxdg_output_v1_name (const QString &name) override
 
void updateXdgOutputProperties ()
 
- Protected Member Functions inherited from QPlatformScreen
void resizeMaximizedWindows ()
 Convenience method to resize all the maximized and fullscreen windows of this platform screen.
 

Protected Attributes

int m_outputId
 
QWaylandDisplaymWaylandDisplay = nullptr
 
QString mManufacturer
 
QString mModel
 
QRect mGeometry
 
QRect mXdgGeometry
 
int mScale = 1
 
int mDepth = 32
 
int mRefreshRate = 60000
 
int mTransform = -1
 
QImage::Format mFormat = QImage::Format_ARGB32_Premultiplied
 
QSize mPhysicalSize
 
QString mOutputName
 
Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation
 
uint mProcessedEvents = 0
 
bool mInitialized = false
 
- Protected Attributes inherited from QPlatformScreen
QScopedPointer< QPlatformScreenPrivated_ptr
 

Additional Inherited Members

- Public Types inherited from QPlatformScreen
enum  SubpixelAntialiasingType {
  Subpixel_None , Subpixel_RGB , Subpixel_BGR , Subpixel_VRGB ,
  Subpixel_VBGR
}
 
enum  PowerState { PowerStateOn , PowerStateStandby , PowerStateSuspend , PowerStateOff }
 

Detailed Description

Definition at line 38 of file qwaylandscreen_p.h.

Member Enumeration Documentation

◆ Event

Enumerator
XdgOutputDoneEvent 
OutputDoneEvent 
XdgOutputNameEvent 

Definition at line 86 of file qwaylandscreen_p.h.

Constructor & Destructor Documentation

◆ QWaylandScreen()

QtWaylandClient::QWaylandScreen::QWaylandScreen ( QWaylandDisplay waylandDisplay,
int  version,
uint32_t  id 
)

Definition at line 25 of file qwaylandscreen.cpp.

References QtWaylandClient::QWaylandDisplay::forceRoundTrip(), initXdgOutput(), maybeInitialize(), mProcessedEvents, mWaylandDisplay, OutputDoneEvent, qCWarning, and QtWaylandClient::QWaylandDisplay::xdgOutputManager().

+ Here is the call graph for this function:

◆ ~QWaylandScreen()

QtWaylandClient::QWaylandScreen::~QWaylandScreen ( )
override

Definition at line 43 of file qwaylandscreen.cpp.

Member Function Documentation

◆ depth()

int QtWaylandClient::QWaylandScreen::depth ( ) const
overridevirtual

Reimplement in subclass to return current depth of the screen.

Implements QPlatformScreen.

Definition at line 116 of file qwaylandscreen.cpp.

References mDepth.

◆ devicePixelRatio()

qreal QtWaylandClient::QWaylandScreen::devicePixelRatio ( ) const
overridevirtual

Reimplement this function in subclass to return the device pixel ratio for the screen.

This is the ratio between physical pixels and the device-independent pixels of the windowing system. The default implementation returns 1.0.

See also
QPlatformWindow::devicePixelRatio()

Reimplemented from QPlatformScreen.

Definition at line 176 of file qwaylandscreen.cpp.

References mScale.

◆ display()

QWaylandDisplay * QtWaylandClient::QWaylandScreen::display ( ) const

Definition at line 90 of file qwaylandscreen.cpp.

References mWaylandDisplay.

◆ format()

QImage::Format QtWaylandClient::QWaylandScreen::format ( ) const
overridevirtual

Reimplement in subclass to return the image format which corresponds to the screen format.

Implements QPlatformScreen.

Definition at line 121 of file qwaylandscreen.cpp.

References mFormat.

◆ fromWlOutput()

QWaylandScreen * QtWaylandClient::QWaylandScreen::fromWlOutput ( ::wl_output *  output)
static

Definition at line 201 of file qwaylandscreen.cpp.

References o, and output().

Referenced by QtWaylandClient::QWaylandSurface::surface_enter(), and QtWaylandClient::QWaylandSurface::surface_leave().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ geometry()

QRect QtWaylandClient::QWaylandScreen::geometry ( ) const
overridevirtual

Reimplement in subclass to return the pixel geometry of the screen.

Implements QPlatformScreen.

Definition at line 105 of file qwaylandscreen.cpp.

References mGeometry, mScale, mXdgGeometry, QRect::size(), and QRect::topLeft().

Referenced by updateOutputProperties(), and updateXdgOutputProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initXdgOutput()

void QtWaylandClient::QWaylandScreen::initXdgOutput ( QWaylandXdgOutputManagerV1 xdgOutputManager)

Definition at line 81 of file qwaylandscreen.cpp.

References Q_ASSERT.

Referenced by QWaylandScreen().

+ Here is the caller graph for this function:

◆ logicalDpi()

QDpi QtWaylandClient::QWaylandScreen::logicalDpi ( ) const
overridevirtual

Reimplement this function in subclass to return the logical horizontal and vertical dots per inch metrics of the screen.

The logical dots per inch metrics are used by Qt to scale the user interface.

The default implementation returns logicalBaseDpi(), which results in a UI scale factor of 1.0.

See also
physicalSize

Reimplemented from QPlatformScreen.

Definition at line 134 of file qwaylandscreen.cpp.

References QPlatformScreen::logicalDpi(), qEnvironmentVariable(), qgetenv(), QStringLiteral, and QByteArray::toInt().

+ Here is the call graph for this function:

◆ manufacturer()

QString QtWaylandClient::QWaylandScreen::manufacturer ( ) const
overridevirtual

Reimplement this function in subclass to return the manufacturer of this screen.

The default implementation returns an empty string.

Since
5.9

Reimplemented from QPlatformScreen.

Definition at line 95 of file qwaylandscreen.cpp.

References mManufacturer.

◆ maybeInitialize()

void QtWaylandClient::QWaylandScreen::maybeInitialize ( )

Definition at line 65 of file qwaylandscreen.cpp.

References QtWaylandClient::QWaylandDisplay::handleScreenInitialized(), mInitialized, mProcessedEvents, mWaylandDisplay, Q_ASSERT, requiredEvents(), updateOutputProperties(), and updateXdgOutputProperties().

Referenced by QWaylandScreen(), output_done(), and zxdg_output_v1_done().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ model()

QString QtWaylandClient::QWaylandScreen::model ( ) const
overridevirtual

Reimplement this function in subclass to return the model of this screen.

The default implementation returns an empty string.

Since
5.9

Reimplemented from QPlatformScreen.

Definition at line 100 of file qwaylandscreen.cpp.

References mModel.

Referenced by output_geometry().

+ Here is the caller graph for this function:

◆ name()

QString QtWaylandClient::QWaylandScreen::name ( ) const
inlineoverridevirtual

Reimplemented from QPlatformScreen.

Definition at line 70 of file qwaylandscreen_p.h.

Referenced by zxdg_output_v1_name().

+ Here is the caller graph for this function:

◆ orientation()

Qt::ScreenOrientation QtWaylandClient::QWaylandScreen::orientation ( ) const
overridevirtual

Reimplement this function in subclass to return the current orientation of the screen, for example based on accelerometer data to determine the device orientation.

The default implementation returns Qt::PrimaryOrientation.

Reimplemented from QPlatformScreen.

Definition at line 166 of file qwaylandscreen.cpp.

References m_orientation.

◆ output()

::wl_output * QtWaylandClient::QWaylandScreen::output ( ) const
inlineoverride

Definition at line 77 of file qwaylandscreen_p.h.

Referenced by fromWlOutput().

+ Here is the caller graph for this function:

◆ output_done()

void QtWaylandClient::QWaylandScreen::output_done ( )
overrideprotected

Definition at line 244 of file qwaylandscreen.cpp.

References maybeInitialize(), mInitialized, mProcessedEvents, OutputDoneEvent, updateOutputProperties(), and updateXdgOutputProperties().

+ Here is the call graph for this function:

◆ output_geometry()

void QtWaylandClient::QWaylandScreen::output_geometry ( int32_t  x,
int32_t  y,
int32_t  width,
int32_t  height,
int  subpixel,
const QString make,
const QString model,
int32_t  transform 
)
overrideprotected

Definition at line 221 of file qwaylandscreen.cpp.

References mGeometry, mManufacturer, mModel, model(), QRect::moveTopLeft(), mPhysicalSize, mTransform, and Q_UNUSED.

+ Here is the call graph for this function:

◆ output_mode()

void QtWaylandClient::QWaylandScreen::output_mode ( uint32_t  flags,
int  width,
int  height,
int  refresh 
)
overrideprotected

Definition at line 208 of file qwaylandscreen.cpp.

References mGeometry, mRefreshRate, QRect::setSize(), and QRect::size().

+ Here is the call graph for this function:

◆ output_scale()

void QtWaylandClient::QWaylandScreen::output_scale ( int32_t  factor)
overrideprotected

Definition at line 239 of file qwaylandscreen.cpp.

References mScale.

◆ outputId()

uint32_t QtWaylandClient::QWaylandScreen::outputId ( ) const
inline

Definition at line 76 of file qwaylandscreen_p.h.

◆ physicalSize()

QSizeF QtWaylandClient::QWaylandScreen::physicalSize ( ) const
overridevirtual

Reimplement this function in subclass to return the physical size of the screen, in millimeters.

The physical size represents the actual physical dimensions of the display.

The default implementation takes the pixel size of the screen, considers a resolution of 100 dots per inch, and returns the calculated physical size. A device with a screen that has different resolutions will need to be supported by a suitable reimplementation of this function.

See also
logcalDpi

Reimplemented from QPlatformScreen.

Definition at line 126 of file qwaylandscreen.cpp.

References QSize::isEmpty(), mPhysicalSize, and QPlatformScreen::physicalSize().

+ Here is the call graph for this function:

◆ refreshRate()

qreal QtWaylandClient::QWaylandScreen::refreshRate ( ) const
overridevirtual

Reimplement this function in subclass to return the vertical refresh rate of the screen, in Hz.

The default returns 60, a sensible default for modern displays.

Reimplemented from QPlatformScreen.

Definition at line 181 of file qwaylandscreen.cpp.

References mRefreshRate.

Referenced by updateOutputProperties().

+ Here is the caller graph for this function:

◆ requiredEvents()

uint QtWaylandClient::QWaylandScreen::requiredEvents ( ) const
protected

Definition at line 51 of file qwaylandscreen.cpp.

References mWaylandDisplay, OutputDoneEvent, ret, XdgOutputDoneEvent, QtWaylandClient::QWaylandDisplay::xdgOutputManager(), and XdgOutputNameEvent.

Referenced by maybeInitialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ scale()

int QtWaylandClient::QWaylandScreen::scale ( ) const

Definition at line 171 of file qwaylandscreen.cpp.

References mScale.

◆ updateOutputProperties()

void QtWaylandClient::QWaylandScreen::updateOutputProperties ( )
protected

Definition at line 257 of file qwaylandscreen.cpp.

References geometry(), QWindowSystemInterface::handleScreenGeometryChange(), QWindowSystemInterface::handleScreenOrientationChange(), QWindowSystemInterface::handleScreenRefreshRateChange(), QRect::height(), Qt::InvertedLandscapeOrientation, Qt::InvertedPortraitOrientation, Qt::LandscapeOrientation, m_orientation, mGeometry, mTransform, Qt::PortraitOrientation, refreshRate(), QPlatformScreen::screen(), and QRect::width().

Referenced by maybeInitialize(), and output_done().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateXdgOutputProperties()

void QtWaylandClient::QWaylandScreen::updateXdgOutputProperties ( )
protected

Definition at line 324 of file qwaylandscreen.cpp.

References geometry(), QWindowSystemInterface::handleScreenGeometryChange(), Q_ASSERT, and QPlatformScreen::screen().

Referenced by maybeInitialize(), output_done(), and zxdg_output_v1_done().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ virtualSiblings()

QList< QPlatformScreen * > QtWaylandClient::QWaylandScreen::virtualSiblings ( ) const
overridevirtual

Returns a list of all the platform screens that are part of the same virtual desktop.

Screens part of the same virtual desktop share a common coordinate system, and windows can be freely moved between them.

Reimplemented from QPlatformScreen.

Definition at line 147 of file qwaylandscreen.cpp.

References list, mWaylandDisplay, QtWaylandClient::QWaylandDisplay::placeholderScreen(), QList< T >::reserve(), QPlatformScreen::screen(), QtWaylandClient::QWaylandDisplay::screens(), and QList< T >::size().

+ Here is the call graph for this function:

◆ waylandScreenFromWindow()

QWaylandScreen * QtWaylandClient::QWaylandScreen::waylandScreenFromWindow ( QWindow window)
static

Definition at line 193 of file qwaylandscreen.cpp.

References QPlatformScreen::isPlaceholder(), QPlatformScreen::platformScreenForWindow(), and window().

+ Here is the call graph for this function:

◆ zxdg_output_v1_done()

void QtWaylandClient::QWaylandScreen::zxdg_output_v1_done ( )
overrideprotected

Definition at line 303 of file qwaylandscreen.cpp.

References maybeInitialize(), mInitialized, mProcessedEvents, mWaylandDisplay, Q_UNLIKELY, qWarning, updateXdgOutputProperties(), XdgOutputDoneEvent, and QtWaylandClient::QWaylandDisplay::xdgOutputManager().

+ Here is the call graph for this function:

◆ zxdg_output_v1_logical_position()

void QtWaylandClient::QWaylandScreen::zxdg_output_v1_logical_position ( int32_t  x,
int32_t  y 
)
overrideprotected

Definition at line 293 of file qwaylandscreen.cpp.

References QRect::moveTopLeft(), and mXdgGeometry.

+ Here is the call graph for this function:

◆ zxdg_output_v1_logical_size()

void QtWaylandClient::QWaylandScreen::zxdg_output_v1_logical_size ( int32_t  width,
int32_t  height 
)
overrideprotected

Definition at line 298 of file qwaylandscreen.cpp.

References mXdgGeometry, and QRect::setSize().

+ Here is the call graph for this function:

◆ zxdg_output_v1_name()

void QtWaylandClient::QWaylandScreen::zxdg_output_v1_name ( const QString name)
overrideprotected

Definition at line 315 of file qwaylandscreen.cpp.

References mInitialized, mOutputName, mProcessedEvents, name(), Q_UNLIKELY, qWarning, and XdgOutputNameEvent.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_orientation

Qt::ScreenOrientation QtWaylandClient::QWaylandScreen::m_orientation = Qt::PrimaryOrientation
protected

Definition at line 124 of file qwaylandscreen_p.h.

Referenced by orientation(), and updateOutputProperties().

◆ m_outputId

int QtWaylandClient::QWaylandScreen::m_outputId
protected

Definition at line 111 of file qwaylandscreen_p.h.

◆ mDepth

int QtWaylandClient::QWaylandScreen::mDepth = 32
protected

Definition at line 118 of file qwaylandscreen_p.h.

Referenced by depth().

◆ mFormat

QImage::Format QtWaylandClient::QWaylandScreen::mFormat = QImage::Format_ARGB32_Premultiplied
protected

Definition at line 121 of file qwaylandscreen_p.h.

Referenced by format().

◆ mGeometry

QRect QtWaylandClient::QWaylandScreen::mGeometry
protected

Definition at line 115 of file qwaylandscreen_p.h.

Referenced by geometry(), output_geometry(), output_mode(), and updateOutputProperties().

◆ mInitialized

bool QtWaylandClient::QWaylandScreen::mInitialized = false
protected

◆ mManufacturer

QString QtWaylandClient::QWaylandScreen::mManufacturer
protected

Definition at line 113 of file qwaylandscreen_p.h.

Referenced by manufacturer(), and output_geometry().

◆ mModel

QString QtWaylandClient::QWaylandScreen::mModel
protected

Definition at line 114 of file qwaylandscreen_p.h.

Referenced by model(), and output_geometry().

◆ mOutputName

QString QtWaylandClient::QWaylandScreen::mOutputName
protected

Definition at line 123 of file qwaylandscreen_p.h.

Referenced by zxdg_output_v1_name().

◆ mPhysicalSize

QSize QtWaylandClient::QWaylandScreen::mPhysicalSize
protected

Definition at line 122 of file qwaylandscreen_p.h.

Referenced by output_geometry(), and physicalSize().

◆ mProcessedEvents

uint QtWaylandClient::QWaylandScreen::mProcessedEvents = 0
protected

◆ mRefreshRate

int QtWaylandClient::QWaylandScreen::mRefreshRate = 60000
protected

Definition at line 119 of file qwaylandscreen_p.h.

Referenced by output_mode(), and refreshRate().

◆ mScale

int QtWaylandClient::QWaylandScreen::mScale = 1
protected

Definition at line 117 of file qwaylandscreen_p.h.

Referenced by devicePixelRatio(), geometry(), output_scale(), and scale().

◆ mTransform

int QtWaylandClient::QWaylandScreen::mTransform = -1
protected

Definition at line 120 of file qwaylandscreen_p.h.

Referenced by output_geometry(), and updateOutputProperties().

◆ mWaylandDisplay

QWaylandDisplay* QtWaylandClient::QWaylandScreen::mWaylandDisplay = nullptr
protected

◆ mXdgGeometry

QRect QtWaylandClient::QWaylandScreen::mXdgGeometry
protected

The documentation for this class was generated from the following files: