| 1 |
// Copyright (C) 2016 The Qt Company Ltd. |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 4 |
|
| 5 |
#ifndef QXCBSCREEN_H |
| 6 |
#define QXCBSCREEN_H |
| 7 |
|
| 8 |
#include <qpa/qplatformscreen.h> |
| 9 |
#include <QtCore/QString> |
| 10 |
|
| 11 |
#include <xcb/xcb.h> |
| 12 |
#include <xcb/randr.h> |
| 13 |
|
| 14 |
#include "qxcbobject.h" |
| 15 |
|
| 16 |
#include <private/qfontengine_p.h> |
| 17 |
|
| 18 |
QT_BEGIN_NAMESPACE |
| 19 |
|
| 20 |
class QXcbConnection; |
| 21 |
class QXcbCursor; |
| 22 |
class QXcbXSettings; |
| 23 |
|
| 24 |
class QXcbScreen : public QXcbObject, public QPlatformScreen |
| 25 |
{ |
| 26 |
public: |
| 27 |
QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, |
| 28 |
xcb_randr_get_output_info_reply_t *output, QString outputName, int number); |
| 29 |
~QXcbScreen(); |
| 30 |
|
| 31 |
QPixmap grabWindow(WId window, int x, int y, int width, int height) const; |
| 32 |
|
| 33 |
QWindow *topLevelAt(const QPoint &point) const; |
| 34 |
|
| 35 |
QRect geometry() const { return m_geometry; } |
| 36 |
QRect nativeGeometry() const { return m_nativeGeometry; } |
| 37 |
QRect availableGeometry() const {return m_availableGeometry;} |
| 38 |
int depth() const { return m_screen->root_depth; } |
| 39 |
QImage::Format format() const; |
| 40 |
QSizeF physicalSize() const { return m_sizeMillimeters; } |
| 41 |
QDpi logicalDpi() const; |
| 42 |
qreal devicePixelRatio() const; |
| 43 |
QPlatformCursor *cursor() const; |
| 44 |
qreal refreshRate() const { return m_refreshRate; } |
| 45 |
Qt::ScreenOrientation orientation() const { return m_orientation; } |
| 46 |
QList<QPlatformScreen *> virtualSiblings() const { return m_siblings; } |
| 47 |
void setVirtualSiblings(QList<QPlatformScreen *> sl) { m_siblings = sl; } |
| 48 |
|
| 49 |
int screenNumber() const { return m_number; } |
| 50 |
|
| 51 |
xcb_screen_t *screen() const { return m_screen; } |
| 52 |
xcb_window_t root() const { return m_screen->root; } |
| 53 |
|
| 54 |
xcb_window_t clientLeader() const { return m_clientLeader; } |
| 55 |
|
| 56 |
void windowShown(QXcbWindow *window); |
| 57 |
QString windowManagerName() const { return m_windowManagerName; } |
| 58 |
bool syncRequestSupported() const { return m_syncRequestSupported; } |
| 59 |
|
| 60 |
const xcb_visualtype_t *visualForId(xcb_visualid_t) const; |
| 61 |
quint8 depthOfVisual(xcb_visualid_t) const; |
| 62 |
|
| 63 |
QString name() const { return m_outputName; } |
| 64 |
|
| 65 |
void handleScreenChange(xcb_randr_screen_change_notify_event_t *change_event); |
| 66 |
void updateGeometry(xcb_timestamp_t timestamp); |
| 67 |
void updateRefreshRate(); |
| 68 |
|
| 69 |
void readXResources(); |
| 70 |
|
| 71 |
QFontEngine::HintStyle hintStyle() const { return m_hintStyle; } |
| 72 |
bool noFontHinting() const { return m_noFontHinting; } |
| 73 |
QFontEngine::SubpixelAntialiasingType subpixelType() const { return m_subpixelType; } |
| 74 |
int antialiasingEnabled() const { return m_antialiasingEnabled; } |
| 75 |
|
| 76 |
QXcbXSettings *xSettings() const; |
| 77 |
|
| 78 |
private: |
| 79 |
static bool xResource(const QByteArray &identifier, |
| 80 |
const QByteArray &expectedIdentifier, |
| 81 |
QByteArray &stringValue); |
| 82 |
void sendStartupMessage(const QByteArray &message) const; |
| 83 |
|
| 84 |
xcb_screen_t *m_screen; |
| 85 |
xcb_randr_crtc_t m_crtc; |
| 86 |
QString m_outputName; |
| 87 |
QSizeF m_outputSizeMillimeters; |
| 88 |
QSizeF m_sizeMillimeters; |
| 89 |
QRect m_geometry; |
| 90 |
QRect m_nativeGeometry; |
| 91 |
QRect m_availableGeometry; |
| 92 |
QSize m_virtualSize; |
| 93 |
QSizeF m_virtualSizeMillimeters; |
| 94 |
QList<QPlatformScreen *> m_siblings; |
| 95 |
Qt::ScreenOrientation m_orientation; |
| 96 |
int m_number; |
| 97 |
QString m_windowManagerName; |
| 98 |
bool m_syncRequestSupported; |
| 99 |
xcb_window_t m_clientLeader; |
| 100 |
QMap<xcb_visualid_t, xcb_visualtype_t> m_visuals; |
| 101 |
QMap<xcb_visualid_t, quint8> m_visualDepths; |
| 102 |
QXcbCursor *m_cursor; |
| 103 |
int m_refreshRate; |
| 104 |
int m_forcedDpi; |
| 105 |
int m_devicePixelRatio; |
| 106 |
QFontEngine::HintStyle m_hintStyle; |
| 107 |
bool m_noFontHinting; |
| 108 |
QFontEngine::SubpixelAntialiasingType m_subpixelType; |
| 109 |
int m_antialiasingEnabled; |
| 110 |
QXcbXSettings *m_xSettings; |
| 111 |
}; |
| 112 |
|
| 113 |
QT_END_NAMESPACE |
| 114 |
|
| 115 |
#endif |