Debian Codegraph @

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

raw
1 /****************************************************************************
2 **
3 ** Copyright (C) 2018 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39
40 #ifndef QT_X11_P_H
41 #define QT_X11_P_H
42
43 #define register /* C++17 deprecated register */
44 #include <X11/Xlib.h>
45 #include <X11/Xatom.h>
46 #undef register
47
48 #if QT_CONFIG(xrender)
49 # include "qtessellator_p.h"
50 # include <X11/extensions/Xrender.h>
51 #endif
52
53 #if QT_CONFIG(fontconfig)
54 #include <fontconfig/fontconfig.h>
55 #endif
56
57 #if defined(FT_LCD_FILTER_H)
58 #include FT_LCD_FILTER_H
59 #endif
60
61 #if defined(FC_LCD_FILTER)
62
63 #ifndef FC_LCD_FILTER_NONE
64 #define FC_LCD_FILTER_NONE FC_LCD_NONE
65 #endif
66
67 #ifndef FC_LCD_FILTER_DEFAULT
68 #define FC_LCD_FILTER_DEFAULT FC_LCD_DEFAULT
69 #endif
70
71 #ifndef FC_LCD_FILTER_LIGHT
72 #define FC_LCD_FILTER_LIGHT FC_LCD_LIGHT
73 #endif
74
75 #ifndef FC_LCD_FILTER_LEGACY
76 #define FC_LCD_FILTER_LEGACY FC_LCD_LEGACY
77 #endif
78
79 #endif
80
81 QT_BEGIN_NAMESPACE
82
83 // rename a couple of X defines to get rid of name clashes
84 // resolve the conflict between X11's FocusIn and QEvent::FocusIn
85 enum {
86 XFocusOut = FocusOut,
87 XFocusIn = FocusIn,
88 XKeyPress = KeyPress,
89 XKeyRelease = KeyRelease,
90 XNone = None,
91 XRevertToParent = RevertToParent,
92 XGrayScale = GrayScale,
93 XCursorShape = CursorShape,
94 };
95 #undef FocusOut
96 #undef FocusIn
97 #undef KeyPress
98 #undef KeyRelease
99 #undef None
100 #undef RevertToParent
101 #undef GrayScale
102 #undef CursorShape
103
104 #ifdef FontChange
105 #undef FontChange
106 #endif
107
108 Q_DECLARE_TYPEINFO(XPoint, Q_PRIMITIVE_TYPE);
109 Q_DECLARE_TYPEINFO(XRectangle, Q_PRIMITIVE_TYPE);
110 Q_DECLARE_TYPEINFO(XChar2b, Q_PRIMITIVE_TYPE);
111 #if QT_CONFIG(xrender)
112 Q_DECLARE_TYPEINFO(XGlyphElt32, Q_PRIMITIVE_TYPE);
113 #endif
114
115 struct QX11InfoData;
116
117 enum DesktopEnvironment {
118 DE_UNKNOWN,
119 DE_KDE,
120 DE_GNOME,
121 DE_CDE,
122 DE_MEEGO_COMPOSITOR,
123 DE_4DWM
124 };
125
126 struct QXcbX11Data {
127 Display *display = nullptr;
128
129 // true if Qt is compiled w/ RENDER support and RENDER is supported on the connected Display
130 bool use_xrender = false;
131 int xrender_major = 0;
132 int xrender_version = 0;
133
134 QX11InfoData *screens = nullptr;
135 Visual **argbVisuals = nullptr;
136 Colormap *argbColormaps = nullptr;
137 int screenCount = 0;
138 int defaultScreen = 0;
139
140 // options
141 int visual_class = 0;
142 int visual_id = 0;
143 int color_count = 0;
144 bool custom_cmap = false;
145
146 // outside visual/colormap
147 Visual *visual = nullptr;
148 Colormap colormap = 0;
149
150 #if QT_CONFIG(xrender)
151 enum { solid_fill_count = 16 };
152 struct SolidFills {
153 XRenderColor color;
154 int screen;
155 Picture picture;
156 } solid_fills[solid_fill_count];
157 enum { pattern_fill_count = 16 };
158 struct PatternFills {
159 XRenderColor color;
160 XRenderColor bg_color;
161 int screen;
162 int style;
163 bool opaque;
164 Picture picture;
165 } pattern_fills[pattern_fill_count];
166 Picture getSolidFill(int screen, const QColor &c);
167 XRenderColor preMultiply(const QColor &c);
168 #endif
169
170 bool fc_antialias = true;
171 int fc_hint_style = 0;
172
173 DesktopEnvironment desktopEnvironment = DE_GNOME;
174 };
175
176 extern QXcbX11Data *qt_x11Data;
177 #define X11 qt_x11Data
178
179 struct QX11InfoData {
180 int screen;
181 int dpiX;
182 int dpiY;
183 int depth;
184 int cells;
185 Colormap colormap;
186 Visual *visual;
187 bool defaultColormap;
188 bool defaultVisual;
189 int subpixel = 0;
190 };
191
192 template <class T>
193 constexpr inline int lowest_bit(T v) noexcept
194 {
195 int result = qCountTrailingZeroBits(v);
196 return ((result >> 3) == sizeof(T)) ? -1 : result;
197 }
198
199 QT_END_NAMESPACE
200
201 #endif // QT_X11_P_H