File indexing completed on 2024-04-28 03:59:28
0001 /* 0002 SPDX-FileCopyrightText: 2000 Troll Tech AS 0003 SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org> 0004 0005 SPDX-License-Identifier: MIT 0006 */ 0007 0008 #ifndef netwm_p_h 0009 #define netwm_p_h 0010 0011 #include <QSharedData> 0012 #include <QSharedDataPointer> 0013 0014 #include "atoms_p.h" 0015 0016 class Atoms : public QSharedData 0017 { 0018 public: 0019 explicit Atoms(xcb_connection_t *c); 0020 0021 xcb_atom_t atom(KwsAtom atom) const 0022 { 0023 return m_atoms[atom]; 0024 } 0025 0026 private: 0027 void init(); 0028 xcb_atom_t m_atoms[KwsAtomCount]; 0029 xcb_connection_t *m_connection; 0030 }; 0031 0032 /** 0033 Resizable array class. 0034 0035 This resizable array is used to simplify the implementation. The existence of 0036 this class is to keep the implementation from depending on a separate 0037 framework/library. 0038 @internal 0039 **/ 0040 0041 template<class Z> 0042 class NETRArray 0043 { 0044 public: 0045 /** 0046 Constructs an empty (size == 0) array. 0047 **/ 0048 0049 NETRArray(); 0050 0051 /** 0052 Resizable array destructor. 0053 **/ 0054 0055 ~NETRArray(); 0056 0057 /** 0058 The [] operator does the work. If the index is larger than the current 0059 size of the array, it is resized. 0060 **/ 0061 0062 Z &operator[](int); 0063 0064 /** 0065 Returns the size of the array. 0066 **/ 0067 0068 int size() const 0069 { 0070 return sz; 0071 } 0072 0073 /** 0074 Resets the array (size == 0). 0075 **/ 0076 void reset(); 0077 0078 private: 0079 int sz; 0080 int capacity; 0081 Z *d; 0082 }; 0083 0084 /** 0085 Private data for the NETRootInfo class. 0086 @internal 0087 **/ 0088 0089 struct NETRootInfoPrivate { 0090 NET::Role role; 0091 0092 // information about the X server 0093 xcb_connection_t *conn; 0094 NETSize rootSize; 0095 xcb_window_t root; 0096 xcb_window_t supportwindow; 0097 const char *name; 0098 0099 uint32_t *temp_buf; 0100 size_t temp_buf_size; 0101 0102 // data that changes (either by the window manager or by a client) 0103 // and requires updates 0104 NETRArray<NETPoint> viewport; 0105 NETRArray<NETRect> workarea; 0106 NETSize geometry; 0107 xcb_window_t active; 0108 xcb_window_t *clients, *stacking, *virtual_roots; 0109 NETRArray<const char *> desktop_names; 0110 int number_of_desktops; 0111 int current_desktop; 0112 0113 unsigned long clients_count, stacking_count, virtual_roots_count; 0114 bool showing_desktop; 0115 NET::Orientation desktop_layout_orientation; 0116 NET::DesktopLayoutCorner desktop_layout_corner; 0117 int desktop_layout_columns, desktop_layout_rows; 0118 0119 NET::Properties properties; 0120 NET::Properties2 properties2; 0121 NET::WindowTypes windowTypes; 0122 NET::States states; 0123 NET::Actions actions; 0124 NET::Properties clientProperties; 0125 NET::Properties2 clientProperties2; 0126 0127 int ref; 0128 0129 QSharedDataPointer<Atoms> atoms; 0130 xcb_atom_t atom(KwsAtom atom) const 0131 { 0132 return atoms->atom(atom); 0133 } 0134 }; 0135 0136 /** 0137 Private data for the NETWinInfo class. 0138 @internal 0139 **/ 0140 0141 struct NETWinInfoPrivate { 0142 NET::Role role; 0143 0144 xcb_connection_t *conn; 0145 xcb_window_t window, root; 0146 NET::MappingState mapping_state; 0147 bool mapping_state_dirty; 0148 0149 NETRArray<NETIcon> icons; 0150 int icon_count; 0151 int *icon_sizes; // for iconSizes() only 0152 0153 NETRect icon_geom, win_geom; 0154 NET::States state; 0155 NETExtendedStrut extended_strut; 0156 NETStrut strut; 0157 NETStrut frame_strut; // strut? 0158 NETStrut frame_overlap; 0159 NETStrut gtk_frame_extents; 0160 NETRArray<NET::WindowType> types; 0161 char *name, *visible_name, *icon_name, *visible_icon_name; 0162 int desktop; 0163 int pid; 0164 bool handled_icons; 0165 xcb_timestamp_t user_time; 0166 char *startup_id; 0167 unsigned long opacity; 0168 xcb_window_t transient_for, window_group; 0169 xcb_pixmap_t icon_pixmap, icon_mask; 0170 NET::Actions allowed_actions; 0171 char *class_class, *class_name, *window_role, *client_machine, *desktop_file, *appmenu_object_path, *appmenu_service_name, *gtk_application_id; 0172 0173 NET::Properties properties; 0174 NET::Properties2 properties2; 0175 NETFullscreenMonitors fullscreen_monitors; 0176 bool has_net_support; 0177 0178 const char *activities; 0179 bool blockCompositing; 0180 bool urgency; 0181 bool input; 0182 NET::MappingState initialMappingState; 0183 NET::Protocols protocols; 0184 std::vector<NETRect> opaqueRegion; 0185 0186 int ref; 0187 0188 QSharedDataPointer<Atoms> atoms; 0189 xcb_atom_t atom(KwsAtom atom) const 0190 { 0191 return atoms->atom(atom); 0192 } 0193 }; 0194 0195 #endif // netwm_p_h