#include <xcb/shm.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_image.h>
+#include <xcb/xcb_atom.h>
/* Needed for xcb_set_wm_protocols() */
#include <xcb/xcb_icccm.h>
static void flame_process_flame (flame *f);
static void flame_draw_flame (flame *f);
-xcb_atom_t
-get_atom (xcb_connection_t *connection, const char *atomName)
-{
- if (atomName == NULL)
- return XCB_NONE;
- xcb_atom_t atom = XCB_NONE;
- xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection,
- xcb_intern_atom(connection, 0, strlen(atomName), atomName), NULL);
- if (reply)
- {
- atom = reply->atom;
- free(reply);
- }
- return atom;
-}
-
flame *
flame_init ()
{
flame_set_flame_zero (f);
flame_set_random_flame_base (f);
- xcb_atom_t deleteWindowAtom = get_atom(f->xcb.c, "WM_DELETE_WINDOW");
+ xcb_atom_t deleteWindowAtom = xcb_atom_get(f->xcb.c, "WM_DELETE_WINDOW");
+ xcb_atom_t wmprotocolsAtom = xcb_atom_get(f->xcb.c, "WM_PROTOCOLS");
/* Listen to X client messages in order to be able to pickup
the "delete window" message that is generated for example
when someone clicks the top-right X button within the window
manager decoration (or when user hits ALT-F4). */
- xcb_set_wm_protocols (f->xcb.c, f->xcb.draw, 1, &deleteWindowAtom);
+ xcb_set_wm_protocols (f->xcb.c, wmprotocolsAtom, f->xcb.draw, 1, &deleteWindowAtom);
bool finished = false;
while (!finished)
{
if ((e = xcb_poll_for_event (f->xcb.c)))
{
- switch (e->response_type & 0x7f)
+ switch (XCB_EVENT_RESPONSE_TYPE(e))
{
case XCB_EXPOSE:
xcb_copy_area(f->xcb.c, f->xcb.pixmap, f->xcb.draw, gc,