|
Packit |
071ada |
/*
|
|
Packit |
071ada |
* Copyright (C) 2001-2006 Bart Massey, Jamey Sharp, and Josh Triplett.
|
|
Packit |
071ada |
* All Rights Reserved.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
Packit |
071ada |
* copy of this software and associated documentation files (the "Software"),
|
|
Packit |
071ada |
* to deal in the Software without restriction, including without limitation
|
|
Packit |
071ada |
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
Packit |
071ada |
* and/or sell copies of the Software, and to permit persons to whom the
|
|
Packit |
071ada |
* Software is furnished to do so, subject to the following conditions:
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* The above copyright notice and this permission notice shall be included in
|
|
Packit |
071ada |
* all copies or substantial portions of the Software.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
Packit |
071ada |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
Packit |
071ada |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
Packit |
071ada |
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
Packit |
071ada |
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
Packit |
071ada |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Except as contained in this notice, the names of the authors or their
|
|
Packit |
071ada |
* institutions shall not be used in advertising or otherwise to promote the
|
|
Packit |
071ada |
* sale, use or other dealings in this Software without prior written
|
|
Packit |
071ada |
* authorization from the authors.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
|
|
Packit |
071ada |
#ifndef __XCB_H__
|
|
Packit |
071ada |
#define __XCB_H__
|
|
Packit |
071ada |
#include <sys/types.h>
|
|
Packit |
071ada |
|
|
Packit |
071ada |
#if defined(__solaris__)
|
|
Packit |
071ada |
#include <inttypes.h>
|
|
Packit |
071ada |
#else
|
|
Packit |
071ada |
#include <stdint.h>
|
|
Packit |
071ada |
#endif
|
|
Packit |
071ada |
|
|
Packit |
071ada |
#ifndef _WIN32
|
|
Packit |
071ada |
#include <sys/uio.h>
|
|
Packit |
071ada |
#else
|
|
Packit |
071ada |
#include "xcb_windefs.h"
|
|
Packit |
071ada |
#endif
|
|
Packit |
071ada |
#include <pthread.h>
|
|
Packit |
071ada |
|
|
Packit |
071ada |
|
|
Packit |
071ada |
#ifdef __cplusplus
|
|
Packit |
071ada |
extern "C" {
|
|
Packit |
071ada |
#endif
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @file xcb.h
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
|
|
Packit |
071ada |
#define XCB_PACKED __attribute__((__packed__))
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @defgroup XCB_Core_API XCB Core API
|
|
Packit |
071ada |
* @brief Core API of the XCB library.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* @{
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/* Pre-defined constants */
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** Current protocol version */
|
|
Packit |
071ada |
#define X_PROTOCOL 11
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** Current minor version */
|
|
Packit |
071ada |
#define X_PROTOCOL_REVISION 0
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** X_TCP_PORT + display number = server port for TCP transport */
|
|
Packit |
071ada |
#define X_TCP_PORT 6000
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** xcb connection errors because of socket, pipe and other stream errors. */
|
|
Packit |
071ada |
#define XCB_CONN_ERROR 1
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** xcb connection shutdown because of extension not supported */
|
|
Packit |
071ada |
#define XCB_CONN_CLOSED_EXT_NOTSUPPORTED 2
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** malloc(), calloc() and realloc() error upon failure, for eg ENOMEM */
|
|
Packit |
071ada |
#define XCB_CONN_CLOSED_MEM_INSUFFICIENT 3
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** Connection closed, exceeding request length that server accepts. */
|
|
Packit |
071ada |
#define XCB_CONN_CLOSED_REQ_LEN_EXCEED 4
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** Connection closed, error during parsing display string. */
|
|
Packit |
071ada |
#define XCB_CONN_CLOSED_PARSE_ERR 5
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** Connection closed because the server does not have a screen matching the display. */
|
|
Packit |
071ada |
#define XCB_CONN_CLOSED_INVALID_SCREEN 6
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** Connection closed because some FD passing operation failed */
|
|
Packit |
071ada |
#define XCB_CONN_CLOSED_FDPASSING_FAILED 7
|
|
Packit |
071ada |
|
|
Packit |
071ada |
#define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1))
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/* Opaque structures */
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief XCB Connection structure.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* A structure that contain all data that XCB needs to communicate with an X server.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
typedef struct xcb_connection_t xcb_connection_t; /**< Opaque structure containing all data that XCB needs to communicate with an X server. */
|
|
Packit |
071ada |
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/* Other types */
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Generic iterator.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* A generic iterator structure.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
typedef struct {
|
|
Packit |
071ada |
void *data; /**< Data of the current iterator */
|
|
Packit |
071ada |
int rem; /**< remaining elements */
|
|
Packit |
071ada |
int index; /**< index of the current iterator */
|
|
Packit |
071ada |
} xcb_generic_iterator_t;
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Generic reply.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* A generic reply structure.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
typedef struct {
|
|
Packit |
071ada |
uint8_t response_type; /**< Type of the response */
|
|
Packit |
071ada |
uint8_t pad0; /**< Padding */
|
|
Packit |
071ada |
uint16_t sequence; /**< Sequence number */
|
|
Packit |
071ada |
uint32_t length; /**< Length of the response */
|
|
Packit |
071ada |
} xcb_generic_reply_t;
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Generic event.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* A generic event structure.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
typedef struct {
|
|
Packit |
071ada |
uint8_t response_type; /**< Type of the response */
|
|
Packit |
071ada |
uint8_t pad0; /**< Padding */
|
|
Packit |
071ada |
uint16_t sequence; /**< Sequence number */
|
|
Packit |
071ada |
uint32_t pad[7]; /**< Padding */
|
|
Packit |
071ada |
uint32_t full_sequence; /**< full sequence */
|
|
Packit |
071ada |
} xcb_generic_event_t;
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Raw Generic event.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* A generic event structure as used on the wire, i.e., without the full_sequence field
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
typedef struct {
|
|
Packit |
071ada |
uint8_t response_type; /**< Type of the response */
|
|
Packit |
071ada |
uint8_t pad0; /**< Padding */
|
|
Packit |
071ada |
uint16_t sequence; /**< Sequence number */
|
|
Packit |
071ada |
uint32_t pad[7]; /**< Padding */
|
|
Packit |
071ada |
} xcb_raw_generic_event_t;
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief GE event
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* An event as sent by the XGE extension. The length field specifies the
|
|
Packit |
071ada |
* number of 4-byte blocks trailing the struct.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* @deprecated Since some fields in this struct have unfortunate names, it is
|
|
Packit |
071ada |
* recommended to use xcb_ge_generic_event_t instead.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
typedef struct {
|
|
Packit |
071ada |
uint8_t response_type; /**< Type of the response */
|
|
Packit |
071ada |
uint8_t pad0; /**< Padding */
|
|
Packit |
071ada |
uint16_t sequence; /**< Sequence number */
|
|
Packit |
071ada |
uint32_t length;
|
|
Packit |
071ada |
uint16_t event_type;
|
|
Packit |
071ada |
uint16_t pad1;
|
|
Packit |
071ada |
uint32_t pad[5]; /**< Padding */
|
|
Packit |
071ada |
uint32_t full_sequence; /**< full sequence */
|
|
Packit |
071ada |
} xcb_ge_event_t;
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Generic error.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* A generic error structure.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
typedef struct {
|
|
Packit |
071ada |
uint8_t response_type; /**< Type of the response */
|
|
Packit |
071ada |
uint8_t error_code; /**< Error code */
|
|
Packit |
071ada |
uint16_t sequence; /**< Sequence number */
|
|
Packit |
071ada |
uint32_t resource_id; /** < Resource ID for requests with side effects only */
|
|
Packit |
071ada |
uint16_t minor_code; /** < Minor opcode of the failed request */
|
|
Packit |
071ada |
uint8_t major_code; /** < Major opcode of the failed request */
|
|
Packit |
071ada |
uint8_t pad0;
|
|
Packit |
071ada |
uint32_t pad[5]; /**< Padding */
|
|
Packit |
071ada |
uint32_t full_sequence; /**< full sequence */
|
|
Packit |
071ada |
} xcb_generic_error_t;
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Generic cookie.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* A generic cookie structure.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
typedef struct {
|
|
Packit |
071ada |
unsigned int sequence; /**< Sequence number */
|
|
Packit |
071ada |
} xcb_void_cookie_t;
|
|
Packit |
071ada |
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/* Include the generated xproto header. */
|
|
Packit |
071ada |
#include "xproto.h"
|
|
Packit |
071ada |
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** XCB_NONE is the universal null resource or null atom parameter value for many core X requests */
|
|
Packit |
071ada |
#define XCB_NONE 0L
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** XCB_COPY_FROM_PARENT can be used for many xcb_create_window parameters */
|
|
Packit |
071ada |
#define XCB_COPY_FROM_PARENT 0L
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** XCB_CURRENT_TIME can be used in most requests that take an xcb_timestamp_t */
|
|
Packit |
071ada |
#define XCB_CURRENT_TIME 0L
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/** XCB_NO_SYMBOL fills in unused entries in xcb_keysym_t tables */
|
|
Packit |
071ada |
#define XCB_NO_SYMBOL 0L
|
|
Packit |
071ada |
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/* xcb_auth.c */
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Container for authorization information.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* A container for authorization information to be sent to the X server.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
typedef struct xcb_auth_info_t {
|
|
Packit |
071ada |
int namelen; /**< Length of the string name (as returned by strlen). */
|
|
Packit |
071ada |
char *name; /**< String containing the authentication protocol name, such as "MIT-MAGIC-COOKIE-1" or "XDM-AUTHORIZATION-1". */
|
|
Packit |
071ada |
int datalen; /**< Length of the data member. */
|
|
Packit |
071ada |
char *data; /**< Data interpreted in a protocol-specific manner. */
|
|
Packit |
071ada |
} xcb_auth_info_t;
|
|
Packit |
071ada |
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/* xcb_out.c */
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Forces any buffered output to be written to the server.
|
|
Packit |
071ada |
* @param c The connection to the X server.
|
|
Packit |
071ada |
* @return > @c 0 on success, <= @c 0 otherwise.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Forces any buffered output to be written to the server. Blocks
|
|
Packit |
071ada |
* until the write is complete.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
int xcb_flush(xcb_connection_t *c);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Returns the maximum request length that this server accepts.
|
|
Packit |
071ada |
* @param c The connection to the X server.
|
|
Packit |
071ada |
* @return The maximum request length field.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* In the absence of the BIG-REQUESTS extension, returns the
|
|
Packit |
071ada |
* maximum request length field from the connection setup data, which
|
|
Packit |
071ada |
* may be as much as 65535. If the server supports BIG-REQUESTS, then
|
|
Packit |
071ada |
* the maximum request length field from the reply to the
|
|
Packit |
071ada |
* BigRequestsEnable request will be returned instead.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Note that this length is measured in four-byte units, making the
|
|
Packit |
071ada |
* theoretical maximum lengths roughly 256kB without BIG-REQUESTS and
|
|
Packit |
071ada |
* 16GB with.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
uint32_t xcb_get_maximum_request_length(xcb_connection_t *c);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Prefetch the maximum request length without blocking.
|
|
Packit |
071ada |
* @param c The connection to the X server.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Without blocking, does as much work as possible toward computing
|
|
Packit |
071ada |
* the maximum request length accepted by the X server.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Invoking this function may cause a call to xcb_big_requests_enable,
|
|
Packit |
071ada |
* but will not block waiting for the reply.
|
|
Packit |
071ada |
* xcb_get_maximum_request_length will return the prefetched data
|
|
Packit |
071ada |
* after possibly blocking while the reply is retrieved.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Note that in order for this function to be fully non-blocking, the
|
|
Packit |
071ada |
* application must previously have called
|
|
Packit |
071ada |
* xcb_prefetch_extension_data(c, &xcb_big_requests_id) and the reply
|
|
Packit |
071ada |
* must have already arrived.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
void xcb_prefetch_maximum_request_length(xcb_connection_t *c);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/* xcb_in.c */
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Returns the next event or error from the server.
|
|
Packit |
071ada |
* @param c The connection to the X server.
|
|
Packit |
071ada |
* @return The next event from the server.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Returns the next event or error from the server, or returns null in
|
|
Packit |
071ada |
* the event of an I/O error. Blocks until either an event or error
|
|
Packit |
071ada |
* arrive, or an I/O error occurs.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Returns the next event or error from the server.
|
|
Packit |
071ada |
* @param c The connection to the X server.
|
|
Packit |
071ada |
* @return The next event from the server.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Returns the next event or error from the server, if one is
|
|
Packit |
071ada |
* available, or returns @c NULL otherwise. If no event is available, that
|
|
Packit |
071ada |
* might be because an I/O error like connection close occurred while
|
|
Packit |
071ada |
* attempting to read the next event, in which case the connection is
|
|
Packit |
071ada |
* shut down when this function returns.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Returns the next event without reading from the connection.
|
|
Packit |
071ada |
* @param c The connection to the X server.
|
|
Packit |
071ada |
* @return The next already queued event from the server.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* This is a version of xcb_poll_for_event that only examines the
|
|
Packit |
071ada |
* event queue for new events. The function doesn't try to read new
|
|
Packit |
071ada |
* events from the connection if no queued events are found.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* This function is useful for callers that know in advance that all
|
|
Packit |
071ada |
* interesting events have already been read from the connection. For
|
|
Packit |
071ada |
* example, callers might use xcb_wait_for_reply and be interested
|
|
Packit |
071ada |
* only of events that preceded a specific reply.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
xcb_generic_event_t *xcb_poll_for_queued_event(xcb_connection_t *c);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
typedef struct xcb_special_event xcb_special_event_t;
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Returns the next event from a special queue
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
xcb_generic_event_t *xcb_poll_for_special_event(xcb_connection_t *c,
|
|
Packit |
071ada |
xcb_special_event_t *se);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Returns the next event from a special queue, blocking until one arrives
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
xcb_generic_event_t *xcb_wait_for_special_event(xcb_connection_t *c,
|
|
Packit |
071ada |
xcb_special_event_t *se);
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @typedef typedef struct xcb_extension_t xcb_extension_t
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
typedef struct xcb_extension_t xcb_extension_t; /**< Opaque structure used as key for xcb_get_extension_data_t. */
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Listen for a special event
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
xcb_special_event_t *xcb_register_for_special_xge(xcb_connection_t *c,
|
|
Packit |
071ada |
xcb_extension_t *ext,
|
|
Packit |
071ada |
uint32_t eid,
|
|
Packit |
071ada |
uint32_t *stamp);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Stop listening for a special event
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
void xcb_unregister_for_special_event(xcb_connection_t *c,
|
|
Packit |
071ada |
xcb_special_event_t *se);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Return the error for a request, or NULL if none can ever arrive.
|
|
Packit |
071ada |
* @param c The connection to the X server.
|
|
Packit |
071ada |
* @param cookie The request cookie.
|
|
Packit |
071ada |
* @return The error for the request, or NULL if none can ever arrive.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* The xcb_void_cookie_t cookie supplied to this function must have resulted
|
|
Packit |
071ada |
* from a call to xcb_[request_name]_checked(). This function will block
|
|
Packit |
071ada |
* until one of two conditions happens. If an error is received, it will be
|
|
Packit |
071ada |
* returned. If a reply to a subsequent request has already arrived, no error
|
|
Packit |
071ada |
* can arrive for this request, so this function will return NULL.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Note that this function will perform a sync if needed to ensure that the
|
|
Packit |
071ada |
* sequence number will advance beyond that provided in cookie; this is a
|
|
Packit |
071ada |
* convenience to avoid races in determining whether the sync is needed.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Discards the reply for a request.
|
|
Packit |
071ada |
* @param c The connection to the X server.
|
|
Packit |
071ada |
* @param sequence The request sequence number from a cookie.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Discards the reply for a request. Additionally, any error generated
|
|
Packit |
071ada |
* by the request is also discarded (unless it was an _unchecked request
|
|
Packit |
071ada |
* and the error has already arrived).
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* This function will not block even if the reply is not yet available.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Note that the sequence really does have to come from an xcb cookie;
|
|
Packit |
071ada |
* this function is not designed to operate on socket-handoff replies.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Discards the reply for a request, given by a 64bit sequence number
|
|
Packit |
071ada |
* @param c The connection to the X server.
|
|
Packit |
071ada |
* @param sequence 64-bit sequence number as returned by xcb_send_request64().
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Discards the reply for a request. Additionally, any error generated
|
|
Packit |
071ada |
* by the request is also discarded (unless it was an _unchecked request
|
|
Packit |
071ada |
* and the error has already arrived).
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* This function will not block even if the reply is not yet available.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Note that the sequence really does have to come from xcb_send_request64();
|
|
Packit |
071ada |
* the cookie sequence number is defined as "unsigned" int and therefore
|
|
Packit |
071ada |
* not 64-bit on all platforms.
|
|
Packit |
071ada |
* This function is not designed to operate on socket-handoff replies.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Unlike its xcb_discard_reply() counterpart, the given sequence number is not
|
|
Packit |
071ada |
* automatically "widened" to 64-bit.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
void xcb_discard_reply64(xcb_connection_t *c, uint64_t sequence);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/* xcb_ext.c */
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Caches reply information from QueryExtension requests.
|
|
Packit |
071ada |
* @param c The connection.
|
|
Packit |
071ada |
* @param ext The extension data.
|
|
Packit |
071ada |
* @return A pointer to the xcb_query_extension_reply_t for the extension.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* This function is the primary interface to the "extension cache",
|
|
Packit |
071ada |
* which caches reply information from QueryExtension
|
|
Packit |
071ada |
* requests. Invoking this function may cause a call to
|
|
Packit |
071ada |
* xcb_query_extension to retrieve extension information from the
|
|
Packit |
071ada |
* server, and may block until extension data is received from the
|
|
Packit |
071ada |
* server.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* The result must not be freed. This storage is managed by the cache
|
|
Packit |
071ada |
* itself.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
const struct xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Prefetch of extension data into the extension cache
|
|
Packit |
071ada |
* @param c The connection.
|
|
Packit |
071ada |
* @param ext The extension data.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* This function allows a "prefetch" of extension data into the
|
|
Packit |
071ada |
* extension cache. Invoking the function may cause a call to
|
|
Packit |
071ada |
* xcb_query_extension, but will not block waiting for the
|
|
Packit |
071ada |
* reply. xcb_get_extension_data will return the prefetched data after
|
|
Packit |
071ada |
* possibly blocking while it is retrieved.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/* xcb_conn.c */
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Access the data returned by the server.
|
|
Packit |
071ada |
* @param c The connection.
|
|
Packit |
071ada |
* @return A pointer to an xcb_setup_t structure.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Accessor for the data returned by the server when the xcb_connection_t
|
|
Packit |
071ada |
* was initialized. This data includes
|
|
Packit |
071ada |
* - the server's required format for images,
|
|
Packit |
071ada |
* - a list of available visuals,
|
|
Packit |
071ada |
* - a list of available screens,
|
|
Packit |
071ada |
* - the server's maximum request length (in the absence of the
|
|
Packit |
071ada |
* BIG-REQUESTS extension),
|
|
Packit |
071ada |
* - and other assorted information.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* See the X protocol specification for more details.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* The result must not be freed.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
const struct xcb_setup_t *xcb_get_setup(xcb_connection_t *c);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Access the file descriptor of the connection.
|
|
Packit |
071ada |
* @param c The connection.
|
|
Packit |
071ada |
* @return The file descriptor.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Accessor for the file descriptor that was passed to the
|
|
Packit |
071ada |
* xcb_connect_to_fd call that returned @p c.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
int xcb_get_file_descriptor(xcb_connection_t *c);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Test whether the connection has shut down due to a fatal error.
|
|
Packit |
071ada |
* @param c The connection.
|
|
Packit |
071ada |
* @return > 0 if the connection is in an error state; 0 otherwise.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Some errors that occur in the context of an xcb_connection_t
|
|
Packit |
071ada |
* are unrecoverable. When such an error occurs, the
|
|
Packit |
071ada |
* connection is shut down and further operations on the
|
|
Packit |
071ada |
* xcb_connection_t have no effect, but memory will not be freed until
|
|
Packit |
071ada |
* xcb_disconnect() is called on the xcb_connection_t.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* @return XCB_CONN_ERROR, because of socket errors, pipe errors or other stream errors.
|
|
Packit |
071ada |
* @return XCB_CONN_CLOSED_EXT_NOTSUPPORTED, when extension not supported.
|
|
Packit |
071ada |
* @return XCB_CONN_CLOSED_MEM_INSUFFICIENT, when memory not available.
|
|
Packit |
071ada |
* @return XCB_CONN_CLOSED_REQ_LEN_EXCEED, exceeding request length that server accepts.
|
|
Packit |
071ada |
* @return XCB_CONN_CLOSED_PARSE_ERR, error during parsing display string.
|
|
Packit |
071ada |
* @return XCB_CONN_CLOSED_INVALID_SCREEN, because the server does not have a screen matching the display.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
int xcb_connection_has_error(xcb_connection_t *c);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Connects to the X server.
|
|
Packit |
071ada |
* @param fd The file descriptor.
|
|
Packit |
071ada |
* @param auth_info Authentication data.
|
|
Packit |
071ada |
* @return A newly allocated xcb_connection_t structure.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Connects to an X server, given the open socket @p fd and the
|
|
Packit |
071ada |
* xcb_auth_info_t @p auth_info. The file descriptor @p fd is
|
|
Packit |
071ada |
* bidirectionally connected to an X server. If the connection
|
|
Packit |
071ada |
* should be unauthenticated, @p auth_info must be @c
|
|
Packit |
071ada |
* NULL.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Always returns a non-NULL pointer to a xcb_connection_t, even on failure.
|
|
Packit |
071ada |
* Callers need to use xcb_connection_has_error() to check for failure.
|
|
Packit |
071ada |
* When finished, use xcb_disconnect() to close the connection and free
|
|
Packit |
071ada |
* the structure.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Closes the connection.
|
|
Packit |
071ada |
* @param c The connection.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Closes the file descriptor and frees all memory associated with the
|
|
Packit |
071ada |
* connection @c c. If @p c is @c NULL, nothing is done.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
void xcb_disconnect(xcb_connection_t *c);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/* xcb_util.c */
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Parses a display string name in the form documented by X(7x).
|
|
Packit |
071ada |
* @param name The name of the display.
|
|
Packit |
071ada |
* @param host A pointer to a malloc'd copy of the hostname.
|
|
Packit |
071ada |
* @param display A pointer to the display number.
|
|
Packit |
071ada |
* @param screen A pointer to the screen number.
|
|
Packit |
071ada |
* @return 0 on failure, non 0 otherwise.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Parses the display string name @p display_name in the form
|
|
Packit |
071ada |
* documented by X(7x). Has no side effects on failure. If
|
|
Packit |
071ada |
* @p displayname is @c NULL or empty, it uses the environment
|
|
Packit |
071ada |
* variable DISPLAY. @p hostp is a pointer to a newly allocated string
|
|
Packit |
071ada |
* that contain the host name. @p displayp is set to the display
|
|
Packit |
071ada |
* number and @p screenp to the preferred screen number. @p screenp
|
|
Packit |
071ada |
* can be @c NULL. If @p displayname does not contain a screen number,
|
|
Packit |
071ada |
* it is set to @c 0.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
int xcb_parse_display(const char *name, char **host, int *display, int *screen);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Connects to the X server.
|
|
Packit |
071ada |
* @param displayname The name of the display.
|
|
Packit |
071ada |
* @param screenp A pointer to a preferred screen number.
|
|
Packit |
071ada |
* @return A newly allocated xcb_connection_t structure.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Connects to the X server specified by @p displayname. If @p
|
|
Packit |
071ada |
* displayname is @c NULL, uses the value of the DISPLAY environment
|
|
Packit |
071ada |
* variable. If a particular screen on that server is preferred, the
|
|
Packit |
071ada |
* int pointed to by @p screenp (if not @c NULL) will be set to that
|
|
Packit |
071ada |
* screen; otherwise the screen will be set to 0.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Always returns a non-NULL pointer to a xcb_connection_t, even on failure.
|
|
Packit |
071ada |
* Callers need to use xcb_connection_has_error() to check for failure.
|
|
Packit |
071ada |
* When finished, use xcb_disconnect() to close the connection and free
|
|
Packit |
071ada |
* the structure.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
xcb_connection_t *xcb_connect(const char *displayname, int *screenp);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Connects to the X server, using an authorization information.
|
|
Packit |
071ada |
* @param display The name of the display.
|
|
Packit |
071ada |
* @param auth The authorization information.
|
|
Packit |
071ada |
* @param screen A pointer to a preferred screen number.
|
|
Packit |
071ada |
* @return A newly allocated xcb_connection_t structure.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Connects to the X server specified by @p displayname, using the
|
|
Packit |
071ada |
* authorization @p auth. If a particular screen on that server is
|
|
Packit |
071ada |
* preferred, the int pointed to by @p screenp (if not @c NULL) will
|
|
Packit |
071ada |
* be set to that screen; otherwise @p screenp will be set to 0.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Always returns a non-NULL pointer to a xcb_connection_t, even on failure.
|
|
Packit |
071ada |
* Callers need to use xcb_connection_has_error() to check for failure.
|
|
Packit |
071ada |
* When finished, use xcb_disconnect() to close the connection and free
|
|
Packit |
071ada |
* the structure.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/* xcb_xid.c */
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @brief Allocates an XID for a new object.
|
|
Packit |
071ada |
* @param c The connection.
|
|
Packit |
071ada |
* @return A newly allocated XID.
|
|
Packit |
071ada |
*
|
|
Packit |
071ada |
* Allocates an XID for a new object. Typically used just prior to
|
|
Packit |
071ada |
* various object creation functions, such as xcb_create_window.
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
uint32_t xcb_generate_id(xcb_connection_t *c);
|
|
Packit |
071ada |
|
|
Packit |
071ada |
|
|
Packit |
071ada |
/**
|
|
Packit |
071ada |
* @}
|
|
Packit |
071ada |
*/
|
|
Packit |
071ada |
|
|
Packit |
071ada |
#ifdef __cplusplus
|
|
Packit |
071ada |
}
|
|
Packit |
071ada |
#endif
|
|
Packit |
071ada |
|
|
Packit |
071ada |
|
|
Packit |
071ada |
#endif /* __XCB_H__ */
|