From 06950aab233de6a2f47293d59575bb42f6131660 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Wed, 27 Jan 2021 22:06:49 +0100 Subject: Complete rewrite using C++ and with shared state support --- src/xcb_connection.hh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/xcb_connection.hh (limited to 'src/xcb_connection.hh') diff --git a/src/xcb_connection.hh b/src/xcb_connection.hh new file mode 100644 index 0000000..74ee751 --- /dev/null +++ b/src/xcb_connection.hh @@ -0,0 +1,30 @@ +#ifndef XCB_CONNECTION_HH +#define XCB_CONNECTION_HH + +#include +#include + +namespace xcb { + +namespace internal { + +struct xcb_connection_deleter { + void operator() (xcb_connection_t* ptr) { + xcb_disconnect(ptr); + } +}; + +} // namespace internal + +typedef std::shared_ptr shared_conn; +typedef std::unique_ptr unique_conn; + +shared_conn make_shared_conn(xcb_connection_t* conn); +unique_conn make_unique_conn(xcb_connection_t* conn); + +xcb_screen_t* get_screen(xcb_connection_t* conn, int screen_index); + +} // namespace xcb + +#endif // XCB_CONNECTION_HH -- cgit v1.2.3-70-g09d2