summaryrefslogtreecommitdiff
path: root/src/xcb_connection.cc
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@opera.com>2026-01-12 23:06:20 +0100
committerJoel Klinghed <the_jk@opera.com>2026-01-12 23:06:20 +0100
commitdfeb19b0a83b8ce57d28bf94a4f8d129993d1064 (patch)
treed352908df286058059e306c350d89a07c67049eb /src/xcb_connection.cc
Initial commit
Diffstat (limited to 'src/xcb_connection.cc')
-rw-r--r--src/xcb_connection.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/xcb_connection.cc b/src/xcb_connection.cc
new file mode 100644
index 0000000..89b4a63
--- /dev/null
+++ b/src/xcb_connection.cc
@@ -0,0 +1,25 @@
+#include "xcb_connection.hh"
+
+#include <xcb/xproto.h>
+
+namespace xcb {
+
+shared_conn make_shared_conn(xcb_connection_t* conn) {
+ return {conn, internal::xcb_connection_deleter()};
+}
+
+unique_conn make_unique_conn(xcb_connection_t* conn) {
+ return unique_conn(conn);
+}
+
+xcb_screen_t* get_screen(xcb_connection_t* conn, int screen_index) {
+ auto iter = xcb_setup_roots_iterator(xcb_get_setup(conn));
+ for (; iter.rem; --screen_index, xcb_screen_next(&iter)) {
+ if (screen_index == 0) {
+ return iter.data;
+ }
+ }
+ return nullptr;
+}
+
+} // namespace xcb