Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 50062c2ac4
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (30 sloc) 0.66 kb
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
* See LICENSE file for license details.
*/
#include "x11.h"
Atom
xatom(const char *name) {
void **e, **f;
e = hash_get(&atommap, name, true);
if(*e == nil) {
*e = (void*)XInternAtom(display, name, false);
f = map_get(&atomnamemap, (ulong)*e, true);
if(*f == nil)
*f = (void*)(uintptr_t)name;
}
return (Atom)*e;
}
char*
atomname(ulong atom) {
void **e;
e = map_get(&atomnamemap, atom, true);
if(*e == nil) {
*e = XGetAtomName(display, atom);
if(*e == nil) {
map_rm(&atomnamemap, atom);
return nil;
}
*hash_get(&atommap, *e, true) = (void*)atom;
}
return *e;
}
Jump to Line
Something went wrong with that request. Please try again.