<p dir="ltr">Nice! Thanks</p>
<br><div class="gmail_quote"><div dir="ltr">On Sat, Mar 18, 2017, 08:21 Christian Linhart <<a href="mailto:chris@demorecorder.com">chris@demorecorder.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The reasoning behind this change is to prepare xcb/demo as<br class="gmail_msg">
a place to be used for test-suites.<br class="gmail_msg">
<br class="gmail_msg">
The changes are loosely based on patches posted by William Swanson<br class="gmail_msg">
on Nov 17, 2012.<br class="gmail_msg">
<br class="gmail_msg">
Signed-off-by: Christian Linhart <<a href="mailto:chris@demorecorder.com" class="gmail_msg" target="_blank">chris@demorecorder.com</a>><br class="gmail_msg">
---<br class="gmail_msg">
Makefile.am | 6 +++---<br class="gmail_msg">
tests/flames.c | 16 +++++++++++-----<br class="gmail_msg">
tests/julia.c | 16 ++++++++++++----<br class="gmail_msg">
3 files changed, 26 insertions(+), 12 deletions(-)<br class="gmail_msg">
<br class="gmail_msg">
diff --git a/Makefile.am b/Makefile.am<br class="gmail_msg">
index 7521af0..0f0f715 100644<br class="gmail_msg">
--- a/Makefile.am<br class="gmail_msg">
+++ b/Makefile.am<br class="gmail_msg">
@@ -18,25 +18,25 @@ hypnomoire_SOURCES = hypnomoire.c reply_formats.c reply_formats.h<br class="gmail_msg">
xcbdpyinfo_SOURCES = xcbdpyinfo.c<br class="gmail_msg">
<br class="gmail_msg">
xcb_test_CFLAGS = $(XCBAUX_CFLAGS)<br class="gmail_msg">
xcb_test_LDADD = $(XCBAUX_LIBS) -lpthread<br class="gmail_msg">
xcb_test_SOURCES = xcb-test.c reply_formats.c reply_formats.h<br class="gmail_msg">
<br class="gmail_msg">
dpms_CFLAGS = $(XCBDPMS_CFLAGS)<br class="gmail_msg">
-dpms_LDADD = $(XCBDPMS_LIBS)<br class="gmail_msg">
+dpms_LDADD = $(XCBDPMS_LIBS) $(XCB_LIBS)<br class="gmail_msg">
dpms_SOURCES = dpms.c<br class="gmail_msg">
<br class="gmail_msg">
rendertest_CFLAGS = $(XCBAUX_CFLAGS) $(XCBRENDER_CFLAGS)<br class="gmail_msg">
rendertest_LDADD = $(XCBAUX_LIBS) $(XCBRENDER_LIBS)<br class="gmail_msg">
rendertest_SOURCES = rendertest.c<br class="gmail_msg">
<br class="gmail_msg">
xcbrandr_CFLAGS = $(XCBAUX_CFLAGS) $(XCBRANDR_CFLAGS)<br class="gmail_msg">
xcbrandr_LDADD = $(XCBAUX_LIBS) $(XCBRANDR_LIBS)<br class="gmail_msg">
xcbrandr_SOURCES = xcbrandr.c<br class="gmail_msg">
<br class="gmail_msg">
xcbxf86dri_CFLAGS = $(XCBXF86DRI_CFLAGS)<br class="gmail_msg">
-xcbxf86dri_LDADD = $(XCBXF86DRI_LIBS)<br class="gmail_msg">
+xcbxf86dri_LDADD = $(XCBXF86DRI_LIBS) $(XCB_LIBS)<br class="gmail_msg">
xcbxf86dri_SOURCES = xcbxf86dri.c<br class="gmail_msg">
<br class="gmail_msg">
xcbxvinfo_CFLAGS = $(XCBXV_CFLAGS)<br class="gmail_msg">
-xcbxvinfo_LDADD = $(XCBXV_LIBS)<br class="gmail_msg">
+xcbxvinfo_LDADD = $(XCBXV_LIBS) $(XCB_LIBS)<br class="gmail_msg">
xcbxvinfo_SOURCES = xcbxvinfo.c<br class="gmail_msg">
diff --git a/tests/flames.c b/tests/flames.c<br class="gmail_msg">
index 89e93cf..391c7ed 100644<br class="gmail_msg">
--- a/tests/flames.c<br class="gmail_msg">
+++ b/tests/flames.c<br class="gmail_msg">
@@ -28,16 +28,17 @@<br class="gmail_msg">
#include <unistd.h><br class="gmail_msg">
<br class="gmail_msg">
#include <xcb/xcb.h><br class="gmail_msg">
#include <xcb/shm.h><br class="gmail_msg">
#include <xcb/xcb_aux.h><br class="gmail_msg">
#include <xcb/xcb_image.h><br class="gmail_msg">
#include <xcb/xcb_atom.h><br class="gmail_msg">
+#include <xcb/xcb_event.h><br class="gmail_msg">
<br class="gmail_msg">
-/* Needed for xcb_set_wm_protocols() */<br class="gmail_msg">
+/* Needed for xcb_icccm_set_wm_protocols() */<br class="gmail_msg">
#include <xcb/xcb_icccm.h><br class="gmail_msg">
<br class="gmail_msg">
#define XCB_ALL_PLANES ~0<br class="gmail_msg">
#include <xcb/xcb_icccm.h><br class="gmail_msg">
<br class="gmail_msg">
/* some defines for the flame */<br class="gmail_msg">
#define HSPREAD 26<br class="gmail_msg">
@@ -72,24 +73,29 @@ typedef struct<br class="gmail_msg">
/* the flame arrays */<br class="gmail_msg">
int ws;<br class="gmail_msg">
unsigned int *flame;<br class="gmail_msg">
unsigned int *flame2;<br class="gmail_msg">
<br class="gmail_msg">
}flame;<br class="gmail_msg">
<br class="gmail_msg">
-static xcb_atom_t get_atom (xcb_connection_t *connection, const char *atomName);<br class="gmail_msg">
static void title_set (flame *f, const char *title);<br class="gmail_msg">
static int ilog2 (unsigned int n);<br class="gmail_msg">
static void flame_set_palette (flame *f);<br class="gmail_msg">
static void flame_set_flame_zero (flame *f);<br class="gmail_msg">
static void flame_set_random_flame_base (flame *f);<br class="gmail_msg">
static void flame_modify_flame_base (flame *f);<br class="gmail_msg">
static void flame_process_flame (flame *f);<br class="gmail_msg">
static void flame_draw_flame (flame *f);<br class="gmail_msg">
<br class="gmail_msg">
+static xcb_atom_t get_atom(xcb_connection_t* c, const char *name)<br class="gmail_msg">
+{<br class="gmail_msg">
+ xcb_intern_atom_cookie_t cookie = xcb_intern_atom(c, 0, strlen(name), name);<br class="gmail_msg">
+ return xcb_intern_atom_reply(c, cookie, NULL)->atom;<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
flame *<br class="gmail_msg">
flame_init ()<br class="gmail_msg">
{<br class="gmail_msg">
flame *f;<br class="gmail_msg">
xcb_screen_t *screen;<br class="gmail_msg">
xcb_gcontext_t gc = { 0 };<br class="gmail_msg">
int screen_nbr;<br class="gmail_msg">
@@ -211,21 +217,21 @@ main ()<br class="gmail_msg">
printf ("Can't initialize global data\nExiting...\n");<br class="gmail_msg">
return -1;<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
flame_set_flame_zero (f);<br class="gmail_msg">
flame_set_random_flame_base (f);<br class="gmail_msg">
<br class="gmail_msg">
- xcb_atom_t deleteWindowAtom = xcb_atom_get(f->xcb.c, "WM_DELETE_WINDOW");<br class="gmail_msg">
- xcb_atom_t wmprotocolsAtom = xcb_atom_get(f->xcb.c, "WM_PROTOCOLS");<br class="gmail_msg">
+ xcb_atom_t deleteWindowAtom = get_atom(f->xcb.c, "WM_DELETE_WINDOW");<br class="gmail_msg">
+ xcb_atom_t wmprotocolsAtom = get_atom(f->xcb.c, "WM_PROTOCOLS");<br class="gmail_msg">
/* Listen to X client messages in order to be able to pickup<br class="gmail_msg">
the "delete window" message that is generated for example<br class="gmail_msg">
when someone clicks the top-right X button within the window<br class="gmail_msg">
manager decoration (or when user hits ALT-F4). */<br class="gmail_msg">
- xcb_set_wm_protocols (f->xcb.c, wmprotocolsAtom, f->xcb.draw, 1, &deleteWindowAtom);<br class="gmail_msg">
+ xcb_icccm_set_wm_protocols (f->xcb.c, f->xcb.draw, wmprotocolsAtom, 1, &deleteWindowAtom);<br class="gmail_msg">
<br class="gmail_msg">
bool finished = false;<br class="gmail_msg">
while (!finished)<br class="gmail_msg">
{<br class="gmail_msg">
if ((e = xcb_poll_for_event (f->xcb.c)))<br class="gmail_msg">
{<br class="gmail_msg">
switch (XCB_EVENT_RESPONSE_TYPE(e))<br class="gmail_msg">
diff --git a/tests/julia.c b/tests/julia.c<br class="gmail_msg">
index 75468ce..eefd829 100644<br class="gmail_msg">
--- a/tests/julia.c<br class="gmail_msg">
+++ b/tests/julia.c<br class="gmail_msg">
@@ -5,17 +5,19 @@<br class="gmail_msg">
#include <assert.h><br class="gmail_msg">
<br class="gmail_msg">
#include <xcb/xcb.h><br class="gmail_msg">
#include <xcb/shm.h><br class="gmail_msg">
#include <xcb/xcb_aux.h><br class="gmail_msg">
#include <xcb/xcb_image.h><br class="gmail_msg">
#include <xcb/xcb_atom.h><br class="gmail_msg">
+#include <xcb/xcb_event.h><br class="gmail_msg">
+<br class="gmail_msg">
#define XCB_ALL_PLANES ~0<br class="gmail_msg">
<br class="gmail_msg">
-/* Needed for xcb_set_wm_protocols() */<br class="gmail_msg">
+/* Needed for xcb_icccm_set_wm_protocols() */<br class="gmail_msg">
#include <xcb/xcb_icccm.h><br class="gmail_msg">
<br class="gmail_msg">
#include "julia.h"<br class="gmail_msg">
<br class="gmail_msg">
#define W_W 640<br class="gmail_msg">
#define W_H 480<br class="gmail_msg">
<br class="gmail_msg">
@@ -116,14 +118,20 @@ draw_julia (Data *datap)<br class="gmail_msg">
datap->palette[c]);<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
xcb_image_put (datap->conn, datap->draw, datap->gc, datap->image,<br class="gmail_msg">
0, 0, 0);<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
+static xcb_atom_t get_atom(xcb_connection_t* c, const char *name)<br class="gmail_msg">
+{<br class="gmail_msg">
+ xcb_intern_atom_cookie_t cookie = xcb_intern_atom(c, 0, strlen(name), name);<br class="gmail_msg">
+ return xcb_intern_atom_reply(c, cookie, NULL)->atom;<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
int<br class="gmail_msg">
main (int argc, char *argv[])<br class="gmail_msg">
{<br class="gmail_msg">
Data data;<br class="gmail_msg">
xcb_screen_t *screen;<br class="gmail_msg">
xcb_drawable_t win;<br class="gmail_msg">
xcb_drawable_t rect;<br class="gmail_msg">
@@ -182,21 +190,21 @@ main (int argc, char *argv[])<br class="gmail_msg">
XCB_COLORMAP_ALLOC_NONE,<br class="gmail_msg">
data.cmap,<br class="gmail_msg">
data.draw,<br class="gmail_msg">
screen->root_visual);<br class="gmail_msg">
<br class="gmail_msg">
palette_julia (&data);<br class="gmail_msg">
<br class="gmail_msg">
- xcb_atom_t deleteWindowAtom = xcb_atom_get(data.conn, "WM_DELETE_WINDOW");<br class="gmail_msg">
- xcb_atom_t wmprotocolsAtom = xcb_atom_get(data.conn, "WM_PROTOCOLS");<br class="gmail_msg">
+ xcb_atom_t deleteWindowAtom = get_atom(data.conn, "WM_DELETE_WINDOW");<br class="gmail_msg">
+ xcb_atom_t wmprotocolsAtom = get_atom(data.conn, "WM_PROTOCOLS");<br class="gmail_msg">
/* Listen to X client messages in order to be able to pickup<br class="gmail_msg">
the "delete window" message that is generated for example<br class="gmail_msg">
when someone clicks the top-right X button within the window<br class="gmail_msg">
manager decoration (or when user hits ALT-F4). */<br class="gmail_msg">
- xcb_set_wm_protocols (data.conn, wmprotocolsAtom, data.draw, 1, &deleteWindowAtom);<br class="gmail_msg">
+ xcb_icccm_set_wm_protocols (data.conn, data.draw, wmprotocolsAtom, 1, &deleteWindowAtom);<br class="gmail_msg">
<br class="gmail_msg">
xcb_flush (data.conn);<br class="gmail_msg">
<br class="gmail_msg">
bool finished = false;<br class="gmail_msg">
while (!finished)<br class="gmail_msg">
{<br class="gmail_msg">
xcb_generic_event_t *e;<br class="gmail_msg">
--<br class="gmail_msg">
2.1.4<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
Xcb mailing list<br class="gmail_msg">
<a href="mailto:Xcb@lists.freedesktop.org" class="gmail_msg" target="_blank">Xcb@lists.freedesktop.org</a><br class="gmail_msg">
<a href="https://lists.freedesktop.org/mailman/listinfo/xcb" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.freedesktop.org/mailman/listinfo/xcb</a></blockquote></div>