Debian Codegraph @

xcb/libqt6xcbqpa-dev/6.6.1/nativepainting/qt_x11_p.h

raw
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
4 #ifndef QT_X11_P_H
5 #define QT_X11_P_H
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
45 QT_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
49 enum {
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
72 Q_DECLARE_TYPEINFO(XPoint, Q_PRIMITIVE_TYPE);
73 Q_DECLARE_TYPEINFO(XRectangle, Q_PRIMITIVE_TYPE);
74 Q_DECLARE_TYPEINFO(XChar2b, Q_PRIMITIVE_TYPE);
75 #if QT_CONFIG(xrender)
76 Q_DECLARE_TYPEINFO(XGlyphElt32, Q_PRIMITIVE_TYPE);
77 #endif
78
79 struct QX11InfoData;
80
81 enum DesktopEnvironment {
82 DE_UNKNOWN,
83 DE_KDE,
84 DE_GNOME,
85 DE_CDE,
86 DE_MEEGO_COMPOSITOR,
87 DE_4DWM
88 };
89
90 struct QXcbX11Data {
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;
95 int xrender_major = 0;
96 int xrender_version = 0;
97
98 QX11InfoData *screens = nullptr;
99 Visual **argbVisuals = nullptr;
100 Colormap *argbColormaps = nullptr;
101 int screenCount = 0;
102 int defaultScreen = 0;
103
104 // options
105 int visual_class = 0;
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 {
117 XRenderColor color;
118 int screen;
119 Picture picture;
120 } solid_fills[solid_fill_count];
121 enum { pattern_fill_count = 16 };
122 struct PatternFills {
123 XRenderColor color;
124 XRenderColor bg_color;
125 int screen;
126 int style;
127 bool opaque;
128 Picture picture;
129 } pattern_fills[pattern_fill_count];
130 Picture getSolidFill(int screen, const QColor &c);
131 XRenderColor preMultiply(const QColor &c);
132 #endif
133
134 bool fc_antialias = true;
135 int fc_hint_style = 0;
136
137 DesktopEnvironment desktopEnvironment = DE_GNOME;
138 };
139
140 extern QXcbX11Data *qt_x11Data;
141 #define X11 qt_x11Data
142
143 struct QX11InfoData {
144 int screen;
145 int dpiX;
146 int dpiY;
147 int depth;
148 int cells;
149 Colormap colormap;
150 Visual *visual;
151 bool defaultColormap;
152 bool defaultVisual;
153 int subpixel = 0;
154 };
155
156 template <class T>
157 constexpr inline int lowest_bit(T v) noexcept
158 {
159 int result = qCountTrailingZeroBits(v);
160 return ((result >> 3) == sizeof(T)) ? -1 : result;
161 }
162
163 QT_END_NAMESPACE
164
165 #endif // QT_X11_P_H