Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qt_x11_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#pragma once
6
7#define register /* C++17 deprecated register */
8#include <X11/Xlib.h>
9#include <X11/Xatom.h>
10#undef register
11
12#if QT_CONFIG(xrender)
13# include "qtessellator_p.h"
14# include <X11/extensions/Xrender.h>
15#endif
16
17#if QT_CONFIG(fontconfig)
18#include <fontconfig/fontconfig.h>
19#endif
20
21#if defined(FT_LCD_FILTER_H)
22#include FT_LCD_FILTER_H
23#endif
24
25#if defined(FC_LCD_FILTER)
26
27#ifndef FC_LCD_FILTER_NONE
28#define FC_LCD_FILTER_NONE FC_LCD_NONE
29#endif
30
31#ifndef FC_LCD_FILTER_DEFAULT
32#define FC_LCD_FILTER_DEFAULT FC_LCD_DEFAULT
33#endif
34
35#ifndef FC_LCD_FILTER_LIGHT
36#define FC_LCD_FILTER_LIGHT FC_LCD_LIGHT
37#endif
38
39#ifndef FC_LCD_FILTER_LEGACY
40#define FC_LCD_FILTER_LEGACY FC_LCD_LEGACY
41#endif
42
43#endif
44
45QT_BEGIN_NAMESPACE
46
47// rename a couple of X defines to get rid of name clashes
48// resolve the conflict between X11's FocusIn and QEvent::FocusIn
49enum {
50 XFocusOut = FocusOut,
51 XFocusIn = FocusIn,
52 XKeyPress = KeyPress,
53 XKeyRelease = KeyRelease,
54 XNone = None,
55 XRevertToParent = RevertToParent,
56 XGrayScale = GrayScale,
57 XCursorShape = CursorShape,
58};
59#undef FocusOut
60#undef FocusIn
61#undef KeyPress
62#undef KeyRelease
63#undef None
64#undef RevertToParent
65#undef GrayScale
66#undef CursorShape
67
68#ifdef FontChange
69#undef FontChange
70#endif
71
75#if QT_CONFIG(xrender)
76Q_DECLARE_TYPEINFO(XGlyphElt32, Q_PRIMITIVE_TYPE);
77#endif
78
79struct QX11InfoData;
80
89
91 Display *display = nullptr;
92
93 // true if Qt is compiled w/ RENDER support and RENDER is supported on the connected Display
94 bool use_xrender = false;
97
99 Visual **argbVisuals = nullptr;
100 Colormap *argbColormaps = nullptr;
101 int screenCount = 0;
103
104 // options
106 int visual_id = 0;
107 int color_count = 0;
108 bool custom_cmap = false;
109
110 // outside visual/colormap
111 Visual *visual = nullptr;
112 Colormap colormap = 0;
113
114#if QT_CONFIG(xrender)
115 enum { solid_fill_count = 16 };
116 struct SolidFills {
118 int screen;
121 enum { pattern_fill_count = 16 };
122 struct PatternFills {
125 int screen;
126 int style;
127 bool opaque;
130 Picture getSolidFill(int screen, const QColor &c);
132#endif
133
134 bool fc_antialias = true;
136
138};
139
140extern QXcbX11Data *qt_x11Data;
141#define X11 qt_x11Data
142
145 int dpiX;
146 int dpiY;
147 int depth;
148 int cells;
149 Colormap colormap;
150 Visual *visual;
153 int subpixel = 0;
154};
155
156template <class T>
157constexpr inline int lowest_bit(T v) noexcept
158{
159 int result = qCountTrailingZeroBits(v);
160 return ((result >> 3) == sizeof(T)) ? -1 : result;
161}
162
163QT_END_NAMESPACE
\inmodule QtGui
Definition qwindow.h:63
qreal devicePixelRatio() const override
bool isBackingStore() const
void copy(const QPlatformPixmap *data, const QRect &rect) override
QBitmap mask() const override
QPlatformPixmap * createCompatiblePlatformPixmap() const override
Drawable handle() const
void setIsBackingStore(bool on)
static XID createBitmapFromImage(const QImage &image)
Pixmap x11ConvertToDefaultDepth()
void fromImage(const QImage &img, Qt::ImageConversionFlags flags) override
QImage toImage() const override
QPaintEngine * paintEngine() const override
QX11PlatformPixmap(PixelType pixelType)
const QXcbX11Info * x11_info() const
void fill(const QColor &fillColor) override
Picture x11PictureHandle() const
void resize(int width, int height) override
void setMask(const QBitmap &mask) override
QImage toImage(const QRect &rect) const override
friend const QXcbX11Info & qt_x11Info(const QPixmap &pixmap)
void setDevicePixelRatio(qreal scaleFactor) override
bool hasAlphaChannel() const override
bool scroll(int dx, int dy, const QRect &rect) override
int metric(QPaintDevice::PaintDeviceMetric metric) const override
QPixmap transformed(const QTransform &matrix, Qt::TransformationMode mode) const override
void beginPaint(const QRegion &region) override
This function is called before painting onto the surface begins, with the region in which the paintin...
QXcbNativeBackingStore(QWindow *window)
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override
Flushes the given region from the specified window.
QImage toImage() const override
Implemented in subclasses to return the content of the backingstore as a QImage.
QPaintDevice * paintDevice() override
Implement this function to return the appropriate paint device.
void resize(const QSize &size, const QRegion &staticContents) override
bool scroll(const QRegion &area, int dx, int dy) override
Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative.
void setDepth(int depth)
static bool appDefaultVisual(int screen=-1)
static int appScreen()
static QXcbX11Info fromScreen(int screen)
static Colormap appColormap(int screen=-1)
static Window appRootWindow(int screen=-1)
static bool appDefaultColormap(int screen=-1)
friend void qt_x11SetScreen(QPixmap &pixmap, int screen)
static int appDepth(int screen=-1)
void setVisual(void *visual)
void * visual() const
static Display * display()
Colormap colormap() const
static int appDpiY(int screen=-1)
QXcbX11Info & operator=(const QXcbX11Info &other)
static int appCells(int screen=-1)
static void * appVisual(int screen=-1)
QXcbX11Info(const QXcbX11Info &other)
static int appDpiX(int screen=-1)
XID Picture
XID Pixmap
Pixmap qt_x11PixmapHandle(const QPixmap &pixmap)
Picture qt_x11PictureHandle(const QPixmap &pixmap)
QX11PlatformPixmap * qt_x11Pixmap(const QPixmap &pixmap)
int qt_x11SetDefaultScreen(int screen)
Q_DECLARE_TYPEINFO(XChar2b, Q_PRIMITIVE_TYPE)
Q_DECLARE_TYPEINFO(XPoint, Q_PRIMITIVE_TYPE)
Q_DECLARE_TYPEINFO(XRectangle, Q_PRIMITIVE_TYPE)
constexpr int lowest_bit(T v) noexcept
Definition qt_x11_p.h:157
QXcbX11Data * qt_x11Data
DesktopEnvironment
Definition qt_x11_p.h:81
@ DE_UNKNOWN
Definition qt_x11_p.h:82
@ DE_GNOME
Definition qt_x11_p.h:84
@ DE_4DWM
Definition qt_x11_p.h:87
@ DE_KDE
Definition qt_x11_p.h:83
@ DE_MEEGO_COMPOSITOR
Definition qt_x11_p.h:86
@ DE_CDE
Definition qt_x11_p.h:85
XID Colormap
unsigned long XID
QList< XRectangle > qt_region_to_xrectangles(const QRegion &r)
XID Window
struct _FcPattern FcPattern
void qt_xcb_native_x11_info_init(QXcbConnection *conn)
Visual * visual
Definition qt_x11_p.h:150
bool defaultColormap
Definition qt_x11_p.h:151
Colormap colormap
Definition qt_x11_p.h:149
bool defaultVisual
Definition qt_x11_p.h:152
int xrender_version
Definition qt_x11_p.h:96
bool custom_cmap
Definition qt_x11_p.h:108
Visual ** argbVisuals
Definition qt_x11_p.h:99
Display * display
Definition qt_x11_p.h:91
DesktopEnvironment desktopEnvironment
Definition qt_x11_p.h:137
int visual_id
Definition qt_x11_p.h:106
int color_count
Definition qt_x11_p.h:107
int screenCount
Definition qt_x11_p.h:101
Visual * visual
Definition qt_x11_p.h:111
bool use_xrender
Definition qt_x11_p.h:94
bool fc_antialias
Definition qt_x11_p.h:134
Colormap * argbColormaps
Definition qt_x11_p.h:100
int visual_class
Definition qt_x11_p.h:105
Colormap colormap
Definition qt_x11_p.h:112
int defaultScreen
Definition qt_x11_p.h:102
int xrender_major
Definition qt_x11_p.h:95
int fc_hint_style
Definition qt_x11_p.h:135
QX11InfoData * screens
Definition qt_x11_p.h:98