remove local helper functions in favor of the new xcb_atom_get in xcb-utils
authorHenning Sten <henning.sten@yahoo.com>
Thu, 18 Sep 2008 18:11:19 +0000 (20:11 +0200)
committerJulien Danjou <julien@danjou.info>
Thu, 18 Sep 2008 19:44:10 +0000 (21:44 +0200)
Signed-off-by: Julien Danjou <julien@danjou.info>
tests/Makefile.am
tests/flames.c
tests/julia.c

index 29035e2..93ab757 100644 (file)
@@ -5,12 +5,12 @@ INCLUDES = $(XCBAUX_CFLAGS) $(XCBIMAGE_CFLAGS)
 
 bin_PROGRAMS = julia lissajoux flames
 
-julia_LDADD = $(XCBAUX_LIBS) $(XCBIMAGE_LIBS) $(XCBICCCM_LIBS)
+julia_LDADD = $(XCBAUX_LIBS) $(XCBIMAGE_LIBS) $(XCBICCCM_LIBS) $(XCBATOM_LIBS)
 julia_SOURCES = julia.c julia.h
 
 lissajoux_LDADD = $(XCBAUX_LIBS) $(XCBIMAGE_LIBS) -lm
 lissajoux_SOURCES = lissajoux.c lissajoux.h
 
 flames_CFLAGS = -O3
-flames_LDADD = $(XCBAUX_LIBS) $(XCBIMAGE_LIBS) $(XCBICCCM_LIBS)
+flames_LDADD = $(XCBAUX_LIBS) $(XCBIMAGE_LIBS) $(XCBICCCM_LIBS) $(XCBATOM_LIBS)
 flames_SOURCES = flames.c
index f55acea..89e93cf 100644 (file)
@@ -31,6 +31,7 @@
 #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>
@@ -85,22 +86,6 @@ static void flame_modify_flame_base (flame *f);
 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 ()
 {
@@ -230,8 +215,8 @@ main ()
   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 wmprotocolsAtom = get_atom(f->xcb.c, "WM_PROTOCOLS");
+  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
index c995d09..75468ce 100644 (file)
@@ -8,6 +8,7 @@
 #include <xcb/shm.h>
 #include <xcb/xcb_aux.h>
 #include <xcb/xcb_image.h>
+#include <xcb/xcb_atom.h>
 #define XCB_ALL_PLANES ~0
 
 /* Needed for xcb_set_wm_protocols() */
@@ -45,22 +46,6 @@ double height = 2.4;
 /* Numbers of colors in the palette */
 int cmax = 316;
 
-static 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;
-}
-
 void
 palette_julia (Data *datap)
 {
@@ -201,8 +186,8 @@ main (int argc, char *argv[])
 
   palette_julia (&data);
 
-  xcb_atom_t deleteWindowAtom = get_atom(data.conn, "WM_DELETE_WINDOW");
-  xcb_atom_t wmprotocolsAtom = get_atom(data.conn, "WM_PROTOCOLS");
+  xcb_atom_t deleteWindowAtom = xcb_atom_get(data.conn, "WM_DELETE_WINDOW");
+  xcb_atom_t wmprotocolsAtom = xcb_atom_get(data.conn, "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