awesome/common/xutil.h

68 lines
2.0 KiB
C
Raw Normal View History

/*
2008-03-04 20:39:21 +01:00
* common/xutil.h - X-related useful functions header
*
2008-03-04 20:39:21 +01:00
* Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
2008-03-04 20:39:21 +01:00
#ifndef AWESOME_COMMON_XUTIL_H
#define AWESOME_COMMON_XUTIL_H
2008-03-21 16:50:17 +01:00
#include <xcb/xcb.h>
#include <xcb/xcb_keysyms.h>
#include <xcb/xcb_aux.h>
2008-03-27 16:51:24 +01:00
#include <xcb/xcb_event.h>
2008-03-21 16:50:17 +01:00
/* XCB doesn't provide keysyms definition */
#include <X11/keysym.h>
#include "array.h"
2008-03-21 16:50:17 +01:00
bool xutil_text_prop_get(xcb_connection_t *, xcb_window_t, xcb_atom_t, char **, ssize_t *);
2008-03-27 16:51:24 +01:00
/** Set the same handler for all errors */
void xutil_error_handler_catch_all_set(xcb_event_handlers_t *,
2008-03-27 16:51:24 +01:00
xcb_generic_error_handler_t, void *);
uint16_t xutil_key_mask_fromstr(const char *, size_t);
uint8_t xutil_button_fromint(int);
2008-03-27 16:51:24 +01:00
/* Get the informations about the screen.
* \param c X connection.
* \param screen Screen number.
* \return Screen informations (must not be freed!).
*/
static inline xcb_screen_t *
xutil_screen_get(xcb_connection_t *c, int screen)
{
xcb_screen_t *s;
if(xcb_connection_has_error(c))
fatal("X connection invalid");
s = xcb_aux_get_screen(c, screen);
assert(s);
return s;
}
int xutil_root2screen(xcb_connection_t *, xcb_window_t);
#endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80