#pragma once #include #include void check_error(xcb_generic_error_t * error) { if (error) { Logger * LOGGER = Logger::getInstance("XCB"); Error(LOGGER, "XCB request failed, event_error: response_type:%u error_code:%u " "sequence:%u resource_id:%u minor_code:%u major_code:%u.\n", error->response_type, error->error_code, error->sequence, error->resource_id, error->minor_code, error->major_code); free(error); } } // Requests with void response type template typename std::enable_if::value, void>::type static query(xcb_connection_t * connection, Args&& ...args) { auto cookie = Request::RequestFunction(connection, std::forward(args)...); xcb_generic_error_t * error = Request::ReplyFunction(connection, cookie); check_error(error); } // Requests with non-void response type template typename std::enable_if::value, std::unique_ptr>::type static query(xcb_connection_t * connection, Args&& ...args) { auto cookie = Request::RequestFunction(connection, std::forward(args)...); xcb_generic_error_t * error = nullptr; std::unique_ptr xcbResponse( Request::ReplyFunction(connection, cookie, &error), free); check_error(error); return xcbResponse; }