Set c.screen in ewmh.tag and before tags in rules.execute
[awesome.git] / common / xutil.h
blobd223ab2ff2b26f683fcf82543be830337294c503
1 /*
2 * common/xutil.h - X-related useful functions header
4 * Copyright © 2007-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_COMMON_XUTIL_H
23 #define AWESOME_COMMON_XUTIL_H
25 #include <xcb/xcb.h>
26 #include <xcb/xcb_keysyms.h>
27 #include <xcb/xcb_aux.h>
28 #include <xcb/xcb_event.h>
29 #include <xcb/xcb_atom.h>
30 #include <xcb/xproto.h>
32 #include "common/array.h"
33 #include "common/atoms.h"
35 static inline char *
36 xutil_get_text_property_from_reply(xcb_get_property_reply_t *reply)
38 if(reply
39 && (reply->type == XCB_ATOM_STRING
40 || reply->type == UTF8_STRING
41 || reply->type == COMPOUND_TEXT)
42 && reply->format == 8
43 && xcb_get_property_value_length(reply))
45 /* We need to copy it that way since the string may not be
46 * NULL-terminated */
47 int len = xcb_get_property_value_length(reply);
48 char *value = p_new(char, len + 1);
49 memcpy(value, xcb_get_property_value(reply), len);
50 value[len] = '\0';
51 return value;
53 return NULL;
56 void xutil_lock_mask_get(xcb_connection_t *, xcb_get_modifier_mapping_cookie_t,
57 xcb_key_symbols_t *,
58 uint16_t *, uint16_t *, uint16_t *, uint16_t *);
60 uint16_t xutil_key_mask_fromstr(const char *);
61 void xutil_key_mask_tostr(uint16_t, const char **, size_t *);
63 #endif
64 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80