1cb93a386Sopenharmony_ci// Copyright 2021 The SwiftShader Authors. All Rights Reserved. 2cb93a386Sopenharmony_ci// 3cb93a386Sopenharmony_ci// Licensed under the Apache License, Version 2.0 (the "License"); 4cb93a386Sopenharmony_ci// you may not use this file except in compliance with the License. 5cb93a386Sopenharmony_ci// You may obtain a copy of the License at 6cb93a386Sopenharmony_ci// 7cb93a386Sopenharmony_ci// http://www.apache.org/licenses/LICENSE-2.0 8cb93a386Sopenharmony_ci// 9cb93a386Sopenharmony_ci// Unless required by applicable law or agreed to in writing, software 10cb93a386Sopenharmony_ci// distributed under the License is distributed on an "AS IS" BASIS, 11cb93a386Sopenharmony_ci// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12cb93a386Sopenharmony_ci// See the License for the specific language governing permissions and 13cb93a386Sopenharmony_ci// limitations under the License. 14cb93a386Sopenharmony_ci 15cb93a386Sopenharmony_ci#ifndef libXCB_hpp 16cb93a386Sopenharmony_ci#define libXCB_hpp 17cb93a386Sopenharmony_ci 18cb93a386Sopenharmony_ci#include <xcb/xcb.h> 19cb93a386Sopenharmony_ci 20cb93a386Sopenharmony_cistruct LibXcbExports 21cb93a386Sopenharmony_ci{ 22cb93a386Sopenharmony_ci LibXcbExports() {} 23cb93a386Sopenharmony_ci LibXcbExports(void *lib); 24cb93a386Sopenharmony_ci 25cb93a386Sopenharmony_ci xcb_void_cookie_t (*xcb_create_gc)(xcb_connection_t *c, xcb_gcontext_t cid, xcb_drawable_t drawable, uint32_t value_mask, const void *value_list) = nullptr; 26cb93a386Sopenharmony_ci int (*xcb_flush)(xcb_connection_t *c) = nullptr; 27cb93a386Sopenharmony_ci xcb_void_cookie_t (*xcb_free_gc)(xcb_connection_t *c, xcb_gcontext_t gc) = nullptr; 28cb93a386Sopenharmony_ci uint32_t (*xcb_generate_id)(xcb_connection_t *c) = nullptr; 29cb93a386Sopenharmony_ci xcb_get_geometry_cookie_t (*xcb_get_geometry)(xcb_connection_t *c, xcb_drawable_t drawable) = nullptr; 30cb93a386Sopenharmony_ci xcb_get_geometry_reply_t *(*xcb_get_geometry_reply)(xcb_connection_t *c, xcb_get_geometry_cookie_t cookie, xcb_generic_error_t **e) = nullptr; 31cb93a386Sopenharmony_ci xcb_void_cookie_t (*xcb_put_image)(xcb_connection_t *c, uint8_t format, xcb_drawable_t drawable, xcb_gcontext_t gc, uint16_t width, uint16_t height, int16_t dst_x, int16_t dst_y, uint8_t left_pad, uint8_t depth, uint32_t data_len, const uint8_t *data) = nullptr; 32cb93a386Sopenharmony_ci}; 33cb93a386Sopenharmony_ci 34cb93a386Sopenharmony_ciclass LibXCB 35cb93a386Sopenharmony_ci{ 36cb93a386Sopenharmony_cipublic: 37cb93a386Sopenharmony_ci bool isPresent() 38cb93a386Sopenharmony_ci { 39cb93a386Sopenharmony_ci return loadExports() != nullptr; 40cb93a386Sopenharmony_ci } 41cb93a386Sopenharmony_ci 42cb93a386Sopenharmony_ci LibXcbExports *operator->(); 43cb93a386Sopenharmony_ci 44cb93a386Sopenharmony_ciprivate: 45cb93a386Sopenharmony_ci LibXcbExports *loadExports(); 46cb93a386Sopenharmony_ci}; 47cb93a386Sopenharmony_ci 48cb93a386Sopenharmony_ciextern LibXCB libXCB; 49cb93a386Sopenharmony_ci 50cb93a386Sopenharmony_ci#endif // libXCB_hpp 51