2 // Copyright (c) 2002 - 2002 Ben Janens (ben at orodu.net)
4 // Permission is hereby granted, free of charge, to any person obtaining a
5 // copy of this software and associated documentation files (the "Software"),
6 // to deal in the Software without restriction, including without limitation
7 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 // and/or sell copies of the Software, and to permit persons to whom the
9 // Software is furnished to do so, subject to the following conditions:
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 // DEALINGS IN THE SOFTWARE.
26 #include <X11/Xatom.h>
33 typedef std::vector
<Window
> SupportWindows
;
36 // windows used to specify support for NETWM
37 SupportWindows _support_windows
;
49 openbox_change_attributes
,
52 // blackbox-protocol atoms (wm -> client)
53 openbox_structure_messages
,
54 openbox_notify_startup
,
55 openbox_notify_window_add
,
56 openbox_notify_window_del
,
57 openbox_notify_window_focus
,
58 openbox_notify_current_workspace
,
59 openbox_notify_workspace_count
,
60 openbox_notify_window_raise
,
61 openbox_notify_window_lower
,
62 // blackbox-protocol atoms (client -> wm)
63 openbox_change_workspace
,
64 openbox_change_window_focus
,
65 openbox_cycle_window_focus
,
68 // root window properties
71 net_client_list_stacking
,
72 net_number_of_desktops
,
79 net_supporting_wm_check
,
81 // root window messages
84 // application window properties
95 // application protocols
98 Atom
getAtom(const char *name
) const;
99 void setSupported(const XScreen
*screen
);
101 void setValue(Window win
, Atom atom
, Atom type
, unsigned char *data
,
102 int size
, int nelements
, bool append
) const;
103 bool getValue(Window win
, Atom atom
, Atom type
, unsigned long *nelements
,
104 unsigned char **value
, int size
) const;
107 XAtom(const XAtom
&);
108 XAtom
& operator=(const XAtom
&);
111 XAtom(const XDisplay
*display
);
114 void setCardValue(Window win
, Atom atom
, long value
) const; // 32-bit CARDINAL
115 void setAtomValue(Window win
, Atom atom
, Atom value
) const;
116 void setWindowValue(Window win
, Atom atom
, Window value
) const;
117 void setPixmapValue(Window win
, Atom atom
, Pixmap value
) const;
118 void setStringValue(Window win
, Atom atom
, std::string
&value
) const;
120 void addCardValue(Window win
, Atom atom
, long value
) const; // 32-bit CARDINAL
121 void addAtomValue(Window win
, Atom atom
, Atom value
) const;
122 void addWindowValue(Window win
, Atom atom
, Window value
) const;
123 void addPixmapValue(Window win
, Atom atom
, Pixmap value
) const;
124 void addStringValue(Window win
, Atom atom
, std::string
&value
) const;
126 // the 'value' is allocated inside the function and
127 // delete [] value needs to be called when you are done with it.
128 // teh 'value' array returned is null terminated, and has 'nelements'
129 // elements in it plus the null.
130 bool getCardValue(Window win
, Atom atom
, unsigned long *nelements
,
131 long **value
) const; // 32-bit CARDINAL
132 bool getAtomValue(Window win
, Atom atom
, unsigned long *nelements
,
134 bool getWindowValue(Window win
, Atom atom
, unsigned long *nelements
,
135 Window
**value
) const;
136 bool getPixmapValue(Window win
, Atom atom
, unsigned long *nelements
,
137 Pixmap
**value
) const;
138 bool getStringValue(Window win
, Atom atom
, unsigned long *nelements
,
139 std::string
&value
) const;
141 void eraseValue(Window win
, Atom atom
) const;
143 inline Atom
wmChangeState() const { return wm_change_state
; }
144 inline Atom
wmState() const { return wm_state
; }
145 inline Atom
wmDelete() const { return wm_delete_window
; }
146 inline Atom
wmProtocols() const { return wm_protocols
; }
147 inline Atom
wmTakeFocus() const { return wm_take_focus
; }
148 inline Atom
wmColormap() const { return wm_colormap_windows
; }
149 inline Atom
motifWMHints() const { return motif_wm_hints
; }
151 // this atom is for normal app->WM hints about decorations, stacking,
152 // starting workspace etc...
153 inline Atom
openboxHints() const { return openbox_hints
;}
155 // these atoms are for normal app->WM interaction beyond the scope of the
157 inline Atom
openboxAttributes() const { return openbox_attributes
; }
158 inline Atom
openboxChangeAttributes() const
159 { return openbox_change_attributes
; }
161 // these atoms are for window->WM interaction, with more control and
162 // information on window "structure"... common examples are
163 // notifying apps when windows are raised/lowered... when the user changes
164 // workspaces... i.e. "pager talk"
165 inline Atom
openboxStructureMessages() const
166 { return openbox_structure_messages
; }
168 inline Atom
openboxNotifyStartup() const
169 { return openbox_notify_startup
; }
170 inline Atom
openboxNotifyWindowAdd() const
171 { return openbox_notify_window_add
; }
172 inline Atom
openboxNotifyWindowDel() const
173 { return openbox_notify_window_del
; }
174 inline Atom
openboxNotifyWindowFocus() const
175 { return openbox_notify_window_focus
; }
176 inline Atom
openboxNotifyCurrentWorkspace() const
177 { return openbox_notify_current_workspace
; }
178 inline Atom
openboxNotifyWorkspaceCount() const
179 { return openbox_notify_workspace_count
; }
180 inline Atom
openboxNotifyWindowRaise() const
181 { return openbox_notify_window_raise
; }
182 inline Atom
openboxNotifyWindowLower() const
183 { return openbox_notify_window_lower
; }
185 // atoms to change that request changes to the desktop environment during
186 // runtime... these messages can be sent by any client... as the sending
187 // client window id is not included in the ClientMessage event...
188 inline Atom
openboxChangeWorkspace() const
189 { return openbox_change_workspace
; }
190 inline Atom
openboxChangeWindowFocus() const
191 { return openbox_change_window_focus
; }
192 inline Atom
openboxCycleWindowFocus() const
193 { return openbox_cycle_window_focus
; }
195 // root window properties
196 inline Atom
netClientList() const { return net_client_list
; }
197 inline Atom
netClientListStacking() const { return net_client_list_stacking
; }
198 inline Atom
netNumberOfDesktops() const { return net_number_of_desktops
; }
199 inline Atom
netDesktopGeometry() const { return net_desktop_geometry
; }
200 inline Atom
netDesktopViewport() const { return net_desktop_viewport
; }
201 inline Atom
netCurrentDesktop() const { return net_current_desktop
; }
202 inline Atom
netDesktopNames() const { return net_desktop_names
; }
203 inline Atom
netActiveWindow() const { return net_active_window
; }
204 inline Atom
netWorkarea() const { return net_workarea
; }
205 inline Atom
netSupportingWMCheck() const { return net_supporting_wm_check
; }
206 inline Atom
netVirtualRoots() const { return net_virtual_roots
; }
208 // root window messages
209 inline Atom
netCloseWindow() const { return net_close_window
; }
210 inline Atom
netWMMoveResize() const { return net_wm_moveresize
; }
212 // application window properties
213 inline Atom
netProperties() const { return net_properties
; }
214 inline Atom
netWMName() const { return net_wm_name
; }
215 inline Atom
netWMDesktop() const { return net_wm_desktop
; }
216 inline Atom
netWMWindowType() const { return net_wm_window_type
; }
217 inline Atom
netWMState() const { return net_wm_state
; }
218 inline Atom
netWMStrut() const { return net_wm_strut
; }
219 inline Atom
netWMIconGeometry() const { return net_wm_icon_geometry
; }
220 inline Atom
netWMIcon() const { return net_wm_icon
; }
221 inline Atom
netWMPid() const { return net_wm_pid
; }
222 inline Atom
netWMHandledIcons() const { return net_wm_handled_icons
; }
224 // application protocols
225 inline Atom
netWMPing() const { return net_wm_ping
; }