diff --git a/libc3/window/cairo/configure b/libc3/window/cairo/configure
index 3cfda71..fd403cc 100755
--- a/libc3/window/cairo/configure
+++ b/libc3/window/cairo/configure
@@ -43,8 +43,8 @@ LIBS="$LIBS -rpath ${PREFIX}/lib"
config_asan
config_gnu
pkg_config cairo
-config_lib_have COCOA -framework Cocoa
pkg_config xkbcommon
+config_lib_have COCOA -framework Cocoa
config_define PREFIX "\"${PREFIX}\""
# Address Sanitizer config
diff --git a/libc3/window/cairo/win32/Makefile b/libc3/window/cairo/win32/Makefile
new file mode 100644
index 0000000..f7adfa9
--- /dev/null
+++ b/libc3/window/cairo/win32/Makefile
@@ -0,0 +1,79 @@
+## c3
+## Copyright 2022,2023 kmx.io <contact@kmx.io>
+##
+## Permission is hereby granted to use this software granted the above
+## copyright notice and this permission paragraph are included in all
+## copies and substantial portions of this software.
+##
+## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+## THIS SOFTWARE.
+
+CLEANFILES = *.a *.gcno *.la .libs *.lo *.o
+
+CLEANFILES_COV = *.css *.gcda *.html .libs/*.gcda
+
+CLEANFILES += ${CLEANFILES_COV}
+
+DISTCLEANFILES = ${CLEANFILES} config.h config.mk
+
+build: libc3_window_cairo_xcb.la
+ ${MAKE} -C demo build
+
+all:
+ ${MAKE} build
+ if ${HAVE_GCOV}; then ${MAKE} cov; fi
+ ${MAKE} debug
+ if ${HAVE_ASAN}; then ${MAKE} asan; fi
+
+asan: libc3_window_cairo_xcb_asan.la
+ ${MAKE} -C demo asan
+
+clean:
+ rm -rf ${CLEANFILES}
+ ${MAKE} -C demo clean
+
+clean_cov:
+ rm -rf ${CLEANFILES_COV}
+ ${MAKE} -C demo clean_cov
+
+cov: libc3_window_cairo_xcb_cov.la
+ ${MAKE} -C demo cov
+
+debug: libc3_window_cairo_xcb_debug.la
+ ${MAKE} -C demo debug
+
+demo: build
+ ${MAKE} -C demo demo
+
+distclean:
+ rm -rf ${DISTCLEANFILES}
+ ${MAKE} -C demo distclean
+
+gdb_demo: debug
+ ${MAKE} -C demo gdb_demo
+
+test: build
+ ${MAKE} -C demo test
+
+update_sources:
+ ./update_sources
+
+.PHONY: \
+ all \
+ asan \
+ build \
+ clean \
+ cov \
+ debug \
+ demo \
+ distclean \
+ gdb_demo \
+ gen \
+ install \
+ test \
+ update_sources
+
+include config.mk
+include sources.mk
diff --git a/libc3/window/cairo/win32/configure b/libc3/window/cairo/win32/configure
new file mode 100644
index 0000000..0eca667
--- /dev/null
+++ b/libc3/window/cairo/win32/configure
@@ -0,0 +1,146 @@
+#!/bin/sh
+## c3
+## Copyright 2022,2023 kmx.io <contact@kmx.io>
+##
+## Permission is hereby granted to use this software granted the above
+## copyright notice and this permission paragraph are included in all
+## copies and substantial portions of this software.
+##
+## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+## THIS SOFTWARE.
+
+set -e
+
+export SRC_TOP="$(dirname "$PWD")"
+
+. ../../../../config.subr
+
+LIB=libc3_window_cairo_xcb.la
+LIB_ASAN=libc3_window_cairo_xcb_asan.la
+LIB_COV=libc3_window_cairo_xcb_cov.la
+LIB_DEBUG=libc3_window_cairo_xcb_debug.la
+
+echo "LIB = $LIB" >> ${CONFIG_MK}
+echo "LIB_ASAN = $LIB_ASAN" >> ${CONFIG_MK}
+echo "LIB_COV = $LIB_COV" >> ${CONFIG_MK}
+echo "LIB_DEBUG = $LIB_DEBUG" >> ${CONFIG_MK}
+
+#LIBC3=../../../libc3.la
+#LIBC3_ASAN=../../../libc3_asan.la
+#LIBC3_COV=../../../libc3_cov.la
+#LIBC3_DEBUG=../../../libc3_debug.la
+
+. ./sources.sh
+
+OBJECTS="$(c2ext .main.lo "$SOURCES")"
+echo "OBJECTS = $OBJECTS" >> ${CONFIG_MK}
+OBJECTS_ASAN="$(c2ext .asan.lo "$SOURCES")"
+OBJECTS_COV="$(c2ext .cov.lo "$SOURCES")"
+OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
+
+# Common config for all targets
+CPPFLAGS="$CPPFLAGS -I../../../../libffi/include -I../../../.."
+CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic -fPIC"
+LDFLAGS="--shared -no-undefined ${LDFLAGS}"
+LIBS="$LIBS -rpath ${PREFIX}/lib"
+config_asan
+config_gnu
+pkg_config xcb
+pkg_config xkbcommon
+pkg_config cairo
+config_define PREFIX "\"${PREFIX}\""
+update_config_h
+LIBS="$LIBS -lxkbcommon -lxkbcommon-x11"
+
+# Address Sanitizer config
+CFLAGS_ASAN="$CFLAGS -O1 -fsanitize=address -fno-omit-frame-pointer -g"
+LDFLAGS_ASAN="$LDFLAGS"
+LIBS_LOCAL_ASAN="../libc3_window_cairo_.la"
+LIBS_ASAN="$LIBS_LOCAL_ASAN $LIBS"
+
+# Coverage config
+CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs -fprofile-generate"
+LDFLAGS_COV="$LDFLAGS --coverage"
+LIBS_LOCAL_COV="../libc3_window_cairo_cov.la"
+LIBS_COV="$LIBS_LOCAL_COV $LIBS"
+
+# Debug config
+CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -g"
+LDFLAGS_DEBUG="$LDFLAGS"
+LIBS_LOCAL_DEBUG="../libc3_window_cairo_debug.la"
+LIBS_DEBUG="$LIBS_LOCAL_DEBUG $LIBS"
+
+# Main config
+DEFAULT_CFLAGS="-O2 -pipe"
+if [ "x$ENV_CFLAGS" = "x" ]; then
+ CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
+fi
+CFLAGS="$CFLAGS -DNDEBUG"
+LIBS_LOCAL="../libc3_window_cairo.la"
+LIBS="$LIBS_LOCAL $LIBS"
+
+echo "LIB = $LIB" >> ${CONFIG_MK}
+echo "HAVE_ASAN = $HAVE_ASAN" >> ${CONFIG_MK}
+echo "CPPFLAGS = $CPPFLAGS" >> ${CONFIG_MK}
+echo "CFLAGS = $CFLAGS" >> ${CONFIG_MK}
+echo "LDFLAGS = $LDFLAGS" >> ${CONFIG_MK}
+echo "LIBS = $LIBS" >> ${CONFIG_MK}
+echo >> ${CONFIG_MK}
+echo "LIB_ASAN = $LIB_ASAN" >> ${CONFIG_MK}
+echo "CFLAGS_ASAN = $CFLAGS_ASAN" >> ${CONFIG_MK}
+echo "LDFLAGS_ASAN = $LDFLAGS_ASAN" >> ${CONFIG_MK}
+echo "LIBS_ASAN = $LIBS_ASAN" >> ${CONFIG_MK}
+echo >> ${CONFIG_MK}
+echo "LIB_COV = $LIB_COV" >> ${CONFIG_MK}
+echo "CFLAGS_COV = $CFLAGS_COV" >> ${CONFIG_MK}
+echo "LDFLAGS_COV = $LDFLAGS_COV" >> ${CONFIG_MK}
+echo "LIBS_COV = $LIBS_COV" >> ${CONFIG_MK}
+echo >> ${CONFIG_MK}
+echo "LIB_DEBUG = $LIB_DEBUG" >> ${CONFIG_MK}
+echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
+echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
+echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
+
+echo >> ${CONFIG_MK}
+echo "$LIB: $LIBS_LOCAL $OBJECTS" >> ${CONFIG_MK}
+echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS} ${OBJECTS} \${LIBS} -rpath ${LIBDIR} -o ${LIB}" >> ${CONFIG_MK}
+
+echo >> ${CONFIG_MK}
+echo "$LIB_ASAN: $LIBS_LOCAL_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
+echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_ASAN} ${OBJECTS_ASAN} \${LIBS_ASAN} -rpath ${LIBDIR} -o ${LIB_ASAN}" >> ${CONFIG_MK}
+
+echo >> ${CONFIG_MK}
+echo "$LIB_COV: $LIBS_LOCAL_COV $OBJECTS_COV" >> ${CONFIG_MK}
+echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_COV} ${OBJECTS_COV} \${LIBS_COV} -rpath ${LIBDIR} -o ${LIB_COV}" >> ${CONFIG_MK}
+
+echo >> ${CONFIG_MK}
+echo "$LIB_DEBUG: $LIBS_LOCAL_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
+echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} \${LIBS_DEBUG} -rpath ${LIBDIR} -o ${LIB_DEBUG}" >> ${CONFIG_MK}
+
+for SRC in $SOURCES; do
+ echo >> ${CONFIG_MK}
+ SRC_LO="$(c2ext .main.lo "$SRC")"
+ c_ext_rule .main.lo "$SRC" >> ${CONFIG_MK}
+ echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
+
+ echo >> ${CONFIG_MK}
+ SRC_ASAN_LO="$(c2ext .asan.lo "$SRC")"
+ c_ext_rule .asan.lo "$SRC" >> ${CONFIG_MK}
+ echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_ASAN} -c $SRC -o $SRC_ASAN_LO" >> ${CONFIG_MK}
+
+ echo >> ${CONFIG_MK}
+ SRC_COV_LO="$(c2ext .cov.lo "$SRC")"
+ c_ext_rule .cov.lo "$SRC" >> ${CONFIG_MK}
+ echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_COV} -c $SRC -o $SRC_COV_LO" >> ${CONFIG_MK}
+
+ echo >> ${CONFIG_MK}
+ SRC_DEBUG_LO="$(c2ext .debug.lo "$SRC")"
+ c_ext_rule .debug.lo "$SRC" >> ${CONFIG_MK}
+ echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_DEBUG_LO" >> ${CONFIG_MK}
+done
+
+update_config_mk
+env_reset
+( cd demo && ./configure; )
diff --git a/libc3/window/cairo/win32/demo/Makefile b/libc3/window/cairo/win32/demo/Makefile
new file mode 100644
index 0000000..34cde24
--- /dev/null
+++ b/libc3/window/cairo/win32/demo/Makefile
@@ -0,0 +1,68 @@
+## c3
+## Copyright 2022,2023 kmx.io <contact@kmx.io>
+##
+## Permission is hereby granted to use this software granted the above
+## copyright notice and this permission paragraph are included in all
+## copies and substantial portions of this software.
+##
+## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+## THIS SOFTWARE.
+include config.mk
+include sources.mk
+
+CLEANFILES = *.a ${PROG} ${PROG_ASAN} ${PROG_COV} ${PROG_DEBUG} *.css \
+ *.gcno *.html *.o .libs *.lo
+
+CLEANFILES_COV = *.css *.gcda *.html .libs/*.gcda
+CLEANFILES += ${CLEANFILES_COV}
+
+DISTCLEANFILES = ${CLEANFILES} config.mk
+
+build: ${PROG}
+
+all:
+ ${MAKE} build
+ if ${HAVE_GCOV}; then ${MAKE} cov; fi
+ ${MAKE} debug
+ if ${HAVE_ASAN}; then ${MAKE} asan; fi
+
+asan: ${PROG_ASAN}
+
+clean:
+ rm -rf ${CLEANFILES}
+
+clean_cov:
+ rm -rf ${CLEANFILES_COV}
+
+cov: ${PROG_COV}
+
+debug: ${PROG_DEBUG}
+
+demo: ${PROG}
+ time ./${PROG}
+
+distclean:
+ rm -rf ${DISTCLEANFILES}
+
+gcovr:
+ gcovr --gcov-executable ${GCOV} --html-details ${PROG}.html
+
+gdb_demo: debug
+ if [ -f ${PROG_DEBUG}.core ]; then gdb .libs/${PROG_DEBUG} ${PROG_DEBUG}.core; else gdb .libs/${PROG_DEBUG}; fi
+
+install:
+ install -m 755 -d ${prefix}/bin
+ install -m 755 ${PROG} ${prefix}/bin/${PROG}
+
+.PHONY: \
+ all \
+ asan \
+ clean \
+ clean_cov \
+ cov \
+ debug \
+ demo \
+ distclean \
+ gdb_demo
diff --git a/libc3/window/cairo/win32/demo/c3_window_cairo_xcb_demo.c b/libc3/window/cairo/win32/demo/c3_window_cairo_xcb_demo.c
new file mode 100644
index 0000000..74bf506
--- /dev/null
+++ b/libc3/window/cairo/win32/demo/c3_window_cairo_xcb_demo.c
@@ -0,0 +1,35 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <cairo/cairo.h>
+#include <libc3/c3.h>
+#include "../../../window.h"
+#include "../../c3_window_cairo_demo.h"
+#include "../window_cairo_xcb.h"
+
+int main (void)
+{
+ s_window_cairo window;
+ window_cairo_init(&window, 0, 0, 800, 600,
+ "C3.Window.Cairo.XCB demo",
+ LIBC3_WINDOW_CAIRO_DEMO_SEQUENCE_COUNT);
+ window.button = c3_window_cairo_demo_button;
+ window.key = c3_window_cairo_demo_key;
+ window.load = c3_window_cairo_demo_load;
+ window.render = c3_window_cairo_demo_render;
+ window.resize = c3_window_cairo_demo_resize;
+ if (! window_cairo_xcb_run(&window))
+ return g_c3_exit_code;
+ return 0;
+}
diff --git a/libc3/window/cairo/win32/demo/configure b/libc3/window/cairo/win32/demo/configure
new file mode 100644
index 0000000..f2bb344
--- /dev/null
+++ b/libc3/window/cairo/win32/demo/configure
@@ -0,0 +1,142 @@
+#!/bin/sh
+## c3
+## Copyright 2022,2023 kmx.io <contact@kmx.io>
+##
+## Permission is hereby granted to use this software granted the above
+## copyright notice and this permission paragraph are included in all
+## copies and substantial portions of this software.
+##
+## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+## THIS SOFTWARE.
+
+set -e
+
+export SRC_TOP="$(dirname "$PWD")"
+
+. ../../../../../config.subr
+
+PROG=c3_window_cairo_xcb_demo
+PROG_ASAN=c3_window_cairo_xcb_demo_asan
+PROG_COV=c3_window_cairo_xcb_demo_cov
+PROG_DEBUG=c3_window_cairo_xcb_demo_debug
+
+echo "PROG = $PROG" >> ${CONFIG_MK}
+echo "PROG_ASAN = $PROG_ASAN" >> ${CONFIG_MK}
+echo "PROG_COV = $PROG_COV" >> ${CONFIG_MK}
+echo "PROG_DEBUG = $PROG_DEBUG" >> ${CONFIG_MK}
+
+. ./sources.sh
+
+OBJECTS="$(c2ext .main.lo "$SOURCES")"
+echo "OBJECTS = $OBJECTS" >> ${CONFIG_MK}
+
+OBJECTS_ASAN="$(c2ext .asan.lo "$SOURCES")"
+echo "OBJECTS_ASAN = $OBJECTS_ASAN" >> ${CONFIG_MK}
+
+if $HAVE_GCOV; then
+ OBJECTS_COV="$(c2ext .cov.lo "$SOURCES")"
+ echo "OBJECTS_COV = $OBJECTS_COV" >> ${CONFIG_MK}
+fi
+
+OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
+echo "OBJECTS_DEBUG = $OBJECTS_DEBUG" >> ${CONFIG_MK}
+
+# Common config for all targets
+CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic"
+CPPFLAGS="$CPPFLAGS -I../../../../../libffi/include -I../../../../.."
+config_asan
+config_gnu
+pkg_config xcb
+pkg_config cairo
+LIBS="$LIBS"
+
+# Asan config
+CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
+LDFLAGS_ASAN="$LDFLAGS"
+LOCAL_LIBS_ASAN="../libc3_window_cairo_xcb_asan.la"
+LIBS_ASAN="$LOCAL_LIBS_ASAN $LIBS"
+
+# Coverage config
+CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs -fprofile-generate"
+LDFLAGS_COV="$LDFLAGS --coverage"
+LOCAL_LIBS_COV="../libc3_window_cairo_xcb_cov.la"
+LIBS_COV="$LOCAL_LIBS_COV $LIBS"
+
+# Debug config
+CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -g"
+LDFLAGS_DEBUG="$LDFLAGS"
+LOCAL_LIBS_DEBUG="../libc3_window_cairo_xcb_debug.la"
+LIBS_DEBUG="$LOCAL_LIBS_DEBUG $LIBS"
+
+# Main config
+DEFAULT_CFLAGS="-O2 -pipe -fPIC"
+if [ "x$ENV_CFLAGS" = "x" ]; then
+ CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
+fi
+CFLAGS="$CFLAGS -DNDEBUG"
+LOCAL_LIBS="../libc3_window_cairo_xcb.la"
+LIBS="$LOCAL_LIBS $LIBS"
+
+echo "HAVE_ASAN = $HAVE_ASAN" >> ${CONFIG_MK}
+echo "CPPFLAGS = $CPPFLAGS" >> ${CONFIG_MK}
+echo "CFLAGS = $CFLAGS" >> ${CONFIG_MK}
+echo "LDFLAGS = $LDFLAGS" >> ${CONFIG_MK}
+echo "LIBS = $LIBS" >> ${CONFIG_MK}
+echo >> ${CONFIG_MK}
+echo "CFLAGS_ASAN = $CFLAGS_ASAN" >> ${CONFIG_MK}
+echo "LDFLAGS_ASAN = $LDFLAGS_ASAN" >> ${CONFIG_MK}
+echo "LIBS_ASAN = $LIBS_ASAN" >> ${CONFIG_MK}
+echo >> ${CONFIG_MK}
+echo "CFLAGS_COV = $CFLAGS_COV" >> ${CONFIG_MK}
+echo "LDFLAGS_COV = $LDFLAGS_COV" >> ${CONFIG_MK}
+echo "LIBS_COV = $LIBS_COV" >> ${CONFIG_MK}
+echo >> ${CONFIG_MK}
+echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
+echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
+echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
+
+echo >> ${CONFIG_MK}
+echo "$PROG: $LOCAL_LIBS $OBJECTS" >> ${CONFIG_MK}
+echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS} \${LDFLAGS} ${OBJECTS} ${LIBS} -o $PROG" >> ${CONFIG_MK}
+
+echo >> ${CONFIG_MK}
+echo "$PROG_ASAN: $LOCAL_LIBS_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
+echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_ASAN} \${LDFLAGS_ASAN} ${OBJECTS_ASAN} ${LIBS_ASAN} -o $PROG_ASAN" >> ${CONFIG_MK}
+
+if $HAVE_GCOV; then
+ echo >> ${CONFIG_MK}
+ echo "$PROG_COV: $LOCAL_LIBS_COV $OBJECTS_COV" >> ${CONFIG_MK}
+ echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_COV} \${LDFLAGS_COV} ${OBJECTS_COV} ${LIBS_COV} -o $PROG_COV" >> ${CONFIG_MK}
+fi
+
+echo >> ${CONFIG_MK}
+echo "$PROG_DEBUG: $LOCAL_LIBS_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
+echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_DEBUG} \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} ${LIBS_DEBUG} -o $PROG_DEBUG" >> ${CONFIG_MK}
+
+for SRC in $SOURCES; do
+ echo >> ${CONFIG_MK}
+ SRC_LO="$(c2ext .main.lo "$SRC")"
+ c_ext_rule .main.lo "$SRC" >> ${CONFIG_MK}
+ echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
+
+ echo >> ${CONFIG_MK}
+ SRC_ASAN_LO="$(c2ext .asan.lo "$SRC")"
+ c_ext_rule .asan.lo "$SRC" >> ${CONFIG_MK}
+ echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_ASAN} -c $SRC -o $SRC_ASAN_LO" >> ${CONFIG_MK}
+
+ if $HAVE_GCOV; then
+ echo >> ${CONFIG_MK}
+ SRC_COV_LO="$(c2ext .cov.lo "$SRC")"
+ c_ext_rule .cov.lo "$SRC" >> ${CONFIG_MK}
+ echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_COV} -c $SRC -o $SRC_COV_LO" >> ${CONFIG_MK}
+ fi
+
+ echo >> ${CONFIG_MK}
+ SRC_DEBUG_LO="$(c2ext .debug.lo "$SRC")"
+ c_ext_rule .debug.lo "$SRC" >> ${CONFIG_MK}
+ echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_DEBUG_LO" >> ${CONFIG_MK}
+done
+
+update_config_mk
diff --git a/libc3/window/cairo/win32/demo/sources.mk b/libc3/window/cairo/win32/demo/sources.mk
new file mode 100644
index 0000000..2e241af
--- /dev/null
+++ b/libc3/window/cairo/win32/demo/sources.mk
@@ -0,0 +1,8 @@
+# sources.mk generated by update_sources
+HEADERS = \
+ \\
+
+SOURCES = \
+ c3_window_cairo_xcb_demo.c \\
+ window.c \\
+
diff --git a/libc3/window/cairo/win32/demo/sources.sh b/libc3/window/cairo/win32/demo/sources.sh
new file mode 100644
index 0000000..f734d9a
--- /dev/null
+++ b/libc3/window/cairo/win32/demo/sources.sh
@@ -0,0 +1,3 @@
+# sources.sh generated by update_sources
+HEADERS=' '
+SOURCES='c3_window_cairo_xcb_demo.c window.c '
diff --git a/libc3/window/cairo/win32/demo/update_sources b/libc3/window/cairo/win32/demo/update_sources
new file mode 100644
index 0000000..f854810
--- /dev/null
+++ b/libc3/window/cairo/win32/demo/update_sources
@@ -0,0 +1,27 @@
+#!/bin/sh
+## c3
+## Copyright 2022,2023 kmx.io <contact@kmx.io>
+##
+## Permission is hereby granted to use this software granted the above
+## copyright notice and this permission paragraph are included in all
+## copies and substantial portions of this software.
+##
+## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+## THIS SOFTWARE.
+
+. ../../../../../config.subr
+
+echo "# sources.mk generated by update_sources" > ${SOURCES_MK}
+echo "# sources.sh generated by update_sources" > ${SOURCES_SH}
+
+HEADERS=
+#HEADERS="$(ls *.h | sort)"
+sources HEADERS "$HEADERS"
+
+SOURCES="$(ls *.c | sort)"
+sources SOURCES "$SOURCES"
+
+update_sources_mk
+update_sources_sh
diff --git a/libc3/window/cairo/win32/demo/window.c b/libc3/window/cairo/win32/demo/window.c
new file mode 100644
index 0000000..2a00f81
--- /dev/null
+++ b/libc3/window/cairo/win32/demo/window.c
@@ -0,0 +1,13 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#include "../../../window.c"
diff --git a/libc3/window/cairo/win32/sources.mk b/libc3/window/cairo/win32/sources.mk
new file mode 100644
index 0000000..d5f7bce
--- /dev/null
+++ b/libc3/window/cairo/win32/sources.mk
@@ -0,0 +1,8 @@
+# sources.mk generated by update_sources
+HEADERS = \
+ config.h \
+ window_cairo_win32.h \
+
+SOURCES = \
+ window_cairo_win32.c \
+
diff --git a/libc3/window/cairo/win32/sources.sh b/libc3/window/cairo/win32/sources.sh
new file mode 100644
index 0000000..a5101b6
--- /dev/null
+++ b/libc3/window/cairo/win32/sources.sh
@@ -0,0 +1,3 @@
+# sources.sh generated by update_sources
+HEADERS='config.h window_cairo_win32.h '
+SOURCES='window_cairo_win32.c '
diff --git a/libc3/window/cairo/win32/update_sources b/libc3/window/cairo/win32/update_sources
new file mode 100644
index 0000000..1a5b896
--- /dev/null
+++ b/libc3/window/cairo/win32/update_sources
@@ -0,0 +1,28 @@
+#!/bin/sh
+## c3
+## Copyright 2022,2023 kmx.io <contact@kmx.io>
+##
+## Permission is hereby granted to use this software granted the above
+## copyright notice and this permission paragraph are included in all
+## copies and substantial portions of this software.
+##
+## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+## THIS SOFTWARE.
+
+. ../../../../config.subr
+
+echo "# sources.mk generated by update_sources" > ${SOURCES_MK}
+echo "# sources.sh generated by update_sources" > ${SOURCES_SH}
+
+HEADERS="$(ls *.h | sort)"
+sources HEADERS "$HEADERS"
+
+SOURCES="$(ls *.c | sort)"
+sources SOURCES "$SOURCES"
+
+update_sources_mk
+update_sources_sh
+
+( cd demo && ./update_sources; )
diff --git a/libc3/window/cairo/win32/window_cairo_win32.c b/libc3/window/cairo/win32/window_cairo_win32.c
new file mode 100644
index 0000000..1ae049a
--- /dev/null
+++ b/libc3/window/cairo/win32/window_cairo_win32.c
@@ -0,0 +1,65 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <cairo/cairo.h>
+#include <libc3/c3.h>
+#include <windows.h>
+#include <xkbcommon/xkbcommon.h>
+#include "window_cairo_win32.h"
+
+bool window_cairo_run (s_window_cairo *window)
+{
+ return window_cairo_win32_run(window);
+}
+
+bool window_cairo_win32_run (s_window_cairo *window)
+{
+ return true;
+}
+
+LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
+ switch (message) {
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ break;
+ default:
+ return DefWindowProc(hwnd, message, wParam, lParam);
+ }
+ return 0;
+}
+
+int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR args, int ncmdshow) {
+ WNDCLASSW wc = {0};
+
+ wc.hbrBackground = (HBRUSH)COLOR_BACKGROUND;
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hInstance = hInst;
+ wc.lpszClassName = L"MyWindowClass";
+ wc.lpfnWndProc = WindowProcedure;
+
+ if (!RegisterClassW(&wc)) {
+ return -1;
+ }
+
+ CreateWindowW(L"MyWindowClass", L"My Window", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 100, 100, 500, 500, NULL, NULL, NULL, NULL);
+
+ MSG msg = {0};
+ while ( GetMessage(&msg, NULL, 0, 0) ) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ return 0;
+}
+
diff --git a/libc3/window/cairo/win32/window_cairo_win32.h b/libc3/window/cairo/win32/window_cairo_win32.h
new file mode 100644
index 0000000..12f9329
--- /dev/null
+++ b/libc3/window/cairo/win32/window_cairo_win32.h
@@ -0,0 +1,20 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#ifndef LIBC3_WINDOW_CAIRO_WIN32_H
+#define LIBC3_WINDOW_CAIRO_WIN32_H
+
+#include "../window_cairo.h"
+
+bool window_cairo_win32_run (s_window_cairo *window);
+
+#endif /* LIBC3_WINDOW_CAIRO_XCB_H */
diff --git a/libc3/window/cairo/xcb/window_cairo_xcb.h b/libc3/window/cairo/xcb/window_cairo_xcb.h
index 290de5e..5f52dcd 100644
--- a/libc3/window/cairo/xcb/window_cairo_xcb.h
+++ b/libc3/window/cairo/xcb/window_cairo_xcb.h
@@ -13,9 +13,7 @@
#ifndef LIBC3_WINDOW_CAIRO_XCB_H
#define LIBC3_WINDOW_CAIRO_XCB_H
-#include <libc3/types.h>
#include <xcb/xcb.h>
-#include "../types.h"
#include "../window_cairo.h"
bool window_cairo_xcb_run (s_window_cairo *window);