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.
25 #include "../config.h"
28 #include <X11/Xatom.h>
35 typedef std::vector
<Window
> SupportWindows
;
38 // windows used to specify support for NETWM
39 SupportWindows _support_windows
;
55 openbox_change_attributes
,
58 // blackbox-protocol atoms (wm -> client)
59 openbox_structure_messages
,
60 openbox_notify_startup
,
61 openbox_notify_window_add
,
62 openbox_notify_window_del
,
63 openbox_notify_window_focus
,
64 openbox_notify_current_workspace
,
65 openbox_notify_workspace_count
,
66 openbox_notify_window_raise
,
67 openbox_notify_window_lower
,
68 // blackbox-protocol atoms (client -> wm)
69 openbox_change_workspace
,
70 openbox_change_window_focus
,
71 openbox_cycle_window_focus
,
74 // root window properties
77 net_client_list_stacking
,
78 net_number_of_desktops
,
85 net_supporting_wm_check
,
87 // root window messages
90 // application window properties
100 net_wm_handled_icons
,
101 // application protocols
104 Atom
getAtom(const char *name
) const;
105 void setSupported(const XScreen
*screen
);
107 void setValue(Window win
, Atom atom
, Atom type
, unsigned char *data
,
108 int size
, int nelements
, bool append
) const;
109 bool getValue(Window win
, Atom atom
, Atom type
, unsigned long *nelements
,
110 unsigned char **value
, int size
) const;
113 XAtom(const XAtom
&);
114 XAtom
& operator=(const XAtom
&);
117 XAtom(const XDisplay
*display
);
120 void setCardValue(Window win
, Atom atom
, long value
) const; // 32-bit CARDINAL
121 void setAtomValue(Window win
, Atom atom
, Atom value
) const;
122 void setWindowValue(Window win
, Atom atom
, Window value
) const;
123 void setPixmapValue(Window win
, Atom atom
, Pixmap value
) const;
124 void setStringValue(Window win
, Atom atom
, std::string
&value
) const;
126 void addCardValue(Window win
, Atom atom
, long value
) const; // 32-bit CARDINAL
127 void addAtomValue(Window win
, Atom atom
, Atom value
) const;
128 void addWindowValue(Window win
, Atom atom
, Window value
) const;
129 void addPixmapValue(Window win
, Atom atom
, Pixmap value
) const;
130 void addStringValue(Window win
, Atom atom
, std::string
&value
) const;
132 // the 'value' is allocated inside the function and
133 // delete [] value needs to be called when you are done with it.
134 // teh 'value' array returned is null terminated, and has 'nelements'
135 // elements in it plus the null.
136 bool getCardValue(Window win
, Atom atom
, unsigned long *nelements
,
137 long **value
) const; // 32-bit CARDINAL
138 bool getAtomValue(Window win
, Atom atom
, unsigned long *nelements
,
140 bool getWindowValue(Window win
, Atom atom
, unsigned long *nelements
,
141 Window
**value
) const;
142 bool getPixmapValue(Window win
, Atom atom
, unsigned long *nelements
,
143 Pixmap
**value
) const;
144 bool getStringValue(Window win
, Atom atom
, unsigned long *nelements
,
145 std::string
&value
) const;
147 void eraseValue(Window win
, Atom atom
) const;
150 inline Atom
openboxPid() const { return openbox_pid
; }
151 #endif // HAVE_GETPID
153 inline Atom
wmChangeState() const { return wm_change_state
; }
154 inline Atom
wmState() const { return wm_state
; }
155 inline Atom
wmDelete() const { return wm_delete_window
; }
156 inline Atom
wmProtocols() const { return wm_protocols
; }
157 inline Atom
wmTakeFocus() const { return wm_take_focus
; }
158 inline Atom
wmColormap() const { return wm_colormap_windows
; }
159 inline Atom
motifWMHints() const { return motif_wm_hints
; }
161 // this atom is for normal app->WM hints about decorations, stacking,
162 // starting workspace etc...
163 inline Atom
openboxHints() const { return openbox_hints
;}
165 // these atoms are for normal app->WM interaction beyond the scope of the
167 inline Atom
openboxAttributes() const { return openbox_attributes
; }
168 inline Atom
openboxChangeAttributes() const
169 { return openbox_change_attributes
; }
171 // these atoms are for window->WM interaction, with more control and
172 // information on window "structure"... common examples are
173 // notifying apps when windows are raised/lowered... when the user changes
174 // workspaces... i.e. "pager talk"
175 inline Atom
openboxStructureMessages() const
176 { return openbox_structure_messages
; }
178 inline Atom
openboxNotifyStartup() const
179 { return openbox_notify_startup
; }
180 inline Atom
openboxNotifyWindowAdd() const
181 { return openbox_notify_window_add
; }
182 inline Atom
openboxNotifyWindowDel() const
183 { return openbox_notify_window_del
; }
184 inline Atom
openboxNotifyWindowFocus() const
185 { return openbox_notify_window_focus
; }
186 inline Atom
openboxNotifyCurrentWorkspace() const
187 { return openbox_notify_current_workspace
; }
188 inline Atom
openboxNotifyWorkspaceCount() const
189 { return openbox_notify_workspace_count
; }
190 inline Atom
openboxNotifyWindowRaise() const
191 { return openbox_notify_window_raise
; }
192 inline Atom
openboxNotifyWindowLower() const
193 { return openbox_notify_window_lower
; }
195 // atoms to change that request changes to the desktop environment during
196 // runtime... these messages can be sent by any client... as the sending
197 // client window id is not included in the ClientMessage event...
198 inline Atom
openboxChangeWorkspace() const
199 { return openbox_change_workspace
; }
200 inline Atom
openboxChangeWindowFocus() const
201 { return openbox_change_window_focus
; }
202 inline Atom
openboxCycleWindowFocus() const
203 { return openbox_cycle_window_focus
; }
205 // root window properties
206 inline Atom
netClientList() const { return net_client_list
; }
207 inline Atom
netClientListStacking() const { return net_client_list_stacking
; }
208 inline Atom
netNumberOfDesktops() const { return net_number_of_desktops
; }
209 inline Atom
netDesktopGeometry() const { return net_desktop_geometry
; }
210 inline Atom
netDesktopViewport() const { return net_desktop_viewport
; }
211 inline Atom
netCurrentDesktop() const { return net_current_desktop
; }
212 inline Atom
netDesktopNames() const { return net_desktop_names
; }
213 inline Atom
netActiveWindow() const { return net_active_window
; }
214 inline Atom
netWorkarea() const { return net_workarea
; }
215 inline Atom
netSupportingWMCheck() const { return net_supporting_wm_check
; }
216 inline Atom
netVirtualRoots() const { return net_virtual_roots
; }
218 // root window messages
219 inline Atom
netCloseWindow() const { return net_close_window
; }
220 inline Atom
netWMMoveResize() const { return net_wm_moveresize
; }
222 // application window properties
223 inline Atom
netProperties() const { return net_properties
; }
224 inline Atom
netWMName() const { return net_wm_name
; }
225 inline Atom
netWMDesktop() const { return net_wm_desktop
; }
226 inline Atom
netWMWindowType() const { return net_wm_window_type
; }
227 inline Atom
netWMState() const { return net_wm_state
; }
228 inline Atom
netWMStrut() const { return net_wm_strut
; }
229 inline Atom
netWMIconGeometry() const { return net_wm_icon_geometry
; }
230 inline Atom
netWMIcon() const { return net_wm_icon
; }
231 inline Atom
netWMPid() const { return net_wm_pid
; }
232 inline Atom
netWMHandledIcons() const { return net_wm_handled_icons
; }
234 // application protocols
235 inline Atom
netWMPing() const { return net_wm_ping
; }