1/*
2 SPDX-FileCopyrightText: 2000 Troll Tech AS
3 SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
4
5 SPDX-License-Identifier: MIT
6*/
7
8#ifndef netwm_p_h
9#define netwm_p_h
10
11#include <QSharedData>
12#include <QSharedDataPointer>
13
14#include "atoms_p.h"
15
16class Atoms : public QSharedData
17{
18public:
19 explicit Atoms(xcb_connection_t *c);
20
21 xcb_atom_t atom(KwsAtom atom) const
22 {
23 return m_atoms[atom];
24 }
25
26private:
27 void init();
28 xcb_atom_t m_atoms[KwsAtomCount];
29 xcb_connection_t *m_connection;
30};
31
32/**
33 Resizable array class.
34
35 This resizable array is used to simplify the implementation. The existence of
36 this class is to keep the implementation from depending on a separate
37 framework/library.
38 @internal
39**/
40
41template<class Z>
42class NETRArray
43{
44public:
45 /**
46 Constructs an empty (size == 0) array.
47 **/
48
49 NETRArray();
50
51 /**
52 Resizable array destructor.
53 **/
54
55 ~NETRArray();
56
57 /**
58 The [] operator does the work. If the index is larger than the current
59 size of the array, it is resized.
60 **/
61
62 Z &operator[](int);
63
64 /**
65 Returns the size of the array.
66 **/
67
68 int size() const
69 {
70 return sz;
71 }
72
73 /**
74 Resets the array (size == 0).
75 **/
76 void reset();
77
78private:
79 int sz;
80 int capacity;
81 Z *d;
82};
83
84/**
85 Private data for the NETRootInfo class.
86 @internal
87**/
88
89struct NETRootInfoPrivate {
90 NET::Role role;
91
92 // information about the X server
93 xcb_connection_t *conn;
94 NETSize rootSize;
95 xcb_window_t root;
96 xcb_window_t supportwindow;
97 const char *name;
98
99 uint32_t *temp_buf;
100 size_t temp_buf_size;
101
102 // data that changes (either by the window manager or by a client)
103 // and requires updates
104 NETRArray<NETPoint> viewport;
105 NETRArray<NETRect> workarea;
106 NETSize geometry;
107 xcb_window_t active;
108 xcb_window_t *clients, *stacking, *virtual_roots;
109 NETRArray<const char *> desktop_names;
110 int number_of_desktops;
111 int current_desktop;
112
113 unsigned long clients_count, stacking_count, virtual_roots_count;
114 bool showing_desktop;
115 NET::Orientation desktop_layout_orientation;
116 NET::DesktopLayoutCorner desktop_layout_corner;
117 int desktop_layout_columns, desktop_layout_rows;
118
119 NET::Properties properties;
120 NET::Properties2 properties2;
121 NET::WindowTypes windowTypes;
122 NET::States states;
123 NET::Actions actions;
124 NET::Properties clientProperties;
125 NET::Properties2 clientProperties2;
126
127 int ref;
128
129 QSharedDataPointer<Atoms> atoms;
130 xcb_atom_t atom(KwsAtom atom) const
131 {
132 return atoms->atom(atom);
133 }
134};
135
136/**
137 Private data for the NETWinInfo class.
138 @internal
139**/
140
141struct NETWinInfoPrivate {
142 NET::Role role;
143
144 xcb_connection_t *conn;
145 xcb_window_t window, root;
146 NET::MappingState mapping_state;
147 bool mapping_state_dirty;
148
149 NETRArray<NETIcon> icons;
150 int icon_count;
151 int *icon_sizes; // for iconSizes() only
152
153 NETRect icon_geom, win_geom;
154 NET::States state;
155 NETExtendedStrut extended_strut;
156 NETStrut strut;
157 NETStrut frame_strut; // strut?
158 NETStrut frame_overlap;
159 NETStrut gtk_frame_extents;
160 NETRArray<NET::WindowType> types;
161 char *name, *visible_name, *icon_name, *visible_icon_name;
162 int desktop;
163 int pid;
164 bool handled_icons;
165 xcb_timestamp_t user_time;
166 char *startup_id;
167 unsigned long opacity;
168 xcb_window_t transient_for, window_group;
169 xcb_pixmap_t icon_pixmap, icon_mask;
170 NET::Actions allowed_actions;
171 char *class_class, *class_name, *window_role, *client_machine, *desktop_file, *appmenu_object_path, *appmenu_service_name, *gtk_application_id;
172
173 NET::Properties properties;
174 NET::Properties2 properties2;
175 NETFullscreenMonitors fullscreen_monitors;
176 bool has_net_support;
177
178 const char *activities;
179 bool blockCompositing;
180 bool urgency;
181 bool input;
182 NET::MappingState initialMappingState;
183 NET::Protocols protocols;
184 std::vector<NETRect> opaqueRegion;
185
186 int ref;
187
188 QSharedDataPointer<Atoms> atoms;
189 xcb_atom_t atom(KwsAtom atom) const
190 {
191 return atoms->atom(atom);
192 }
193};
194
195#endif // netwm_p_h
196

source code of kwindowsystem/src/platforms/xcb/netwm_p.h