[Xcb-commit] xcb/demo: Makefile.am tests
Christian Linhart
clinhart at kemper.freedesktop.org
Sat May 13 09:16:02 UTC 2017
Makefile.am | 6 +++---
tests/flames.c | 16 +++++++++++-----
tests/julia.c | 16 ++++++++++++----
3 files changed, 26 insertions(+), 12 deletions(-)
New commits:
commit 7b8eb1b3a5d38e897cf2cd0f29ba4b90fd76e996
Author: Christian Linhart <chris at demorecorder.com>
Date: Sat Mar 18 09:52:52 2017 +0100
make xcb/demo compile again.
The reasoning behind this change is to prepare xcb/demo as
a place to be used for test-suites.
The changes are loosely based on patches posted by William Swanson
on Nov 17, 2012.
Signed-off-by: Christian Linhart <chris at demorecorder.com>
diff --git a/Makefile.am b/Makefile.am
index 7521af0..0f0f715 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,7 +22,7 @@ xcb_test_LDADD = $(XCBAUX_LIBS) -lpthread
xcb_test_SOURCES = xcb-test.c reply_formats.c reply_formats.h
dpms_CFLAGS = $(XCBDPMS_CFLAGS)
-dpms_LDADD = $(XCBDPMS_LIBS)
+dpms_LDADD = $(XCBDPMS_LIBS) $(XCB_LIBS)
dpms_SOURCES = dpms.c
rendertest_CFLAGS = $(XCBAUX_CFLAGS) $(XCBRENDER_CFLAGS)
@@ -34,9 +34,9 @@ xcbrandr_LDADD = $(XCBAUX_LIBS) $(XCBRANDR_LIBS)
xcbrandr_SOURCES = xcbrandr.c
xcbxf86dri_CFLAGS = $(XCBXF86DRI_CFLAGS)
-xcbxf86dri_LDADD = $(XCBXF86DRI_LIBS)
+xcbxf86dri_LDADD = $(XCBXF86DRI_LIBS) $(XCB_LIBS)
xcbxf86dri_SOURCES = xcbxf86dri.c
xcbxvinfo_CFLAGS = $(XCBXV_CFLAGS)
-xcbxvinfo_LDADD = $(XCBXV_LIBS)
+xcbxvinfo_LDADD = $(XCBXV_LIBS) $(XCB_LIBS)
xcbxvinfo_SOURCES = xcbxvinfo.c
diff --git a/tests/flames.c b/tests/flames.c
index 89e93cf..391c7ed 100644
--- a/tests/flames.c
+++ b/tests/flames.c
@@ -32,8 +32,9 @@
#include <xcb/xcb_aux.h>
#include <xcb/xcb_image.h>
#include <xcb/xcb_atom.h>
+#include <xcb/xcb_event.h>
-/* Needed for xcb_set_wm_protocols() */
+/* Needed for xcb_icccm_set_wm_protocols() */
#include <xcb/xcb_icccm.h>
#define XCB_ALL_PLANES ~0
@@ -76,7 +77,6 @@ typedef struct
}flame;
-static xcb_atom_t get_atom (xcb_connection_t *connection, const char *atomName);
static void title_set (flame *f, const char *title);
static int ilog2 (unsigned int n);
static void flame_set_palette (flame *f);
@@ -86,6 +86,12 @@ static void flame_modify_flame_base (flame *f);
static void flame_process_flame (flame *f);
static void flame_draw_flame (flame *f);
+static xcb_atom_t get_atom(xcb_connection_t* c, const char *name)
+{
+ xcb_intern_atom_cookie_t cookie = xcb_intern_atom(c, 0, strlen(name), name);
+ return xcb_intern_atom_reply(c, cookie, NULL)->atom;
+}
+
flame *
flame_init ()
{
@@ -215,13 +221,13 @@ main ()
flame_set_flame_zero (f);
flame_set_random_flame_base (f);
- 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");
+ xcb_atom_t deleteWindowAtom = get_atom(f->xcb.c, "WM_DELETE_WINDOW");
+ xcb_atom_t wmprotocolsAtom = get_atom(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, wmprotocolsAtom, f->xcb.draw, 1, &deleteWindowAtom);
+ xcb_icccm_set_wm_protocols (f->xcb.c, f->xcb.draw, wmprotocolsAtom, 1, &deleteWindowAtom);
bool finished = false;
while (!finished)
diff --git a/tests/julia.c b/tests/julia.c
index 75468ce..eefd829 100644
--- a/tests/julia.c
+++ b/tests/julia.c
@@ -9,9 +9,11 @@
#include <xcb/xcb_aux.h>
#include <xcb/xcb_image.h>
#include <xcb/xcb_atom.h>
+#include <xcb/xcb_event.h>
+
#define XCB_ALL_PLANES ~0
-/* Needed for xcb_set_wm_protocols() */
+/* Needed for xcb_icccm_set_wm_protocols() */
#include <xcb/xcb_icccm.h>
#include "julia.h"
@@ -120,6 +122,12 @@ draw_julia (Data *datap)
0, 0, 0);
}
+static xcb_atom_t get_atom(xcb_connection_t* c, const char *name)
+{
+ xcb_intern_atom_cookie_t cookie = xcb_intern_atom(c, 0, strlen(name), name);
+ return xcb_intern_atom_reply(c, cookie, NULL)->atom;
+}
+
int
main (int argc, char *argv[])
{
@@ -186,13 +194,13 @@ main (int argc, char *argv[])
palette_julia (&data);
- xcb_atom_t deleteWindowAtom = xcb_atom_get(data.conn, "WM_DELETE_WINDOW");
- xcb_atom_t wmprotocolsAtom = xcb_atom_get(data.conn, "WM_PROTOCOLS");
+ xcb_atom_t deleteWindowAtom = get_atom(data.conn, "WM_DELETE_WINDOW");
+ xcb_atom_t wmprotocolsAtom = get_atom(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
manager decoration (or when user hits ALT-F4). */
- xcb_set_wm_protocols (data.conn, wmprotocolsAtom, data.draw, 1, &deleteWindowAtom);
+ xcb_icccm_set_wm_protocols (data.conn, data.draw, wmprotocolsAtom, 1, &deleteWindowAtom);
xcb_flush (data.conn);
More information about the xcb-commit
mailing list