polytreewm/src/atoms.c

36 lines
1.3 KiB
C
Raw Normal View History

2021-11-12 04:02:46 -05:00
#include "atoms.h"
2021-11-12 04:04:13 -05:00
#include <stdlib.h>
2021-11-12 04:07:15 -05:00
Atoms atoms_create(Display *const dpy)
2021-11-12 04:04:13 -05:00
{
2021-11-12 04:07:15 -05:00
Atoms atoms = malloc(sizeof(struct Atoms));
atoms->wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
atoms->wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
atoms->wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
atoms->wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
atoms->netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
atoms->netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
atoms->netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
atoms->netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
atoms->netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
atoms->netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
atoms->netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
atoms->netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
atoms->netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
atoms->utf8string = XInternAtom(dpy, "UTF8_STRING", False);
2021-11-12 04:07:15 -05:00
return atoms;
2021-11-12 04:04:13 -05:00
}
2021-11-21 01:11:11 -05:00
void atoms_delete(Atoms atoms)
2021-11-12 04:02:46 -05:00
{
2021-11-21 01:11:11 -05:00
// TODO: maybe we should assert
if (atoms == NULL) return;
2021-11-12 04:07:15 -05:00
free(atoms);
2021-11-12 04:02:46 -05:00
}