summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar synzr <synzr@klo.pp.ru> 2026-07-02 11:39:32 +0500
committerGravatar synzr <synzr@klo.pp.ru> 2026-07-02 11:39:32 +0500
commit7821c417c6bc8ebb105672d7e15102d19271b1ed (patch)
tree4d414f01078197f38dc1a2825242060425e38c54
parent88f314ec66347db07bd97e67a24f45913233dee3 (diff)
downloadxhorse-7821c417c6bc8ebb105672d7e15102d19271b1ed.tar.gz
xhorse-7821c417c6bc8ebb105672d7e15102d19271b1ed.tar.bz2
xhorse-7821c417c6bc8ebb105672d7e15102d19271b1ed.zip
Blank window for 5 seconds
-rw-r--r--.editorconfig3
-rw-r--r--Makefile2
-rw-r--r--xhorse.c38
3 files changed, 43 insertions, 0 deletions
diff --git a/.editorconfig b/.editorconfig
index c1e2c64..249febf 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -10,3 +10,6 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
+
+[Makefile]
+indent_style = tab
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..04b2567
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,2 @@
+build: xhorse.c
+ gcc -o xhorse.out xhorse.c -lxcb
diff --git a/xhorse.c b/xhorse.c
new file mode 100644
index 0000000..dec79c2
--- /dev/null
+++ b/xhorse.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <xcb/xcb.h>
+
+int main(void)
+{
+ xcb_connection_t *conn = xcb_connect(NULL, NULL);
+ if (!conn)
+ {
+ printf("xcb_connect() failed; conn = %p\n", conn);
+ return EXIT_FAILURE;
+ }
+ printf("connected to X; conn = %p\n", conn);
+
+ xcb_screen_t *scr = xcb_setup_roots_iterator(
+ xcb_get_setup(conn)
+ ).data;
+
+ xcb_window_t win = xcb_generate_id(conn);
+ xcb_create_window(conn, XCB_COPY_FROM_PARENT, win, scr->root,
+ 0, 0, 100, 100, 10, XCB_WINDOW_CLASS_INPUT_OUTPUT,
+ scr->root_visual, 0, NULL);
+ xcb_map_window(conn, win);
+ xcb_flush(conn);
+ printf("window created; win = %d\n", win);
+
+ sleep(5);
+
+ xcb_unmap_window(conn, win);
+ xcb_flush(conn);
+ printf("window destroyed; win = %d\n", win);
+
+ xcb_disconnect(conn);
+ puts("disconnected from X");
+
+ return EXIT_SUCCESS;
+}