2008-06-30 18:25:01 +02:00
|
|
|
/*
|
|
|
|
* atoms.c - X atoms functions
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common/atoms.h"
|
|
|
|
#include "common/util.h"
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const char *name;
|
2009-04-18 13:37:01 +02:00
|
|
|
size_t len;
|
2008-06-30 18:25:01 +02:00
|
|
|
xcb_atom_t *atom;
|
|
|
|
} atom_item_t;
|
|
|
|
|
2008-06-30 20:05:53 +02:00
|
|
|
#include "common/atoms-intern.h"
|
2008-06-30 18:25:01 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
atoms_init(xcb_connection_t *conn)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
xcb_intern_atom_cookie_t cs[countof(ATOM_LIST)];
|
|
|
|
xcb_intern_atom_reply_t *r;
|
|
|
|
|
|
|
|
/* Create the atom and get the reply in a XCB way (e.g. send all
|
|
|
|
* the requests at the same time and then get the replies) */
|
|
|
|
for(i = 0; i < countof(ATOM_LIST); i++)
|
|
|
|
cs[i] = xcb_intern_atom_unchecked(conn,
|
|
|
|
false,
|
2009-04-18 13:37:01 +02:00
|
|
|
ATOM_LIST[i].len,
|
2008-06-30 18:25:01 +02:00
|
|
|
ATOM_LIST[i].name);
|
|
|
|
|
|
|
|
for(i = 0; i < countof(ATOM_LIST); i++)
|
|
|
|
{
|
|
|
|
if(!(r = xcb_intern_atom_reply(conn, cs[i], NULL)))
|
2009-08-30 07:26:19 +02:00
|
|
|
/* An error occurred, get reply for next atom */
|
2008-06-30 18:25:01 +02:00
|
|
|
continue;
|
|
|
|
|
|
|
|
*ATOM_LIST[i].atom = r->atom;
|
|
|
|
p_delete(&r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-25 17:41:12 +02:00
|
|
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|