Add awesome.register_xproperty (FS#1212)
[awesome.git] / property.h
blob59277f87461376d3ea929a2b3e9b0c88f0c66148
1 /*
2 * property.h - property handlers header
4 * Copyright © 2008-2009 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef AWESOME_PROPERTY_H
23 #define AWESOME_PROPERTY_H
25 #include "globalconf.h"
27 #define PROPERTY(funcname) \
28 xcb_get_property_cookie_t property_get_##funcname(client_t *c); \
29 void property_update_##funcname(client_t *c, xcb_get_property_cookie_t cookie)
31 PROPERTY(wm_name);
32 PROPERTY(net_wm_name);
33 PROPERTY(wm_icon_name);
34 PROPERTY(net_wm_icon_name);
35 PROPERTY(wm_client_machine);
36 PROPERTY(wm_window_role);
37 PROPERTY(wm_transient_for);
38 PROPERTY(wm_client_leader);
39 PROPERTY(wm_normal_hints);
40 PROPERTY(wm_hints);
41 PROPERTY(wm_class);
42 PROPERTY(wm_protocols);
43 PROPERTY(net_wm_pid);
44 PROPERTY(net_wm_icon);
46 #undef PROPERTY
48 void property_handle_propertynotify(xcb_property_notify_event_t *ev);
49 int luaA_register_xproperty(lua_State *L);
51 struct xproperty {
52 xcb_atom_t atom;
53 const char *name;
54 enum {
55 /* UTF8_STRING */
56 PROP_STRING,
57 /* CARDINAL */
58 PROP_NUMBER,
59 /* CARDINAL with values 0 and 1 (or "0 and != 0") */
60 PROP_BOOLEAN
61 } type;
64 static inline int
65 xproperty_cmp(const void *a, const void *b)
67 const xproperty_t *x = a, *y = b;
68 return x->atom - y->atom;
71 BARRAY_FUNCS(xproperty_t, xproperty, DO_NOTHING, xproperty_cmp)
73 #endif
74 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80