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>
32 typedef std::vector
<Window
> SupportWindows
;
35 // windows used to specify support for NETWM
36 SupportWindows _support_windows
;
48 openbox_change_attributes
,
51 // blackbox-protocol atoms (wm -> client)
52 openbox_structure_messages
,
53 openbox_notify_startup
,
54 openbox_notify_window_add
,
55 openbox_notify_window_del
,
56 openbox_notify_window_focus
,
57 openbox_notify_current_workspace
,
58 openbox_notify_workspace_count
,
59 openbox_notify_window_raise
,
60 openbox_notify_window_lower
;
61 // blackbox-protocol atoms (client -> wm)
62 openbox_change_workspace
,
63 openbox_change_window_focus
,
64 openbox_cycle_window_focus
,
67 // root window properties
70 net_client_list_stacking
,
71 net_number_of_desktops
,
78 net_supporting_wm_check
,
80 // root window messages
83 // application window properties
94 // application protocols
97 Atom
getAtom(const char *name
) const;
98 void setSupported(const XScreen
*screen
) const;
100 void setValue(Window win
, Atom atom
, Atom type
, unsigned char *data
, int size
,
101 int nelements
, bool append
);
102 bool getValue(Window win
, Atom atom
, Atom type
, unsigned long *nelements
,
103 unsigned char **value
, int size
) const;
106 XAtom(const XAtom
&);
107 XAtom
& operator=(const XAtom
&);
110 XAtom(XDisplay
*display
);
113 void setValue(Window win
, Atom atom
, long value
) const; // a 32-bit CARDINAL
114 void setValue(Window win
, Atom atom
, Atom value
) const;
115 void setValue(Window win
, Atom atom
, Window value
) const;
116 void setValue(Window win
, Atom atom
, Pixmap value
) const;
117 void setValue(Window win
, Atom atom
, std::string
&value
) const;
119 void addValue(Window win
, Atom atom
, long value
) const; // a 32-bit CARDINAL
120 void addValue(Window win
, Atom atom
, Atom value
) const;
121 void addValue(Window win
, Atom atom
, Window value
) const;
122 void addValue(Window win
, Atom atom
, Pixmap value
) const;
123 void addValue(Window win
, Atom atom
, std::string
&value
) const;
125 // the 'value' is allocated inside the function and
126 // delete [] value needs to be called when you are done with it.
127 // teh 'value' array returned is null terminated, and has 'nelements'
128 // elements in it plus the null.
129 bool getValue(Window win
, Atom atom
, unsigned long *nelements
,
130 long **value
) const; // a 32-bit CARDINAL
131 bool getValue(Window win
, Atom atom
, unsigned long *nelements
,
133 bool getValue(Window win
, Atom atom
, unsigned long *nelements
,
134 Window
**value
) const;
135 bool getValue(Window win
, Atom atom
, unsigned long *nelements
,
136 Pixmap
**value
) const;
137 bool getValue(Window win
, Atom atom
, unsigned long *nelements
,
138 std::string
&value
) const;
140 void eraseValue(Window win
, Atom atom
) const;
142 inline Atom
wmChangeState() const { return wm_change_state
; }
143 inline Atom
wmState() const { return wm_state
; }
144 inline Atom
wmDelete() const { return wm_delete_window
; }
145 inline Atom
wmProtocols() const { return wm_protocols
; }
146 inline Atom
wmTakeFocus() const { return wm_take_focus
; }
147 inline Atom
wmColormap() const { return wm_colormap_windows
; }
148 inline Atom
motifWMHints() const { return motif_wm_hints
; }
150 // this atom is for normal app->WM hints about decorations, stacking,
151 // starting workspace etc...
152 inline Atom
openboxHints() const { return openbox_hints
;}
154 // these atoms are for normal app->WM interaction beyond the scope of the
156 inline Atom
openboxAttributes() const { return openbox_attributes
; }
157 inline Atom
openboxChangeAttributes() const
158 { return openbox_change_attributes
; }
160 // these atoms are for window->WM interaction, with more control and
161 // information on window "structure"... common examples are
162 // notifying apps when windows are raised/lowered... when the user changes
163 // workspaces... i.e. "pager talk"
164 inline Atom
openboxStructureMessages() const
165 { return openbox_structure_messages
; }
167 inline Atom
openboxNotifyStartup() const
168 { return openbox_notify_startup
; }
169 inline Atom
openboxNotifyWindowAdd() const
170 { return openbox_notify_window_add
; }
171 inline Atom
openboxNotifyWindowDel() const
172 { return openbox_notify_window_del
; }
173 inline Atom
openboxNotifyWindowFocus() const
174 { return openbox_notify_window_focus
; }
175 inline Atom
openboxNotifyCurrentWorkspace() const
176 { return openbox_notify_current_workspace
; }
177 inline Atom
openboxNotifyWorkspaceCount() const
178 { return openbox_notify_workspace_count
; }
179 inline Atom
openboxNotifyWindowRaise() const
180 { return openbox_notify_window_raise
; }
181 inline Atom
openboxNotifyWindowLower() const
182 { return openbox_notify_window_lower
; }
184 // atoms to change that request changes to the desktop environment during
185 // runtime... these messages can be sent by any client... as the sending
186 // client window id is not included in the ClientMessage event...
187 inline Atom
openboxChangeWorkspace() const
188 { return openbox_change_workspace
; }
189 inline Atom
openboxChangeWindowFocus() const
190 { return openbox_change_window_focus
; }
191 inline Atom
openboxCycleWindowFocus() const
192 { return openbox_cycle_window_focus
; }
194 // root window properties
195 inline Atom
netClientList() const { return net_client_list
; }
196 inline Atom
netClientListStacking() const { return net_client_list_stacking
; }
197 inline Atom
netNumberOfDesktops() const { return net_number_of_desktops
; }
198 inline Atom
netDesktopGeometry() const { return net_desktop_geometry
; }
199 inline Atom
netDesktopViewport() const { return net_desktop_viewport
; }
200 inline Atom
netCurrentDesktop() const { return net_current_desktop
; }
201 inline Atom
netDesktopNames() const { return net_desktop_names
; }
202 inline Atom
netActiveWindow() const { return net_active_window
; }
203 inline Atom
netWorkarea() const { return net_workarea
; }
204 inline Atom
netSupportingWMCheck() const { return net_supporting_wm_check
; }
205 inline Atom
netVirtualRoots() const { return net_virtual_roots
; }
207 // root window messages
208 inline Atom
netCloseWindow() const { return net_close_window
; }
209 inline Atom
netWMMoveResize() const { return net_wm_moveresize
; }
211 // application window properties
212 inline Atom
netProperties() const { return net_properties
; }
213 inline Atom
netWMName() const { return net_wm_name
; }
214 inline Atom
netWMDesktop() const { return net_wm_desktop
; }
215 inline Atom
netWMWindowType() const { return net_wm_window_type
; }
216 inline Atom
netWMState() const { return net_wm_state
; }
217 inline Atom
netWMStrut() const { return net_wm_strut
; }
218 inline Atom
netWMIconGeometry() const { return net_wm_icon_geometry
; }
219 inline Atom
netWMIcon() const { return net_wm_icon
; }
220 inline Atom
netWMPid() const { return net_wm_pid
; }
221 inline Atom
netWMHandledIcons() const { return net_wm_handled_icons
; }
223 // application protocols
224 inline Atom
netWMPing() const { return net_wm_ping
; }