xcb.h
Go to the documentation of this file.
/*
* Copyright (C) 2001-2006 Bart Massey, Jamey Sharp, and Josh Triplett.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the names of the authors or their
* institutions shall not be used in advertising or otherwise to promote the
* sale, use or other dealings in this Software without prior written
* authorization from the authors.
*/
#ifndef __XCB_H__
#define __XCB_H__
#include <sys/types.h>
#if defined(__solaris__)
#include <inttypes.h>
#else
#include <stdint.h>
#endif
#ifndef _WIN32
#include <sys/uio.h>
#else
#include "xcb_windefs.h"
#endif
#include <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __GNUC__
#define XCB_PACKED __attribute__((__packed__))
#else
#define XCB_PACKED
#endif
/* Pre-defined constants */
#define X_PROTOCOL 11
#define X_PROTOCOL_REVISION 0
#define X_TCP_PORT 6000
#define XCB_CONN_ERROR 1
#define XCB_CONN_CLOSED_EXT_NOTSUPPORTED 2
#define XCB_CONN_CLOSED_MEM_INSUFFICIENT 3
#define XCB_CONN_CLOSED_REQ_LEN_EXCEED 4
#define XCB_CONN_CLOSED_PARSE_ERR 5
#define XCB_CONN_CLOSED_INVALID_SCREEN 6
#define XCB_CONN_CLOSED_FDPASSING_FAILED 7
#define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1))
/* Opaque structures */
typedef struct xcb_connection_t xcb_connection_t;
/* Other types */
typedef struct {
void *data;
int rem;
int index;
} xcb_generic_iterator_t;
typedef struct {
uint8_t response_type;
uint8_t pad0;
uint16_t sequence;
uint32_t length;
} xcb_generic_reply_t;
typedef struct {
uint8_t response_type;
uint8_t pad0;
uint16_t sequence;
uint32_t pad[7];
uint32_t full_sequence;
} xcb_generic_event_t;
typedef struct {
uint8_t response_type;
uint8_t pad0;
uint16_t sequence;
uint32_t pad[7];
} xcb_raw_generic_event_t;
typedef struct {
uint8_t response_type;
uint8_t pad0;
uint16_t sequence;
uint32_t length;
uint16_t event_type;
uint16_t pad1;
uint32_t pad[5];
uint32_t full_sequence;
} xcb_ge_event_t;
typedef struct {
uint8_t response_type;
uint8_t error_code;
uint16_t sequence;
uint32_t resource_id;
uint16_t minor_code;
uint8_t major_code;
uint8_t pad0;
uint32_t pad[5];
uint32_t full_sequence;
} xcb_generic_error_t;
typedef struct {
unsigned int sequence;
} xcb_void_cookie_t;
/* Include the generated xproto header. */
#include "xproto.h"
#define XCB_NONE 0L
#define XCB_COPY_FROM_PARENT 0L
#define XCB_CURRENT_TIME 0L
#define XCB_NO_SYMBOL 0L
/* xcb_auth.c */
typedef struct xcb_auth_info_t {
int namelen;
char *name;
int datalen;
char *data;
} xcb_auth_info_t;
/* xcb_out.c */
int xcb_flush(xcb_connection_t *c);
uint32_t xcb_get_maximum_request_length(xcb_connection_t *c);
void xcb_prefetch_maximum_request_length(xcb_connection_t *c);
/* xcb_in.c */
xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c);
xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c);
xcb_generic_event_t *xcb_poll_for_queued_event(xcb_connection_t *c);
typedef struct xcb_special_event xcb_special_event_t;
xcb_generic_event_t *xcb_poll_for_special_event(xcb_connection_t *c,
xcb_special_event_t *se);
xcb_generic_event_t *xcb_wait_for_special_event(xcb_connection_t *c,
xcb_special_event_t *se);
typedef struct xcb_extension_t xcb_extension_t;
xcb_special_event_t *xcb_register_for_special_xge(xcb_connection_t *c,
xcb_extension_t *ext,
uint32_t eid,
uint32_t *stamp);
void xcb_unregister_for_special_event(xcb_connection_t *c,
xcb_special_event_t *se);
xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie);
void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence);
void xcb_discard_reply64(xcb_connection_t *c, uint64_t sequence);
/* xcb_ext.c */
const struct xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
/* xcb_conn.c */
const struct xcb_setup_t *xcb_get_setup(xcb_connection_t *c);
int xcb_get_file_descriptor(xcb_connection_t *c);
int xcb_connection_has_error(xcb_connection_t *c);
xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info);
void xcb_disconnect(xcb_connection_t *c);
/* xcb_util.c */
int xcb_parse_display(const char *name, char **host, int *display, int *screen);
xcb_connection_t *xcb_connect(const char *displayname, int *screenp);
xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen);
/* xcb_xid.c */
uint32_t xcb_generate_id(xcb_connection_t *c);
uint64_t
xcb_total_read(xcb_connection_t *c);
uint64_t
xcb_total_written(xcb_connection_t *c);
#ifdef __cplusplus
}
#endif
#endif /* __XCB_H__ */
xcb_wait_for_special_event
xcb_generic_event_t * xcb_wait_for_special_event(xcb_connection_t *c, xcb_special_event_t *se)
Returns the next event from a special queue, blocking until one arrives.
Definition xcb_in.c:792
xcb_poll_for_queued_event
xcb_generic_event_t * xcb_poll_for_queued_event(xcb_connection_t *c)
Returns the next event without reading from the connection.
Definition xcb_in.c:731
xcb_total_written
uint64_t xcb_total_written(xcb_connection_t *c)
Obtain number of bytes written to the connection.
Definition xcb_conn.c:576
xcb_total_read
uint64_t xcb_total_read(xcb_connection_t *c)
Obtain number of bytes read from the connection.
Definition xcb_conn.c:563
xcb_generate_id
uint32_t xcb_generate_id(xcb_connection_t *c)
Allocates an XID for a new object.
Definition xcb_xid.c:41
xcb_prefetch_maximum_request_length
void xcb_prefetch_maximum_request_length(xcb_connection_t *c)
Prefetch the maximum request length without blocking.
Definition xcb_out.c:139
xcb_connect_to_display_with_auth_info
xcb_connection_t * xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen)
Connects to the X server, using an authorization information.
Definition xcb_util.c:525
xcb_get_file_descriptor
int xcb_get_file_descriptor(xcb_connection_t *c)
Access the file descriptor of the connection.
Definition xcb_conn.c:340
xcb_wait_for_event
xcb_generic_event_t * xcb_wait_for_event(xcb_connection_t *c)
Returns the next event or error from the server.
Definition xcb_in.c:695
xcb_connection_has_error
int xcb_connection_has_error(xcb_connection_t *c)
Test whether the connection has shut down due to a fatal error.
Definition xcb_conn.c:348
xcb_discard_reply64
void xcb_discard_reply64(xcb_connection_t *c, uint64_t sequence)
Discards the reply for a request, given by a 64bit sequence number.
Definition xcb_in.c:643
xcb_unregister_for_special_event
void xcb_unregister_for_special_event(xcb_connection_t *c, xcb_special_event_t *se)
Stop listening for a special event.
Definition xcb_in.c:860
xcb_request_check
xcb_generic_error_t * xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie)
Return the error for a request, or NULL if none can ever arrive.
Definition xcb_in.c:736
xcb_flush
int xcb_flush(xcb_connection_t *c)
Forces any buffered output to be written to the server.
Definition xcb_out.c:421
xcb_connect_to_fd
xcb_connection_t * xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
Connects to the X server.
Definition xcb_conn.c:354
xcb_prefetch_extension_data
void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext)
Prefetch of extension data into the extension cache.
Definition xcb_ext.c:106
xcb_get_setup
const struct xcb_setup_t * xcb_get_setup(xcb_connection_t *c)
Access the data returned by the server.
Definition xcb_conn.c:332
xcb_get_maximum_request_length
uint32_t xcb_get_maximum_request_length(xcb_connection_t *c)
Returns the maximum request length that this server accepts.
Definition xcb_out.c:162
xcb_discard_reply
void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence)
Discards the reply for a request.
Definition xcb_in.c:629
xcb_get_extension_data
const struct xcb_query_extension_reply_t * xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext)
Caches reply information from QueryExtension requests.
Definition xcb_ext.c:88
xcb_poll_for_special_event
xcb_generic_event_t * xcb_poll_for_special_event(xcb_connection_t *c, xcb_special_event_t *se)
Returns the next event from a special queue.
Definition xcb_in.c:777
xcb_parse_display
int xcb_parse_display(const char *name, char **host, int *display, int *screen)
Parses a display string name in the form documented by X(7x).
Definition xcb_util.c:233
xcb_poll_for_event
xcb_generic_event_t * xcb_poll_for_event(xcb_connection_t *c)
Returns the next event or error from the server.
Definition xcb_in.c:726
xcb_disconnect
void xcb_disconnect(xcb_connection_t *c)
Closes the connection.
Definition xcb_conn.c:398
xcb_connect
xcb_connection_t * xcb_connect(const char *displayname, int *screenp)
Connects to the X server.
Definition xcb_util.c:520
xcb_register_for_special_xge
xcb_special_event_t * xcb_register_for_special_xge(xcb_connection_t *c, xcb_extension_t *ext, uint32_t eid, uint32_t *stamp)
Listen for a special event.
Definition xcb_in.c:817
xcb_auth_info_t
Container for authorization information.
Definition xcb.h:232
xcb_auth_info_t::namelen
int namelen
Definition xcb.h:233
xcb_auth_info_t::data
char * data
Definition xcb.h:236
xcb_auth_info_t::datalen
int datalen
Definition xcb.h:235
xcb_auth_info_t::name
char * name
Definition xcb.h:234
xcb_connection_t
Definition xcbint.h:208
xcb_extension_t
Definition xcbext.h:39
xcb_ge_event_t
GE event.
Definition xcb.h:170
xcb_ge_event_t::sequence
uint16_t sequence
Definition xcb.h:173
xcb_ge_event_t::pad
uint32_t pad[5]
Definition xcb.h:177
xcb_ge_event_t::full_sequence
uint32_t full_sequence
Definition xcb.h:178
xcb_ge_event_t::response_type
uint8_t response_type
Definition xcb.h:171
xcb_ge_event_t::pad0
uint8_t pad0
Definition xcb.h:172
xcb_generic_error_t
Generic error.
Definition xcb.h:186
xcb_generic_error_t::sequence
uint16_t sequence
Definition xcb.h:189
xcb_generic_error_t::pad0
uint8_t pad0
Definition xcb.h:193
xcb_generic_error_t::pad
uint32_t pad[5]
Definition xcb.h:194
xcb_generic_error_t::minor_code
uint16_t minor_code
Definition xcb.h:191
xcb_generic_error_t::response_type
uint8_t response_type
Definition xcb.h:187
xcb_generic_error_t::major_code
uint8_t major_code
Definition xcb.h:192
xcb_generic_error_t::full_sequence
uint32_t full_sequence
Definition xcb.h:195
xcb_generic_error_t::error_code
uint8_t error_code
Definition xcb.h:188
xcb_generic_event_t
Generic event.
Definition xcb.h:141
xcb_generic_event_t::full_sequence
uint32_t full_sequence
Definition xcb.h:146
xcb_generic_event_t::sequence
uint16_t sequence
Definition xcb.h:144
xcb_generic_event_t::pad
uint32_t pad[7]
Definition xcb.h:145
xcb_generic_event_t::pad0
uint8_t pad0
Definition xcb.h:143
xcb_generic_event_t::response_type
uint8_t response_type
Definition xcb.h:142
xcb_generic_iterator_t
Generic iterator.
Definition xcb.h:118
xcb_generic_iterator_t::rem
int rem
Definition xcb.h:120
xcb_generic_iterator_t::data
void * data
Definition xcb.h:119
xcb_generic_iterator_t::index
int index
Definition xcb.h:121
xcb_generic_reply_t
Generic reply.
Definition xcb.h:129
xcb_generic_reply_t::length
uint32_t length
Definition xcb.h:133
xcb_generic_reply_t::response_type
uint8_t response_type
Definition xcb.h:130
xcb_generic_reply_t::sequence
uint16_t sequence
Definition xcb.h:132
xcb_generic_reply_t::pad0
uint8_t pad0
Definition xcb.h:131
xcb_query_extension_reply_t
xcb_query_extension_reply_t
Definition xproto.h:4287
xcb_raw_generic_event_t
Raw Generic event.
Definition xcb.h:154
xcb_raw_generic_event_t::pad0
uint8_t pad0
Definition xcb.h:156
xcb_raw_generic_event_t::response_type
uint8_t response_type
Definition xcb.h:155
xcb_raw_generic_event_t::pad
uint32_t pad[7]
Definition xcb.h:158
xcb_raw_generic_event_t::sequence
uint16_t sequence
Definition xcb.h:157
xcb_setup_t
xcb_setup_t
Definition xproto.h:475
xcb_special_event
Definition xcb_in.c:64
xcb_void_cookie_t
Generic cookie.
Definition xcb.h:203
xcb_void_cookie_t::sequence
unsigned int sequence
Definition xcb.h:204