aboutsummaryrefslogtreecommitdiff
path: root/demos/xcb/start/main.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-04-01 21:33:24 +0800
committercrupest <crupest@outlook.com>2021-04-01 21:33:24 +0800
commit7874ec6bb127e87020a05154cd2f3105386e9109 (patch)
tree0ed3e8b0d771c274439976c7c02c7f8c7c7c6d0a /demos/xcb/start/main.cpp
parentaf2e38b320905bf3b1e5d0969d0811c47289bbfe (diff)
parentba43736c55ad510942e9e83ca0c8bea7265cf055 (diff)
downloadcru-7874ec6bb127e87020a05154cd2f3105386e9109.tar.gz
cru-7874ec6bb127e87020a05154cd2f3105386e9109.tar.bz2
cru-7874ec6bb127e87020a05154cd2f3105386e9109.zip
Merge branch 'master' of https://github.com/crupest/CruUI
Diffstat (limited to 'demos/xcb/start/main.cpp')
-rw-r--r--demos/xcb/start/main.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/demos/xcb/start/main.cpp b/demos/xcb/start/main.cpp
new file mode 100644
index 00000000..c4e3761e
--- /dev/null
+++ b/demos/xcb/start/main.cpp
@@ -0,0 +1,23 @@
+#include <unistd.h>
+#include <xcb/xcb.h>
+
+int main() {
+ int screen_num;
+ xcb_connection_t* connection = xcb_connect(NULL, &screen_num);
+ const xcb_setup_t* setup = xcb_get_setup(connection);
+ xcb_screen_iterator_t iter = xcb_setup_roots_iterator(setup);
+ xcb_screen_t* screen = iter.data;
+
+ xcb_window_t window = xcb_generate_id(connection);
+ xcb_create_window(connection, XCB_COPY_FROM_PARENT, window, screen->root, 0,
+ 0, 150, 150, 10, XCB_WINDOW_CLASS_INPUT_OUTPUT,
+ screen->root_visual, 0, NULL);
+ xcb_map_window(connection, window);
+ xcb_flush(connection);
+
+ pause();
+
+ xcb_disconnect(connection);
+
+ return 0;
+}