From 4a968d807d2ec611f443d704ae875911894c04e2 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 10 May 2020 13:44:06 +0200 Subject: A few things MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- .gitignore | 2 +- LIBAXL_HANDSHAKE_AUTHENTICATE.3 | 1 + LIBAXL_HANDSHAKE_FAILED.3 | 1 + LIBAXL_HANDSHAKE_SUCCESS.3 | 1 + LIBAXL_PROTOCOL_VERSION.3 | 27 + LIBAXL_PROTOCOL_VERSION_MAJOR.3 | 25 + LIBAXL_PROTOCOL_VERSION_MINOR.3 | 25 + Makefile | 544 ++++++++------- TODO | 1 + common.h | 6 +- internal-linux.h | 4 +- libaxl-atoms.h | 70 -- libaxl-consts.h | 266 ------- libaxl-display-info.h | 306 --------- libaxl-errors.h | 202 ------ libaxl-events.h | 538 --------------- libaxl-replies.h | 490 ------------- libaxl-requests.h | 1445 -------------------------------------- libaxl-types.h | 133 ---- libaxl.h | 227 +----- libaxl/advanced.h | 85 +++ libaxl/atoms.h | 74 ++ libaxl/consts.h | 270 ++++++++ libaxl/display-info.h | 310 +++++++++ libaxl/errors.h | 206 ++++++ libaxl/events.h | 542 +++++++++++++++ libaxl/low-level.h | 139 ++++ libaxl/replies.h | 494 +++++++++++++ libaxl/requests.h | 1449 +++++++++++++++++++++++++++++++++++++++ libaxl/types.h | 137 ++++ libaxl_attach.c | 8 + libaxl_close.c | 8 + libaxl_context_create.3 | 37 + libaxl_context_free.3 | 26 + libaxl_create.c | 15 + libaxl_deallocate_id.3 | 34 + libaxl_detach.c | 18 + libaxl_fileno.3 | 31 + libaxl_generate_id.3 | 38 + libaxl_get_tcp_port.3 | 31 + libaxl_protocol_version.3 | 40 ++ libaxl_protocol_version_major.3 | 34 + libaxl_protocol_version_major.c | 2 +- libaxl_protocol_version_minor.3 | 34 + libaxl_protocol_version_minor.c | 2 +- libaxl_send_handshake.c | 8 +- 46 files changed, 4470 insertions(+), 3916 deletions(-) create mode 120000 LIBAXL_HANDSHAKE_AUTHENTICATE.3 create mode 120000 LIBAXL_HANDSHAKE_FAILED.3 create mode 120000 LIBAXL_HANDSHAKE_SUCCESS.3 create mode 100644 LIBAXL_PROTOCOL_VERSION.3 create mode 100644 LIBAXL_PROTOCOL_VERSION_MAJOR.3 create mode 100644 LIBAXL_PROTOCOL_VERSION_MINOR.3 delete mode 100644 libaxl-atoms.h delete mode 100644 libaxl-consts.h delete mode 100644 libaxl-display-info.h delete mode 100644 libaxl-errors.h delete mode 100644 libaxl-events.h delete mode 100644 libaxl-replies.h delete mode 100644 libaxl-requests.h delete mode 100644 libaxl-types.h create mode 100644 libaxl/advanced.h create mode 100644 libaxl/atoms.h create mode 100644 libaxl/consts.h create mode 100644 libaxl/display-info.h create mode 100644 libaxl/errors.h create mode 100644 libaxl/events.h create mode 100644 libaxl/low-level.h create mode 100644 libaxl/replies.h create mode 100644 libaxl/requests.h create mode 100644 libaxl/types.h create mode 100644 libaxl_attach.c create mode 100644 libaxl_close.c create mode 100644 libaxl_context_create.3 create mode 100644 libaxl_context_free.3 create mode 100644 libaxl_create.c create mode 100644 libaxl_deallocate_id.3 create mode 100644 libaxl_detach.c create mode 100644 libaxl_fileno.3 create mode 100644 libaxl_generate_id.3 create mode 100644 libaxl_get_tcp_port.3 create mode 100644 libaxl_protocol_version.3 create mode 100644 libaxl_protocol_version_major.3 create mode 100644 libaxl_protocol_version_minor.3 diff --git a/.gitignore b/.gitignore index 9a77d83..9a14e98 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ *.so *.so.* *.lo -/libaxl-*-structs.h +/libaxl/*-structs.h diff --git a/LIBAXL_HANDSHAKE_AUTHENTICATE.3 b/LIBAXL_HANDSHAKE_AUTHENTICATE.3 new file mode 120000 index 0000000..4edbb10 --- /dev/null +++ b/LIBAXL_HANDSHAKE_AUTHENTICATE.3 @@ -0,0 +1 @@ +libaxl_receive_handshake.3 \ No newline at end of file diff --git a/LIBAXL_HANDSHAKE_FAILED.3 b/LIBAXL_HANDSHAKE_FAILED.3 new file mode 120000 index 0000000..4edbb10 --- /dev/null +++ b/LIBAXL_HANDSHAKE_FAILED.3 @@ -0,0 +1 @@ +libaxl_receive_handshake.3 \ No newline at end of file diff --git a/LIBAXL_HANDSHAKE_SUCCESS.3 b/LIBAXL_HANDSHAKE_SUCCESS.3 new file mode 120000 index 0000000..4edbb10 --- /dev/null +++ b/LIBAXL_HANDSHAKE_SUCCESS.3 @@ -0,0 +1 @@ +libaxl_receive_handshake.3 \ No newline at end of file diff --git a/LIBAXL_PROTOCOL_VERSION.3 b/LIBAXL_PROTOCOL_VERSION.3 new file mode 100644 index 0000000..cdc2c94 --- /dev/null +++ b/LIBAXL_PROTOCOL_VERSION.3 @@ -0,0 +1,27 @@ +.TH LIBAXL_PROTOCOL_VERSION 3 libaxl +.SH NAME +LIBAXL_PROTOCOL_VERSION - X protocol version +.SH SYNOPSIS +.nf +#include + +#define LIBAXL_PROTOCOL_VERSION /* value omitted */ +.fi +.SH DESCRIPTION +The +.BR LIBAXL_PROTOCOL_VERSION +macro expands to the number, as the sum +of the major number multiplied by 1000 and +the minor number, of the highest version of +the X protocol that the library, as compiled +against, supports. +.SH NOTES +There is no corresponding macro for the lowest +supported version. The lowest supported +version is 11.0 (X11); X11 was released in +September 1987 and predates Linux, thus +this is extremely unlikely this will change. +.SH SEE ALSO +.BR libaxl_protocol_version (3), +.BR LIBAXL_PROTOCOL_VERSION_MAJOR (3), +.BR LIBAXL_PROTOCOL_VERSION_MINOR (3) diff --git a/LIBAXL_PROTOCOL_VERSION_MAJOR.3 b/LIBAXL_PROTOCOL_VERSION_MAJOR.3 new file mode 100644 index 0000000..d8a0500 --- /dev/null +++ b/LIBAXL_PROTOCOL_VERSION_MAJOR.3 @@ -0,0 +1,25 @@ +.TH LIBAXL_PROTOCOL_VERSION_MAJOR 3 libaxl +.SH NAME +LIBAXL_PROTOCOL_VERSION_MAJOR - X protocol version, major number +.SH SYNOPSIS +.nf +#include + +#define LIBAXL_PROTOCOL_VERSION_MAJOR /* value omitted */ +.fi +.SH DESCRIPTION +The +.BR LIBAXL_PROTOCOL_VERSION_MAJOR +macro expands to the major number of the +highest version of the X protocol that +the library, as compiled against, supports. +.SH NOTES +There is no corresponding macro for the lowest +supported version. The lowest supported +version is 11.0 (X11); X11 was released in +September 1987 and predates Linux, thus +this is extremely unlikely this will change. +.SH SEE ALSO +.BR libaxl_protocol_version_major (3), +.BR LIBAXL_PROTOCOL_VERSION_MINOR (3), +.BR LIBAXL_PROTOCOL_VERSION (3) diff --git a/LIBAXL_PROTOCOL_VERSION_MINOR.3 b/LIBAXL_PROTOCOL_VERSION_MINOR.3 new file mode 100644 index 0000000..5a2b975 --- /dev/null +++ b/LIBAXL_PROTOCOL_VERSION_MINOR.3 @@ -0,0 +1,25 @@ +.TH LIBAXL_PROTOCOL_VERSION_MINOR 3 libaxl +.SH NAME +LIBAXL_PROTOCOL_VERSION_MINOR - X protocol version, minor number +.SH SYNOPSIS +.nf +#include + +#define LIBAXL_PROTOCOL_VERSION_MINOR /* value omitted */ +.fi +.SH DESCRIPTION +The +.BR LIBAXL_PROTOCOL_VERSION_MINOR +macro expands to the minor number of the +highest version of the X protocol that +the library, as compiled against, supports. +.SH NOTES +There is no corresponding macro for the lowest +supported version. The lowest supported +version is 11.0 (X11); X11 was released in +September 1987 and predates Linux, thus +this is extremely unlikely this will change. +.SH SEE ALSO +.BR libaxl_protocol_version_minor (3), +.BR LIBAXL_PROTOCOL_VERSION_MAJOR (3), +.BR LIBAXL_PROTOCOL_VERSION (3) diff --git a/Makefile b/Makefile index d7ea856..b894be7 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,12 @@ include $(CONFIGFILE) include $(OSCONFIGFILE) OBJ =\ + libaxl_attach.o\ + libaxl_close.o\ libaxl_context_create.o\ libaxl_context_free.o\ + libaxl_create.o\ + libaxl_detach.o\ libaxl_fileno.o\ libaxl_flush.o\ libaxl_generate_id.o\ @@ -22,29 +26,37 @@ OBJ =\ libaxl_next_depth.o\ libaxl_next_screen.o\ libaxl_parse_display.o\ + libaxl_protocol_version.o\ libaxl_protocol_version_major.o\ libaxl_protocol_version_minor.o\ - libaxl_protocol_version.o\ libaxl_receive.o\ libaxl_receive_handshake.o\ libaxl_send_handshake.o\ libaxl_send_request.o +LIB_SUBHDR_GEN =\ + libaxl/errors-structs.h\ + libaxl/events-structs.h\ + libaxl/replies-structs.h\ + libaxl/requests-ptr-structs.h\ + libaxl/requests-structs.h + +LIB_SUBHDR =\ + libaxl/advanced.h\ + libaxl/atoms.h\ + libaxl/consts.h\ + libaxl/display-info.h\ + libaxl/errors.h\ + libaxl/events.h\ + libaxl/low-level.h\ + libaxl/replies.h\ + libaxl/requests.h\ + libaxl/types.h\ + $(LIB_SUBHDR_GEN) + LIB_HDR =\ libaxl.h\ - libaxl-atoms.h\ - libaxl-consts.h\ - libaxl-errors.h\ - libaxl-errors-structs.h\ - libaxl-events.h\ - libaxl-events-structs.h\ - libaxl-replies.h\ - libaxl-replies-structs.h\ - libaxl-requests.h\ - libaxl-requests-ptr-structs.h\ - libaxl-requests-structs.h\ - libaxl-types.h\ - libaxl-display-info.h + $(LIB_SUBHDR) HDR =\ common.h\ @@ -122,161 +134,175 @@ MAN3 =\ LIBAXL_ATOM_WM_ZOOM_HINTS.3\ LIBAXL_ATOM_X_HEIGHT.3\ LIBAXL_ERROR.3\ - LIBAXL_ERROR_REQUEST.3\ - LIBAXL_ERROR_VALUE.3\ - LIBAXL_ERROR_WINDOW.3\ - LIBAXL_ERROR_PIXMAP.3\ - LIBAXL_ERROR_ATOM.3\ - LIBAXL_ERROR_CURSOR.3\ - LIBAXL_ERROR_FONT.3\ - LIBAXL_ERROR_MATCH.3\ - LIBAXL_ERROR_DRAWABLE.3\ LIBAXL_ERROR_ACCESS.3\ LIBAXL_ERROR_ALLOC.3\ + LIBAXL_ERROR_ATOM.3\ LIBAXL_ERROR_COLORMAP.3\ + LIBAXL_ERROR_CURSOR.3\ + LIBAXL_ERROR_DRAWABLE.3\ + LIBAXL_ERROR_FONT.3\ LIBAXL_ERROR_GCONTEXT.3\ LIBAXL_ERROR_ID_CHOICE.3\ - LIBAXL_ERROR_NAME.3\ - LIBAXL_ERROR_LENGTH.3\ LIBAXL_ERROR_IMPLEMENTATION.3\ - struct_libaxl_error_request.3\ - struct_libaxl_error_value.3\ - struct_libaxl_error_window.3\ - struct_libaxl_error_pixmap.3\ - struct_libaxl_error_atom.3\ - struct_libaxl_error_cursor.3\ - struct_libaxl_error_font.3\ - struct_libaxl_error_match.3\ - struct_libaxl_error_drawable.3\ - struct_libaxl_error_access.3\ - struct_libaxl_error_alloc.3\ - struct_libaxl_error_colormap.3\ - struct_libaxl_error_gcontext.3\ - struct_libaxl_error_id_choice.3\ - struct_libaxl_error_name.3\ - struct_libaxl_error_length.3\ - struct_libaxl_error_implementation.3\ - union_libaxl_error.3\ - LIBAXL_REQUEST_CREATE_WINDOW.3\ - LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES.3\ - LIBAXL_REQUEST_GET_WINDOW_ATTRIBUTES.3\ - LIBAXL_REQUEST_DESTROY_WINDOW.3\ - LIBAXL_REQUEST_DESTROY_SUBWINDOWS.3\ + LIBAXL_ERROR_LENGTH.3\ + LIBAXL_ERROR_MATCH.3\ + LIBAXL_ERROR_NAME.3\ + LIBAXL_ERROR_PIXMAP.3\ + LIBAXL_ERROR_REQUEST.3\ + LIBAXL_ERROR_VALUE.3\ + LIBAXL_ERROR_WINDOW.3\ + LIBAXL_HANDSHAKE_AUTHENTICATE.3\ + LIBAXL_HANDSHAKE_FAILED.3\ + LIBAXL_HANDSHAKE_SUCCESS.3\ + LIBAXL_PROTOCOL_VERSION.3\ + LIBAXL_PROTOCOL_VERSION_MAJOR.3\ + LIBAXL_PROTOCOL_VERSION_MINOR.3\ + LIBAXL_REQUEST_ALLOC_COLOR.3\ + LIBAXL_REQUEST_ALLOC_COLOR_CELLS.3\ + LIBAXL_REQUEST_ALLOC_COLOR_PLANES.3\ + LIBAXL_REQUEST_ALLOC_NAMED_COLOR.3\ + LIBAXL_REQUEST_ALLOW_EVENTS.3\ + LIBAXL_REQUEST_BELL.3\ + LIBAXL_REQUEST_CHANGE_ACTIVE_POINTER_GRAB.3\ + LIBAXL_REQUEST_CHANGE_GC.3\ + LIBAXL_REQUEST_CHANGE_HOSTS.3\ + LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL.3\ + LIBAXL_REQUEST_CHANGE_KEYBOARD_MAPPING.3\ + LIBAXL_REQUEST_CHANGE_POINTER_CONTROL.3\ + LIBAXL_REQUEST_CHANGE_PROPERTY.3\ LIBAXL_REQUEST_CHANGE_SAVE_SET.3\ - LIBAXL_REQUEST_REPARENT_WINDOW.3\ - LIBAXL_REQUEST_MAP_WINDOW.3\ - LIBAXL_REQUEST_MAP_SUBWINDOWS.3\ - LIBAXL_REQUEST_UNMAP_WINDOW.3\ - LIBAXL_REQUEST_UNMAP_SUBWINDOWS.3\ - LIBAXL_REQUEST_CONFIGURE_WINDOW.3\ + LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES.3\ LIBAXL_REQUEST_CIRCULATE_WINDOW.3\ - LIBAXL_REQUEST_GET_GEOMETRY.3\ - LIBAXL_REQUEST_QUERY_TREE.3\ - LIBAXL_REQUEST_INTERN_ATOM.3\ - LIBAXL_REQUEST_GET_ATOM_NAME.3\ - LIBAXL_REQUEST_CHANGE_PROPERTY.3\ + LIBAXL_REQUEST_CLEAR_AREA.3\ + LIBAXL_REQUEST_CLOSE_FONT.3\ + LIBAXL_REQUEST_CONFIGURE_WINDOW.3\ + LIBAXL_REQUEST_CONVERT_SELECTION.3\ + LIBAXL_REQUEST_COPY_AREA.3\ + LIBAXL_REQUEST_COPY_COLORMAP_AND_FREE.3\ + LIBAXL_REQUEST_COPY_GC.3\ + LIBAXL_REQUEST_COPY_PLANE.3\ + LIBAXL_REQUEST_CREATE_COLORMAP.3\ + LIBAXL_REQUEST_CREATE_CURSOR.3\ + LIBAXL_REQUEST_CREATE_GC.3\ + LIBAXL_REQUEST_CREATE_GLYPH_CURSOR.3\ + LIBAXL_REQUEST_CREATE_PIXMAP.3\ + LIBAXL_REQUEST_CREATE_WINDOW.3\ LIBAXL_REQUEST_DELETE_PROPERTY.3\ + LIBAXL_REQUEST_DESTROY_SUBWINDOWS.3\ + LIBAXL_REQUEST_DESTROY_WINDOW.3\ + LIBAXL_REQUEST_FILL_POLY.3\ + LIBAXL_REQUEST_FORCE_SCREEN_SAVER.3\ + LIBAXL_REQUEST_FREE_COLORMAP.3\ + LIBAXL_REQUEST_FREE_COLORS.3\ + LIBAXL_REQUEST_FREE_CURSOR.3\ + LIBAXL_REQUEST_FREE_GC.3\ + LIBAXL_REQUEST_FREE_PIXMAP.3\ + LIBAXL_REQUEST_GET_ATOM_NAME.3\ + LIBAXL_REQUEST_GET_FONT_PATH.3\ + LIBAXL_REQUEST_GET_GEOMETRY.3\ + LIBAXL_REQUEST_GET_IMAGE.3\ + LIBAXL_REQUEST_GET_INPUT_FOCUS.3\ + LIBAXL_REQUEST_GET_KEYBOARD_CONTROL.3\ + LIBAXL_REQUEST_GET_KEYBOARD_MAPPING.3\ + LIBAXL_REQUEST_GET_MODIFIER_MAPPING.3\ + LIBAXL_REQUEST_GET_MOTION_EVENTS.3\ + LIBAXL_REQUEST_GET_POINTER_CONTROL.3\ + LIBAXL_REQUEST_GET_POINTER_MAPPING.3\ LIBAXL_REQUEST_GET_PROPERTY.3\ - LIBAXL_REQUEST_LIST_PROPERTIES.3\ - LIBAXL_REQUEST_SET_SELECTION_OWNER.3\ + LIBAXL_REQUEST_GET_SCREEN_SAVER.3\ LIBAXL_REQUEST_GET_SELECTION_OWNER.3\ - LIBAXL_REQUEST_CONVERT_SELECTION.3\ - LIBAXL_REQUEST_SEND_EVENT.3\ - LIBAXL_REQUEST_GRAB_POINTER.3\ - LIBAXL_REQUEST_UNGRAB_POINTER.3\ + LIBAXL_REQUEST_GET_WINDOW_ATTRIBUTES.3\ LIBAXL_REQUEST_GRAB_BUTTON.3\ - LIBAXL_REQUEST_UNGRAB_BUTTON.3\ - LIBAXL_REQUEST_CHANGE_ACTIVE_POINTER_GRAB.3\ - LIBAXL_REQUEST_GRAB_KEYBOARD.3\ - LIBAXL_REQUEST_UNGRAB_KEYBOARD.3\ LIBAXL_REQUEST_GRAB_KEY.3\ - LIBAXL_REQUEST_UNGRAB_KEY.3\ - LIBAXL_REQUEST_ALLOW_EVENTS.3\ + LIBAXL_REQUEST_GRAB_KEYBOARD.3\ + LIBAXL_REQUEST_GRAB_POINTER.3\ LIBAXL_REQUEST_GRAB_SERVER.3\ - LIBAXL_REQUEST_UNGRAB_SERVER.3\ - LIBAXL_REQUEST_QUERY_POINTER.3\ - LIBAXL_REQUEST_GET_MOTION_EVENTS.3\ - LIBAXL_REQUEST_TRANSLATE_COORDINATES.3\ - LIBAXL_REQUEST_WARP_POINTER.3\ - LIBAXL_REQUEST_SET_INPUT_FOCUS.3\ - LIBAXL_REQUEST_GET_INPUT_FOCUS.3\ - LIBAXL_REQUEST_QUERY_KEYMAP.3\ - LIBAXL_REQUEST_OPEN_FONT.3\ - LIBAXL_REQUEST_CLOSE_FONT.3\ - LIBAXL_REQUEST_QUERY_FONT.3\ - LIBAXL_REQUEST_QUERY_TEXT_EXTENTS.3\ + LIBAXL_REQUEST_IMAGE_TEXT.3\ + LIBAXL_REQUEST_IMAGE_TEXT.3\ + LIBAXL_REQUEST_INSTALL_COLORMAP.3\ + LIBAXL_REQUEST_INTERN_ATOM.3\ + LIBAXL_REQUEST_KILL_CLIENT.3\ + LIBAXL_REQUEST_LIST_EXTENSIONS.3\ LIBAXL_REQUEST_LIST_FONTS.3\ LIBAXL_REQUEST_LIST_FONTS_WITH_INFO.3\ - LIBAXL_REQUEST_SET_FONT_PATH.3\ - LIBAXL_REQUEST_GET_FONT_PATH.3\ - LIBAXL_REQUEST_CREATE_PIXMAP.3\ - LIBAXL_REQUEST_FREE_PIXMAP.3\ - LIBAXL_REQUEST_CREATE_GC.3\ - LIBAXL_REQUEST_CHANGE_GC.3\ - LIBAXL_REQUEST_COPY_GC.3\ - LIBAXL_REQUEST_SET_DASHES.3\ - LIBAXL_REQUEST_SET_CLIP_RECTANGLES.3\ - LIBAXL_REQUEST_FREE_GC.3\ - LIBAXL_REQUEST_CLEAR_AREA.3\ - LIBAXL_REQUEST_COPY_AREA.3\ - LIBAXL_REQUEST_COPY_PLANE.3\ - LIBAXL_REQUEST_POLY_POINT.3\ - LIBAXL_REQUEST_POLY_LINE.3\ - LIBAXL_REQUEST_POLY_SEGMENT.3\ - LIBAXL_REQUEST_POLY_RECTANGLE.3\ + LIBAXL_REQUEST_LIST_HOSTS.3\ + LIBAXL_REQUEST_LIST_INSTALLED_COLORMAPS.3\ + LIBAXL_REQUEST_LIST_PROPERTIES.3\ + LIBAXL_REQUEST_LOOKUP_COLOR.3\ + LIBAXL_REQUEST_MAP_SUBWINDOWS.3\ + LIBAXL_REQUEST_MAP_WINDOW.3\ + LIBAXL_REQUEST_NO_OPERATION.3\ + LIBAXL_REQUEST_OPEN_FONT.3\ LIBAXL_REQUEST_POLY_ARC.3\ - LIBAXL_REQUEST_FILL_POLY.3\ - LIBAXL_REQUEST_POLY_FILL_RECTANGLE.3\ LIBAXL_REQUEST_POLY_FILL_ARC.3\ - LIBAXL_REQUEST_PUT_IMAGE.3\ - LIBAXL_REQUEST_GET_IMAGE.3\ + LIBAXL_REQUEST_POLY_FILL_RECTANGLE.3\ + LIBAXL_REQUEST_POLY_LINE.3\ + LIBAXL_REQUEST_POLY_POINT.3\ + LIBAXL_REQUEST_POLY_RECTANGLE.3\ + LIBAXL_REQUEST_POLY_SEGMENT.3\ LIBAXL_REQUEST_POLY_TEXT.3\ LIBAXL_REQUEST_POLY_TEXT.3\ - LIBAXL_REQUEST_IMAGE_TEXT.3\ - LIBAXL_REQUEST_IMAGE_TEXT.3\ - LIBAXL_REQUEST_CREATE_COLORMAP.3\ - LIBAXL_REQUEST_FREE_COLORMAP.3\ - LIBAXL_REQUEST_COPY_COLORMAP_AND_FREE.3\ - LIBAXL_REQUEST_INSTALL_COLORMAP.3\ - LIBAXL_REQUEST_UNINSTALL_COLORMAP.3\ - LIBAXL_REQUEST_LIST_INSTALLED_COLORMAPS.3\ - LIBAXL_REQUEST_ALLOC_COLOR.3\ - LIBAXL_REQUEST_ALLOC_NAMED_COLOR.3\ - LIBAXL_REQUEST_ALLOC_COLOR_CELLS.3\ - LIBAXL_REQUEST_ALLOC_COLOR_PLANES.3\ - LIBAXL_REQUEST_FREE_COLORS.3\ - LIBAXL_REQUEST_STORE_COLORS.3\ - LIBAXL_REQUEST_STORE_NAMED_COLOR.3\ - LIBAXL_REQUEST_QUERY_COLORS.3\ - LIBAXL_REQUEST_LOOKUP_COLOR.3\ - LIBAXL_REQUEST_CREATE_CURSOR.3\ - LIBAXL_REQUEST_CREATE_GLYPH_CURSOR.3\ - LIBAXL_REQUEST_FREE_CURSOR.3\ - LIBAXL_REQUEST_RECOLOR_CURSOR.3\ + LIBAXL_REQUEST_PUT_IMAGE.3\ LIBAXL_REQUEST_QUERY_BEST_SIZE.3\ + LIBAXL_REQUEST_QUERY_COLORS.3\ LIBAXL_REQUEST_QUERY_EXTENSION.3\ - LIBAXL_REQUEST_LIST_EXTENSIONS.3\ - LIBAXL_REQUEST_CHANGE_KEYBOARD_MAPPING.3\ - LIBAXL_REQUEST_GET_KEYBOARD_MAPPING.3\ - LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL.3\ - LIBAXL_REQUEST_GET_KEYBOARD_CONTROL.3\ - LIBAXL_REQUEST_BELL.3\ - LIBAXL_REQUEST_CHANGE_POINTER_CONTROL.3\ - LIBAXL_REQUEST_GET_POINTER_CONTROL.3\ - LIBAXL_REQUEST_SET_SCREEN_SAVER.3\ - LIBAXL_REQUEST_GET_SCREEN_SAVER.3\ - LIBAXL_REQUEST_CHANGE_HOSTS.3\ - LIBAXL_REQUEST_LIST_HOSTS.3\ + LIBAXL_REQUEST_QUERY_FONT.3\ + LIBAXL_REQUEST_QUERY_KEYMAP.3\ + LIBAXL_REQUEST_QUERY_POINTER.3\ + LIBAXL_REQUEST_QUERY_TEXT_EXTENTS.3\ + LIBAXL_REQUEST_QUERY_TREE.3\ + LIBAXL_REQUEST_RECOLOR_CURSOR.3\ + LIBAXL_REQUEST_REPARENT_WINDOW.3\ + LIBAXL_REQUEST_ROTATE_PROPERTIES.3\ + LIBAXL_REQUEST_SEND_EVENT.3\ LIBAXL_REQUEST_SET_ACCESS_CONTROL.3\ + LIBAXL_REQUEST_SET_CLIP_RECTANGLES.3\ LIBAXL_REQUEST_SET_CLOSE_DOWN_MODE.3\ - LIBAXL_REQUEST_KILL_CLIENT.3\ - LIBAXL_REQUEST_ROTATE_PROPERTIES.3\ - LIBAXL_REQUEST_FORCE_SCREEN_SAVER.3\ - LIBAXL_REQUEST_SET_POINTER_MAPPING.3\ - LIBAXL_REQUEST_GET_POINTER_MAPPING.3\ + LIBAXL_REQUEST_SET_DASHES.3\ + LIBAXL_REQUEST_SET_FONT_PATH.3\ + LIBAXL_REQUEST_SET_INPUT_FOCUS.3\ LIBAXL_REQUEST_SET_MODIFIER_MAPPING.3\ - LIBAXL_REQUEST_GET_MODIFIER_MAPPING.3\ - LIBAXL_REQUEST_NO_OPERATION.3\ + LIBAXL_REQUEST_SET_POINTER_MAPPING.3\ + LIBAXL_REQUEST_SET_SCREEN_SAVER.3\ + LIBAXL_REQUEST_SET_SELECTION_OWNER.3\ + LIBAXL_REQUEST_STORE_COLORS.3\ + LIBAXL_REQUEST_STORE_NAMED_COLOR.3\ + LIBAXL_REQUEST_TRANSLATE_COORDINATES.3\ + LIBAXL_REQUEST_UNGRAB_BUTTON.3\ + LIBAXL_REQUEST_UNGRAB_KEY.3\ + LIBAXL_REQUEST_UNGRAB_KEYBOARD.3\ + LIBAXL_REQUEST_UNGRAB_POINTER.3\ + LIBAXL_REQUEST_UNGRAB_SERVER.3\ + LIBAXL_REQUEST_UNINSTALL_COLORMAP.3\ + LIBAXL_REQUEST_UNMAP_SUBWINDOWS.3\ + LIBAXL_REQUEST_UNMAP_WINDOW.3\ + LIBAXL_REQUEST_WARP_POINTER.3\ + libaxl_context_create.3\ + libaxl_context_free.3\ + libaxl_deallocate_id.3\ + libaxl_fileno.3\ + libaxl_generate_id.3\ + libaxl_get_tcp_port.3\ + libaxl_protocol_version.3\ + libaxl_protocol_version_major.3\ + libaxl_protocol_version_minor.3\ + struct_libaxl_error_access.3\ + struct_libaxl_error_alloc.3\ + struct_libaxl_error_atom.3\ + struct_libaxl_error_colormap.3\ + struct_libaxl_error_cursor.3\ + struct_libaxl_error_drawable.3\ + struct_libaxl_error_font.3\ + struct_libaxl_error_gcontext.3\ + struct_libaxl_error_id_choice.3\ + struct_libaxl_error_implementation.3\ + struct_libaxl_error_length.3\ + struct_libaxl_error_match.3\ + struct_libaxl_error_name.3\ + struct_libaxl_error_pixmap.3\ + struct_libaxl_error_request.3\ + struct_libaxl_error_value.3\ + struct_libaxl_error_window.3\ struct_libaxl_reply_alloc_color.3\ struct_libaxl_reply_alloc_color_cells.3\ struct_libaxl_reply_alloc_color_planes.3\ @@ -317,131 +343,132 @@ MAN3 =\ struct_libaxl_reply_set_modifier_mapping.3\ struct_libaxl_reply_set_pointer_mapping.3\ struct_libaxl_reply_translate_coordinates.3\ - struct_libaxl_request_create_window.3\ - struct_libaxl_request_change_window_attributes.3\ - struct_libaxl_request_get_window_attributes.3\ - struct_libaxl_request_destroy_window.3\ - struct_libaxl_request_destroy_subwindows.3\ + struct_libaxl_request_alloc_color.3\ + struct_libaxl_request_alloc_color_cells.3\ + struct_libaxl_request_alloc_color_planes.3\ + struct_libaxl_request_alloc_named_color.3\ + struct_libaxl_request_allow_events.3\ + struct_libaxl_request_bell.3\ + struct_libaxl_request_change_active_pointer_grab.3\ + struct_libaxl_request_change_gc.3\ + struct_libaxl_request_change_hosts.3\ + struct_libaxl_request_change_keyboard_control.3\ + struct_libaxl_request_change_keyboard_mapping.3\ + struct_libaxl_request_change_pointer_control.3\ + struct_libaxl_request_change_property.3\ struct_libaxl_request_change_save_set.3\ - struct_libaxl_request_reparent_window.3\ - struct_libaxl_request_map_window.3\ - struct_libaxl_request_map_subwindows.3\ - struct_libaxl_request_unmap_window.3\ - struct_libaxl_request_unmap_subwindows.3\ - struct_libaxl_request_configure_window.3\ + struct_libaxl_request_change_window_attributes.3\ struct_libaxl_request_circulate_window.3\ - struct_libaxl_request_get_geometry.3\ - struct_libaxl_request_query_tree.3\ - struct_libaxl_request_intern_atom.3\ - struct_libaxl_request_get_atom_name.3\ - struct_libaxl_request_change_property.3\ + struct_libaxl_request_clear_area.3\ + struct_libaxl_request_close_font.3\ + struct_libaxl_request_configure_window.3\ + struct_libaxl_request_convert_selection.3\ + struct_libaxl_request_copy_area.3\ + struct_libaxl_request_copy_colormap_and_free.3\ + struct_libaxl_request_copy_gc.3\ + struct_libaxl_request_copy_plane.3\ + struct_libaxl_request_create_colormap.3\ + struct_libaxl_request_create_cursor.3\ + struct_libaxl_request_create_gc.3\ + struct_libaxl_request_create_glyph_cursor.3\ + struct_libaxl_request_create_pixmap.3\ + struct_libaxl_request_create_window.3\ struct_libaxl_request_delete_property.3\ + struct_libaxl_request_destroy_subwindows.3\ + struct_libaxl_request_destroy_window.3\ + struct_libaxl_request_fill_poly.3\ + struct_libaxl_request_force_screen_saver.3\ + struct_libaxl_request_free_colormap.3\ + struct_libaxl_request_free_colors.3\ + struct_libaxl_request_free_cursor.3\ + struct_libaxl_request_free_gc.3\ + struct_libaxl_request_free_pixmap.3\ + struct_libaxl_request_get_atom_name.3\ + struct_libaxl_request_get_font_path.3\ + struct_libaxl_request_get_geometry.3\ + struct_libaxl_request_get_image.3\ + struct_libaxl_request_get_input_focus.3\ + struct_libaxl_request_get_keyboard_control.3\ + struct_libaxl_request_get_keyboard_mapping.3\ + struct_libaxl_request_get_modifier_mapping.3\ + struct_libaxl_request_get_motion_events.3\ + struct_libaxl_request_get_pointer_control.3\ + struct_libaxl_request_get_pointer_mapping.3\ struct_libaxl_request_get_property.3\ - struct_libaxl_request_list_properties.3\ - struct_libaxl_request_set_selection_owner.3\ + struct_libaxl_request_get_screen_saver.3\ struct_libaxl_request_get_selection_owner.3\ - struct_libaxl_request_convert_selection.3\ - struct_libaxl_request_send_event.3\ - struct_libaxl_request_grab_pointer.3\ - struct_libaxl_request_ungrab_pointer.3\ + struct_libaxl_request_get_window_attributes.3\ struct_libaxl_request_grab_button.3\ - struct_libaxl_request_ungrab_button.3\ - struct_libaxl_request_change_active_pointer_grab.3\ - struct_libaxl_request_grab_keyboard.3\ - struct_libaxl_request_ungrab_keyboard.3\ struct_libaxl_request_grab_key.3\ - struct_libaxl_request_ungrab_key.3\ - struct_libaxl_request_allow_events.3\ + struct_libaxl_request_grab_keyboard.3\ + struct_libaxl_request_grab_pointer.3\ struct_libaxl_request_grab_server.3\ - struct_libaxl_request_ungrab_server.3\ - struct_libaxl_request_query_pointer.3\ - struct_libaxl_request_get_motion_events.3\ - struct_libaxl_request_translate_coordinates.3\ - struct_libaxl_request_warp_pointer.3\ - struct_libaxl_request_set_input_focus.3\ - struct_libaxl_request_get_input_focus.3\ - struct_libaxl_request_query_keymap.3\ - struct_libaxl_request_open_font.3\ - struct_libaxl_request_close_font.3\ - struct_libaxl_request_query_font.3\ - struct_libaxl_request_query_text_extents.3\ + struct_libaxl_request_image_text.3\ + struct_libaxl_request_image_text.3\ + struct_libaxl_request_install_colormap.3\ + struct_libaxl_request_intern_atom.3\ + struct_libaxl_request_kill_client.3\ + struct_libaxl_request_list_extensions.3\ struct_libaxl_request_list_fonts.3\ struct_libaxl_request_list_fonts_with_info.3\ - struct_libaxl_request_set_font_path.3\ - struct_libaxl_request_get_font_path.3\ - struct_libaxl_request_create_pixmap.3\ - struct_libaxl_request_free_pixmap.3\ - struct_libaxl_request_create_gc.3\ - struct_libaxl_request_change_gc.3\ - struct_libaxl_request_copy_gc.3\ - struct_libaxl_request_set_dashes.3\ - struct_libaxl_request_set_clip_rectangles.3\ - struct_libaxl_request_free_gc.3\ - struct_libaxl_request_clear_area.3\ - struct_libaxl_request_copy_area.3\ - struct_libaxl_request_copy_plane.3\ - struct_libaxl_request_poly_point.3\ - struct_libaxl_request_poly_line.3\ - struct_libaxl_request_poly_segment.3\ - struct_libaxl_request_poly_rectangle.3\ + struct_libaxl_request_list_hosts.3\ + struct_libaxl_request_list_installed_colormaps.3\ + struct_libaxl_request_list_properties.3\ + struct_libaxl_request_lookup_color.3\ + struct_libaxl_request_map_subwindows.3\ + struct_libaxl_request_map_window.3\ + struct_libaxl_request_no_operation.3\ + struct_libaxl_request_open_font.3\ struct_libaxl_request_poly_arc.3\ - struct_libaxl_request_fill_poly.3\ - struct_libaxl_request_poly_fill_rectangle.3\ struct_libaxl_request_poly_fill_arc.3\ - struct_libaxl_request_put_image.3\ - struct_libaxl_request_get_image.3\ + struct_libaxl_request_poly_fill_rectangle.3\ + struct_libaxl_request_poly_line.3\ + struct_libaxl_request_poly_point.3\ + struct_libaxl_request_poly_rectangle.3\ + struct_libaxl_request_poly_segment.3\ struct_libaxl_request_poly_text.3\ struct_libaxl_request_poly_text.3\ - struct_libaxl_request_image_text.3\ - struct_libaxl_request_image_text.3\ - struct_libaxl_request_create_colormap.3\ - struct_libaxl_request_free_colormap.3\ - struct_libaxl_request_copy_colormap_and_free.3\ - struct_libaxl_request_install_colormap.3\ - struct_libaxl_request_uninstall_colormap.3\ - struct_libaxl_request_list_installed_colormaps.3\ - struct_libaxl_request_alloc_color.3\ - struct_libaxl_request_alloc_named_color.3\ - struct_libaxl_request_alloc_color_cells.3\ - struct_libaxl_request_alloc_color_planes.3\ - struct_libaxl_request_free_colors.3\ - struct_libaxl_request_store_colors.3\ - struct_libaxl_request_store_named_color.3\ - struct_libaxl_request_query_colors.3\ - struct_libaxl_request_lookup_color.3\ - struct_libaxl_request_create_cursor.3\ - struct_libaxl_request_create_glyph_cursor.3\ - struct_libaxl_request_free_cursor.3\ - struct_libaxl_request_recolor_cursor.3\ + struct_libaxl_request_put_image.3\ struct_libaxl_request_query_best_size.3\ + struct_libaxl_request_query_colors.3\ struct_libaxl_request_query_extension.3\ - struct_libaxl_request_list_extensions.3\ - struct_libaxl_request_change_keyboard_mapping.3\ - struct_libaxl_request_get_keyboard_mapping.3\ - struct_libaxl_request_change_keyboard_control.3\ - struct_libaxl_request_get_keyboard_control.3\ - struct_libaxl_request_bell.3\ - struct_libaxl_request_change_pointer_control.3\ - struct_libaxl_request_get_pointer_control.3\ - struct_libaxl_request_set_screen_saver.3\ - struct_libaxl_request_get_screen_saver.3\ - struct_libaxl_request_change_hosts.3\ - struct_libaxl_request_list_hosts.3\ + struct_libaxl_request_query_font.3\ + struct_libaxl_request_query_keymap.3\ + struct_libaxl_request_query_pointer.3\ + struct_libaxl_request_query_text_extents.3\ + struct_libaxl_request_query_tree.3\ + struct_libaxl_request_recolor_cursor.3\ + struct_libaxl_request_reparent_window.3\ + struct_libaxl_request_rotate_properties.3\ + struct_libaxl_request_send_event.3\ struct_libaxl_request_set_access_control.3\ + struct_libaxl_request_set_clip_rectangles.3\ struct_libaxl_request_set_close_down_mode.3\ - struct_libaxl_request_kill_client.3\ - struct_libaxl_request_rotate_properties.3\ - struct_libaxl_request_force_screen_saver.3\ - struct_libaxl_request_set_pointer_mapping.3\ - struct_libaxl_request_get_pointer_mapping.3\ + struct_libaxl_request_set_dashes.3\ + struct_libaxl_request_set_font_path.3\ + struct_libaxl_request_set_input_focus.3\ struct_libaxl_request_set_modifier_mapping.3\ - struct_libaxl_request_get_modifier_mapping.3\ - struct_libaxl_request_no_operation.3 + struct_libaxl_request_set_pointer_mapping.3\ + struct_libaxl_request_set_screen_saver.3\ + struct_libaxl_request_set_selection_owner.3\ + struct_libaxl_request_store_colors.3\ + struct_libaxl_request_store_named_color.3\ + struct_libaxl_request_translate_coordinates.3\ + struct_libaxl_request_ungrab_button.3\ + struct_libaxl_request_ungrab_key.3\ + struct_libaxl_request_ungrab_keyboard.3\ + struct_libaxl_request_ungrab_pointer.3\ + struct_libaxl_request_ungrab_server.3\ + struct_libaxl_request_uninstall_colormap.3\ + struct_libaxl_request_unmap_subwindows.3\ + struct_libaxl_request_unmap_window.3\ + struct_libaxl_request_warp_pointer.3\ + union_libaxl_error.3 LOBJ = $(OBJ:.o=.lo) -all: libaxl.a libaxl.$(LIBEXT) $(LIB_HDR) +all: libaxl.a libaxl.$(LIBEXT) $(LIB_SUBHDR_GEN) $(OBJ): $(@:.o=.c) $(HDR) $(LOBJ): $(@:.lo=.c) $(HDR) @@ -451,20 +478,20 @@ $(LOBJ): $(@:.lo=.c) $(HDR) .c.lo: $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS) -libaxl-errors-structs.h: libaxl-errors.h - sed -n 's/^struct libaxl_error_\([^ \t]*\).*$$/\tstruct libaxl_error_\1 \1;/p' < libaxl-errors.h > $@ +libaxl/errors-structs.h: libaxl/errors.h + sed -n 's/^struct libaxl_error_\([^ \t]*\).*$$/\tstruct libaxl_error_\1 \1;/p' < libaxl/errors.h > $@ -libaxl-events-structs.h: libaxl-events.h - sed -n 's/^struct libaxl_event_\([^ \t]*\).*$$/\tstruct libaxl_event_\1 \1;/p' < libaxl-events.h > $@ +libaxl/events-structs.h: libaxl/events.h + sed -n 's/^struct libaxl_event_\([^ \t]*\).*$$/\tstruct libaxl_event_\1 \1;/p' < libaxl/events.h > $@ -libaxl-replies-structs.h: libaxl-replies.h - sed -n 's/^struct libaxl_reply_\([^ \t]*\).*$$/\tstruct libaxl_reply_\1 \1;/p' < libaxl-replies.h > $@ +libaxl/replies-structs.h: libaxl/replies.h + sed -n 's/^struct libaxl_reply_\([^ \t]*\).*$$/\tstruct libaxl_reply_\1 \1;/p' < libaxl/replies.h > $@ -libaxl-requests-ptr-structs.h: libaxl-requests.h - sed -n 's/^struct libaxl_request_\([^ \t]*\).*$$/\tconst struct libaxl_request_\1 \*\1;/p' < libaxl-requests.h > $@ +libaxl/requests-ptr-structs.h: libaxl/requests.h + sed -n 's/^struct libaxl_request_\([^ \t]*\).*$$/\tconst struct libaxl_request_\1 \*\1;/p' < libaxl/requests.h > $@ -libaxl-requests-structs.h: libaxl-requests.h - sed -n 's/^struct libaxl_request_\([^ \t]*\).*$$/\tstruct libaxl_request_\1 \1;/p' < libaxl-requests.h > $@ +libaxl/requests-structs.h: libaxl/requests.h + sed -n 's/^struct libaxl_request_\([^ \t]*\).*$$/\tstruct libaxl_request_\1 \1;/p' < libaxl/requests.h > $@ libaxl.a: $(OBJ) $(AR) rc $@ $? @@ -474,12 +501,13 @@ libaxl.$(LIBEXT): $(LOBJ) $(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS) install: libaxl.a libaxl.$(LIBEXT) - mkdir -p -- "$(DESTDIR)$(PREFIX)/include" + mkdir -p -- "$(DESTDIR)$(PREFIX)/include/libaxl" mkdir -p -- "$(DESTDIR)$(PREFIX)/lib" # mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man0" # mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man3" # mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man7" cp -- libaxl.h "$(DESTDIR)$(PREFIX)/include" + cp -- $(LIB_SUBHDR) "$(DESTDIR)$(PREFIX)/include/libaxl" cp -- libaxl.a "$(DESTDIR)$(PREFIX)/lib" cp -- libaxl.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libaxl.$(LIBMINOREXT)" ln -sf -- libaxl.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libaxl.$(LIBMAJOREXT)" @@ -499,7 +527,7 @@ uninstall: # -cd -- "$(DESTDIR)$(MANPREFIX)/man7/" && rm -f -- $(MAN7) clean: - -rm -f -- *.o *.lo *.a *.su *.$(LIBEXT) libaxl-*-structs.h + -rm -f -- *.o *.lo *.a *.su *.$(LIBEXT) libaxl/*-structs.h .SUFFIXES: .SUFFIXES: .lo .o .c diff --git a/TODO b/TODO index bfaa09a..14536aa 100644 --- a/TODO +++ b/TODO @@ -1,2 +1,3 @@ Man pages: check italic–bold consistency Man pages: check values of constants +Add libaxl_connect diff --git a/common.h b/common.h index c265cee..aee5172 100644 --- a/common.h +++ b/common.h @@ -55,10 +55,10 @@ DEFINE_CHECKED(ssize_t, __checked_ssize_t) #define X_TCP_PORT 6000 -struct libaxl_connection { /* TODO add serialisation functions, add close and detach functions */ +struct libaxl_connection { /* TODO add serialisation functions */ int fd; uint16_t last_seqnum; - LIBAXL_CONNECTION_RWLOCK; /* INIT_LIBAXL_CONNECTION_RWLOCK(&.) */ + LIBAXL_CONNECTION_RWLOCK; LIBAXL_CONTEXT *pending_out; size_t in_progress; size_t in_buf_size; @@ -66,7 +66,7 @@ struct libaxl_connection { /* TODO add serialisation functions, add close and de uint32_t xid_base; uint32_t xid_max; uint32_t xid_shift; - volatile _Atomic uint32_t xid_last; /* atomic_init(&.xid_last, 0) */ + volatile _Atomic uint32_t xid_last; uint8_t request_map[1UL << 16]; struct libaxl_display_info info; char *info_buf; diff --git a/internal-linux.h b/internal-linux.h index 4fb2ee3..553a783 100644 --- a/internal-linux.h +++ b/internal-linux.h @@ -26,13 +26,13 @@ _Static_assert(sizeof(MUTEX) == sizeof(uint32_t)); do {\ atomic_store(&(MUTEX), 0);\ if (syscall(SYS_futex, &(MUTEX), FUTEX_PRIVATE_FLAG | FUTEX_WAKE, INT_MAX, NULL, 0, 0) < 0) {\ - /* TODO */\ + /* TODO handle of error in _UNLOCK */\ }\ } while (0) #define _WAIT(MUTEX)\ do {\ if (syscall(SYS_futex, &(MUTEX), FUTEX_PRIVATE_FLAG | FUTEX_WAIT, 1, NULL, 0, 0) < 0) {\ - /* TODO */\ + /* TODO handle of error in _WAIT */\ }\ } while (0) diff --git a/libaxl-atoms.h b/libaxl-atoms.h deleted file mode 100644 index 140d769..0000000 --- a/libaxl-atoms.h +++ /dev/null @@ -1,70 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#define LIBAXL_ATOM_PRIMARY 1 -#define LIBAXL_ATOM_SECONDARY 2 -#define LIBAXL_ATOM_ARC 3 -#define LIBAXL_ATOM_ATOM 4 -#define LIBAXL_ATOM_BITMAP 5 -#define LIBAXL_ATOM_CARDINAL 6 -#define LIBAXL_ATOM_COLORMAP 7 -#define LIBAXL_ATOM_CURSOR 8 -#define LIBAXL_ATOM_CUT_BUFFER0 9 -#define LIBAXL_ATOM_CUT_BUFFER1 10 -#define LIBAXL_ATOM_CUT_BUFFER2 11 -#define LIBAXL_ATOM_CUT_BUFFER3 12 -#define LIBAXL_ATOM_CUT_BUFFER4 13 -#define LIBAXL_ATOM_CUT_BUFFER5 14 -#define LIBAXL_ATOM_CUT_BUFFER6 15 -#define LIBAXL_ATOM_CUT_BUFFER7 16 -#define LIBAXL_ATOM_DRAWABLE 17 -#define LIBAXL_ATOM_FONT 18 -#define LIBAXL_ATOM_INTEGER 19 -#define LIBAXL_ATOM_PIXMAP 20 -#define LIBAXL_ATOM_POINT 21 -#define LIBAXL_ATOM_RECTANGLE 22 -#define LIBAXL_ATOM_RESOURCE_MANAGER 23 -#define LIBAXL_ATOM_RGB_COLOR_MAP 24 -#define LIBAXL_ATOM_RGB_BEST_MAP 25 -#define LIBAXL_ATOM_RGB_BLUE_MAP 26 -#define LIBAXL_ATOM_RGB_DEFAULT_MAP 27 -#define LIBAXL_ATOM_RGB_GRAY_MAP 28 -#define LIBAXL_ATOM_RGB_GREEN_MAP 29 -#define LIBAXL_ATOM_RGB_RED_MAP 30 -#define LIBAXL_ATOM_STRING 31 -#define LIBAXL_ATOM_VISUALID 32 -#define LIBAXL_ATOM_WINDOW 33 -#define LIBAXL_ATOM_WM_COMMAND 34 -#define LIBAXL_ATOM_WM_HINTS 35 -#define LIBAXL_ATOM_WM_CLIENT_MACHINE 36 -#define LIBAXL_ATOM_WM_ICON_NAME 37 -#define LIBAXL_ATOM_WM_ICON_SIZE 38 -#define LIBAXL_ATOM_WM_NAME 39 -#define LIBAXL_ATOM_WM_NORMAL_HINTS 40 -#define LIBAXL_ATOM_WM_SIZE_HINTS 41 -#define LIBAXL_ATOM_WM_ZOOM_HINTS 42 -#define LIBAXL_ATOM_MIN_SPACE 43 -#define LIBAXL_ATOM_NORM_SPACE 44 -#define LIBAXL_ATOM_MAX_SPACE 45 -#define LIBAXL_ATOM_END_SPACE 46 -#define LIBAXL_ATOM_SUPERSCRIPT_X 47 -#define LIBAXL_ATOM_SUPERSCRIPT_Y 48 -#define LIBAXL_ATOM_SUBSCRIPT_X 49 -#define LIBAXL_ATOM_SUBSCRIPT_Y 50 -#define LIBAXL_ATOM_UNDERLINE_POSITION 51 -#define LIBAXL_ATOM_UNDERLINE_THICKNESS 52 -#define LIBAXL_ATOM_STRIKEOUT_ASCENT 53 -#define LIBAXL_ATOM_STRIKEOUT_DESCENT 54 -#define LIBAXL_ATOM_ITALIC_ANGLE 55 -#define LIBAXL_ATOM_X_HEIGHT 56 -#define LIBAXL_ATOM_QUAD_WIDTH 57 -#define LIBAXL_ATOM_WEIGHT 58 -#define LIBAXL_ATOM_POINT_SIZE 59 -#define LIBAXL_ATOM_RESOLUTION 60 -#define LIBAXL_ATOM_COPYRIGHT 61 -#define LIBAXL_ATOM_NOTICE 62 -#define LIBAXL_ATOM_FONT_NAME 63 -#define LIBAXL_ATOM_FAMILY_NAME 64 -#define LIBAXL_ATOM_FULL_NAME 65 -#define LIBAXL_ATOM_CAP_HEIGHT 66 -#define LIBAXL_ATOM_WM_CLASS 67 -#define LIBAXL_ATOM_WM_TRANSIENT_FOR 68 diff --git a/libaxl-consts.h b/libaxl-consts.h deleted file mode 100644 index cf6a119..0000000 --- a/libaxl-consts.h +++ /dev/null @@ -1,266 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -/* libaxl_keycode_t */ -#define LIBAXL_ANY_KEY 0 - -/* libaxl_bool_t */ -#define LIBAXL_FALSE 0 -#define LIBAXL_TRUE 1 - -/* libaxl_timestamp_t */ -#define LIBAXL_CURRENT_TIME 0 - -/* struct libaxl_host.family - struct libaxl_request_change_hosts.family */ -#define LIBAXL_INTERNET 0 /* IPv4 */ -#define LIBAXL_DECNET 1 /* DECnet */ -#define LIBAXL_CHAOS 2 /* Chaos */ -#define LIBAXL_SERVER_INTERPRETED 5 /* Server Interpreted */ -#define LIBAXL_INTERNET_V6 6 /* IPv6 */ - -/* union libaxl_text_item8 - union libaxl_text_item16 */ -#define LIBAXL_FONT_SHIFT_INDICATOR 255 - -/* struct libaxl_coloritem.flags - struct libaxl_request_store_named_color.flags */ -#define LIBAXL_RED 0x01 -#define LIBAXL_GREEN 0x02 -#define LIBAXL_BLUE 0x04 - -/* struct libaxl_request_set_clip_rectangles.ordering */ -#define LIBAXL_UNSORTED 0 -#define LIBAXL_YSORTED 1 -#define LIBAXL_YXSORTED 2 -#define LIBAXL_YXBANDED 3 - -/* struct libaxl_request_force_screen_saver.mode */ -#define LIBAXL_RESET 0 -#define LIBAXL_ACTIVATE 1 - -/* struct libaxl_request_query_best_size.class */ -#define LIBAXL_CURSOR 0 -#define LIBAXL_TILE 1 -#define LIBAXL_STIPPLE 2 - -/* struct libaxl_request_circulate_windo.direction */ -#define LIBAXL_RAISE_LOWEST 0 -#define LIBAXL_LOWER_HIGHEST 1 - -/* struct libaxl_request_allow_events.mode */ -#define LIBAXL_ASYNC_POINTER 0 -#define LIBAXL_SYNC_POINTER 1 -#define LIBAXL_REPLAY_POINTER 2 -#define LIBAXL_ASYNC_KEYBOARD 3 -#define LIBAXL_SYNC_KEYBOARD 4 -#define LIBAXL_REPLAY_KEYBOARD 5 -#define LIBAXL_ASYNC_BOTH 6 -#define LIBAXL_SYNC_BOTH 7 - -/* struct libaxl_request_change_property.mode */ -#define LIBAXL_REPLACE 0 -#define LIBAXL_PREPEND 1 -#define LIBAXL_APPEND 2 - -/* struct libaxl_request_send_event.destination */ -#define LIBAXL_POINTER_WINDOW 0 -#define LIBAXL_INPUT_FOCUS 1 - -/* struct libaxl_event_property_notify.state */ -#define LIBAXL_NEW_VALUE 0 -#define LIBAXL_DELETED 1 - -/* struct libaxl_event_colormap_notify.state */ -#define LIBAXL_UNINSTALLED 0 -#define LIBAXL_INSTALLED 1 - -/* struct libaxl_event_mapping_notify.request */ -#define LIBAXL_MODIFIER 0 -#define LIBAXL_KEYBOARD 1 -#define LIBAXL_POINTER 2 - -/* struct libaxl_visual_type.class */ -#define LIBAXL_STATIC_GRAY 0 -#define LIBAXL_GRAY_SCALE 1 -#define LIBAXL_STATIC_COLOR 2 -#define LIBAXL_PSEUDO_COLOR 3 -#define LIBAXL_TRUE_COLOR 4 -#define LIBAXL_DIRECT_COLOR 5 - -/* circatulation place */ -#define LIBAXL_TOP 0 -#define LIBAXL_BOTTOM 1 - -/* cap style */ -#define LIBAXL_CAP_NOT_LAST 0 -#define LIBAXL_CAP_BUTT 1 -#define LIBAXL_CAP_ROUND 2 -#define LIBAXL_CAP_PROJECTING 3 - -/* join style */ -#define LIBAXL_JOIN_MITER 0 -#define LIBAXL_JOIN_ROUND 1 -#define LIBAXL_JOIN_BEVEL 2 - -/* map state */ -#define LIBAXL_UNMAPPED 0 -#define LIBAXL_UNVIEWABLE 1 -#define LIBAXL_VIEWABLE 2 - -/* gcontext function */ -#define LIBAXL_CLEAR 0 -#define LIBAXL_AND 1 -#define LIBAXL_AND_REVERSE 2 -#define LIBAXL_COPY 3 -#define LIBAXL_AND_INVERTED 4 -#define LIBAXL_NO_OP 5 -#define LIBAXL_XOR 6 -#define LIBAXL_OR 7 -#define LIBAXL_NOR 8 -#define LIBAXL_EQUIV 9 -#define LIBAXL_INVERT 10 -#define LIBAXL_OR_REVERSE 11 -#define LIBAXL_COPY_INVERTED 12 -#define LIBAXL_OR_INVERTED 13 -#define LIBAXL_NAND 14 -#define LIBAXL_SET 15 - -/* close down mode */ -#define LIBAXL_DESTROY 0 -#define LIBAXL_RETAIN_PERMANENT 1 -#define LIBAXL_RETAIN_TEMPORARY 2 - -/* visibility state */ -#define LIBAXL_UNOBSCURED 0 -#define LIBAXL_PARTIALLY_OBSCURED 1 -#define LIBAXL_FULLY_OBSCURED 2 - -/* bitgravity and wingravity */ -#define LIBAXL_FORGET 0 /* bitgravity */ -#define LIBAXL_UNMAP 0 /* wingravity */ -#define LIBAXL_NORTH_WEST 1 -#define LIBAXL_NORTH 2 -#define LIBAXL_NORTH_EAST 3 -#define LIBAXL_WEST 4 -#define LIBAXL_CENTER 5 -#define LIBAXL_EAST 6 -#define LIBAXL_SOUTH_WEST 7 -#define LIBAXL_SOUTH 8 -#define LIBAXL_SOUTH_EAST 9 -#define LIBAXL_STATIC 10 - -/* synchronicity */ -#define LIBAXL_SYNCHRONOUS 0 -#define LIBAXL_ASYNCHRONOUS 1 - -/* image formats */ -#define LIBAXL_BITMAP 0 -#define LIBAXL_XYPIXMAP 1 -#define LIBAXL_ZPIXMAP 2 - -/* buttons */ -#define LIBAXL_ANY_BUTTON 0 - -/* draw directions */ -#define LIBAXL_LEFT_TO_RIGHT 0 -#define LIBAXL_RIGHT_TO_LEFT 1 - -/* fill rule */ -#define LIBAXL_EVEN_ODD 0 -#define LIBAXL_WINDING 1 - -/* fill style and line style */ -#define LIBAXL_SOLID 0 -#define LIBAXL_TILED 1 /* fill style */ -#define LIBAXL_STIPPLED 2 /* fill style */ -#define LIBAXL_OPAQUE_STIPPLED 3 /* fill style */ -#define LIBAXL_ON_OFF_DASH 1 /* line style */ -#define LIBAXL_DOUBLE_DASH 2 /* line style */ - -/* polygon shape */ -#define LIBAXL_COMPLEX 0 -#define LIBAXL_NONCONVEX 1 -#define LIBAXL_CONVEX 2 - -/* arc mode */ -#define LIBAXL_CHORD 0 -#define LIBAXL_PIE_SLICE 1 - -/* grab mode (includes LIBAXL_NORMAL) */ -#define LIBAXL_GRAB 1 -#define LIBAXL_UNGRAB 2 -#define LIBAXL_WHILE_GRABBED 3 - -/* grab status (includes LIBAXL_SUCCESS) */ -#define LIBAXL_ALREADY_GRABBED 1 -#define LIBAXL_INVALID_TIME 2 -#define LIBAXL_NOT_VIEWABLE 3 -#define LIBAXL_FROZEN 4 - -/* coordinate mode */ -#define LIBAXL_ORIGIN 0 -#define LIBAXL_PREVIOUS 1 - -/* enabled status */ -#define LIBAXL_DISABLE 0 -#define LIBAXL_DISABLED 0 -#define LIBAXL_ENABLE 1 -#define LIBAXL_ENABLED 1 - -/* window class */ -#define LIBAXL_INPUT_OUTPUT 1 -#define LIBAXL_INPUT_ONLY 2 - -/* subwindow mode */ -#define LIBAXL_CLIP_BY_CHILDREN 0 -#define LIBAXL_INCLUDE_INFERIORS 1 - -/* backing store */ -#define LIBAXL_NOT_USEFUL 0 /* Not used in `struct libaxl_screen.backing_stores` */ -#define LIBAXL_NEVER 0 /* Used in `struct libaxl_screen.backing_stores` */ -#define LIBAXL_WHEN_MAPPED 1 -#define LIBAXL_ALWAYS 2 - -/* change mode */ -#define LIBAXL_INSERT 0 -#define LIBAXL_DELETE 1 - -/* stack mode */ -#define LIBAXL_ABOVE 0 -#define LIBAXL_BELOW 1 -#define LIBAXL_TOP_IF 2 -#define LIBAXL_BOTTOM_IF 3 -#define LIBAXL_OPPOSITE 4 - -/* pointer window detail and window focus details */ -#define LIBAXL_ANCESTOR 0 -#define LIBAXL_VIRTUAL 1 -#define LIBAXL_INFERIOR 2 -#define LIBAXL_NONLINEAR 3 -#define LIBAXL_NONLINEAR_VIRTUAL 4 -/* window focus details */ -#define LIBAXL_FOCUS_POINTER 5 /* Just called Pointer in the specification */ -#define LIBAXL_FOCUS_POINTER_ROOT 6 /* Just called PointerRoot in the specification */ -#define LIBAXL_FOCUS_NONE 7 /* Just called None in the specification */ - -/* misc. */ -#define LIBAXL_ANY_PROPERTY_TYPE 0 -#define LIBAXL_ALL_TEMPORARY 0 -#define LIBAXL_PARENT_RELATIVE 1 -#define LIBAXL_HINT 1 -#define LIBAXL_ALL 1 - -/* generic */ -#define LIBAXL_NONE 0 -#define LIBAXL_NORMAL 0 -#define LIBAXL_SUCCESS 0 -#define LIBAXL_BUSY 1 -#define LIBAXL_FAILED 2 -#define LIBAXL_NO 0 -#define LIBAXL_YES 1 -#define LIBAXL_DEFAULT 2 -#define LIBAXL_OFF 0 -#define LIBAXL_ON 1 -#define LIBAXL_COPY_FROM_PARENT 0 -#define LIBAXL_POINTER_ROOT 1 -#define LIBAXL_PARENT 2 diff --git a/libaxl-display-info.h b/libaxl-display-info.h deleted file mode 100644 index 1d00a67..0000000 --- a/libaxl-display-info.h +++ /dev/null @@ -1,306 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -/** - * The highest number of the `struct_version` field in - * `struct libaxl_display_info` that this header file - * supports - */ -#define LIBAXL_DISPLAY_INFO_VERSION 0 - -/** - * Standard byte orders - */ -enum libaxl_byte_order { - /** - * Least significant byte first - */ - LIBAXL_LSB_FIRST, - - /** - * Most significant byte first - */ - LIBAXL_MSB_FIRST -}; - -/** - * Standard bit orders - */ -enum libaxl_bit_order { - /** - * Least significant bit leftmost - */ - LIBAXL_LSB_LEFTMOST, - - /** - * Most significant bit leftmost - */ - LIBAXL_MSB_LEFTMOST -}; - -struct libaxl_format { - uint8_t depth; - uint8_t bits_per_pixel; - uint8_t scanline_pad; - uint8_t __unused[5]; -}; - -struct libaxl_visual_type { - libaxl_visual_t visual_id; - uint8_t class; /* LIBAXL_STATIC_GRAY, LIBAXL_GRAY_SCALE, LIBAXL_STATIC_COLOR, - * LIBAXL_PSEUDO_COLOR, LIBAXL_TRUE_COLOR, LIBAXL_DIRECT_COLOR */ - uint8_t bits_per_rgb_value; - uint16_t colormap_entries; - uint32_t red_mask; - uint32_t green_mask; - uint32_t blue_mask; - uint32_t __unused; -}; - -struct libaxl_depth { - uint8_t depth; - uint8_t __pad; - uint16_t number_of_visuals; - uint32_t __unused; - struct libaxl_visual_type visuals[]; -}; - -/** - * Screen information - */ -struct libaxl_screen { - /** - * The root window of the screen - * - * This is always an LIBAXL_INPUT_OUTPUT window - */ - libaxl_window_t root; - - /** - * The map initially associated with the root window - * - * Windows with minimal colour requires may want to - * use this colormap if they use the same depth as - * the root window. - */ - libaxl_colormap_t default_colormap; - - /** - * Bright colour usable for implementing monochrome - * applications using `.default_colormap` - * - * This colour is permanently allocated - * - * May be set to a dark colour on some screens - * (that what the colours to be inverted); the - * actual RGB value is unspecified and may any - * colour and not necessarily black or white - */ - uint32_t white_pixel; - - /** - * Dark colour usable for implementing monochrome - * applications using `.default_colormap` - * - * This colour is permanently allocated - * - * May be set to a bright colour on some screens - * (that what the colours to be inverted); the - * actual RGB value is unspecified and may any - * colour and not necessarily black or white - */ - uint32_t black_pixel; - - uint32_t current_input_masks; /* TODO SETofEVENTS */ - - /** - * The width, in pixels, of the root window; - * which cannot be changed in the core protocol - * - * This value will not update when root window - * is resized, but new connections may get an - * update value - */ - uint16_t width_in_pixels; - - /** - * The height, in pixels, of the root window; - * which cannot be changed in the core protocol - * - * This value will not update when root window - * is resized, but new connections may get an - * update value - */ - uint16_t height_in_pixels; - - /** - * The width, in millimeters, of the root window; - * which cannot be changed in the core protocol - * - * This value will not update when root window - * is resized or the monitor is changed - * - * Note that the horizontal and vertical DPI - * (dots per inch) of a monitor are not - * necessarily equal to each other - */ - uint16_t width_in_millimeters; - - /** - * The height, in millimeters, of the root window; - * which cannot be changed in the core protocol - * - * This value will not update when root window - * is resized or the monitor is changed - * - * Note that the horizontal and vertical DPI - * (dots per inch) of a monitor are not - * necessarily equal to each other - */ - uint16_t height_in_millimeters; - - uint16_t min_installed_maps; - uint16_t max_installed_maps; - libaxl_visual_t root_visual; - uint8_t backing_stores; - libaxl_bool_t save_under; - uint8_t root_depth; - uint8_t number_of_allowed_depths; - struct libaxl_depth allowed_depths[]; -}; - -/** - * Information about the display, display server, and connection - */ -struct libaxl_display_info { - /** - * The version number of this structure that this library uses. - * When using dynamic linking, is important use the version that - * is the lowest of the number stored in this field and the - * number stored in the LIBAXL_DISPLAY_INFO_VERSION constant. - */ - int struct_version; /* TODO set when creating LIBAXL_CONNECTION */ - - /* SINCE STRUCT VERSION 0: */ - - /** - * The major number of version of the protocol negotiated - * between the client and the server. This is not necessarily - * the same number as returned in the second parameter of - * the libaxl_receive_handshake() function. - */ - int protocol_version_major; - - /** - * The minor number of version of the protocol negotiated - * between the client and the server. This is not necessarily - * the same number as returned in the third parameter of - * the libaxl_receive_handshake() function. - */ - int protocol_version_minor; - - /** - * The version of the protocol negotiated between the client - * and the server, encoded as the sum of the major number - * multipled by 10000 and the minor number. - */ - int protocol_version; - - /** - * The byte order generally used in communication with the - * display server - */ - enum libaxl_byte_order protocol_byte_order; - - /** - * The byte order used in images - */ - enum libaxl_byte_order image_byte_order; - - /** - * The smallest keycode transmitted by the server - * - * Will never be less than 8 - */ - unsigned int min_keycode; - - /** - * The greatest keycode transmitted by the server - * - * This field has the `unsigned int` type rather than the - * `libaxl_keycode_t` type because the latter is restricted - * to 8-bits, and a future version of the protocol could - * theoretically use a larger value - */ - unsigned int max_keycode; - - /** - * Some identification of the owner of the server implementation - */ - const char *vendor; - - /** - * Release number for the implementation. The vendor controls - * the semantics of this number. - */ - uint32_t vendor_release; - - /** - * The bit order used in the units in the scanlines of bitmaps - */ - enum libaxl_bit_order bitmap_format_bit_order; - - /** - * Number of bits (will be a multiple of 8) that the scanlines - * in bitmaps are quantised into units of - * - * Will never greater than `bitmap_format_scanline_pad` - */ - size_t bitmap_format_scanline_unit; - - /** - * Number of bits (will be a multiple of 8), that scanlines in - * bitmaps are padded to - */ - size_t bitmap_format_scanline_pad; - - /** - * The server may retain recent pointer motion history with - * finer granularity than is reported by LIBAXL_EVENT_MOTION_NOTIFY - * events, and which may be requested with - * LIBAXL_REQUEST_GET_MOTION_EVENTS requests - */ - size_t motion_buffer_size; - - /** - * The maximum value that can may appear in the length field - * in requests (that field is filled in by the library). Any - * requests larger than this (it is in byte-quads, meaning - * that it is multipled by 4 to get limit in bytes) generate - * a LIBAXL_ERROR_LENGTH error and the request is discarded. - * - * This field will always be at least 4096 (meaning 16384 bytes) - */ - size_t maximum_request_length; - - /** - * The number of elements in `.formats` - */ - size_t nformats; - - const struct libaxl_format *formats; /* TODO doc */ - - /** - * The number of elements in `.screens` - */ - size_t nscreens; - - /** - * List of all screens in the display - */ - const struct libaxl_format *screens; - - /** - * The default screen - */ - const struct libaxl_format *default_screen; -}; diff --git a/libaxl-errors.h b/libaxl-errors.h deleted file mode 100644 index c1b8a92..0000000 --- a/libaxl-errors.h +++ /dev/null @@ -1,202 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#define LIBAXL_ERROR 0 - -struct libaxl_error_request { -#define LIBAXL_ERROR_REQUEST 1 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t __unused1; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_value { -#define LIBAXL_ERROR_VALUE 2 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t bad_value; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_window { -#define LIBAXL_ERROR_WINDOW 3 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t bad_resource_id; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_pixmap { -#define LIBAXL_ERROR_PIXMAP 4 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t bad_resource_id; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_atom { -#define LIBAXL_ERROR_ATOM 5 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t bad_resource_id; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_cursor { -#define LIBAXL_ERROR_CURSOR 6 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t bad_resource_id; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_font { -#define LIBAXL_ERROR_FONT 7 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t bad_resource_id; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_match { -#define LIBAXL_ERROR_MATCH 8 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t __unused1; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_drawable { -#define LIBAXL_ERROR_DRAWABLE 9 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t bad_resource_id; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_access { -#define LIBAXL_ERROR_ACCESS 10 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t __unused1; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_alloc { -#define LIBAXL_ERROR_ALLOC 11 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t __unused1; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_colormap { -#define LIBAXL_ERROR_COLORMAP 12 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t bad_resource_id; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_gcontext { -#define LIBAXL_ERROR_GCONTEXT 13 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t bad_resource_id; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_id_choice { -#define LIBAXL_ERROR_ID_CHOICE 14 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t bad_resource_id; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_name { -#define LIBAXL_ERROR_NAME 15 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t __unused1; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_length { -#define LIBAXL_ERROR_LENGTH 16 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t __unused1; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_error_implementation { -#define LIBAXL_ERROR_IMPLEMENTATION 17 - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t __unused1; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -union libaxl_error { - struct { - uint8_t __zero; - uint8_t code; - uint16_t sequence_number; - uint32_t __detail; - uint16_t minor_opcode; - uint8_t major_opcode; - }; -#include "libaxl-errors-structs.h" -}; diff --git a/libaxl-events.h b/libaxl-events.h deleted file mode 100644 index ed47f3d..0000000 --- a/libaxl-events.h +++ /dev/null @@ -1,538 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -struct libaxl_event_key_press { -#define LIBAXL_EVENT_KEY_PRESS 2 - uint8_t code; - libaxl_keycode_t detail; - uint16_t sequence_number; - libaxl_timestamp_t time; - libaxl_window_t root; - libaxl_window_t event; - libaxl_window_t child; /* Can be LIBAXL_NONE */ - int16_t root_x; - int16_t root_y; - int16_t event_x; - int16_t event_y; - libaxl_keybutmask_t state; - libaxl_bool_t same_screen; - uint8_t __unused[1]; -}; - -struct libaxl_event_key_release { -#define LIBAXL_EVENT_KEY_RELEASE 3 - uint8_t code; - libaxl_keycode_t detail; - uint16_t sequence_number; - libaxl_timestamp_t time; - libaxl_window_t root; - libaxl_window_t event; - libaxl_window_t child; /* Can be LIBAXL_NONE */ - int16_t root_x; - int16_t root_y; - int16_t event_x; - int16_t event_y; - libaxl_keybutmask_t state; - libaxl_bool_t same_screen; - uint8_t __unused[1]; -}; - -struct libaxl_event_key_press_release { - /* key_{press,release} */ - uint8_t code; - libaxl_keycode_t detail; - uint16_t sequence_number; - libaxl_timestamp_t time; - libaxl_window_t root; - libaxl_window_t event; - libaxl_window_t child; /* Can be LIBAXL_NONE */ - int16_t root_x; - int16_t root_y; - int16_t event_x; - int16_t event_y; - libaxl_keybutmask_t state; - libaxl_bool_t same_screen; - uint8_t __unused[1]; -}; - -struct libaxl_event_button_press { -#define LIBAXL_EVENT_BUTTON_PRESS 4 - uint8_t code; - libaxl_button_t detail; - uint16_t sequence_number; - libaxl_timestamp_t time; - libaxl_window_t root; - libaxl_window_t event; - libaxl_window_t child; /* Can be LIBAXL_NONE */ - int16_t root_x; - int16_t root_y; - int16_t event_x; - int16_t event_y; - libaxl_keybutmask_t state; - libaxl_bool_t same_screen; - uint8_t __unused[1]; -}; - -struct libaxl_event_button_release { -#define LIBAXL_EVENT_BUTTON_RELEASE 5 - uint8_t code; - libaxl_button_t detail; - uint16_t sequence_number; - libaxl_timestamp_t time; - libaxl_window_t root; - libaxl_window_t event; - libaxl_window_t child; /* Can be LIBAXL_NONE */ - int16_t root_x; - int16_t root_y; - int16_t event_x; - int16_t event_y; - libaxl_keybutmask_t state; - libaxl_bool_t same_screen; - uint8_t __unused[1]; -}; - -struct libaxl_event_button_press_release { - /* button_{press,release} */ - uint8_t code; - libaxl_button_t detail; - uint16_t sequence_number; - libaxl_timestamp_t time; - libaxl_window_t root; - libaxl_window_t event; - libaxl_window_t child; /* Can be LIBAXL_NONE */ - int16_t root_x; - int16_t root_y; - int16_t event_x; - int16_t event_y; - libaxl_keybutmask_t state; - libaxl_bool_t same_screen; - uint8_t __unused[1]; -}; - -struct libaxl_event_motion_notify { -#define LIBAXL_EVENT_MOTION_NOTIFY 6 - uint8_t code; - uint8_t detail; /* LIBAXL_NORMAL or LIBAXL_HINT */ - uint16_t sequence_number; - libaxl_timestamp_t time; - libaxl_window_t root; - libaxl_window_t event; - libaxl_window_t child; /* Can be LIBAXL_NONE */ - int16_t root_x; - int16_t root_y; - int16_t event_x; - int16_t event_y; - libaxl_keybutmask_t state; - libaxl_bool_t same_screen; - uint8_t __unused[1]; -}; - -struct libaxl_event_input_device_event { - /* {key,button}_{press,release}, motion_notify */ - uint8_t code; - uint8_t detail; - uint16_t sequence_number; - libaxl_timestamp_t time; - libaxl_window_t root; - libaxl_window_t event; - libaxl_window_t child; /* Can be LIBAXL_NONE */ - int16_t root_x; - int16_t root_y; - int16_t event_x; - int16_t event_y; - libaxl_keybutmask_t state; - libaxl_bool_t same_screen; - uint8_t __unused[1]; -}; - -struct libaxl_event_enter_notify { -#define LIBAXL_EVENT_ENTER_NOTIFY 7 - uint8_t code; - uint8_t detail; /* See "pointer window details" in libaxl-consts.h */ - uint16_t sequence_number; - libaxl_timestamp_t time; - libaxl_window_t root; - libaxl_window_t event; - libaxl_window_t child; /* Can be LIBAXL_NONE */ - int16_t root_x; - int16_t root_y; - int16_t event_x; - int16_t event_y; - libaxl_keybutmask_t state; - uint8_t mode; /* LIBAXL_NORMAL, LIBAXL_GRAB, or LIBAXL_UNGRAB */ - uint8_t flags; /* TODO #x01 = Focus, #x02 = Same-screen */ -}; - -struct libaxl_event_leave_notify { -#define LIBAXL_EVENT_LEAVE_NOTIFY 8 - uint8_t code; - uint8_t detail; /* See "pointer window details" in libaxl-consts.h */ - uint16_t sequence_number; - libaxl_timestamp_t time; - libaxl_window_t root; - libaxl_window_t event; - libaxl_window_t child; /* Can be LIBAXL_NONE */ - int16_t root_x; - int16_t root_y; - int16_t event_x; - int16_t event_y; - libaxl_keybutmask_t state; - uint8_t mode; /* LIBAXL_NORMAL, LIBAXL_GRAB, or LIBAXL_UNGRAB */ - uint8_t flags; /* TODO #x01 = Focus, #x02 = Same-screen */ -}; - -struct libaxl_event_pointer_window_event { - /* {enter,leave}_notify */ - uint8_t code; - uint8_t detail; /* See "pointer window details" in libaxl-consts.h */ - uint16_t sequence_number; - libaxl_timestamp_t time; - libaxl_window_t root; - libaxl_window_t event; - libaxl_window_t child; /* Can be LIBAXL_NONE */ - int16_t root_x; - int16_t root_y; - int16_t event_x; - int16_t event_y; - libaxl_keybutmask_t state; - uint8_t mode; /* LIBAXL_NORMAL, LIBAXL_GRAB, or LIBAXL_UNGRAB */ - uint8_t flags; /* TODO #x01 = Focus, #x02 = Same-screen */ -}; - -struct libaxl_event_focus_in { -#define LIBAXL_EVENT_FOCUS_IN 9 - uint8_t code; - uint8_t detail; /* See "window focus details" in libaxl-consts.h (Beware of namespacing!) */ - uint16_t sequence_number; - libaxl_window_t window; - uint8_t mode; /* LIBAXL_NORMAL, LIBAXL_GRAB, LIBAXL_UNGRAB, or LIBAXL_WHILE_GRABBED */ - uint8_t __unused[23]; -}; - -struct libaxl_event_focus_out { -#define LIBAXL_EVENT_FOCUS_OUT 10 - uint8_t code; - uint8_t detail; /* See "window focus details" in libaxl-consts.h (Beware of namespacing!) */ - uint16_t sequence_number; - libaxl_window_t window; - uint8_t mode; /* LIBAXL_NORMAL, LIBAXL_GRAB, LIBAXL_UNGRAB, or LIBAXL_WHILE_GRABBED */ - uint8_t __unused[23]; -}; - -struct libaxl_event_input_focus_event { - /* focus_{in,out} */ - uint8_t code; - uint8_t detail; /* See "window focus details" in libaxl-consts.h (Beware of namespacing!) */ - uint16_t sequence_number; - libaxl_window_t window; - uint8_t mode; /* LIBAXL_NORMAL, LIBAXL_GRAB, LIBAXL_UNGRAB, or LIBAXL_WHILE_GRABBED */ - uint8_t __unused[23]; -}; - -struct libaxl_event_keymap_notify { -#define LIBAXL_EVENT_KEYMAP_NOTIFY 11 - uint8_t code; - uint8_t keys[31]; /* Byte for keycodes 0-7, which are unused, is omitted */ -}; - -struct libaxl_event_expose { -#define LIBAXL_EVENT_EXPOSE 12 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t window; - uint16_t x; - uint16_t y; - uint16_t width; - uint16_t height; - uint16_t count; - uint8_t __unused[14]; -}; - -struct libaxl_event_graphics_exposure { -#define LIBAXL_EVENT_GRAPHICS_EXPOSURE 13 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_drawable_t drawable; - uint16_t x; - uint16_t y; - uint16_t width; - uint16_t height; - uint16_t minor_opcode; - uint16_t count; - uint8_t major_opcode; - uint8_t __unused[11]; -}; - -struct libaxl_event_no_exposure { -#define LIBAXL_EVENT_NO_EXPOSURE 14 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_drawable_t drawable; - uint16_t minor_opcode; - uint8_t major_opcode; - uint8_t __unused[21]; -}; - -struct libaxl_event_visibility_notify { -#define LIBAXL_EVENT_VISIBILITY_NOTIFY 15 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_drawable_t drawable; - uint8_t state; /* LIBAXL_UNOBSCURED, LIBAXL_PARTIALLY_OBSCURED, or LIBAXL_FULLY_OBSCURED */ - uint8_t __unused[23]; -}; - -struct libaxl_event_create_notify { -#define LIBAXL_EVENT_CREATE_NOTIFY 16 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t parent; - libaxl_window_t window; - int16_t x; - int16_t y; - int16_t width; - int16_t height; - int16_t border_width; - libaxl_bool_t override_redirect; - uint8_t __unused[9]; -}; - -struct libaxl_event_destroy_notify { -#define LIBAXL_EVENT_DESTROY_NOTIFY 17 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t event; - libaxl_window_t window; - uint8_t __unused[20]; -}; - -struct libaxl_event_unmap_notify { -#define LIBAXL_EVENT_UNMAP_NOTIFY 18 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t event; - libaxl_window_t window; - libaxl_bool_t from_configure; - uint8_t __unused[19]; -}; - -struct libaxl_event_map_notify { -#define LIBAXL_EVENT_MAP_NOTIFY 19 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t event; - libaxl_window_t window; - libaxl_bool_t override_redirect; - uint8_t __unused[19]; -}; - -struct libaxl_event_map_request { -#define LIBAXL_EVENT_MAP_REQUEST 20 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t parent; - libaxl_window_t window; - uint8_t __unused[20]; -}; - -struct libaxl_event_reparent_notify { -#define LIBAXL_EVENT_REPARENT_NOTIFY 21 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t event; - libaxl_window_t window; - libaxl_window_t parent; - int16_t x; - int16_t y; - libaxl_bool_t override_redirect; - uint8_t __unused[11]; -}; - -struct libaxl_event_configure_notify { -#define LIBAXL_EVENT_CONFIGURE_NOTIFY 22 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t event; - libaxl_window_t window; - libaxl_window_t above_sibling; /* Can be LIBAXL_NONE */ - int16_t x; - int16_t y; - uint16_t width; - uint16_t height; - uint16_t border_width; - libaxl_bool_t override_redirect; - uint8_t __unused[5]; -}; - -struct libaxl_event_configure_request { -#define LIBAXL_EVENT_CONFIGURE_REQUEST 23 - uint8_t code; - uint8_t stack_mode; /* See "stack mode" in libaxl-consts.h */ - uint16_t sequence_number; - libaxl_window_t event; - libaxl_window_t window; - libaxl_window_t sibling; /* Can be LIBAXL_NONE */ - int16_t x; - int16_t y; - uint16_t width; - uint16_t height; - uint16_t border_width; - uint16_t value_mask; -#define LIBAXL_EVENT_CONFIGURE_REQUEST_X 0x0001U -#define LIBAXL_EVENT_CONFIGURE_REQUEST_Y 0x0002U -#define LIBAXL_EVENT_CONFIGURE_REQUEST_WIDTH 0x0004U -#define LIBAXL_EVENT_CONFIGURE_REQUEST_HEIGHT 0x0008U -#define LIBAXL_EVENT_CONFIGURE_REQUEST_BORDER_WIDTH 0x0010U -#define LIBAXL_EVENT_CONFIGURE_REQUEST_SIBLING 0x0020U -#define LIBAXL_EVENT_CONFIGURE_REQUEST_STACK_MODE 0x0040U - uint8_t __unused[4]; -}; - -struct libaxl_event_gravity_notify { -#define LIBAXL_EVENT_GRAVITY_NOTIFY 24 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t event; - libaxl_window_t window; - int16_t x; - int16_t y; - uint8_t __unused[16]; -}; - -struct libaxl_event_resize_request { -#define LIBAXL_EVENT_RESIZE_REQUEST 25 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t window; - uint16_t width; - uint16_t height; - uint8_t __unused[20]; -}; - -struct libaxl_event_circulate_notify { -#define LIBAXL_EVENT_CIRCULATE_NOTIFY 26 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t event; - libaxl_window_t window; - uint32_t __unused1; - uint8_t place; /* LIBAXL_TOP or LIBAXL_BOTTOM */ - uint8_t __unused[15]; -}; - -struct libaxl_event_circulate_request { -#define LIBAXL_EVENT_CIRCULATE_REQUEST 27 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t parent; - libaxl_window_t window; - uint32_t __unused1; - uint8_t place; /* LIBAXL_TOP or LIBAXL_BOTTOM */ - uint8_t __unused[15]; -}; - -struct libaxl_event_property_notify { -#define LIBAXL_EVENT_PROPERTY_NOTIFY 28 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t window; - libaxl_atom_t atom; - uint8_t state; /* LIBAXL_NEW_VALUE or LIBAXL_DELETED */ - uint8_t __unused[15]; -}; - -struct libaxl_event_selection_clear { -#define LIBAXL_EVENT_SELECTION_CLEAR 29 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_timestamp_t time; - libaxl_window_t owner; - libaxl_atom_t selection; - uint8_t __unused[16]; -}; - -struct libaxl_event_selection_request { -#define LIBAXL_EVENT_SELECTION_REQUEST 30 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ - libaxl_window_t owner; - libaxl_window_t requestor; - libaxl_atom_t selection; - libaxl_atom_t target; - libaxl_atom_t property; /* Can be LIBAXL_NONE */ - uint8_t __unused[4]; -}; - -struct libaxl_event_selection_notify { -#define LIBAXL_EVENT_SELECTION_NOTIFY 31 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ - libaxl_window_t requestor; - libaxl_atom_t selection; - libaxl_atom_t target; - libaxl_atom_t property; /* Can be LIBAXL_NONE */ - uint8_t __unused[8]; -}; - -struct libaxl_event_colormap_notify { -#define LIBAXL_EVENT_COLORMAP_NOTIFY 32 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - libaxl_window_t requestor; - libaxl_colormap_t colormap; /* Can be LIBAXL_NONE */ - libaxl_bool_t new; - uint8_t state; /* LIBAXL_UNINSTALLED or LIBAXL_INSTALLED */ - uint8_t __unused[18]; -}; - -struct libaxl_event_client_message { -#define LIBAXL_EVENT_CLIENT_MESSAGE 33 - uint8_t code; - uint8_t format; /* {8, 16, 32} */ - uint16_t sequence_number; - libaxl_window_t window; - libaxl_atom_t type; - union { - uint8_t u8[20]; - uint16_t u16[10]; - uint32_t u32[5]; - } data; -}; - -struct libaxl_event_mapping_notify { -#define LIBAXL_EVENT_MAPPING_NOTIFY 34 - uint8_t code; - uint8_t __pad; - uint16_t sequence_number; - uint8_t request; /* LIBAXL_MODIFIER, LIBAXL_KEYBOARD, or LIBAXL_POINTER */ - libaxl_keycode_t first_keycode; - uint8_t count; - uint8_t __unused[25]; -}; - -union libaxl_event { - uint8_t code; /* Highest bit marks the event as sent with SendEvent */ - /* .keymap_notify does not have a sequence number */ -#include "libaxl-events-structs.h" -}; diff --git a/libaxl-replies.h b/libaxl-replies.h deleted file mode 100644 index 30e02a1..0000000 --- a/libaxl-replies.h +++ /dev/null @@ -1,490 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#define LIBAXL_REPLY 1 /* TODO man */ - -struct libaxl_reply_get_window_attributes { - uint8_t __one; - uint8_t backing_store; /* LIBAXL_NOT_USEFUL, LIBAXL_WHEN_MAPPED, or LIBAXL_ALWAYS */ - uint16_t sequence_number; - uint32_t _reply_length; /* = 3 */ - libaxl_visual_t visual; - uint16_t class; /* LIBAXL_INPUT_OUTPUT (= 1) or LIBAXL_INPUT_ONLY (= 2) */ - uint8_t bit_gravity; - uint8_t win_gravity; - uint32_t backing_planes; - uint32_t backing_pixel; - libaxl_bool_t save_under; - libaxl_bool_t map_is_installed; - uint8_t map_state; /* LIBAXL_UNMAPPED, LIBAXL_UNVIEWABLE, or LIBAXL_VIEWABLE */ - libaxl_bool_t override_redirect; - libaxl_colormap_t colormap; /* Can be LIBAXL_NONE */ - uint32_t all_event_masks; /* TODO SETofEVENT */ - uint32_t your_event_mask; /* TODO SETofEVENT */ - uint16_t do_not_propagate_mask; /* TODO SETofDEVICEEVENT */ - uint16_t __pad; -}; - -struct libaxl_reply_get_geometry { - uint8_t __one; - uint8_t depth; - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - libaxl_window_t root; - int16_t x; - int16_t y; - uint16_t width; - uint16_t height; - uint16_t border_width; - uint8_t __unused[10]; -}; - -struct libaxl_reply_query_tree { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; /* = .number_of_children */ - libaxl_window_t root; - libaxl_window_t parent; /* Can be LIBAXL_NONE */ - uint16_t number_of_children; - uint8_t __unused[14]; - libaxl_window_t *children; -}; - -struct libaxl_reply_intern_atom { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - libaxl_atom_t atom; /* Can be LIBAXL_NONE */ - uint8_t __unused[20]; -}; - -struct libaxl_reply_get_atom_name { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; - uint16_t length_of_name; - uint8_t __unused[22]; - char *name; -}; - -struct libaxl_reply_get_property { - uint8_t __one; - uint8_t format; /* {0 = 0, 8 = 8, 16 = 16, 32 = 32}*/ - uint16_t sequence_number; - uint32_t _reply_length; - libaxl_atom_t type; /* Can be LIBAXL_NONE */ - uint32_t bytes_after; - uint32_t length_of_value; /* in format units */ - uint8_t __unused[12]; - union { - char *value; - uint8_t *value8; - uint16_t *value16; - uint32_t *value32; - }; -}; - -struct libaxl_reply_list_properties { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; - uint16_t number_of_atoms; - uint8_t __unused[22]; - libaxl_atom_t *atoms; -}; - -struct libaxl_reply_get_selection_owner { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - libaxl_window_t owner; /* Can be LIBAXL_NONE */ - uint8_t __unused[20]; -}; - -struct libaxl_reply_grab_pointer { - uint8_t __one; - uint8_t status; /* See "grab status" in libaxl-consts.h */ - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - uint8_t __unused[24]; -}; - -struct libaxl_reply_grab_keyboard { - uint8_t __one; - uint8_t status; /* See "grab status" in libaxl-consts.h */ - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - uint8_t __unused[24]; -}; - -struct libaxl_reply_query_pointer { - uint8_t __one; - libaxl_bool_t same_screen; - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - libaxl_window_t root; - libaxl_window_t child; /* Can be LIBAXL_NONE */ - int16_t root_x; - int16_t root_y; - int16_t win_x; - int16_t win_y; - libaxl_keybutmask_t mask; /* TODO ? SETofKEYBUTMASK shouldn't have its own type */ - uint8_t __unused[6]; -}; - -struct libaxl_reply_get_motion_events { - uint8_t __one; - libaxl_bool_t same_screen; - uint16_t sequence_number; - uint32_t _reply_length; /* = 2 * .number_of_events */ - uint32_t number_of_events; - uint8_t __unused[20]; - struct libaxl_timecoord *events; -}; - -struct libaxl_reply_translate_coordinates { - uint8_t __one; - libaxl_bool_t same_screen; - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - libaxl_window_t child; /* Can be LIBAXL_NONE */ - int16_t dest_x; - int16_t dest_y; - int8_t __unused[16]; -}; - -struct libaxl_reply_get_input_focus { - uint8_t __one; - uint8_t revert_to; /* LIBAXL_NONE, LIBAXL_POINTER_ROOT, or LIBAXL_PARENT */ - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - libaxl_window_t focus; /* Can be LIBAXL_NONE or LIBAXL_POINTER_ROOT */ - int8_t __unused[20]; -}; - -struct libaxl_reply_query_keymap { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; /* = 2 */ - uint8_t keys[32]; -}; - -struct libaxl_reply_query_font { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; - struct libaxl_charinfo min_bounds; - uint32_t __unused1; - struct libaxl_charinfo max_bounds; - uint32_t __unused2; - uint16_t min_char_or_byte2; - uint16_t max_char_or_byte2; - uint16_t default_char; - uint16_t number_of_properties; - uint8_t draw_direction; /* LIBAXL_LEFT_TO_RIGHT or LIBAXL_RIGHT_TO_LEFT */ - uint8_t min_byte1; - uint8_t max_byte1; - libaxl_bool_t all_chars_exist; - int16_t font_ascent; - int16_t font_descent; - uint32_t number_of_char_infos; - struct libaxl_fontprop *properties; - struct libaxl_charinfo *char_infos; -}; - -struct libaxl_reply_query_text_extents { - uint8_t __one; - uint8_t draw_direction; /* LIBAXL_LEFT_TO_RIGHT or LIBAXL_RIGHT_TO_LEFT */ - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - int16_t font_ascent; - int16_t font_descent; - int16_t overall_ascent; - int16_t overall_descent; - int32_t overall_width; - int32_t overall_left; - int32_t overall_right; - uint8_t __unused[4]; -}; - -struct libaxl_reply_list_fonts { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; - uint16_t number_of_names; - uint8_t __unused[22]; - struct libaxl_str8 *names; -}; - -struct libaxl_reply_list_fonts_with_info { - uint8_t __one; - uint8_t length_of_name; /* 0 = end of series */ - uint16_t sequence_number; - uint32_t _reply_length; /* = 7 if .length_of_name = 0 */ - - /* the rest (52 bytes) are unused if .length_of_name = 0 */ - struct libaxl_charinfo min_bounds; - uint32_t __unused1; - struct libaxl_charinfo max_bounds; - uint32_t __unused2; - uint16_t min_char_or_byte2; - uint16_t max_char_or_byte2; - uint16_t default_char; - uint16_t number_of_properties; - uint8_t draw_direction; /* LIBAXL_LEFT_TO_RIGHT or LIBAXL_RIGHT_TO_LEFT */ - uint8_t min_byte1; - uint8_t max_byte1; - libaxl_bool_t all_chars_exist; - int16_t font_ascent; - int16_t font_descent; - uint32_t replies_hint; - struct libaxl_fontprop *properties; - char *name; -}; - -struct libaxl_reply_get_font_path { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; - uint16_t number_of_strs; - uint8_t __unused[22]; - struct libaxl_str8 *path; -}; - -struct libaxl_reply_get_image { - uint8_t __one; - uint8_t depth; - uint16_t sequence_number; - uint32_t _reply_length; - libaxl_visual_t visual; /* Can be LIBAXL_NONE */ - uint8_t __unused[20]; - size_t size_of_data; - uint8_t *data; -}; - -struct libaxl_reply_list_installed_colormaps { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; /* = .number_of_cmaps */ - uint16_t number_of_cmaps; - uint8_t __unused[22]; - libaxl_colormap_t *cmaps; -}; - -struct libaxl_reply_alloc_color { - uint8_t __one; - uint8_t __pad1; - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - uint16_t red; - uint16_t green; - uint16_t blue; - uint16_t __pad2; - uint32_t pixel; - uint8_t __unused[12]; -}; - -struct libaxl_reply_alloc_named_color { - uint8_t __one; - uint8_t __pad1; - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - uint32_t pixel; - uint16_t exact_red; - uint16_t exact_green; - uint16_t exact_blue; - uint16_t visual_red; - uint16_t visual_green; - uint16_t visual_blue; - uint8_t __unused[8]; -}; - -struct libaxl_reply_alloc_color_cells { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; - uint16_t number_of_pixels; - uint16_t number_of_masks; - uint8_t __used[20]; - uint32_t *pixels; - uint32_t *mask; -}; - -struct libaxl_reply_alloc_color_planes { - uint8_t __one; - uint8_t __pad1; - uint16_t sequence_number; - uint32_t _reply_length; /* = .number_of_pixels */ - uint16_t number_of_pixels; - uint16_t __pad2; - uint32_t red_mask; - uint32_t green_mask; - uint32_t blue_mask; - uint8_t __unused[8]; - uint32_t *pixels; -}; - -struct libaxl_reply_query_colors { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; /* = 2 * .number_of_colors */ - uint16_t number_of_colors; - uint8_t __unused[22]; - struct libaxl_rgb16 *colors; -}; - -struct libaxl_reply_lookup_color { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - uint16_t exact_red; - uint16_t exact_green; - uint16_t exact_blue; - uint16_t visual_red; - uint16_t visual_green; - uint16_t visual_blue; - uint8_t __unused[12]; -}; - -struct libaxl_reply_query_best_size { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - uint16_t width; - uint16_t height; - uint8_t __unused[20]; -}; - -struct libaxl_reply_query_extension { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - libaxl_bool_t present; - uint8_t major_opcode; - uint8_t first_event; - uint8_t first_error; - uint8_t __unused[20]; -}; - -struct libaxl_reply_list_extensions { - uint8_t __one; - uint8_t number_of_names; - uint16_t sequence_number; - uint32_t _reply_length; - uint8_t __unused[24]; - struct libaxl_str8 *names; -}; - -struct libaxl_reply_get_keyboard_mapping { - uint8_t __one; - uint8_t keysyms_per_keycode; - uint16_t sequence_number; - uint32_t _reply_length; /* = count field from the request divided by .keysyms_per_keycode */ - uint8_t __unused[24]; - libaxl_keysym_t *keysyms; -}; - -struct libaxl_reply_get_keyboard_control { - uint8_t __one; - uint8_t global_auto_repeat; /* LIBAXL_OFF or LIBAXL_ON */ - uint16_t sequence_number; - uint32_t _reply_length; /* = 5 */ - uint32_t led_mask; - uint8_t key_click_percent; - uint8_t bell_percent; - uint16_t bell_pitch; - uint16_t bell_duration; - uint16_t __unused; - uint8_t auto_repeats[32]; -}; - -struct libaxl_reply_get_pointer_control { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - uint16_t acceleration_numerator; - uint16_t acceleration_denominator; - uint16_t threshold; - uint8_t __unused[18]; -}; - -struct libaxl_reply_get_screen_saver { - uint8_t __one; - uint8_t __pad; - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - uint16_t timeout; - uint16_t interval; - uint8_t prefer_blanking; /* LIBAXL_NO or LIBAXL_YES */ - uint8_t allow_exposures; /* LIBAXL_NO or LIBAXL_YES */ - uint8_t __unused[18]; -}; - -struct libaxl_reply_list_hosts { - uint8_t __one; - uint8_t mode; /* LIBAXL_DISABLED or LIBAXL_ENABLED */ - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - uint16_t number_of_hosts; - uint8_t __unused[22]; - struct libaxl_host *hosts; -}; - -struct libaxl_reply_set_pointer_mapping { - uint8_t __one; - uint8_t status; /* LIBAXL_SUCCESS or LIBAXL_BUSY */ - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - uint8_t __unused[24]; -}; - -struct libaxl_reply_get_pointer_mapping { - uint8_t __one; - uint8_t length_of_map; - uint16_t sequence_number; - uint32_t _reply_length; - uint8_t __unused[24]; - uint8_t *map; -}; - -struct libaxl_reply_set_modifier_mapping { - uint8_t __one; - uint8_t status; /* LIBAXL_SUCCESS, LIBAXL_BUSY, or LIBAXL_FAILED */ - uint16_t sequence_number; - uint32_t _reply_length; /* = 0 */ - uint8_t __unused[24]; -}; - -struct libaxl_reply_get_modifier_mapping { - uint8_t __one; - uint8_t keycodes_per_modifier; /* pairs */ - uint16_t sequence_number; - uint32_t _reply_length; /* = 2 * .keycodes_per_modifier */ - uint8_t __unused[24]; - libaxl_keycode_t *keycodes; -}; - -union libaxl_reply { - struct { - uint8_t __one; - uint8_t __data; - uint16_t sequence_number; - uint32_t _reply_length; - }; -#include "libaxl-replies-structs.h" -}; diff --git a/libaxl-requests.h b/libaxl-requests.h deleted file mode 100644 index f0a6279..0000000 --- a/libaxl-requests.h +++ /dev/null @@ -1,1445 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -struct libaxl_request_create_window { -#define LIBAXL_REQUEST_CREATE_WINDOW 1 - uint8_t opcode; - uint8_t depth; - uint16_t _request_length; - libaxl_window_t wid; - libaxl_window_t parent; - int16_t x; - int16_t y; - uint16_t width; - uint16_t height; - uint16_t border_width; - uint16_t class; /* LIBAXL_COPY_FROM_PARENT, LIBAXL_INPUT_OUTPUT, or LIBAXL_INPUT_ONLY */ - libaxl_visual_t visual; /* Can be LIBAXL_COPY_FROM_PARENT */ - uint32_t value_mask; /* Determines which below are included, all are encoded as uint32_t */ -#define LIBAXL_REQUEST_CREATE_WINDOW_BACKGROUND_PIXMAP 0x00000001UL -#define LIBAXL_REQUEST_CREATE_WINDOW_BACKGROUND_PIXEL 0x00000002UL -#define LIBAXL_REQUEST_CREATE_WINDOW_BORDER_PIXMAP 0x00000004UL -#define LIBAXL_REQUEST_CREATE_WINDOW_BORDER_PIXEL 0x00000008UL -#define LIBAXL_REQUEST_CREATE_WINDOW_BIT_GRAVITY 0x00000010UL -#define LIBAXL_REQUEST_CREATE_WINDOW_WIN_GRAVITY 0x00000020UL -#define LIBAXL_REQUEST_CREATE_WINDOW_BACKING_STORE 0x00000040UL -#define LIBAXL_REQUEST_CREATE_WINDOW_BACKING_PLANES 0x00000080UL -#define LIBAXL_REQUEST_CREATE_WINDOW_BACKING_PIXEL 0x00000100UL -#define LIBAXL_REQUEST_CREATE_WINDOW_OVERRIDE_REDIRECT 0x00000200UL -#define LIBAXL_REQUEST_CREATE_WINDOW_SAVE_UNDER 0x00000400UL -#define LIBAXL_REQUEST_CREATE_WINDOW_EVENT_MASK 0x00000800UL -#define LIBAXL_REQUEST_CREATE_WINDOW_DO_NOT_PROPAGATE_MASK 0x00001000UL -#define LIBAXL_REQUEST_CREATE_WINDOW_COLORMAP 0x00002000UL -#define LIBAXL_REQUEST_CREATE_WINDOW_CURSOR 0x00004000UL - libaxl_pixmap_t background_pixmap; /* Can be LIBAXL_NONE or LIBAXL_PARENT_RELATIVE */ - uint32_t background_pixel; - libaxl_pixmap_t border_pixmap; /* Can be LIBAXL_COPY_FROM_PARENT */ - uint32_t border_pixel; - uint8_t bit_gravity; - uint8_t win_gravity; - uint8_t backing_store; /* LIBAXL_NOT_USEFUL, LIBAXL_WHEN_MAPPED, or LIBAXL_ALWAYS */ - uint8_t __omitted1; - uint32_t backing_planes; - uint32_t backing_pixel; - libaxl_bool_t override_redirect; - libaxl_bool_t save_under; - uint16_t __omitted2; - uint32_t event_mask; /* TODO SETofEVENT */ - uint32_t do_not_propagate_mask; /* TODO SETofDEVICEEVENT */ - libaxl_colormap_t colormap; /* Can be LIBAXL_COPY_FROM_PARENT */ - libaxl_cursor_t cursor; /* Can be LIBAXL_NONE */ -}; - -struct libaxl_request_change_window_attributes { -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES 2 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - libaxl_window_t window; - uint32_t value_mask; /* Determines which below are included, all are encoded as uint32_t */ -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BACKGROUND_PIXMAP 0x00000001UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BACKGROUND_PIXEL 0x00000002UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BORDER_PIXMAP 0x00000004UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BORDER_PIXEL 0x00000008UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BIT_GRAVITY 0x00000010UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_WIN_GRAVITY 0x00000020UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BACKING_STORE 0x00000040UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BACKING_PLANES 0x00000080UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BACKING_PIXEL 0x00000100UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_OVERRIDE_REDIRECT 0x00000200UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_SAVE_UNDER 0x00000400UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_EVENT_MASK 0x00000800UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_DO_NOT_PROPAGATE_MASK 0x00001000UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_COLORMAP 0x00002000UL -#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_CURSOR 0x00004000UL - libaxl_pixmap_t background_pixmap; /* Can be LIBAXL_NONE or LIBAXL_PARENT_RELATIVE */ - uint32_t background_pixel; - libaxl_pixmap_t border_pixmap; /* Can be LIBAXL_COPY_FROM_PARENT */ - uint32_t border_pixel; - uint8_t bit_gravity; - uint8_t win_gravity; - uint8_t backing_store; /* LIBAXL_NOT_USEFUL, LIBAXL_WHEN_MAPPED, or LIBAXL_ALWAYS */ - uint8_t __omitted1; - uint32_t backing_planes; - uint32_t backing_pixel; - libaxl_bool_t override_redirect; - libaxl_bool_t save_under; - uint16_t __omitted2; - uint32_t event_mask; /* TODO SETofEVENT */ - uint32_t do_not_propagate_mask; /* TODO SETofDEVICEEVENT */ - libaxl_colormap_t colormap; /* Can be LIBAXL_COPY_FROM_PARENT */ - libaxl_cursor_t cursor; /* Can be LIBAXL_NONE */ -}; - -struct libaxl_request_get_window_attributes { -#define LIBAXL_REQUEST_GET_WINDOW_ATTRIBUTES 3 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_window_t window; -}; - -struct libaxl_request_destroy_window { -#define LIBAXL_REQUEST_DESTROY_WINDOW 4 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_window_t window; -}; - -struct libaxl_request_destroy_subwindows { -#define LIBAXL_REQUEST_DESTROY_SUBWINDOWS 5 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_window_t window; -}; - -struct libaxl_request_change_save_set { -#define LIBAXL_REQUEST_CHANGE_SAVE_SET 6 - uint8_t opcode; - uint8_t mode; /* LIBAXL_INSERT or LIBAXL_DELETE */ - uint16_t _request_length; /* = 2 */ - libaxl_window_t window; -}; - -struct libaxl_request_reparent_window { -#define LIBAXL_REQUEST_REPARENT_WINDOW 7 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 4 */ - libaxl_window_t window; - libaxl_window_t parent; - int16_t x; - int16_t y; -}; - -struct libaxl_request_map_window { -#define LIBAXL_REQUEST_MAP_WINDOW 8 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_window_t window; -}; - -struct libaxl_request_map_subwindows { -#define LIBAXL_REQUEST_MAP_SUBWINDOWS 9 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_window_t window; -}; - -struct libaxl_request_unmap_window { -#define LIBAXL_REQUEST_UNMAP_WINDOW 10 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_window_t window; -}; - -struct libaxl_request_unmap_subwindows { -#define LIBAXL_REQUEST_UNMAP_SUBWINDOWS 11 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_window_t window; -}; - -struct libaxl_request_configure_window { -#define LIBAXL_REQUEST_CONFIGURE_WINDOW 12 - uint8_t opcode; - uint8_t __pad1; - uint16_t _request_length; - libaxl_window_t window; - uint16_t value_mask; /* Determines which below are included, all are encoded as uint32_t */ -#define LIBAXL_REQUEST_CONFIGURE_WINDOW_X 0x0001U -#define LIBAXL_REQUEST_CONFIGURE_WINDOW_Y 0x0002U -#define LIBAXL_REQUEST_CONFIGURE_WINDOW_WIDTH 0x0004U -#define LIBAXL_REQUEST_CONFIGURE_WINDOW_HEIGHT 0x0008U -#define LIBAXL_REQUEST_CONFIGURE_WINDOW_BORDER_WIDTH 0x0010U -#define LIBAXL_REQUEST_CONFIGURE_WINDOW_SIBLING 0x0020U -#define LIBAXL_REQUEST_CONFIGURE_WINDOW_STACK_MODE 0x0040U - uint16_t __pad2; - int16_t x; - int16_t y; - uint16_t width; - uint16_t height; - uint16_t border_width; - uint16_t __omitted1; - libaxl_window_t sibling; - uint8_t stack_mode; /* See "stack mode" in libaxl-consts.h */ - uint8_t __omitted2[3]; -}; - -struct libaxl_request_circulate_window { -#define LIBAXL_REQUEST_CIRCULATE_WINDOW 13 - uint8_t opcode; - uint8_t direction; /* LIBAXL_RAISE_LOWEST or LIBAXL_LOWER_HIGHEST */ - uint16_t _request_length; /* = 2 */ - libaxl_window_t window; -}; - -struct libaxl_request_get_geometry { -#define LIBAXL_REQUEST_GET_GEOMETRY 14 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_drawable_t drawable; -}; - -struct libaxl_request_query_tree { -#define LIBAXL_REQUEST_QUERY_TREE 15 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_window_t window; -}; - -struct libaxl_request_intern_atom { -#define LIBAXL_REQUEST_INTERN_ATOM 16 - uint8_t opcode; - libaxl_bool_t only_if_exists; - uint16_t _request_length; - uint16_t length_of_name; - uint16_t __pad; - char *name; -}; - -struct libaxl_request_get_atom_name { -#define LIBAXL_REQUEST_GET_ATOM_NAME 17 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_atom_t atom; -}; - -struct libaxl_request_change_property { -#define LIBAXL_REQUEST_CHANGE_PROPERTY 18 - uint8_t opcode; - uint8_t mode; /* See libaxl-consts.h */ - uint16_t _request_length; - libaxl_window_t window; - libaxl_atom_t property; - libaxl_atom_t type; - uint8_t format; /* {8, 16, 32} */ - uint8_t __pad[3]; - uint32_t length_of_data; /* in format units */ - union { - char *data; - uint8_t *data8; - uint16_t *data16; - uint32_t *data32; - }; -}; - -struct libaxl_request_delete_property { -#define LIBAXL_REQUEST_DELETE_PROPERTY 19 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 3 */ - libaxl_window_t window; - libaxl_atom_t property; -}; - -struct libaxl_request_get_property { -#define LIBAXL_REQUEST_GET_PROPERTY 20 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 6 */ - libaxl_window_t window; - libaxl_atom_t property; - libaxl_atom_t type; /* Can be LIBAXL_ANY_PROPERTY_TYPE */ - uint32_t offset; - uint32_t length; -}; - -struct libaxl_request_list_properties { -#define LIBAXL_REQUEST_LIST_PROPERTIES 21 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_window_t window; -}; - -struct libaxl_request_set_selection_owner { -#define LIBAXL_REQUEST_SET_SELECTION_OWNER 22 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 4 */ - libaxl_window_t owner; /* Can be LIBAXL_NONE */ - libaxl_atom_t selection; - libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ -}; - -struct libaxl_request_get_selection_owner { -#define LIBAXL_REQUEST_GET_SELECTION_OWNER 23 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_atom_t selection; -}; - -struct libaxl_request_convert_selection { -#define LIBAXL_REQUEST_CONVERT_SELECTION 24 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 5 */ - libaxl_atom_t selection; - libaxl_atom_t target; - libaxl_atom_t property; /* Can be LIBAXL_NONE */ - libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ -}; - -struct libaxl_request_send_event { -#define LIBAXL_REQUEST_SEND_EVENT 25 - uint8_t opcode; - libaxl_bool_t propagate; - uint16_t _request_length; /* = 11 */ - libaxl_window_t destination; /* Can be LIBAXL_POINTER_WINDOW or LIBAXL_INPUT_FOCUS */ - uint32_t event_mask; /* TODO SETofEVENT */ - union libaxl_event event; -}; - -struct libaxl_request_grab_pointer { -#define LIBAXL_REQUEST_GRAB_POINTER 26 - uint8_t opcode; - libaxl_bool_t owner_events; - uint16_t _request_length; /* = 6 */ - libaxl_window_t grab_window; - uint16_t event_mask; /* TODO SETofPOINTEREVENT */ - uint8_t pointer_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ - uint8_t keyboard_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ - libaxl_window_t confine_to; /* Can be LIBAXL_NONE */ - libaxl_cursor_t cursor; /* Can be LIBAXL_NONE */ - libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ -}; - -struct libaxl_request_ungrab_pointer { -#define LIBAXL_REQUEST_UNGRAB_POINTER 27 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ -}; - -struct libaxl_request_grab_button { -#define LIBAXL_REQUEST_GRAB_BUTTON 28 - uint8_t opcode; - uint8_t __pad1; - uint16_t _request_length; /* = 6 */ - libaxl_window_t grab_window; - uint16_t event_mask; /* TODO SETofPOINTEREVENT */ - uint8_t pointer_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ - uint8_t keyboard_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ - libaxl_window_t confine_to; /* Can be LIBAXL_NONE */ - libaxl_cursor_t cursor; /* Can be LIBAXL_NONE */ - uint8_t button; /* Can be LIBAXL_ANY_BUTTON */ - uint8_t __pad2; - uint16_t modifiers; /* TODO SETofKEYMASK, #x8000 = AnyModifier */ -}; - -struct libaxl_request_ungrab_button { -#define LIBAXL_REQUEST_UNGRAB_BUTTON 29 - uint8_t opcode; - uint8_t button; /* Can be LIBAXL_ANY_BUTTON */ - uint16_t _request_length; /* = 3 */ - libaxl_window_t grab_window; - uint16_t modifiers; /* TODO SETofKEYMASK, #x8000 = AnyModifier */ - uint16_t __pad; -}; - -struct libaxl_request_change_active_pointer_grab { -#define LIBAXL_REQUEST_CHANGE_ACTIVE_POINTER_GRAB 30 - uint8_t opcode; - uint8_t __pad1; - uint16_t _request_length; /* = 4 */ - libaxl_cursor_t cursor; /* Can be LIBAXL_NONE */ - libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ - uint16_t event_mask; /* TODO SETofPOINTEREVENT */ - uint16_t __pad2; -}; - -struct libaxl_request_grab_keyboard { -#define LIBAXL_REQUEST_GRAB_KEYBOARD 31 - uint8_t opcode; - libaxl_bool_t owner_events; - uint16_t _request_length; /* = 4 */ - libaxl_window_t grab_window; - libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ - uint8_t pointer_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ - uint8_t keyboard_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ - uint16_t __pad; -}; - -struct libaxl_request_ungrab_keyboard { -#define LIBAXL_REQUEST_UNGRAB_KEYBOARD 32 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ -}; - -struct libaxl_request_grab_key { -#define LIBAXL_REQUEST_GRAB_KEY 33 - uint8_t opcode; - libaxl_bool_t owner_events; - uint16_t _request_length; /* = 4 */ - libaxl_window_t grab_window; - uint16_t modifiers; /* TODO SETofKEYMASK, #x8000 = AnyModifier */ - libaxl_keycode_t key; /* Can be LIBAXL_ANY_KEY */ - uint8_t pointer_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ - uint8_t keyboard_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ - uint8_t __pad[3]; -}; - -struct libaxl_request_ungrab_key { -#define LIBAXL_REQUEST_UNGRAB_KEY 34 - uint8_t opcode; - libaxl_keycode_t key; /* Can be LIBAXL_ANY_KEY */ - uint16_t _request_length; /* = 3 */ - libaxl_window_t grab_window; - uint16_t modifiers; /* TODO SETofKEYMASK, #x8000 = AnyModifier */ - uint16_t __pad; -}; - -struct libaxl_request_allow_events { -#define LIBAXL_REQUEST_ALLOW_EVENTS 35 - uint8_t opcode; - uint8_t mode; /* See libaxl-consts.h */ - uint16_t _request_length; /* = 2 */ - libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ -}; - -struct libaxl_request_grab_server { -#define LIBAXL_REQUEST_GRAB_SERVER 36 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_ungrab_server { -#define LIBAXL_REQUEST_UNGRAB_SERVER 37 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_query_pointer { -#define LIBAXL_REQUEST_QUERY_POINTER 38 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_window_t window; -}; - -struct libaxl_request_get_motion_events { -#define LIBAXL_REQUEST_GET_MOTION_EVENTS 39 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 4 */ - libaxl_window_t window; - libaxl_timestamp_t start; /* Can be LIBAXL_CURRENT_TIME */ - libaxl_timestamp_t end; /* Can be LIBAXL_CURRENT_TIME */ -}; - -struct libaxl_request_translate_coordinates { -#define LIBAXL_REQUEST_TRANSLATE_COORDINATES 40 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 4 */ - libaxl_window_t src_window; - libaxl_window_t dest_window; - int16_t src_x; - int16_t src_y; -}; - -struct libaxl_request_warp_pointer { -#define LIBAXL_REQUEST_WARP_POINTER 41 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 6 */ - libaxl_window_t src_window; /* Can be LIBAXL_NONE */ - libaxl_window_t dest_window; /* Can be LIBAXL_NONE */ - int16_t src_x; - int16_t src_y; - uint16_t src_width; - uint16_t src_height; - int16_t dest_x; - int16_t dest_y; -}; - -struct libaxl_request_set_input_focus { -#define LIBAXL_REQUEST_SET_INPUT_FOCUS 42 - uint8_t opcode; - uint8_t revert_to; /* LIBAXL_NONE, LIBAXL_POINTER_ROOT, or LIBAXL_PARENT */ - uint16_t _request_length; /* = 3 */ - libaxl_window_t focus; /* Can be LIBAXL_NONE or LIBAXL_POINTER_ROOT */ - libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ -}; - -struct libaxl_request_get_input_focus { -#define LIBAXL_REQUEST_GET_INPUT_FOCUS 43 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_query_keymap { -#define LIBAXL_REQUEST_QUERY_KEYMAP 44 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_open_font { -#define LIBAXL_REQUEST_OPEN_FONT 45 - uint8_t opcode; - uint8_t __pad1; - uint16_t _request_length; - libaxl_font_t fid; - uint16_t length_of_name; - uint16_t __pad2; - char *name; -}; - -struct libaxl_request_close_font { -#define LIBAXL_REQUEST_CLOSE_FONT 46 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - libaxl_font_t font; -}; - -struct libaxl_request_query_font { -#define LIBAXL_REQUEST_QUERY_FONT 47 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - libaxl_fontable_t font; -}; - -struct libaxl_request_query_text_extents { -#define LIBAXL_REQUEST_QUERY_TEXT_EXTENTS 48 - uint8_t opcode; - libaxl_bool_t _odd_length; - uint16_t _request_length; - libaxl_fontable_t font; - size_t length_of_string; - uint16_t *string; -}; - -struct libaxl_request_list_fonts { -#define LIBAXL_REQUEST_LIST_FONTS 49 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - uint16_t max_names; - uint16_t length_of_pattern; - char *pattern; -}; - -struct libaxl_request_list_fonts_with_info { -#define LIBAXL_REQUEST_LIST_FONTS_WITH_INFO 50 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - uint16_t max_names; - uint16_t length_of_pattern; - char *pattern; -}; - -struct libaxl_request_set_font_path { -#define LIBAXL_REQUEST_SET_FONT_PATH 51 - uint8_t opcode; - uint8_t __pad1; - uint16_t _request_length; - uint16_t number_of_strs; /* in path */ - uint16_t __pad2; - struct libaxl_str8 *path; -}; - -struct libaxl_request_get_font_path { -#define LIBAXL_REQUEST_GET_FONT_PATH 52 - uint8_t opcode; - uint8_t __pad1; - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_create_pixmap { -#define LIBAXL_REQUEST_CREATE_PIXMAP 53 - uint8_t opcode; - uint8_t depth; - uint16_t _request_length; /* = 4 */ - libaxl_pixmap_t pid; - libaxl_drawable_t drawable; - uint16_t width; - uint16_t height; -}; - -struct libaxl_request_free_pixmap { -#define LIBAXL_REQUEST_FREE_PIXMAP 54 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_pixmap_t pixmap; -}; - -struct libaxl_request_create_gc { -#define LIBAXL_REQUEST_CREATE_GC 55 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - libaxl_gcontext_t cid; - libaxl_drawable_t drawable; - uint32_t value_mask; /* Determines which below are included, all are encoded as uint32_t */ -#define LIBAXL_REQUEST_CREATE_GC_FUNCTION 0x00000001UL -#define LIBAXL_REQUEST_CREATE_GC_PLANE_MASK 0x00000002UL -#define LIBAXL_REQUEST_CREATE_GC_FOREGROUND 0x00000004UL -#define LIBAXL_REQUEST_CREATE_GC_BACKGROUND 0x00000008UL -#define LIBAXL_REQUEST_CREATE_GC_LINE_WIDTH 0x00000010UL -#define LIBAXL_REQUEST_CREATE_GC_LINE_STYLE 0x00000020UL -#define LIBAXL_REQUEST_CREATE_GC_CAP_STYLE 0x00000040UL -#define LIBAXL_REQUEST_CREATE_GC_JOIN_STYLE 0x00000080UL -#define LIBAXL_REQUEST_CREATE_GC_FILL_STYLE 0x00000100UL -#define LIBAXL_REQUEST_CREATE_GC_FILL_RULE 0x00000200UL -#define LIBAXL_REQUEST_CREATE_GC_TILE 0x00000400UL -#define LIBAXL_REQUEST_CREATE_GC_STIPPLE 0x00000800UL -#define LIBAXL_REQUEST_CREATE_GC_TILE_STIPPLE_X_ORIGIN 0x00001000UL -#define LIBAXL_REQUEST_CREATE_GC_TILE_STIPPLE_Y_ORIGIN 0x00002000UL -#define LIBAXL_REQUEST_CREATE_GC_FONT 0x00004000UL -#define LIBAXL_REQUEST_CREATE_GC_SUBWINDOW_MODE 0x00008000UL -#define LIBAXL_REQUEST_CREATE_GC_GRAPHICS_EXPOSURES 0x00010000UL -#define LIBAXL_REQUEST_CREATE_GC_CLIP_X_ORIGIN 0x00020000UL -#define LIBAXL_REQUEST_CREATE_GC_CLIP_Y_ORIGIN 0x00040000UL -#define LIBAXL_REQUEST_CREATE_GC_CLIP_MASK 0x00080000UL -#define LIBAXL_REQUEST_CREATE_GC_DASH_OFFSET 0x00100000UL -#define LIBAXL_REQUEST_CREATE_GC_DASHES 0x00200000UL -#define LIBAXL_REQUEST_CREATE_GC_ARC_MODE 0x00400000UL - uint8_t function; /* See "gcontext function" in libaxl-consts.h */ - uint8_t __omitted1[3]; - uint32_t plane_mask; - uint32_t foreground; - uint32_t background; - uint16_t line_width; - uint8_t line_style; /* LIBAXL_SOLID, LIBAXL_ON_OFF_DASH, or LIBAXL_DOUBLE_DASH */ - uint8_t cap_style; /* See "cap style" in libaxl-consts.h (Beware of namespacing) */ - uint8_t join_style; /* See "join style" in libaxl-consts.h (Beware of namespacing) */ - uint8_t fill_style; /* LIBAXL_SOLID, LIBAXL_TILED, LIBAXL_STIPPLED, or LIBAXL_OPAQUE_STIPPLED */ - uint8_t fill_rule; /* LIBAXL_EVEN_ODD or LIBAXL_WINDING */ - uint8_t __omitted2; - libaxl_pixmap_t tile; - libaxl_pixmap_t stipple; - int16_t tile_stipple_x_origin; - int16_t tile_stipple_y_origin; - libaxl_font_t font; - uint8_t subwindow_mode; /* CLIP_BY_CHILDREN or INCLUDE_INFERIORS */ - libaxl_bool_t graphics_exposures; - uint16_t __omitted3; - int16_t clip_x_origin; - int16_t clip_y_origin; - libaxl_pixmap_t clip_mask; /* Can be LIBAXL_NONE */ - uint16_t dash_offset; - uint8_t dashes; - uint8_t arc_mode; /* LIBAXL_CHORD or LIBAXL_PIE_SLICE */ -}; - -struct libaxl_request_change_gc { -#define LIBAXL_REQUEST_CHANGE_GC 56 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - libaxl_gcontext_t gc; - uint32_t value_mask; /* Determines which below are included, all are encoded as uint32_t */ -#define LIBAXL_REQUEST_CHANGE_GC_FUNCTION 0x00000001UL -#define LIBAXL_REQUEST_CHANGE_GC_PLANE_MASK 0x00000002UL -#define LIBAXL_REQUEST_CHANGE_GC_FOREGROUND 0x00000004UL -#define LIBAXL_REQUEST_CHANGE_GC_BACKGROUND 0x00000008UL -#define LIBAXL_REQUEST_CHANGE_GC_LINE_WIDTH 0x00000010UL -#define LIBAXL_REQUEST_CHANGE_GC_LINE_STYLE 0x00000020UL -#define LIBAXL_REQUEST_CHANGE_GC_CAP_STYLE 0x00000040UL -#define LIBAXL_REQUEST_CHANGE_GC_JOIN_STYLE 0x00000080UL -#define LIBAXL_REQUEST_CHANGE_GC_FILL_STYLE 0x00000100UL -#define LIBAXL_REQUEST_CHANGE_GC_FILL_RULE 0x00000200UL -#define LIBAXL_REQUEST_CHANGE_GC_TILE 0x00000400UL -#define LIBAXL_REQUEST_CHANGE_GC_STIPPLE 0x00000800UL -#define LIBAXL_REQUEST_CHANGE_GC_TILE_STIPPLE_X_ORIGIN 0x00001000UL -#define LIBAXL_REQUEST_CHANGE_GC_TILE_STIPPLE_Y_ORIGIN 0x00002000UL -#define LIBAXL_REQUEST_CHANGE_GC_FONT 0x00004000UL -#define LIBAXL_REQUEST_CHANGE_GC_SUBWINDOW_MODE 0x00008000UL -#define LIBAXL_REQUEST_CHANGE_GC_GRAPHICS_EXPOSURES 0x00010000UL -#define LIBAXL_REQUEST_CHANGE_GC_CLIP_X_ORIGIN 0x00020000UL -#define LIBAXL_REQUEST_CHANGE_GC_CLIP_Y_ORIGIN 0x00040000UL -#define LIBAXL_REQUEST_CHANGE_GC_CLIP_MASK 0x00080000UL -#define LIBAXL_REQUEST_CHANGE_GC_DASH_OFFSET 0x00100000UL -#define LIBAXL_REQUEST_CHANGE_GC_DASHES 0x00200000UL -#define LIBAXL_REQUEST_CHANGE_GC_ARC_MODE 0x00400000UL - uint8_t function; /* See "gcontext function" in libaxl-consts.h */ - uint8_t __omitted1[3]; - uint32_t plane_mask; - uint32_t foreground; - uint32_t background; - uint16_t line_width; - uint8_t line_style; /* LIBAXL_SOLID, LIBAXL_ON_OFF_DASH, or LIBAXL_DOUBLE_DASH */ - uint8_t cap_style; /* See "cap style" in libaxl-consts.h (Beware of namespacing) */ - uint8_t join_style; /* See "join style" in libaxl-consts.h (Beware of namespacing) */ - uint8_t fill_style; /* LIBAXL_SOLID, LIBAXL_TILED, LIBAXL_STIPPLED, or LIBAXL_OPAQUE_STIPPLED */ - uint8_t fill_rule; /* LIBAXL_EVEN_ODD or LIBAXL_WINDING */ - uint8_t __omitted2; - libaxl_pixmap_t tile; - libaxl_pixmap_t stipple; - int16_t tile_stipple_x_origin; - int16_t tile_stipple_y_origin; - libaxl_font_t font; - uint8_t subwindow_mode; /* CLIP_BY_CHILDREN or INCLUDE_INFERIORS */ - libaxl_bool_t graphics_exposures; - uint16_t __omitted3; - int16_t clip_x_origin; - int16_t clip_y_origin; - libaxl_pixmap_t clip_mask; /* Can be LIBAXL_NONE */ - uint16_t dash_offset; - uint8_t dashes; - uint8_t arc_mode; /* LIBAXL_CHORD or LIBAXL_PIE_SLICE */ -}; - -struct libaxl_request_copy_gc { -#define LIBAXL_REQUEST_COPY_GC 57 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 4 */ - libaxl_gcontext_t src_gc; - libaxl_gcontext_t dest_gc; - uint32_t value_mask; -#define LIBAXL_REQUEST_COPY_GC_FUNCTION 0x00000001UL -#define LIBAXL_REQUEST_COPY_GC_PLANE_MASK 0x00000002UL -#define LIBAXL_REQUEST_COPY_GC_FOREGROUND 0x00000004UL -#define LIBAXL_REQUEST_COPY_GC_BACKGROUND 0x00000008UL -#define LIBAXL_REQUEST_COPY_GC_LINE_WIDTH 0x00000010UL -#define LIBAXL_REQUEST_COPY_GC_LINE_STYLE 0x00000020UL -#define LIBAXL_REQUEST_COPY_GC_CAP_STYLE 0x00000040UL -#define LIBAXL_REQUEST_COPY_GC_JOIN_STYLE 0x00000080UL -#define LIBAXL_REQUEST_COPY_GC_FILL_STYLE 0x00000100UL -#define LIBAXL_REQUEST_COPY_GC_FILL_RULE 0x00000200UL -#define LIBAXL_REQUEST_COPY_GC_TILE 0x00000400UL -#define LIBAXL_REQUEST_COPY_GC_STIPPLE 0x00000800UL -#define LIBAXL_REQUEST_COPY_GC_TILE_STIPPLE_X_ORIGIN 0x00001000UL -#define LIBAXL_REQUEST_COPY_GC_TILE_STIPPLE_Y_ORIGIN 0x00002000UL -#define LIBAXL_REQUEST_COPY_GC_FONT 0x00004000UL -#define LIBAXL_REQUEST_COPY_GC_SUBWINDOW_MODE 0x00008000UL -#define LIBAXL_REQUEST_COPY_GC_GRAPHICS_EXPOSURES 0x00010000UL -#define LIBAXL_REQUEST_COPY_GC_CLIP_X_ORIGIN 0x00020000UL -#define LIBAXL_REQUEST_COPY_GC_CLIP_Y_ORIGIN 0x00040000UL -#define LIBAXL_REQUEST_COPY_GC_CLIP_MASK 0x00080000UL -#define LIBAXL_REQUEST_COPY_GC_DASH_OFFSET 0x00100000UL -#define LIBAXL_REQUEST_COPY_GC_DASHES 0x00200000UL -#define LIBAXL_REQUEST_COPY_GC_ARC_MODE 0x00400000UL -}; - -struct libaxl_request_set_dashes { -#define LIBAXL_REQUEST_SET_DASHES 58 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - libaxl_gcontext_t gc; - uint16_t dash_offset; - uint16_t length_of_dashes; - uint8_t *dashes; -}; - -struct libaxl_request_set_clip_rectangles { -#define LIBAXL_REQUEST_SET_CLIP_RECTANGLES 59 - uint8_t opcode; - uint8_t ordering; /* LIBAXL_UNSORTED, LIBAXL_YSORTED, LIBAXL_YXSORTED, or LIBAXL_YXBANDED */ - uint16_t _request_length; - libaxl_gcontext_t gc; - int16_t clip_x_origin; - int16_t clip_y_origin; - size_t number_of_rectangles; - struct libaxl_rectangle *rectangles; -}; - -struct libaxl_request_free_gc { -#define LIBAXL_REQUEST_FREE_GC 60 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_gcontext_t gc; -}; - -struct libaxl_request_clear_area { -#define LIBAXL_REQUEST_CLEAR_AREA 61 - uint8_t opcode; - libaxl_bool_t exposures; - uint16_t _request_length; /* = 4 */ - libaxl_window_t window; - int16_t x; - int16_t y; - uint16_t width; - uint16_t height; -}; - -struct libaxl_request_copy_area { -#define LIBAXL_REQUEST_COPY_AREA 62 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 7 */ - libaxl_drawable_t src_drawable; - libaxl_drawable_t dest_drawable; - libaxl_gcontext_t gc; - int16_t src_x; - int16_t src_y; - int16_t dest_x; - int16_t dest_y; - uint16_t width; - uint16_t height; -}; - -struct libaxl_request_copy_plane { -#define LIBAXL_REQUEST_COPY_PLANE 63 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 8 */ - libaxl_drawable_t src_drawable; - libaxl_drawable_t dest_drawable; - libaxl_gcontext_t gc; - int16_t src_x; - int16_t src_y; - int16_t dest_x; - int16_t dest_y; - uint16_t width; - uint16_t height; - uint32_t bit_plane; -}; - -struct libaxl_request_poly_point { -#define LIBAXL_REQUEST_POLY_POINT 64 - uint8_t opcode; - uint8_t coordinate_mode; /* LIBAXL_ORIGIN or LIBAXL_PREVIOUS */ - uint16_t _request_length; - libaxl_drawable_t drawable; - libaxl_gcontext_t gc; - size_t number_of_points; - struct libaxl_point *points; -}; - -struct libaxl_request_poly_line { -#define LIBAXL_REQUEST_POLY_LINE 65 - uint8_t opcode; - uint8_t coordinate_mode; /* LIBAXL_ORIGIN or LIBAXL_PREVIOUS */ - uint16_t _request_length; - libaxl_drawable_t drawable; - libaxl_gcontext_t gc; - struct libaxl_point *points; -}; - -struct libaxl_request_poly_segment { -#define LIBAXL_REQUEST_POLY_SEGMENT 66 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - libaxl_drawable_t drawable; - libaxl_gcontext_t gc; - size_t number_of_segments; - struct libaxl_segment *segments; -}; - -struct libaxl_request_poly_rectangle { -#define LIBAXL_REQUEST_POLY_RECTANGLE 67 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - libaxl_drawable_t drawable; - libaxl_gcontext_t gc; - size_t number_of_rectangles; - struct libaxl_rectangle *rectangle; -}; - -struct libaxl_request_poly_arc { -#define LIBAXL_REQUEST_POLY_ARC 68 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - libaxl_drawable_t drawable; - libaxl_gcontext_t gc; - size_t number_of_arcs; - struct libaxl_arc *arc; -}; - -struct libaxl_request_fill_poly { -#define LIBAXL_REQUEST_FILL_POLY 69 - uint8_t opcode; - uint8_t __pad1; - uint16_t _request_length; - libaxl_drawable_t drawable; - libaxl_gcontext_t gc; - uint8_t shape; /* LIBAXL_COMPLEX, LIBAXL_NONCONVEX, or LIBAXL_CONVEX */ - uint8_t coordinate_mode; /* LIBAXL_ORIGIN or LIBAXL_PREVIOUS */ - uint16_t __pad2; - size_t number_of_pointss; - struct libaxl_point *points; -}; - -struct libaxl_request_poly_fill_rectangle { -#define LIBAXL_REQUEST_POLY_FILL_RECTANGLE 70 - uint8_t opcode; - uint8_t __pad1; - uint16_t _request_length; - libaxl_drawable_t drawable; - libaxl_gcontext_t gc; - size_t number_of_rectangles; - struct libaxl_rectangle *rectangles; -}; - -struct libaxl_request_poly_fill_arc { -#define LIBAXL_REQUEST_POLY_FILL_ARC 71 - uint8_t opcode; - uint8_t __pad1; - uint16_t _request_length; - libaxl_drawable_t drawable; - libaxl_gcontext_t gc; - size_t number_of_arcs; - struct libaxl_arc *arcs; -}; - -struct libaxl_request_put_image { -#define LIBAXL_REQUEST_PUT_IMAGE 72 - uint8_t opcode; - uint8_t format; /* LIBAXL_BITMAP, LIBAXL_XYPIXMAP, or LIBAXL_ZPIXMAP */ - uint16_t _request_length; - libaxl_drawable_t drawable; - libaxl_gcontext_t gc; - uint16_t width; - uint16_t height; - int16_t dest_x; - int16_t dest_y; - uint8_t left_pad; - uint8_t depth; - uint16_t __pad; - size_t data_size; - uint8_t *data; -}; - -struct libaxl_request_get_image { -#define LIBAXL_REQUEST_GET_IMAGE 73 - uint8_t opcode; - uint8_t format; /* LIBAXL_XYPIXMAP (= 1) or LIBAXL_ZPIXMAP (= 2) */ - uint16_t _request_length; /* = 5 */ - libaxl_drawable_t drawable; - int16_t x; - int16_t y; - uint16_t width; - uint16_t height; - uint32_t plane_mask; -}; - -struct libaxl_request_poly_text8 { -#define LIBAXL_REQUEST_POLY_TEXT8 74 - uint8_t opcode; - uint8_t __unused; - uint16_t _request_length; - libaxl_drawable_t drawable; - libaxl_gcontext_t gc; - int16_t x; - int16_t y; - size_t number_of_items; - union libaxl_text_item8 *items; -}; - -struct libaxl_request_poly_text16 { -#define LIBAXL_REQUEST_POLY_TEXT16 75 - uint8_t opcode; - uint8_t __unused; - uint16_t _request_length; - libaxl_drawable_t drawable; - libaxl_gcontext_t gc; - int16_t x; - int16_t y; - size_t number_of_items; - union libaxl_text_item16 *items; -}; - -struct libaxl_request_image_text8 { -#define LIBAXL_REQUEST_IMAGE_TEXT8 76 - uint8_t opcode; - uint8_t length_of_string; - uint16_t _request_length; - libaxl_drawable_t drawable; - libaxl_gcontext_t gc; - int16_t x; - int16_t y; - char *string; -}; - -struct libaxl_request_image_text16 { -#define LIBAXL_REQUEST_IMAGE_TEXT16 77 - uint8_t opcode; - uint8_t length_of_string; - uint16_t _request_length; - libaxl_drawable_t drawable; - libaxl_gcontext_t gc; - int16_t x; - int16_t y; - uint16_t *string; -}; - -struct libaxl_request_create_colormap { -#define LIBAXL_REQUEST_CREATE_COLORMAP 78 - uint8_t opcode; - uint8_t alloc; /* LIBAXL_NONE or LIBAXL_ALL */ - uint16_t _request_length; /* = 4 */ - libaxl_colormap_t mid; - libaxl_window_t window; - libaxl_visual_t visual; -}; - -struct libaxl_request_free_colormap { -#define LIBAXL_REQUEST_FREE_COLORMAP 79 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_colormap_t cmap; -}; - -struct libaxl_request_copy_colormap_and_free { -#define LIBAXL_REQUEST_COPY_COLORMAP_AND_FREE 80 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 3 */ - libaxl_colormap_t mid; - libaxl_colormap_t src_cmap; -}; - -struct libaxl_request_install_colormap { -#define LIBAXL_REQUEST_INSTALL_COLORMAP 81 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_colormap_t cmap; -}; - -struct libaxl_request_uninstall_colormap { -#define LIBAXL_REQUEST_UNINSTALL_COLORMAP 82 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_colormap_t cmap; -}; - -struct libaxl_request_list_installed_colormaps { -#define LIBAXL_REQUEST_LIST_INSTALLED_COLORMAPS 83 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_window_t window; -}; - -struct libaxl_request_alloc_color { -#define LIBAXL_REQUEST_ALLOC_COLOR 84 - uint8_t opcode; - uint8_t __pad1; - uint16_t _request_length; /* = 4 */ - libaxl_colormap_t cmap; - uint16_t red; - uint16_t green; - uint16_t blue; - uint16_t __pad2; -}; - -struct libaxl_request_alloc_named_color { -#define LIBAXL_REQUEST_ALLOC_NAMED_COLOR 85 - uint8_t opcode; - uint8_t __pad1; - uint16_t _request_length; - libaxl_colormap_t cmap; - uint16_t length_of_name; - uint16_t __pad2; - char *name; -}; - -struct libaxl_request_alloc_color_cells { -#define LIBAXL_REQUEST_ALLOC_COLOR_CELLS 86 - uint8_t opcode; - libaxl_bool_t contiguous; - uint16_t _request_length; /* = 3 */ - libaxl_colormap_t cmap; - uint16_t colors; - uint16_t planes; -}; - -struct libaxl_request_alloc_color_planes { -#define LIBAXL_REQUEST_ALLOC_COLOR_PLANES 87 - uint8_t opcode; - libaxl_bool_t contiguous; - uint16_t _request_length; /* = 4 */ - libaxl_colormap_t cmap; - uint16_t colors; - uint16_t reds; - uint16_t greens; - uint16_t blues; -}; - -struct libaxl_request_free_colors { -#define LIBAXL_REQUEST_FREE_COLORS 88 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - libaxl_colormap_t cmap; - uint32_t plane_mask; - size_t number_of_pixels; - uint32_t *pixels; -}; - -struct libaxl_request_store_colors { -#define LIBAXL_REQUEST_STORE_COLORS 89 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - libaxl_colormap_t cmap; - size_t number_of_items; - struct libaxl_coloritem *items; -}; - -struct libaxl_request_store_named_color { -#define LIBAXL_REQUEST_STORE_NAMED_COLOR 90 - uint8_t opcode; - uint8_t flags; /* See libaxl-consts.h */ - uint16_t _request_length; - libaxl_colormap_t cmap; - uint32_t pixel; - uint16_t length_of_name; - uint16_t __unused; - char *name; -}; - -struct libaxl_request_query_colors { -#define LIBAXL_REQUEST_QUERY_COLORS 91 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - libaxl_colormap_t cmap; - size_t number_of_pixels; - uint32_t *pixels; -}; - -struct libaxl_request_lookup_color { -#define LIBAXL_REQUEST_LOOKUP_COLOR 92 - uint8_t opcode; - uint8_t __unused; - uint16_t _request_length; - libaxl_colormap_t cmap; - uint16_t length_of_name; - uint16_t __pad; - char *name; -}; - -struct libaxl_request_create_cursor { -#define LIBAXL_REQUEST_CREATE_CURSOR 93 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 8 */ - libaxl_cursor_t cid; - libaxl_pixmap_t source; - libaxl_pixmap_t mask; /* Can be LIBAXL_NONE */ - uint16_t fore_red; - uint16_t fore_green; - uint16_t fore_blue; - uint16_t back_red; - uint16_t back_green; - uint16_t back_blue; - uint16_t x; - uint16_t y; -}; - -struct libaxl_request_create_glyph_cursor { -#define LIBAXL_REQUEST_CREATE_GLYPH_CURSOR 94 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 8 */ - libaxl_cursor_t cid; - libaxl_font_t source_font; - libaxl_font_t mask_font; /* Can be LIBAXL_NONE */ - uint16_t source_char; - uint16_t mask_char; - uint16_t fore_red; - uint16_t fore_green; - uint16_t fore_blue; - uint16_t back_red; - uint16_t back_green; - uint16_t back_blue; -}; - -struct libaxl_request_free_cursor { -#define LIBAXL_REQUEST_FREE_CURSOR 95 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_cursor_t cursor; -}; - -struct libaxl_request_recolor_cursor { -#define LIBAXL_REQUEST_RECOLOR_CURSOR 96 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 5 */ - libaxl_cursor_t cursor; - uint16_t fore_red; - uint16_t fore_green; - uint16_t fore_blue; - uint16_t back_red; - uint16_t back_green; - uint16_t back_blue; -}; - -struct libaxl_request_query_best_size { -#define LIBAXL_REQUEST_QUERY_BEST_SIZE 97 - uint8_t opcode; - uint8_t class; /* LIBAXL_CURSOR, LIBAXL_TILE, or LIBAXL_STIPPLE */ - uint16_t _request_length; /* = 3 */ - libaxl_drawable_t drawable; - uint16_t width; - uint16_t height; -}; - -struct libaxl_request_query_extension { -#define LIBAXL_REQUEST_QUERY_EXTENSION 98 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - uint16_t length_of_name; - uint16_t __unused; - char *name; -}; - -struct libaxl_request_list_extensions { -#define LIBAXL_REQUEST_LIST_EXTENSIONS 99 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_change_keyboard_mapping { -#define LIBAXL_REQUEST_CHANGE_KEYBOARD_MAPPING 100 - uint8_t opcode; - uint8_t keycode_count; - uint16_t _request_length; - libaxl_keycode_t first_keycode; - uint8_t keysyms_per_keycode; - uint16_t __pad; - libaxl_keysym_t *keysyms; -}; - -struct libaxl_request_get_keyboard_mapping { -#define LIBAXL_REQUEST_GET_KEYBOARD_MAPPING 101 - uint8_t opcode; - uint8_t __pad1; - uint16_t _request_length; /* = 2 */ - libaxl_keycode_t first_keycode; - uint8_t count; - uint16_t __pad2; -}; - -struct libaxl_request_change_keyboard_control { -#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL 102 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - uint32_t value_mask; /* Determines which below are included, all are encoded as uint32_t */ -#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_KEY_CLICK_PERCENT 0x0001U -#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_BELL_PERCENT 0x0002U -#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_BELL_PITCH 0x0004U -#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_BELL_DURATION 0x0008U -#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_LED 0x0010U -#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_LED_MODE 0x0020U -#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_KEY 0x0040U -#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_AUTO_REPEAT_MODE 0x0080U - int8_t key_click_percent; - int8_t bell_percent; - int16_t bell_pitch; - int16_t bell_duration; - uint8_t led; - uint8_t led_mode; /* LIBAXL_OFF or LIBAXL_ON */ - libaxl_keycode_t key; - uint8_t auto_repeat_mode; /* LIBAXL_OFF, LIBAXL_ON, or LIBAXL_DEFAULT */ - uint16_t __omitted; -}; - -struct libaxl_request_get_keyboard_control { -#define LIBAXL_REQUEST_GET_KEYBOARD_CONTROL 103 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_bell { -#define LIBAXL_REQUEST_BELL 104 - uint8_t opcode; - int8_t percent; - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_change_pointer_control { -#define LIBAXL_REQUEST_CHANGE_POINTER_CONTROL 105 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 3 */ - int16_t acceleration_numerator; - int16_t acceleration_denominator; - int16_t threshold; - libaxl_bool_t do_acceleration; - libaxl_bool_t do_threshold; -}; - -struct libaxl_request_get_pointer_control { -#define LIBAXL_REQUEST_GET_POINTER_CONTROL 106 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_set_screen_saver { -#define LIBAXL_REQUEST_SET_SCREEN_SAVER 107 - uint8_t opcode; - uint8_t __pad1; - uint16_t _request_length; /* = 3 */ - int16_t timeout; - int16_t interval; - uint8_t prefer_blanking; /* LIBAXL_NO, LIBAXL_YES, or LIBAXL_DEFAULT */ - uint8_t allow_exposures; /* LIBAXL_NO, LIBAXL_YES, or LIBAXL_DEFAULT */ - uint16_t __pad2; -}; - -struct libaxl_request_get_screen_saver { -#define LIBAXL_REQUEST_GET_SCREEN_SAVER 108 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_change_hosts { -#define LIBAXL_REQUEST_CHANGE_HOSTS 109 - uint8_t opcode; - uint8_t mode; /* LIBAXL_INSERT or LIBAXL_DELETE */ - uint16_t _request_length; - uint8_t family; /* See libaxl-consts.h */ - uint8_t __pad; - uint16_t length_of_address; - uint8_t *address; -}; - -struct libaxl_request_list_hosts { -#define LIBAXL_REQUEST_LIST_HOSTS 110 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_set_access_control { -#define LIBAXL_REQUEST_SET_ACCESS_CONTROL 111 - uint8_t opcode; - uint8_t mode; /* LIBAXL_DISABLE or LIBAXL_ENABLE */ - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_set_close_down_mode { -#define LIBAXL_REQUEST_SET_CLOSE_DOWN_MODE 112 - uint8_t opcode; - uint8_t mode; /* LIBAXL_DESTROY, LIBAXL_RETAIN_PERMANENT, or LIBAXL_RETAIN_TEMPORARY */ - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_kill_client { -#define LIBAXL_REQUEST_KILL_CLIENT 113 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 2 */ - libaxl_id_t resource; /* Can be LIBAXL_ALL_TEMPORARY */ -}; - -struct libaxl_request_rotate_properties { -#define LIBAXL_REQUEST_ROTATE_PROPERTIES 114 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; - libaxl_window_t window; - uint16_t number_of_properties; - int16_t delta; - libaxl_atom_t *properties; -}; - -struct libaxl_request_force_screen_saver { -#define LIBAXL_REQUEST_FORCE_SCREEN_SAVER 115 - uint8_t opcode; - uint8_t mode; /* LIBAXL_RESET or LIBAXL_ACTIVATE */ - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_set_pointer_mapping { -#define LIBAXL_REQUEST_SET_POINTER_MAPPING 116 - uint8_t opcode; - uint8_t length_of_map; - uint16_t _request_length; - uint8_t *map; -}; - -struct libaxl_request_get_pointer_mapping { -#define LIBAXL_REQUEST_GET_POINTER_MAPPING 117 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_set_modifier_mapping { -#define LIBAXL_REQUEST_SET_MODIFIER_MAPPING 118 - uint8_t opcode; - uint8_t keycodes_per_modifier; /* number of pairs */ - uint16_t _request_length; - libaxl_keycode_t *keycodes; -}; - -struct libaxl_request_get_modifier_mapping { -#define LIBAXL_REQUEST_GET_MODIFIER_MAPPING 119 - uint8_t opcode; - uint8_t __pad; - uint16_t _request_length; /* = 1 */ -}; - -struct libaxl_request_no_operation { -#define LIBAXL_REQUEST_NO_OPERATION 127 - uint8_t opcode; - uint8_t __pad; - uint16_t request_length; -}; - -union libaxl_request { /* TODO man page */ - struct { - uint8_t opcode; - uint8_t __data; - uint16_t _request_length; - }; -# include "libaxl-requests-structs.h" -}; - -union libaxl_request_const_ptr { /* TODO man page */ - void *as_voidptr; - union libaxl_request *as_union; -# include "libaxl-requests-ptr-structs.h" -} _LIBAXL_GCC_ONLY(__attribute__((__transparent_union__))); diff --git a/libaxl-types.h b/libaxl-types.h deleted file mode 100644 index c55a319..0000000 --- a/libaxl-types.h +++ /dev/null @@ -1,133 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -#include -#include - -typedef uint32_t libaxl_id_t; -typedef libaxl_id_t libaxl_window_t; -typedef libaxl_id_t libaxl_pixmap_t; -typedef libaxl_id_t libaxl_cursor_t; -typedef libaxl_id_t libaxl_font_t; -typedef libaxl_id_t libaxl_gcontext_t; -typedef libaxl_id_t libaxl_colormap_t; -typedef libaxl_id_t libaxl_drawable_t; /* libaxl_window_t or libaxl_pixmap_t */ -typedef libaxl_id_t libaxl_fontable_t; /* libaxl_font_t or libaxl_gcontext_t */ -typedef libaxl_id_t libaxl_atom_t; -typedef libaxl_id_t libaxl_visual_t; -typedef uint32_t libaxl_timestamp_t; -typedef uint32_t libaxl_keysym_t; -typedef uint8_t libaxl_keycode_t; -typedef uint8_t libaxl_button_t; -typedef uint8_t libaxl_bool_t; -typedef uint16_t libaxl_keybutmask_t; - -struct libaxl_point { - int16_t x; - int16_t y; -}; - -struct libaxl_segment { - int16_t x1; - int16_t y1; - int16_t x2; - int16_t y2; -}; - -struct libaxl_rectangle { - int16_t x; /* rightward offset from upper-left corner */ - int16_t y; /* downward offset from upper-left corner */ - uint16_t width; - uint16_t height; -}; - -struct libaxl_arc { - int16_t x; - int16_t y; - uint16_t width; - uint16_t height; - int16_t angle1; - int16_t angle2; -}; - -struct libaxl_char2b { - uint8_t byte1; - uint8_t byte2; -}; - -union libaxl_text_item8 { - struct { - uint8_t length_of_string; /* cannot be LIBAXL_FONT_SHIFT_INDICATOR (= 255) */ - int8_t delta; - char *string; - }; - struct { - uint8_t font_shift_indicator; /* must be LIBAXL_FONT_SHIFT_INDICATOR (= 255) */ - uint8_t font_byte_3; /* (most-significant) */ - uint8_t font_byte_2; - uint8_t font_byte_1; - uint8_t font_byte_0; /* (least-significant) */ - }; -}; - -union libaxl_text_item16 { - struct { - uint8_t length_of_string; /* in number of CHAR2Bs, cannot be LIBAXL_FONT_SHIFT_INDICATOR (= 255) */ - int8_t delta; - uint16_t *string; - }; - struct { - uint8_t font_shift_indicator; /* must be LIBAXL_FONT_SHIFT_INDICATOR (= 255) */ - uint8_t font_byte_3; /* (most-significant) */ - uint8_t font_byte_2; - uint8_t font_byte_1; - uint8_t font_byte_0; /* (least-significant) */ - }; -}; - -struct libaxl_coloritem { - uint32_t pixel; - uint16_t red; - uint16_t green; - uint16_t blue; - uint8_t flags; /* See libaxl-consts.h */ - uint8_t __unused; -}; - -struct libaxl_timecoord { - libaxl_timestamp_t time; - int16_t x; - int16_t y; -}; - -struct libaxl_fontprop { - libaxl_atom_t name; - uint32_t value; /* <32-bits> */ -}; - -struct libaxl_charinfo { - int16_t left_side_bearing; - int16_t right_side_bearing; - int16_t character_width; - int16_t ascent; - int16_t descent; - uint16_t attributes; -}; - -struct libaxl_rgb16 { - uint16_t red; - uint16_t green; - uint16_t blue; - uint16_t __unused; -}; - -struct libaxl_str8 { - uint8_t length; - char *name; -}; - -struct libaxl_host { - uint8_t family; /* See libaxl-consts.h */ - uint8_t __pad; - uint16_t length_of_address; - uint8_t *address; -}; diff --git a/libaxl.h b/libaxl.h index 6ba6dc4..b9b2c5b 100644 --- a/libaxl.h +++ b/libaxl.h @@ -1,6 +1,6 @@ /* See LICENSE file for copyright and license details. */ #ifndef LIBAXL_H -#define LIBAXL_H +#define LIBAXL_H 2 #include #include @@ -11,39 +11,29 @@ # define _LIBAXL_GCC_ONLY(...) #endif -#include "libaxl-types.h" -#include "libaxl-consts.h" -#include "libaxl-atoms.h" -#include "libaxl-events.h" -#include "libaxl-errors.h" -#include "libaxl-requests.h" -#include "libaxl-replies.h" -#include "libaxl-display-info.h" - /** - * The major version number of the highest version of X protocol - * of the library supports (the lowest version is 11.0). If you - * are using dynamic linking, you make also want to use the - * libaxl_protocol_major() function. - */ -#define LIBAXL_PROTOCOL_MAJOR 11 - -/** - * The minor version number of the highest version of X protocol - * of the library supports (the lowest version is 11.0). If you - * are using dynamic linking, you make also want to use the - * libaxl_protocol_minor() function. + * Opaque structure for connection to the X display server */ -#define LIBAXL_PROTOCOL_MINOR 0 +typedef struct libaxl_connection LIBAXL_CONNECTION; /* TODO man */ /** - * The version number of the highest version of X protocol of - * the library supports, as one integer where the major number - * is multiped by 100000, (the lowest version is 11.0, which is - * encoded as 1100000). If you are using dynamic linking, you - * make also want to use the libaxl_protocol_version() function. + * Opaque structure that wraps LIBAXL_CONNECTION with + * private data for the thread, all threads running at + * the same time shall access the display server + * via a unique LIBAXL_CONTEXT */ -#define LIBAXL_PROTOCOL_VERSION ((LIBAXL_PROTOCOL_MAJOR) * 100000 + (LIBAXL_PROTOCOL_MINOR)) +typedef struct libaxl_context LIBAXL_CONTEXT; /* TODO man */ + +#include "libaxl/types.h" +#include "libaxl/consts.h" +#include "libaxl/atoms.h" +#include "libaxl/events.h" +#include "libaxl/errors.h" +#include "libaxl/requests.h" +#include "libaxl/replies.h" +#include "libaxl/display-info.h" +#include "libaxl/advanced.h" +#include "libaxl/low-level.h" /* libaxl error codes */ #define LIBAXL_ERROR_SYSTEM -1 /* use `errno` */ @@ -60,16 +50,6 @@ #define LIBAXL_ERROR_INVALID_HANDSHAKE_RESPONSE -12 #define LIBAXL_ERROR_OUT_OF_RESOURCE_IDS -13 -#define LIBAXL_HANDSHAKE_FAILED 0 -#define LIBAXL_HANDSHAKE_SUCCESS 1 -#define LIBAXL_HANDSHAKE_AUTHENTICATE 2 - -/* - * The largest possible return of the libaxl_get_decnet_object() - * function, plus 1 for the terminal NUL byte - */ -#define LIBAXL_DECNET_OBJECT_MAX (5 + 3 * sizeof(int) - sizeof(int) / 2) - union libaxl_input { /* TODO doc, man */ uint8_t type; union libaxl_error error; /* if .type = LIBAXL_ERROR */ @@ -78,49 +58,13 @@ union libaxl_input { /* TODO doc, man */ }; /** - * Opaque structure for connection to the X display server - */ -typedef struct libaxl_connection LIBAXL_CONNECTION; - -/** - * Opaque structure that wraps LIBAXL_CONNECTION with - * private data for the thread, all threads running at - * the same time shall access the display server - * via a unique LIBAXL_CONTEXT - */ -typedef struct libaxl_context LIBAXL_CONTEXT; - -/** - * Returns the major version number of the highest version of - * X protocol of the library supports (the lowest version is - * 11.0). If you are using static linking, you make also want - * to use the LIBAXL_PROTOCOL_MAJOR constant. + * Deallocation and close a connection * - * @return The major version number of highest support version of the protocol - */ -int libaxl_protocol_version_major(void); - -/** - * Returns the minor version number of the highest version of - * X protocol of the library supports (the lowest version is - * 11.0). If you are using static linking, you make also want - * to use the LIBAXL_PROTOCOL_MINOR constant. - * - * @return The minor version number of highest support version of the protocol - */ -int libaxl_protocol_version_minor(void); - -/** - * Returns the minor version number of the highest version of - * X protocol of the library supports (the lowest version is 11.0, - * which is encoded as 1100000). If you are using static linking, - * you make also want to use the LIBAXL_PROTOCOL_VERSION constant. - * - * @return The version number of highest support version of the protocol, - * encoded as a sum of the major number multipled by 100000 (1e5) - * and the minor number, e.g. 1100000 for 11.0 (X11) + * @param conn The connection to the display server + * @return 0 on success, -1 of there was an asynchronous error */ -int libaxl_protocol_version(void); +_LIBAXL_GCC_ONLY(__attribute__((__nonnull__))) +int libaxl_close(LIBAXL_CONNECTION *); /* TODO man */ /** * Get the file description used for a connection to @@ -131,7 +75,7 @@ int libaxl_protocol_version(void); * the connection to the display server */ _LIBAXL_GCC_ONLY(__attribute__((__nonnull__, __warn_unused_result__))) -int libaxl_fileno(LIBAXL_CONNECTION *); /* TODO man */ +int libaxl_fileno(LIBAXL_CONNECTION *); /** * Get information about a connection and the display @@ -212,14 +156,14 @@ libaxl_next_screen(const struct libaxl_screen *screen) /* TODO man */ * @return The context, NULL on failure (can only be out of memory) */ _LIBAXL_GCC_ONLY(__attribute__((__nonnull__, __malloc__, __warn_unused_result__))) -LIBAXL_CONTEXT *libaxl_context_create(LIBAXL_CONNECTION *); /* TODO man */ +LIBAXL_CONTEXT *libaxl_context_create(LIBAXL_CONNECTION *); /** * Deallocate a context * * @param ctx The context to deallocate */ -void libaxl_context_free(LIBAXL_CONTEXT *); /* TODO man */ +void libaxl_context_free(LIBAXL_CONTEXT *); /** * Generate a resource ID @@ -234,7 +178,7 @@ void libaxl_context_free(LIBAXL_CONTEXT *); /* TODO man */ * is always LIBAXL_ERROR_OUT_OF_RESOURCE_IDS */ _LIBAXL_GCC_ONLY(__attribute__((__nonnull__, __warn_unused_result__))) -libaxl_id_t libaxl_generate_id(LIBAXL_CONTEXT *); /* TODO man */ +libaxl_id_t libaxl_generate_id(LIBAXL_CONTEXT *); /** * Deallocate a resource ID so that it can be reused later @@ -244,86 +188,7 @@ libaxl_id_t libaxl_generate_id(LIBAXL_CONTEXT *); /* TODO man */ * @return 0 on success, a negative libaxl error code on failure */ _LIBAXL_GCC_ONLY(__attribute__((__nonnull__))) -int libaxl_deallocate_id(LIBAXL_CONTEXT *, libaxl_id_t); /* TODO man, implement */ - -/** - * Parse a display name string - * - * The format for the display name string shall be either - * - * [/][]:[.] - * - * or for the "unix" protocol - * - * [.] - * - * @param name The display name string, $DISPLAY will be used if NULL or empty - * @param hostp Output parameter for the host of or (if the protocol is "unix") path - * to the display, remember to free after successful completion - * @param protocolp Output parameter for the network protocol used to access the display, - * remember to free after successful completion - * @param displayp Output parameter for the display's index (0 if the protocol is "unix") - * @param screenp Output parameter for the screen's index - * @return 0 on success, a negative libaxl error code on failure - */ -_LIBAXL_GCC_ONLY(__attribute__((__nonnull__(2, 3, 4, 5)))) -int libaxl_parse_display(const char *, char **, char **, int *, int *); /* TODO man */ - -/** - * Get the TCP port that is used for a display - * - * @param display The display's number, the function will assume that it is a valid number - * @return The TCP port used for the display - */ -_LIBAXL_GCC_ONLY(__attribute__((__warn_unused_result__, __const__))) -inline uint16_t libaxl_get_tcp_port(int display) /* TODO man */ -{ - return (uint16_t)(display + 6000); -} - -/** - * Get the DECnet object name that is used for a display - * - * @param buf Buffer that the object name shall be written to, it is recommended - * that is size, if static, is LIBAXL_DECNET_OBJECT_MAX (which is - * always sufficient), otherwise it should be at least the return value - * of this function (for the same last argument but with NULL and 0 - * as the first two arguments) plus 1 - * @param size The size of the buffer in the `buf` argument - * @param display The display's number - * @return The length of the object name, will not exceed LIBAXL_DECNET_OBJECT_MAX - * less 1; an additional uncounted NUL byte will be written to the buffer - * if it is large enough; or -1 on failure (specifically snprintf(3), which - * the function calls, by fail with EOVERFLOW if the `size` argument is - * greater than {INT_MAX}) - */ -int libaxl_get_decnet_object(char *, size_t, int); /* TODO man */ - -/** - * This function is to be called once and only once, excluding any - * failure that does not set `errno` to EINPROGRESS and excluding - * any call for which the display server respond that the handshake - * failed or requires authentication, immediately after connecting - * to the socket for the display - * - * The libaxl_receive_handshake() shall be called immediately after - * calling this function - * - * @param ctx The thread's context for the connection to the display to send the handshake over - * @param auth_name The protocol name of the authorisation the client expects the server to use; - * valid authorisation mechanisms are not part of the core X protocol - * @param auth_name_len The length of `auth_name`, 0 if `auth_name` is NULL - * @param auth_data The authorisation data, which is specific to the choosen authorisation mechanism - * @param auth_data_len The length of `auth_data`, 0 if `auth_data` is NULL - * @param flags Flags to use for the 4th parameter when calling send(3) - * @return 0 on success, a negative libaxl error code on failure - * - * If the function returns LIBAXL_ERROR_SYSTEM and sets `errno` - * to EINPROGRESS, the message has been saved (possibly partially - * sent) and pending to be sent by calling libaxl_flush(). - */ -_LIBAXL_GCC_ONLY(__attribute__((__nonnull__(1)))) -int libaxl_send_handshake(LIBAXL_CONTEXT *restrict, const char *, size_t, const char *, size_t, int); /* TODO man */ +int libaxl_deallocate_id(LIBAXL_CONTEXT *, libaxl_id_t); /* TODO implement */ /** * Send a request to the display server @@ -366,38 +231,6 @@ int libaxl_send_request(LIBAXL_CONTEXT *restrict, union libaxl_request_const_ptr _LIBAXL_GCC_ONLY(__attribute__((__nonnull__))) int libaxl_flush(LIBAXL_CONNECTION *restrict, int); /* TODO man */ -/** - * Receive the server's part of the handshake, this function - * shall be called once immediately after each successful call - * to the libaxl_send_handshake() function or successful call - * to the libaxl_flush() function due to EINPROGRESS failure - * of call to the libaxl_send_handshake() function - * - * @param ctx The thread's context for the connection to the display server - * @param majorp Output parameter for the major version number for a version - * of the X protocol that the display server supports, which is - * not necessarily the version that the library uses. Will only - * be set if the function returns LIBAXL_HANDSHAKE_FAILED or - * LIBAXL_HANDSHAKE_SUCCESS. - * @param minorp Output parameter for the minor version number for a version - * of the X protocol that the display server supports, which is - * not necessarily the version that the library uses. Will only - * be set if the function returns LIBAXL_HANDSHAKE_FAILED or - * LIBAXL_HANDSHAKE_SUCCESS. - * @param reasonp Output parameter for the reason the handshake or authorisation - * failed. Will be set to NULL unless the function returns - * LIBAXL_HANDSHAKE_FAILED or LIBAXL_HANDSHAKE_AUTHENTICATE. - * Remember to free after successful completion (non-negative return) - * @param flags Flags to use for the 4th parameter when calling recv(3) - * @return 0 on success, a negative libaxl error code on failure - * - * Behaviour is unspecified if SO_PEEK_OFF is active on the - * connection to the display server or if the MSG_PEEK flag - * is used - */ -_LIBAXL_GCC_ONLY(__attribute__((__nonnull__(1)))) -int libaxl_receive_handshake(LIBAXL_CONTEXT *restrict, int *restrict, int *restrict, char **restrict, int); /* TODO man */ - /** * Receive the next pending message from the display server * @@ -424,4 +257,6 @@ int libaxl_receive_handshake(LIBAXL_CONTEXT *restrict, int *restrict, int *restr _LIBAXL_GCC_ONLY(__attribute__((__nonnull__))) int libaxl_receive(LIBAXL_CONTEXT *restrict, union libaxl_input *restrict, int); /* TODO man */ +#undef LIBAXL_H +#define LIBAXL_H 1 #endif diff --git a/libaxl/advanced.h b/libaxl/advanced.h new file mode 100644 index 0000000..b2ccdac --- /dev/null +++ b/libaxl/advanced.h @@ -0,0 +1,85 @@ +/* See LICENSE file for copyright and license details. */ + +#if !defined(LIBAXL_H) || (LIBAXL_H < 2) +# error Do not include directly, include instead. +#endif + +/** + * The major version number of the highest version of X protocol + * of the library supports (the lowest version is 11.0). If you + * are using dynamic linking, you make also want to use the + * libaxl_protocol_version_major() function. + */ +#define LIBAXL_PROTOCOL_VERSION_MAJOR 11 + +/** + * The minor version number of the highest version of X protocol + * of the library supports (the lowest version is 11.0). If you + * are using dynamic linking, you make also want to use the + * libaxl_protocol_version_minor() function. + */ +#define LIBAXL_PROTOCOL_VERSION_MINOR 0 + +/** + * The version number of the highest version of X protocol of + * the library supports, as one integer where the major number + * is multiped by 1000, (the lowest version is 11.0, which is + * encoded as 11000). If you are using dynamic linking, you + * make also want to use the libaxl_protocol_version() function. + */ +#define LIBAXL_PROTOCOL_VERSION ((LIBAXL_PROTOCOL_VERSION_MAJOR) * 1000 + (LIBAXL_PROTOCOL_VERSION_MINOR)) + +/** + * Returns the major version number of the highest version of + * X protocol of the library supports (the lowest version is + * 11.0). If you are using static linking, you make also want + * to use the LIBAXL_PROTOCOL_VERSION_MAJOR constant. + * + * @return The major version number of highest support version of the protocol + */ +_LIBAXL_GCC_ONLY(__attribute__((__warn_unused_result__))) +int libaxl_protocol_version_major(void); + +/** + * Returns the minor version number of the highest version of + * X protocol of the library supports (the lowest version is + * 11.0). If you are using static linking, you make also want + * to use the LIBAXL_PROTOCOL_VERSION_MINOR constant. + * + * @return The minor version number of highest support version of the protocol + */ +_LIBAXL_GCC_ONLY(__attribute__((__warn_unused_result__))) +int libaxl_protocol_version_minor(void); + +/** + * Returns the minor version number of the highest version of + * X protocol of the library supports (the lowest version is 11.0, + * which is encoded as 11000). If you are using static linking, + * you make also want to use the LIBAXL_PROTOCOL_VERSION constant. + * + * @return The version number of highest support version of the protocol, + * encoded as a sum of the major number multipled by 1000 and + * the minor number, e.g. 11000 for 11.0 (X11) + */ +_LIBAXL_GCC_ONLY(__attribute__((__warn_unused_result__))) +int libaxl_protocol_version(void); + +/** + * Deallocations a connection object without + * closing the file descriptor, which instead + * is returned + * + * @param conn The connection to the display server + * @return The file descriptor of the connection + */ +_LIBAXL_GCC_ONLY(__attribute__((__nonnull__, __warn_unused_result__))) +int libaxl_detach(LIBAXL_CONNECTION *); /* TODO man */ + +/** + * Change the file descriptor of a connection + * + * @param conn The connection to the display server + * @param fd The new file descriptor + */ +_LIBAXL_GCC_ONLY(__attribute__((__nonnull__))) +void libaxl_attach(LIBAXL_CONNECTION *, int); /* TODO man */ diff --git a/libaxl/atoms.h b/libaxl/atoms.h new file mode 100644 index 0000000..e41ac74 --- /dev/null +++ b/libaxl/atoms.h @@ -0,0 +1,74 @@ +/* See LICENSE file for copyright and license details. */ + +#if !defined(LIBAXL_H) || (LIBAXL_H < 2) +# error Do not include directly, include instead. +#endif + +#define LIBAXL_ATOM_PRIMARY 1 +#define LIBAXL_ATOM_SECONDARY 2 +#define LIBAXL_ATOM_ARC 3 +#define LIBAXL_ATOM_ATOM 4 +#define LIBAXL_ATOM_BITMAP 5 +#define LIBAXL_ATOM_CARDINAL 6 +#define LIBAXL_ATOM_COLORMAP 7 +#define LIBAXL_ATOM_CURSOR 8 +#define LIBAXL_ATOM_CUT_BUFFER0 9 +#define LIBAXL_ATOM_CUT_BUFFER1 10 +#define LIBAXL_ATOM_CUT_BUFFER2 11 +#define LIBAXL_ATOM_CUT_BUFFER3 12 +#define LIBAXL_ATOM_CUT_BUFFER4 13 +#define LIBAXL_ATOM_CUT_BUFFER5 14 +#define LIBAXL_ATOM_CUT_BUFFER6 15 +#define LIBAXL_ATOM_CUT_BUFFER7 16 +#define LIBAXL_ATOM_DRAWABLE 17 +#define LIBAXL_ATOM_FONT 18 +#define LIBAXL_ATOM_INTEGER 19 +#define LIBAXL_ATOM_PIXMAP 20 +#define LIBAXL_ATOM_POINT 21 +#define LIBAXL_ATOM_RECTANGLE 22 +#define LIBAXL_ATOM_RESOURCE_MANAGER 23 +#define LIBAXL_ATOM_RGB_COLOR_MAP 24 +#define LIBAXL_ATOM_RGB_BEST_MAP 25 +#define LIBAXL_ATOM_RGB_BLUE_MAP 26 +#define LIBAXL_ATOM_RGB_DEFAULT_MAP 27 +#define LIBAXL_ATOM_RGB_GRAY_MAP 28 +#define LIBAXL_ATOM_RGB_GREEN_MAP 29 +#define LIBAXL_ATOM_RGB_RED_MAP 30 +#define LIBAXL_ATOM_STRING 31 +#define LIBAXL_ATOM_VISUALID 32 +#define LIBAXL_ATOM_WINDOW 33 +#define LIBAXL_ATOM_WM_COMMAND 34 +#define LIBAXL_ATOM_WM_HINTS 35 +#define LIBAXL_ATOM_WM_CLIENT_MACHINE 36 +#define LIBAXL_ATOM_WM_ICON_NAME 37 +#define LIBAXL_ATOM_WM_ICON_SIZE 38 +#define LIBAXL_ATOM_WM_NAME 39 +#define LIBAXL_ATOM_WM_NORMAL_HINTS 40 +#define LIBAXL_ATOM_WM_SIZE_HINTS 41 +#define LIBAXL_ATOM_WM_ZOOM_HINTS 42 +#define LIBAXL_ATOM_MIN_SPACE 43 +#define LIBAXL_ATOM_NORM_SPACE 44 +#define LIBAXL_ATOM_MAX_SPACE 45 +#define LIBAXL_ATOM_END_SPACE 46 +#define LIBAXL_ATOM_SUPERSCRIPT_X 47 +#define LIBAXL_ATOM_SUPERSCRIPT_Y 48 +#define LIBAXL_ATOM_SUBSCRIPT_X 49 +#define LIBAXL_ATOM_SUBSCRIPT_Y 50 +#define LIBAXL_ATOM_UNDERLINE_POSITION 51 +#define LIBAXL_ATOM_UNDERLINE_THICKNESS 52 +#define LIBAXL_ATOM_STRIKEOUT_ASCENT 53 +#define LIBAXL_ATOM_STRIKEOUT_DESCENT 54 +#define LIBAXL_ATOM_ITALIC_ANGLE 55 +#define LIBAXL_ATOM_X_HEIGHT 56 +#define LIBAXL_ATOM_QUAD_WIDTH 57 +#define LIBAXL_ATOM_WEIGHT 58 +#define LIBAXL_ATOM_POINT_SIZE 59 +#define LIBAXL_ATOM_RESOLUTION 60 +#define LIBAXL_ATOM_COPYRIGHT 61 +#define LIBAXL_ATOM_NOTICE 62 +#define LIBAXL_ATOM_FONT_NAME 63 +#define LIBAXL_ATOM_FAMILY_NAME 64 +#define LIBAXL_ATOM_FULL_NAME 65 +#define LIBAXL_ATOM_CAP_HEIGHT 66 +#define LIBAXL_ATOM_WM_CLASS 67 +#define LIBAXL_ATOM_WM_TRANSIENT_FOR 68 diff --git a/libaxl/consts.h b/libaxl/consts.h new file mode 100644 index 0000000..a57a9de --- /dev/null +++ b/libaxl/consts.h @@ -0,0 +1,270 @@ +/* See LICENSE file for copyright and license details. */ + +#if !defined(LIBAXL_H) || (LIBAXL_H < 2) +# error Do not include directly, include instead. +#endif + +/* libaxl_keycode_t */ +#define LIBAXL_ANY_KEY 0 + +/* libaxl_bool_t */ +#define LIBAXL_FALSE 0 +#define LIBAXL_TRUE 1 + +/* libaxl_timestamp_t */ +#define LIBAXL_CURRENT_TIME 0 + +/* struct libaxl_host.family + struct libaxl_request_change_hosts.family */ +#define LIBAXL_INTERNET 0 /* IPv4 */ +#define LIBAXL_DECNET 1 /* DECnet */ +#define LIBAXL_CHAOS 2 /* Chaos */ +#define LIBAXL_SERVER_INTERPRETED 5 /* Server Interpreted */ +#define LIBAXL_INTERNET_V6 6 /* IPv6 */ + +/* union libaxl_text_item8 + union libaxl_text_item16 */ +#define LIBAXL_FONT_SHIFT_INDICATOR 255 + +/* struct libaxl_coloritem.flags + struct libaxl_request_store_named_color.flags */ +#define LIBAXL_RED 0x01 +#define LIBAXL_GREEN 0x02 +#define LIBAXL_BLUE 0x04 + +/* struct libaxl_request_set_clip_rectangles.ordering */ +#define LIBAXL_UNSORTED 0 +#define LIBAXL_YSORTED 1 +#define LIBAXL_YXSORTED 2 +#define LIBAXL_YXBANDED 3 + +/* struct libaxl_request_force_screen_saver.mode */ +#define LIBAXL_RESET 0 +#define LIBAXL_ACTIVATE 1 + +/* struct libaxl_request_query_best_size.class */ +#define LIBAXL_CURSOR 0 +#define LIBAXL_TILE 1 +#define LIBAXL_STIPPLE 2 + +/* struct libaxl_request_circulate_windo.direction */ +#define LIBAXL_RAISE_LOWEST 0 +#define LIBAXL_LOWER_HIGHEST 1 + +/* struct libaxl_request_allow_events.mode */ +#define LIBAXL_ASYNC_POINTER 0 +#define LIBAXL_SYNC_POINTER 1 +#define LIBAXL_REPLAY_POINTER 2 +#define LIBAXL_ASYNC_KEYBOARD 3 +#define LIBAXL_SYNC_KEYBOARD 4 +#define LIBAXL_REPLAY_KEYBOARD 5 +#define LIBAXL_ASYNC_BOTH 6 +#define LIBAXL_SYNC_BOTH 7 + +/* struct libaxl_request_change_property.mode */ +#define LIBAXL_REPLACE 0 +#define LIBAXL_PREPEND 1 +#define LIBAXL_APPEND 2 + +/* struct libaxl_request_send_event.destination */ +#define LIBAXL_POINTER_WINDOW 0 +#define LIBAXL_INPUT_FOCUS 1 + +/* struct libaxl_event_property_notify.state */ +#define LIBAXL_NEW_VALUE 0 +#define LIBAXL_DELETED 1 + +/* struct libaxl_event_colormap_notify.state */ +#define LIBAXL_UNINSTALLED 0 +#define LIBAXL_INSTALLED 1 + +/* struct libaxl_event_mapping_notify.request */ +#define LIBAXL_MODIFIER 0 +#define LIBAXL_KEYBOARD 1 +#define LIBAXL_POINTER 2 + +/* struct libaxl_visual_type.class */ +#define LIBAXL_STATIC_GRAY 0 +#define LIBAXL_GRAY_SCALE 1 +#define LIBAXL_STATIC_COLOR 2 +#define LIBAXL_PSEUDO_COLOR 3 +#define LIBAXL_TRUE_COLOR 4 +#define LIBAXL_DIRECT_COLOR 5 + +/* circatulation place */ +#define LIBAXL_TOP 0 +#define LIBAXL_BOTTOM 1 + +/* cap style */ +#define LIBAXL_CAP_NOT_LAST 0 +#define LIBAXL_CAP_BUTT 1 +#define LIBAXL_CAP_ROUND 2 +#define LIBAXL_CAP_PROJECTING 3 + +/* join style */ +#define LIBAXL_JOIN_MITER 0 +#define LIBAXL_JOIN_ROUND 1 +#define LIBAXL_JOIN_BEVEL 2 + +/* map state */ +#define LIBAXL_UNMAPPED 0 +#define LIBAXL_UNVIEWABLE 1 +#define LIBAXL_VIEWABLE 2 + +/* gcontext function */ +#define LIBAXL_CLEAR 0 +#define LIBAXL_AND 1 +#define LIBAXL_AND_REVERSE 2 +#define LIBAXL_COPY 3 +#define LIBAXL_AND_INVERTED 4 +#define LIBAXL_NO_OP 5 +#define LIBAXL_XOR 6 +#define LIBAXL_OR 7 +#define LIBAXL_NOR 8 +#define LIBAXL_EQUIV 9 +#define LIBAXL_INVERT 10 +#define LIBAXL_OR_REVERSE 11 +#define LIBAXL_COPY_INVERTED 12 +#define LIBAXL_OR_INVERTED 13 +#define LIBAXL_NAND 14 +#define LIBAXL_SET 15 + +/* close down mode */ +#define LIBAXL_DESTROY 0 +#define LIBAXL_RETAIN_PERMANENT 1 +#define LIBAXL_RETAIN_TEMPORARY 2 + +/* visibility state */ +#define LIBAXL_UNOBSCURED 0 +#define LIBAXL_PARTIALLY_OBSCURED 1 +#define LIBAXL_FULLY_OBSCURED 2 + +/* bitgravity and wingravity */ +#define LIBAXL_FORGET 0 /* bitgravity */ +#define LIBAXL_UNMAP 0 /* wingravity */ +#define LIBAXL_NORTH_WEST 1 +#define LIBAXL_NORTH 2 +#define LIBAXL_NORTH_EAST 3 +#define LIBAXL_WEST 4 +#define LIBAXL_CENTER 5 +#define LIBAXL_EAST 6 +#define LIBAXL_SOUTH_WEST 7 +#define LIBAXL_SOUTH 8 +#define LIBAXL_SOUTH_EAST 9 +#define LIBAXL_STATIC 10 + +/* synchronicity */ +#define LIBAXL_SYNCHRONOUS 0 +#define LIBAXL_ASYNCHRONOUS 1 + +/* image formats */ +#define LIBAXL_BITMAP 0 +#define LIBAXL_XYPIXMAP 1 +#define LIBAXL_ZPIXMAP 2 + +/* buttons */ +#define LIBAXL_ANY_BUTTON 0 + +/* draw directions */ +#define LIBAXL_LEFT_TO_RIGHT 0 +#define LIBAXL_RIGHT_TO_LEFT 1 + +/* fill rule */ +#define LIBAXL_EVEN_ODD 0 +#define LIBAXL_WINDING 1 + +/* fill style and line style */ +#define LIBAXL_SOLID 0 +#define LIBAXL_TILED 1 /* fill style */ +#define LIBAXL_STIPPLED 2 /* fill style */ +#define LIBAXL_OPAQUE_STIPPLED 3 /* fill style */ +#define LIBAXL_ON_OFF_DASH 1 /* line style */ +#define LIBAXL_DOUBLE_DASH 2 /* line style */ + +/* polygon shape */ +#define LIBAXL_COMPLEX 0 +#define LIBAXL_NONCONVEX 1 +#define LIBAXL_CONVEX 2 + +/* arc mode */ +#define LIBAXL_CHORD 0 +#define LIBAXL_PIE_SLICE 1 + +/* grab mode (includes LIBAXL_NORMAL) */ +#define LIBAXL_GRAB 1 +#define LIBAXL_UNGRAB 2 +#define LIBAXL_WHILE_GRABBED 3 + +/* grab status (includes LIBAXL_SUCCESS) */ +#define LIBAXL_ALREADY_GRABBED 1 +#define LIBAXL_INVALID_TIME 2 +#define LIBAXL_NOT_VIEWABLE 3 +#define LIBAXL_FROZEN 4 + +/* coordinate mode */ +#define LIBAXL_ORIGIN 0 +#define LIBAXL_PREVIOUS 1 + +/* enabled status */ +#define LIBAXL_DISABLE 0 +#define LIBAXL_DISABLED 0 +#define LIBAXL_ENABLE 1 +#define LIBAXL_ENABLED 1 + +/* window class */ +#define LIBAXL_INPUT_OUTPUT 1 +#define LIBAXL_INPUT_ONLY 2 + +/* subwindow mode */ +#define LIBAXL_CLIP_BY_CHILDREN 0 +#define LIBAXL_INCLUDE_INFERIORS 1 + +/* backing store */ +#define LIBAXL_NOT_USEFUL 0 /* Not used in `struct libaxl_screen.backing_stores` */ +#define LIBAXL_NEVER 0 /* Used in `struct libaxl_screen.backing_stores` */ +#define LIBAXL_WHEN_MAPPED 1 +#define LIBAXL_ALWAYS 2 + +/* change mode */ +#define LIBAXL_INSERT 0 +#define LIBAXL_DELETE 1 + +/* stack mode */ +#define LIBAXL_ABOVE 0 +#define LIBAXL_BELOW 1 +#define LIBAXL_TOP_IF 2 +#define LIBAXL_BOTTOM_IF 3 +#define LIBAXL_OPPOSITE 4 + +/* pointer window detail and window focus details */ +#define LIBAXL_ANCESTOR 0 +#define LIBAXL_VIRTUAL 1 +#define LIBAXL_INFERIOR 2 +#define LIBAXL_NONLINEAR 3 +#define LIBAXL_NONLINEAR_VIRTUAL 4 +/* window focus details */ +#define LIBAXL_FOCUS_POINTER 5 /* Just called Pointer in the specification */ +#define LIBAXL_FOCUS_POINTER_ROOT 6 /* Just called PointerRoot in the specification */ +#define LIBAXL_FOCUS_NONE 7 /* Just called None in the specification */ + +/* misc. */ +#define LIBAXL_ANY_PROPERTY_TYPE 0 +#define LIBAXL_ALL_TEMPORARY 0 +#define LIBAXL_PARENT_RELATIVE 1 +#define LIBAXL_HINT 1 +#define LIBAXL_ALL 1 + +/* generic */ +#define LIBAXL_NONE 0 +#define LIBAXL_NORMAL 0 +#define LIBAXL_SUCCESS 0 +#define LIBAXL_BUSY 1 +#define LIBAXL_FAILED 2 +#define LIBAXL_NO 0 +#define LIBAXL_YES 1 +#define LIBAXL_DEFAULT 2 +#define LIBAXL_OFF 0 +#define LIBAXL_ON 1 +#define LIBAXL_COPY_FROM_PARENT 0 +#define LIBAXL_POINTER_ROOT 1 +#define LIBAXL_PARENT 2 diff --git a/libaxl/display-info.h b/libaxl/display-info.h new file mode 100644 index 0000000..714e833 --- /dev/null +++ b/libaxl/display-info.h @@ -0,0 +1,310 @@ +/* See LICENSE file for copyright and license details. */ + +#if !defined(LIBAXL_H) || (LIBAXL_H < 2) +# error Do not include directly, include instead. +#endif + +/** + * The highest number of the `struct_version` field in + * `struct libaxl_display_info` that this header file + * supports + */ +#define LIBAXL_DISPLAY_INFO_VERSION 0 + +/** + * Standard byte orders + */ +enum libaxl_byte_order { + /** + * Least significant byte first + */ + LIBAXL_LSB_FIRST, + + /** + * Most significant byte first + */ + LIBAXL_MSB_FIRST +}; + +/** + * Standard bit orders + */ +enum libaxl_bit_order { + /** + * Least significant bit leftmost + */ + LIBAXL_LSB_LEFTMOST, + + /** + * Most significant bit leftmost + */ + LIBAXL_MSB_LEFTMOST +}; + +struct libaxl_format { + uint8_t depth; + uint8_t bits_per_pixel; + uint8_t scanline_pad; + uint8_t __unused[5]; +}; + +struct libaxl_visual_type { + libaxl_visual_t visual_id; + uint8_t class; /* LIBAXL_STATIC_GRAY, LIBAXL_GRAY_SCALE, LIBAXL_STATIC_COLOR, + * LIBAXL_PSEUDO_COLOR, LIBAXL_TRUE_COLOR, LIBAXL_DIRECT_COLOR */ + uint8_t bits_per_rgb_value; + uint16_t colormap_entries; + uint32_t red_mask; + uint32_t green_mask; + uint32_t blue_mask; + uint32_t __unused; +}; + +struct libaxl_depth { + uint8_t depth; + uint8_t __pad; + uint16_t number_of_visuals; + uint32_t __unused; + struct libaxl_visual_type visuals[]; +}; + +/** + * Screen information + */ +struct libaxl_screen { + /** + * The root window of the screen + * + * This is always an LIBAXL_INPUT_OUTPUT window + */ + libaxl_window_t root; + + /** + * The map initially associated with the root window + * + * Windows with minimal colour requires may want to + * use this colormap if they use the same depth as + * the root window. + */ + libaxl_colormap_t default_colormap; + + /** + * Bright colour usable for implementing monochrome + * applications using `.default_colormap` + * + * This colour is permanently allocated + * + * May be set to a dark colour on some screens + * (that what the colours to be inverted); the + * actual RGB value is unspecified and may any + * colour and not necessarily black or white + */ + uint32_t white_pixel; + + /** + * Dark colour usable for implementing monochrome + * applications using `.default_colormap` + * + * This colour is permanently allocated + * + * May be set to a bright colour on some screens + * (that what the colours to be inverted); the + * actual RGB value is unspecified and may any + * colour and not necessarily black or white + */ + uint32_t black_pixel; + + uint32_t current_input_masks; /* TODO SETofEVENTS */ + + /** + * The width, in pixels, of the root window; + * which cannot be changed in the core protocol + * + * This value will not update when root window + * is resized, but new connections may get an + * update value + */ + uint16_t width_in_pixels; + + /** + * The height, in pixels, of the root window; + * which cannot be changed in the core protocol + * + * This value will not update when root window + * is resized, but new connections may get an + * update value + */ + uint16_t height_in_pixels; + + /** + * The width, in millimeters, of the root window; + * which cannot be changed in the core protocol + * + * This value will not update when root window + * is resized or the monitor is changed + * + * Note that the horizontal and vertical DPI + * (dots per inch) of a monitor are not + * necessarily equal to each other + */ + uint16_t width_in_millimeters; + + /** + * The height, in millimeters, of the root window; + * which cannot be changed in the core protocol + * + * This value will not update when root window + * is resized or the monitor is changed + * + * Note that the horizontal and vertical DPI + * (dots per inch) of a monitor are not + * necessarily equal to each other + */ + uint16_t height_in_millimeters; + + uint16_t min_installed_maps; + uint16_t max_installed_maps; + libaxl_visual_t root_visual; + uint8_t backing_stores; + libaxl_bool_t save_under; + uint8_t root_depth; + uint8_t number_of_allowed_depths; + struct libaxl_depth allowed_depths[]; +}; + +/** + * Information about the display, display server, and connection + */ +struct libaxl_display_info { + /** + * The version number of this structure that this library uses. + * When using dynamic linking, is important use the version that + * is the lowest of the number stored in this field and the + * number stored in the LIBAXL_DISPLAY_INFO_VERSION constant. + */ + int struct_version; /* TODO set when creating LIBAXL_CONNECTION */ + + /* SINCE STRUCT VERSION 0: */ + + /** + * The major number of version of the protocol negotiated + * between the client and the server. This is not necessarily + * the same number as returned in the second parameter of + * the libaxl_receive_handshake() function. + */ + int protocol_version_major; + + /** + * The minor number of version of the protocol negotiated + * between the client and the server. This is not necessarily + * the same number as returned in the third parameter of + * the libaxl_receive_handshake() function. + */ + int protocol_version_minor; + + /** + * The version of the protocol negotiated between the client + * and the server, encoded as the sum of the major number + * multipled by 10000 and the minor number. + */ + int protocol_version; + + /** + * The byte order generally used in communication with the + * display server + */ + enum libaxl_byte_order protocol_byte_order; + + /** + * The byte order used in images + */ + enum libaxl_byte_order image_byte_order; + + /** + * The smallest keycode transmitted by the server + * + * Will never be less than 8 + */ + unsigned int min_keycode; + + /** + * The greatest keycode transmitted by the server + * + * This field has the `unsigned int` type rather than the + * `libaxl_keycode_t` type because the latter is restricted + * to 8-bits, and a future version of the protocol could + * theoretically use a larger value + */ + unsigned int max_keycode; + + /** + * Some identification of the owner of the server implementation + */ + const char *vendor; + + /** + * Release number for the implementation. The vendor controls + * the semantics of this number. + */ + uint32_t vendor_release; + + /** + * The bit order used in the units in the scanlines of bitmaps + */ + enum libaxl_bit_order bitmap_format_bit_order; + + /** + * Number of bits (will be a multiple of 8) that the scanlines + * in bitmaps are quantised into units of + * + * Will never greater than `bitmap_format_scanline_pad` + */ + size_t bitmap_format_scanline_unit; + + /** + * Number of bits (will be a multiple of 8), that scanlines in + * bitmaps are padded to + */ + size_t bitmap_format_scanline_pad; + + /** + * The server may retain recent pointer motion history with + * finer granularity than is reported by LIBAXL_EVENT_MOTION_NOTIFY + * events, and which may be requested with + * LIBAXL_REQUEST_GET_MOTION_EVENTS requests + */ + size_t motion_buffer_size; + + /** + * The maximum value that can may appear in the length field + * in requests (that field is filled in by the library). Any + * requests larger than this (it is in byte-quads, meaning + * that it is multipled by 4 to get limit in bytes) generate + * a LIBAXL_ERROR_LENGTH error and the request is discarded. + * + * This field will always be at least 4096 (meaning 16384 bytes) + */ + size_t maximum_request_length; + + /** + * The number of elements in `.formats` + */ + size_t nformats; + + const struct libaxl_format *formats; /* TODO doc */ + + /** + * The number of elements in `.screens` + */ + size_t nscreens; + + /** + * List of all screens in the display + */ + const struct libaxl_format *screens; + + /** + * The default screen + */ + const struct libaxl_format *default_screen; +}; diff --git a/libaxl/errors.h b/libaxl/errors.h new file mode 100644 index 0000000..baccc2d --- /dev/null +++ b/libaxl/errors.h @@ -0,0 +1,206 @@ +/* See LICENSE file for copyright and license details. */ + +#if !defined(LIBAXL_H) || (LIBAXL_H < 2) +# error Do not include directly, include instead. +#endif + +#define LIBAXL_ERROR 0 + +struct libaxl_error_request { +#define LIBAXL_ERROR_REQUEST 1 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t __unused1; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_value { +#define LIBAXL_ERROR_VALUE 2 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t bad_value; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_window { +#define LIBAXL_ERROR_WINDOW 3 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t bad_resource_id; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_pixmap { +#define LIBAXL_ERROR_PIXMAP 4 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t bad_resource_id; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_atom { +#define LIBAXL_ERROR_ATOM 5 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t bad_resource_id; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_cursor { +#define LIBAXL_ERROR_CURSOR 6 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t bad_resource_id; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_font { +#define LIBAXL_ERROR_FONT 7 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t bad_resource_id; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_match { +#define LIBAXL_ERROR_MATCH 8 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t __unused1; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_drawable { +#define LIBAXL_ERROR_DRAWABLE 9 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t bad_resource_id; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_access { +#define LIBAXL_ERROR_ACCESS 10 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t __unused1; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_alloc { +#define LIBAXL_ERROR_ALLOC 11 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t __unused1; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_colormap { +#define LIBAXL_ERROR_COLORMAP 12 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t bad_resource_id; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_gcontext { +#define LIBAXL_ERROR_GCONTEXT 13 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t bad_resource_id; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_id_choice { +#define LIBAXL_ERROR_ID_CHOICE 14 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t bad_resource_id; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_name { +#define LIBAXL_ERROR_NAME 15 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t __unused1; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_length { +#define LIBAXL_ERROR_LENGTH 16 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t __unused1; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_error_implementation { +#define LIBAXL_ERROR_IMPLEMENTATION 17 + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t __unused1; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +union libaxl_error { + struct { + uint8_t __zero; + uint8_t code; + uint16_t sequence_number; + uint32_t __detail; + uint16_t minor_opcode; + uint8_t major_opcode; + }; +#include "errors-structs.h" +}; diff --git a/libaxl/events.h b/libaxl/events.h new file mode 100644 index 0000000..9191a92 --- /dev/null +++ b/libaxl/events.h @@ -0,0 +1,542 @@ +/* See LICENSE file for copyright and license details. */ + +#if !defined(LIBAXL_H) || (LIBAXL_H < 2) +# error Do not include directly, include instead. +#endif + +struct libaxl_event_key_press { +#define LIBAXL_EVENT_KEY_PRESS 2 + uint8_t code; + libaxl_keycode_t detail; + uint16_t sequence_number; + libaxl_timestamp_t time; + libaxl_window_t root; + libaxl_window_t event; + libaxl_window_t child; /* Can be LIBAXL_NONE */ + int16_t root_x; + int16_t root_y; + int16_t event_x; + int16_t event_y; + libaxl_keybutmask_t state; + libaxl_bool_t same_screen; + uint8_t __unused[1]; +}; + +struct libaxl_event_key_release { +#define LIBAXL_EVENT_KEY_RELEASE 3 + uint8_t code; + libaxl_keycode_t detail; + uint16_t sequence_number; + libaxl_timestamp_t time; + libaxl_window_t root; + libaxl_window_t event; + libaxl_window_t child; /* Can be LIBAXL_NONE */ + int16_t root_x; + int16_t root_y; + int16_t event_x; + int16_t event_y; + libaxl_keybutmask_t state; + libaxl_bool_t same_screen; + uint8_t __unused[1]; +}; + +struct libaxl_event_key_press_release { + /* key_{press,release} */ + uint8_t code; + libaxl_keycode_t detail; + uint16_t sequence_number; + libaxl_timestamp_t time; + libaxl_window_t root; + libaxl_window_t event; + libaxl_window_t child; /* Can be LIBAXL_NONE */ + int16_t root_x; + int16_t root_y; + int16_t event_x; + int16_t event_y; + libaxl_keybutmask_t state; + libaxl_bool_t same_screen; + uint8_t __unused[1]; +}; + +struct libaxl_event_button_press { +#define LIBAXL_EVENT_BUTTON_PRESS 4 + uint8_t code; + libaxl_button_t detail; + uint16_t sequence_number; + libaxl_timestamp_t time; + libaxl_window_t root; + libaxl_window_t event; + libaxl_window_t child; /* Can be LIBAXL_NONE */ + int16_t root_x; + int16_t root_y; + int16_t event_x; + int16_t event_y; + libaxl_keybutmask_t state; + libaxl_bool_t same_screen; + uint8_t __unused[1]; +}; + +struct libaxl_event_button_release { +#define LIBAXL_EVENT_BUTTON_RELEASE 5 + uint8_t code; + libaxl_button_t detail; + uint16_t sequence_number; + libaxl_timestamp_t time; + libaxl_window_t root; + libaxl_window_t event; + libaxl_window_t child; /* Can be LIBAXL_NONE */ + int16_t root_x; + int16_t root_y; + int16_t event_x; + int16_t event_y; + libaxl_keybutmask_t state; + libaxl_bool_t same_screen; + uint8_t __unused[1]; +}; + +struct libaxl_event_button_press_release { + /* button_{press,release} */ + uint8_t code; + libaxl_button_t detail; + uint16_t sequence_number; + libaxl_timestamp_t time; + libaxl_window_t root; + libaxl_window_t event; + libaxl_window_t child; /* Can be LIBAXL_NONE */ + int16_t root_x; + int16_t root_y; + int16_t event_x; + int16_t event_y; + libaxl_keybutmask_t state; + libaxl_bool_t same_screen; + uint8_t __unused[1]; +}; + +struct libaxl_event_motion_notify { +#define LIBAXL_EVENT_MOTION_NOTIFY 6 + uint8_t code; + uint8_t detail; /* LIBAXL_NORMAL or LIBAXL_HINT */ + uint16_t sequence_number; + libaxl_timestamp_t time; + libaxl_window_t root; + libaxl_window_t event; + libaxl_window_t child; /* Can be LIBAXL_NONE */ + int16_t root_x; + int16_t root_y; + int16_t event_x; + int16_t event_y; + libaxl_keybutmask_t state; + libaxl_bool_t same_screen; + uint8_t __unused[1]; +}; + +struct libaxl_event_input_device_event { + /* {key,button}_{press,release}, motion_notify */ + uint8_t code; + uint8_t detail; + uint16_t sequence_number; + libaxl_timestamp_t time; + libaxl_window_t root; + libaxl_window_t event; + libaxl_window_t child; /* Can be LIBAXL_NONE */ + int16_t root_x; + int16_t root_y; + int16_t event_x; + int16_t event_y; + libaxl_keybutmask_t state; + libaxl_bool_t same_screen; + uint8_t __unused[1]; +}; + +struct libaxl_event_enter_notify { +#define LIBAXL_EVENT_ENTER_NOTIFY 7 + uint8_t code; + uint8_t detail; /* See "pointer window details" in libaxl-consts.h */ + uint16_t sequence_number; + libaxl_timestamp_t time; + libaxl_window_t root; + libaxl_window_t event; + libaxl_window_t child; /* Can be LIBAXL_NONE */ + int16_t root_x; + int16_t root_y; + int16_t event_x; + int16_t event_y; + libaxl_keybutmask_t state; + uint8_t mode; /* LIBAXL_NORMAL, LIBAXL_GRAB, or LIBAXL_UNGRAB */ + uint8_t flags; /* TODO #x01 = Focus, #x02 = Same-screen */ +}; + +struct libaxl_event_leave_notify { +#define LIBAXL_EVENT_LEAVE_NOTIFY 8 + uint8_t code; + uint8_t detail; /* See "pointer window details" in libaxl-consts.h */ + uint16_t sequence_number; + libaxl_timestamp_t time; + libaxl_window_t root; + libaxl_window_t event; + libaxl_window_t child; /* Can be LIBAXL_NONE */ + int16_t root_x; + int16_t root_y; + int16_t event_x; + int16_t event_y; + libaxl_keybutmask_t state; + uint8_t mode; /* LIBAXL_NORMAL, LIBAXL_GRAB, or LIBAXL_UNGRAB */ + uint8_t flags; /* TODO #x01 = Focus, #x02 = Same-screen */ +}; + +struct libaxl_event_pointer_window_event { + /* {enter,leave}_notify */ + uint8_t code; + uint8_t detail; /* See "pointer window details" in libaxl-consts.h */ + uint16_t sequence_number; + libaxl_timestamp_t time; + libaxl_window_t root; + libaxl_window_t event; + libaxl_window_t child; /* Can be LIBAXL_NONE */ + int16_t root_x; + int16_t root_y; + int16_t event_x; + int16_t event_y; + libaxl_keybutmask_t state; + uint8_t mode; /* LIBAXL_NORMAL, LIBAXL_GRAB, or LIBAXL_UNGRAB */ + uint8_t flags; /* TODO #x01 = Focus, #x02 = Same-screen */ +}; + +struct libaxl_event_focus_in { +#define LIBAXL_EVENT_FOCUS_IN 9 + uint8_t code; + uint8_t detail; /* See "window focus details" in libaxl-consts.h (Beware of namespacing!) */ + uint16_t sequence_number; + libaxl_window_t window; + uint8_t mode; /* LIBAXL_NORMAL, LIBAXL_GRAB, LIBAXL_UNGRAB, or LIBAXL_WHILE_GRABBED */ + uint8_t __unused[23]; +}; + +struct libaxl_event_focus_out { +#define LIBAXL_EVENT_FOCUS_OUT 10 + uint8_t code; + uint8_t detail; /* See "window focus details" in libaxl-consts.h (Beware of namespacing!) */ + uint16_t sequence_number; + libaxl_window_t window; + uint8_t mode; /* LIBAXL_NORMAL, LIBAXL_GRAB, LIBAXL_UNGRAB, or LIBAXL_WHILE_GRABBED */ + uint8_t __unused[23]; +}; + +struct libaxl_event_input_focus_event { + /* focus_{in,out} */ + uint8_t code; + uint8_t detail; /* See "window focus details" in libaxl-consts.h (Beware of namespacing!) */ + uint16_t sequence_number; + libaxl_window_t window; + uint8_t mode; /* LIBAXL_NORMAL, LIBAXL_GRAB, LIBAXL_UNGRAB, or LIBAXL_WHILE_GRABBED */ + uint8_t __unused[23]; +}; + +struct libaxl_event_keymap_notify { +#define LIBAXL_EVENT_KEYMAP_NOTIFY 11 + uint8_t code; + uint8_t keys[31]; /* Byte for keycodes 0-7, which are unused, is omitted */ +}; + +struct libaxl_event_expose { +#define LIBAXL_EVENT_EXPOSE 12 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t window; + uint16_t x; + uint16_t y; + uint16_t width; + uint16_t height; + uint16_t count; + uint8_t __unused[14]; +}; + +struct libaxl_event_graphics_exposure { +#define LIBAXL_EVENT_GRAPHICS_EXPOSURE 13 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_drawable_t drawable; + uint16_t x; + uint16_t y; + uint16_t width; + uint16_t height; + uint16_t minor_opcode; + uint16_t count; + uint8_t major_opcode; + uint8_t __unused[11]; +}; + +struct libaxl_event_no_exposure { +#define LIBAXL_EVENT_NO_EXPOSURE 14 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_drawable_t drawable; + uint16_t minor_opcode; + uint8_t major_opcode; + uint8_t __unused[21]; +}; + +struct libaxl_event_visibility_notify { +#define LIBAXL_EVENT_VISIBILITY_NOTIFY 15 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_drawable_t drawable; + uint8_t state; /* LIBAXL_UNOBSCURED, LIBAXL_PARTIALLY_OBSCURED, or LIBAXL_FULLY_OBSCURED */ + uint8_t __unused[23]; +}; + +struct libaxl_event_create_notify { +#define LIBAXL_EVENT_CREATE_NOTIFY 16 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t parent; + libaxl_window_t window; + int16_t x; + int16_t y; + int16_t width; + int16_t height; + int16_t border_width; + libaxl_bool_t override_redirect; + uint8_t __unused[9]; +}; + +struct libaxl_event_destroy_notify { +#define LIBAXL_EVENT_DESTROY_NOTIFY 17 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t event; + libaxl_window_t window; + uint8_t __unused[20]; +}; + +struct libaxl_event_unmap_notify { +#define LIBAXL_EVENT_UNMAP_NOTIFY 18 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t event; + libaxl_window_t window; + libaxl_bool_t from_configure; + uint8_t __unused[19]; +}; + +struct libaxl_event_map_notify { +#define LIBAXL_EVENT_MAP_NOTIFY 19 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t event; + libaxl_window_t window; + libaxl_bool_t override_redirect; + uint8_t __unused[19]; +}; + +struct libaxl_event_map_request { +#define LIBAXL_EVENT_MAP_REQUEST 20 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t parent; + libaxl_window_t window; + uint8_t __unused[20]; +}; + +struct libaxl_event_reparent_notify { +#define LIBAXL_EVENT_REPARENT_NOTIFY 21 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t event; + libaxl_window_t window; + libaxl_window_t parent; + int16_t x; + int16_t y; + libaxl_bool_t override_redirect; + uint8_t __unused[11]; +}; + +struct libaxl_event_configure_notify { +#define LIBAXL_EVENT_CONFIGURE_NOTIFY 22 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t event; + libaxl_window_t window; + libaxl_window_t above_sibling; /* Can be LIBAXL_NONE */ + int16_t x; + int16_t y; + uint16_t width; + uint16_t height; + uint16_t border_width; + libaxl_bool_t override_redirect; + uint8_t __unused[5]; +}; + +struct libaxl_event_configure_request { +#define LIBAXL_EVENT_CONFIGURE_REQUEST 23 + uint8_t code; + uint8_t stack_mode; /* See "stack mode" in libaxl-consts.h */ + uint16_t sequence_number; + libaxl_window_t event; + libaxl_window_t window; + libaxl_window_t sibling; /* Can be LIBAXL_NONE */ + int16_t x; + int16_t y; + uint16_t width; + uint16_t height; + uint16_t border_width; + uint16_t value_mask; +#define LIBAXL_EVENT_CONFIGURE_REQUEST_X 0x0001U +#define LIBAXL_EVENT_CONFIGURE_REQUEST_Y 0x0002U +#define LIBAXL_EVENT_CONFIGURE_REQUEST_WIDTH 0x0004U +#define LIBAXL_EVENT_CONFIGURE_REQUEST_HEIGHT 0x0008U +#define LIBAXL_EVENT_CONFIGURE_REQUEST_BORDER_WIDTH 0x0010U +#define LIBAXL_EVENT_CONFIGURE_REQUEST_SIBLING 0x0020U +#define LIBAXL_EVENT_CONFIGURE_REQUEST_STACK_MODE 0x0040U + uint8_t __unused[4]; +}; + +struct libaxl_event_gravity_notify { +#define LIBAXL_EVENT_GRAVITY_NOTIFY 24 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t event; + libaxl_window_t window; + int16_t x; + int16_t y; + uint8_t __unused[16]; +}; + +struct libaxl_event_resize_request { +#define LIBAXL_EVENT_RESIZE_REQUEST 25 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t window; + uint16_t width; + uint16_t height; + uint8_t __unused[20]; +}; + +struct libaxl_event_circulate_notify { +#define LIBAXL_EVENT_CIRCULATE_NOTIFY 26 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t event; + libaxl_window_t window; + uint32_t __unused1; + uint8_t place; /* LIBAXL_TOP or LIBAXL_BOTTOM */ + uint8_t __unused[15]; +}; + +struct libaxl_event_circulate_request { +#define LIBAXL_EVENT_CIRCULATE_REQUEST 27 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t parent; + libaxl_window_t window; + uint32_t __unused1; + uint8_t place; /* LIBAXL_TOP or LIBAXL_BOTTOM */ + uint8_t __unused[15]; +}; + +struct libaxl_event_property_notify { +#define LIBAXL_EVENT_PROPERTY_NOTIFY 28 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t window; + libaxl_atom_t atom; + uint8_t state; /* LIBAXL_NEW_VALUE or LIBAXL_DELETED */ + uint8_t __unused[15]; +}; + +struct libaxl_event_selection_clear { +#define LIBAXL_EVENT_SELECTION_CLEAR 29 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_timestamp_t time; + libaxl_window_t owner; + libaxl_atom_t selection; + uint8_t __unused[16]; +}; + +struct libaxl_event_selection_request { +#define LIBAXL_EVENT_SELECTION_REQUEST 30 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ + libaxl_window_t owner; + libaxl_window_t requestor; + libaxl_atom_t selection; + libaxl_atom_t target; + libaxl_atom_t property; /* Can be LIBAXL_NONE */ + uint8_t __unused[4]; +}; + +struct libaxl_event_selection_notify { +#define LIBAXL_EVENT_SELECTION_NOTIFY 31 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ + libaxl_window_t requestor; + libaxl_atom_t selection; + libaxl_atom_t target; + libaxl_atom_t property; /* Can be LIBAXL_NONE */ + uint8_t __unused[8]; +}; + +struct libaxl_event_colormap_notify { +#define LIBAXL_EVENT_COLORMAP_NOTIFY 32 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + libaxl_window_t requestor; + libaxl_colormap_t colormap; /* Can be LIBAXL_NONE */ + libaxl_bool_t new; + uint8_t state; /* LIBAXL_UNINSTALLED or LIBAXL_INSTALLED */ + uint8_t __unused[18]; +}; + +struct libaxl_event_client_message { +#define LIBAXL_EVENT_CLIENT_MESSAGE 33 + uint8_t code; + uint8_t format; /* {8, 16, 32} */ + uint16_t sequence_number; + libaxl_window_t window; + libaxl_atom_t type; + union { + uint8_t u8[20]; + uint16_t u16[10]; + uint32_t u32[5]; + } data; +}; + +struct libaxl_event_mapping_notify { +#define LIBAXL_EVENT_MAPPING_NOTIFY 34 + uint8_t code; + uint8_t __pad; + uint16_t sequence_number; + uint8_t request; /* LIBAXL_MODIFIER, LIBAXL_KEYBOARD, or LIBAXL_POINTER */ + libaxl_keycode_t first_keycode; + uint8_t count; + uint8_t __unused[25]; +}; + +union libaxl_event { + uint8_t code; /* Highest bit marks the event as sent with SendEvent */ + /* .keymap_notify does not have a sequence number */ +#include "events-structs.h" +}; diff --git a/libaxl/low-level.h b/libaxl/low-level.h new file mode 100644 index 0000000..d817a7d --- /dev/null +++ b/libaxl/low-level.h @@ -0,0 +1,139 @@ +/* See LICENSE file for copyright and license details. */ + +#if !defined(LIBAXL_H) || (LIBAXL_H < 2) +# error Do not include directly, include instead. +#endif + +#define LIBAXL_HANDSHAKE_FAILED 0 +#define LIBAXL_HANDSHAKE_SUCCESS 1 +#define LIBAXL_HANDSHAKE_AUTHENTICATE 2 + +/* + * The largest possible return of the libaxl_get_decnet_object() + * function, plus 1 for the terminal NUL byte + */ +#define LIBAXL_DECNET_OBJECT_MAX (5 + 3 * sizeof(int) - sizeof(int) / 2) /* TODO man */ + +/** + * Create a connection object for a socket + * + * @param fd The file descriptor for the socket of the + * connection (does not have to be connected yet) + * @return The connection object, `NULL` on error + * + * On failure, no error is returned, but the error + * is always LIBAXL_ERROR_SYSTEM + */ +_LIBAXL_GCC_ONLY(__attribute__((__malloc__, __warn_unused_result__))) +LIBAXL_CONNECTION *libaxl_create(int); /* TODO man */ + +/** + * Parse a display name string + * + * The format for the display name string shall be either + * + * [/][]:[.] + * + * or for the "unix" protocol + * + * [.] + * + * @param name The display name string, $DISPLAY will be used if NULL or empty + * @param hostp Output parameter for the host of or (if the protocol is "unix") path + * to the display, remember to free after successful completion + * @param protocolp Output parameter for the network protocol used to access the display, + * remember to free after successful completion + * @param displayp Output parameter for the display's index (0 if the protocol is "unix") + * @param screenp Output parameter for the screen's index + * @return 0 on success, a negative libaxl error code on failure + */ +_LIBAXL_GCC_ONLY(__attribute__((__nonnull__(2, 3, 4, 5)))) +int libaxl_parse_display(const char *, char **, char **, int *, int *); /* TODO man */ + +/** + * Get the TCP port that is used for a display + * + * @param display The display's number, the function will assume that it is a valid number + * @return The TCP port used for the display + */ +_LIBAXL_GCC_ONLY(__attribute__((__warn_unused_result__, __const__))) +inline uint16_t libaxl_get_tcp_port(int display) +{ + return (uint16_t)(display + 6000); +} + +/** + * Get the DECnet object name that is used for a display + * + * @param buf Buffer that the object name shall be written to, it is recommended + * that is size, if static, is LIBAXL_DECNET_OBJECT_MAX (which is + * always sufficient), otherwise it should be at least the return value + * of this function (for the same last argument but with NULL and 0 + * as the first two arguments) plus 1 + * @param size The size of the buffer in the `buf` argument + * @param display The display's number + * @return The length of the object name, will not exceed LIBAXL_DECNET_OBJECT_MAX + * less 1; an additional uncounted NUL byte will be written to the buffer + * if it is large enough; or -1 on failure (specifically snprintf(3), which + * the function calls, by fail with EOVERFLOW if the `size` argument is + * greater than {INT_MAX}) + */ +int libaxl_get_decnet_object(char *, size_t, int); /* TODO man */ + +/** + * This function is to be called once and only once, excluding any + * failure that does not set `errno` to EINPROGRESS and excluding + * any call for which the display server respond that the handshake + * failed or requires authentication, immediately after connecting + * to the socket for the display + * + * The libaxl_receive_handshake() shall be called immediately after + * calling this function + * + * @param ctx The thread's context for the connection to the display to send the handshake over + * @param auth_name The protocol name of the authorisation the client expects the server to use; + * valid authorisation mechanisms are not part of the core X protocol + * @param auth_name_len The length of `auth_name`, 0 if `auth_name` is NULL + * @param auth_data The authorisation data, which is specific to the choosen authorisation mechanism + * @param auth_data_len The length of `auth_data`, 0 if `auth_data` is NULL + * @param flags Flags to use for the 4th parameter when calling send(3) + * @return 0 on success, a negative libaxl error code on failure + * + * If the function returns LIBAXL_ERROR_SYSTEM and sets `errno` + * to EINPROGRESS, the message has been saved (possibly partially + * sent) and pending to be sent by calling libaxl_flush(). + */ +_LIBAXL_GCC_ONLY(__attribute__((__nonnull__(1)))) +int libaxl_send_handshake(LIBAXL_CONTEXT *restrict, const char *, size_t, const char *, size_t, int); /* TODO man */ + +/** + * Receive the server's part of the handshake, this function + * shall be called once immediately after each successful call + * to the libaxl_send_handshake() function or successful call + * to the libaxl_flush() function due to EINPROGRESS failure + * of call to the libaxl_send_handshake() function + * + * @param ctx The thread's context for the connection to the display server + * @param majorp Output parameter for the major version number for a version + * of the X protocol that the display server supports, which is + * not necessarily the version that the library uses. Will only + * be set if the function returns LIBAXL_HANDSHAKE_FAILED or + * LIBAXL_HANDSHAKE_SUCCESS. + * @param minorp Output parameter for the minor version number for a version + * of the X protocol that the display server supports, which is + * not necessarily the version that the library uses. Will only + * be set if the function returns LIBAXL_HANDSHAKE_FAILED or + * LIBAXL_HANDSHAKE_SUCCESS. + * @param reasonp Output parameter for the reason the handshake or authorisation + * failed. Will be set to NULL unless the function returns + * LIBAXL_HANDSHAKE_FAILED or LIBAXL_HANDSHAKE_AUTHENTICATE. + * Remember to free after successful completion (non-negative return) + * @param flags Flags to use for the 4th parameter when calling recv(3) + * @return 0 on success, a negative libaxl error code on failure + * + * Behaviour is unspecified if SO_PEEK_OFF is active on the + * connection to the display server or if the MSG_PEEK flag + * is used + */ +_LIBAXL_GCC_ONLY(__attribute__((__nonnull__(1)))) +int libaxl_receive_handshake(LIBAXL_CONTEXT *restrict, int *restrict, int *restrict, char **restrict, int); /* TODO man */ diff --git a/libaxl/replies.h b/libaxl/replies.h new file mode 100644 index 0000000..ded2d51 --- /dev/null +++ b/libaxl/replies.h @@ -0,0 +1,494 @@ +/* See LICENSE file for copyright and license details. */ + +#if !defined(LIBAXL_H) || (LIBAXL_H < 2) +# error Do not include directly, include instead. +#endif + +#define LIBAXL_REPLY 1 /* TODO man */ + +struct libaxl_reply_get_window_attributes { + uint8_t __one; + uint8_t backing_store; /* LIBAXL_NOT_USEFUL, LIBAXL_WHEN_MAPPED, or LIBAXL_ALWAYS */ + uint16_t sequence_number; + uint32_t _reply_length; /* = 3 */ + libaxl_visual_t visual; + uint16_t class; /* LIBAXL_INPUT_OUTPUT (= 1) or LIBAXL_INPUT_ONLY (= 2) */ + uint8_t bit_gravity; + uint8_t win_gravity; + uint32_t backing_planes; + uint32_t backing_pixel; + libaxl_bool_t save_under; + libaxl_bool_t map_is_installed; + uint8_t map_state; /* LIBAXL_UNMAPPED, LIBAXL_UNVIEWABLE, or LIBAXL_VIEWABLE */ + libaxl_bool_t override_redirect; + libaxl_colormap_t colormap; /* Can be LIBAXL_NONE */ + uint32_t all_event_masks; /* TODO SETofEVENT */ + uint32_t your_event_mask; /* TODO SETofEVENT */ + uint16_t do_not_propagate_mask; /* TODO SETofDEVICEEVENT */ + uint16_t __pad; +}; + +struct libaxl_reply_get_geometry { + uint8_t __one; + uint8_t depth; + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + libaxl_window_t root; + int16_t x; + int16_t y; + uint16_t width; + uint16_t height; + uint16_t border_width; + uint8_t __unused[10]; +}; + +struct libaxl_reply_query_tree { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; /* = .number_of_children */ + libaxl_window_t root; + libaxl_window_t parent; /* Can be LIBAXL_NONE */ + uint16_t number_of_children; + uint8_t __unused[14]; + libaxl_window_t *children; +}; + +struct libaxl_reply_intern_atom { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + libaxl_atom_t atom; /* Can be LIBAXL_NONE */ + uint8_t __unused[20]; +}; + +struct libaxl_reply_get_atom_name { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; + uint16_t length_of_name; + uint8_t __unused[22]; + char *name; +}; + +struct libaxl_reply_get_property { + uint8_t __one; + uint8_t format; /* {0 = 0, 8 = 8, 16 = 16, 32 = 32}*/ + uint16_t sequence_number; + uint32_t _reply_length; + libaxl_atom_t type; /* Can be LIBAXL_NONE */ + uint32_t bytes_after; + uint32_t length_of_value; /* in format units */ + uint8_t __unused[12]; + union { + char *value; + uint8_t *value8; + uint16_t *value16; + uint32_t *value32; + }; +}; + +struct libaxl_reply_list_properties { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; + uint16_t number_of_atoms; + uint8_t __unused[22]; + libaxl_atom_t *atoms; +}; + +struct libaxl_reply_get_selection_owner { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + libaxl_window_t owner; /* Can be LIBAXL_NONE */ + uint8_t __unused[20]; +}; + +struct libaxl_reply_grab_pointer { + uint8_t __one; + uint8_t status; /* See "grab status" in libaxl-consts.h */ + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + uint8_t __unused[24]; +}; + +struct libaxl_reply_grab_keyboard { + uint8_t __one; + uint8_t status; /* See "grab status" in libaxl-consts.h */ + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + uint8_t __unused[24]; +}; + +struct libaxl_reply_query_pointer { + uint8_t __one; + libaxl_bool_t same_screen; + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + libaxl_window_t root; + libaxl_window_t child; /* Can be LIBAXL_NONE */ + int16_t root_x; + int16_t root_y; + int16_t win_x; + int16_t win_y; + libaxl_keybutmask_t mask; /* TODO ? SETofKEYBUTMASK shouldn't have its own type */ + uint8_t __unused[6]; +}; + +struct libaxl_reply_get_motion_events { + uint8_t __one; + libaxl_bool_t same_screen; + uint16_t sequence_number; + uint32_t _reply_length; /* = 2 * .number_of_events */ + uint32_t number_of_events; + uint8_t __unused[20]; + struct libaxl_timecoord *events; +}; + +struct libaxl_reply_translate_coordinates { + uint8_t __one; + libaxl_bool_t same_screen; + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + libaxl_window_t child; /* Can be LIBAXL_NONE */ + int16_t dest_x; + int16_t dest_y; + int8_t __unused[16]; +}; + +struct libaxl_reply_get_input_focus { + uint8_t __one; + uint8_t revert_to; /* LIBAXL_NONE, LIBAXL_POINTER_ROOT, or LIBAXL_PARENT */ + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + libaxl_window_t focus; /* Can be LIBAXL_NONE or LIBAXL_POINTER_ROOT */ + int8_t __unused[20]; +}; + +struct libaxl_reply_query_keymap { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; /* = 2 */ + uint8_t keys[32]; +}; + +struct libaxl_reply_query_font { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; + struct libaxl_charinfo min_bounds; + uint32_t __unused1; + struct libaxl_charinfo max_bounds; + uint32_t __unused2; + uint16_t min_char_or_byte2; + uint16_t max_char_or_byte2; + uint16_t default_char; + uint16_t number_of_properties; + uint8_t draw_direction; /* LIBAXL_LEFT_TO_RIGHT or LIBAXL_RIGHT_TO_LEFT */ + uint8_t min_byte1; + uint8_t max_byte1; + libaxl_bool_t all_chars_exist; + int16_t font_ascent; + int16_t font_descent; + uint32_t number_of_char_infos; + struct libaxl_fontprop *properties; + struct libaxl_charinfo *char_infos; +}; + +struct libaxl_reply_query_text_extents { + uint8_t __one; + uint8_t draw_direction; /* LIBAXL_LEFT_TO_RIGHT or LIBAXL_RIGHT_TO_LEFT */ + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + int16_t font_ascent; + int16_t font_descent; + int16_t overall_ascent; + int16_t overall_descent; + int32_t overall_width; + int32_t overall_left; + int32_t overall_right; + uint8_t __unused[4]; +}; + +struct libaxl_reply_list_fonts { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; + uint16_t number_of_names; + uint8_t __unused[22]; + struct libaxl_str8 *names; +}; + +struct libaxl_reply_list_fonts_with_info { + uint8_t __one; + uint8_t length_of_name; /* 0 = end of series */ + uint16_t sequence_number; + uint32_t _reply_length; /* = 7 if .length_of_name = 0 */ + + /* the rest (52 bytes) are unused if .length_of_name = 0 */ + struct libaxl_charinfo min_bounds; + uint32_t __unused1; + struct libaxl_charinfo max_bounds; + uint32_t __unused2; + uint16_t min_char_or_byte2; + uint16_t max_char_or_byte2; + uint16_t default_char; + uint16_t number_of_properties; + uint8_t draw_direction; /* LIBAXL_LEFT_TO_RIGHT or LIBAXL_RIGHT_TO_LEFT */ + uint8_t min_byte1; + uint8_t max_byte1; + libaxl_bool_t all_chars_exist; + int16_t font_ascent; + int16_t font_descent; + uint32_t replies_hint; + struct libaxl_fontprop *properties; + char *name; +}; + +struct libaxl_reply_get_font_path { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; + uint16_t number_of_strs; + uint8_t __unused[22]; + struct libaxl_str8 *path; +}; + +struct libaxl_reply_get_image { + uint8_t __one; + uint8_t depth; + uint16_t sequence_number; + uint32_t _reply_length; + libaxl_visual_t visual; /* Can be LIBAXL_NONE */ + uint8_t __unused[20]; + size_t size_of_data; + uint8_t *data; +}; + +struct libaxl_reply_list_installed_colormaps { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; /* = .number_of_cmaps */ + uint16_t number_of_cmaps; + uint8_t __unused[22]; + libaxl_colormap_t *cmaps; +}; + +struct libaxl_reply_alloc_color { + uint8_t __one; + uint8_t __pad1; + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + uint16_t red; + uint16_t green; + uint16_t blue; + uint16_t __pad2; + uint32_t pixel; + uint8_t __unused[12]; +}; + +struct libaxl_reply_alloc_named_color { + uint8_t __one; + uint8_t __pad1; + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + uint32_t pixel; + uint16_t exact_red; + uint16_t exact_green; + uint16_t exact_blue; + uint16_t visual_red; + uint16_t visual_green; + uint16_t visual_blue; + uint8_t __unused[8]; +}; + +struct libaxl_reply_alloc_color_cells { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; + uint16_t number_of_pixels; + uint16_t number_of_masks; + uint8_t __used[20]; + uint32_t *pixels; + uint32_t *mask; +}; + +struct libaxl_reply_alloc_color_planes { + uint8_t __one; + uint8_t __pad1; + uint16_t sequence_number; + uint32_t _reply_length; /* = .number_of_pixels */ + uint16_t number_of_pixels; + uint16_t __pad2; + uint32_t red_mask; + uint32_t green_mask; + uint32_t blue_mask; + uint8_t __unused[8]; + uint32_t *pixels; +}; + +struct libaxl_reply_query_colors { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; /* = 2 * .number_of_colors */ + uint16_t number_of_colors; + uint8_t __unused[22]; + struct libaxl_rgb16 *colors; +}; + +struct libaxl_reply_lookup_color { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + uint16_t exact_red; + uint16_t exact_green; + uint16_t exact_blue; + uint16_t visual_red; + uint16_t visual_green; + uint16_t visual_blue; + uint8_t __unused[12]; +}; + +struct libaxl_reply_query_best_size { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + uint16_t width; + uint16_t height; + uint8_t __unused[20]; +}; + +struct libaxl_reply_query_extension { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + libaxl_bool_t present; + uint8_t major_opcode; + uint8_t first_event; + uint8_t first_error; + uint8_t __unused[20]; +}; + +struct libaxl_reply_list_extensions { + uint8_t __one; + uint8_t number_of_names; + uint16_t sequence_number; + uint32_t _reply_length; + uint8_t __unused[24]; + struct libaxl_str8 *names; +}; + +struct libaxl_reply_get_keyboard_mapping { + uint8_t __one; + uint8_t keysyms_per_keycode; + uint16_t sequence_number; + uint32_t _reply_length; /* = count field from the request divided by .keysyms_per_keycode */ + uint8_t __unused[24]; + libaxl_keysym_t *keysyms; +}; + +struct libaxl_reply_get_keyboard_control { + uint8_t __one; + uint8_t global_auto_repeat; /* LIBAXL_OFF or LIBAXL_ON */ + uint16_t sequence_number; + uint32_t _reply_length; /* = 5 */ + uint32_t led_mask; + uint8_t key_click_percent; + uint8_t bell_percent; + uint16_t bell_pitch; + uint16_t bell_duration; + uint16_t __unused; + uint8_t auto_repeats[32]; +}; + +struct libaxl_reply_get_pointer_control { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + uint16_t acceleration_numerator; + uint16_t acceleration_denominator; + uint16_t threshold; + uint8_t __unused[18]; +}; + +struct libaxl_reply_get_screen_saver { + uint8_t __one; + uint8_t __pad; + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + uint16_t timeout; + uint16_t interval; + uint8_t prefer_blanking; /* LIBAXL_NO or LIBAXL_YES */ + uint8_t allow_exposures; /* LIBAXL_NO or LIBAXL_YES */ + uint8_t __unused[18]; +}; + +struct libaxl_reply_list_hosts { + uint8_t __one; + uint8_t mode; /* LIBAXL_DISABLED or LIBAXL_ENABLED */ + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + uint16_t number_of_hosts; + uint8_t __unused[22]; + struct libaxl_host *hosts; +}; + +struct libaxl_reply_set_pointer_mapping { + uint8_t __one; + uint8_t status; /* LIBAXL_SUCCESS or LIBAXL_BUSY */ + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + uint8_t __unused[24]; +}; + +struct libaxl_reply_get_pointer_mapping { + uint8_t __one; + uint8_t length_of_map; + uint16_t sequence_number; + uint32_t _reply_length; + uint8_t __unused[24]; + uint8_t *map; +}; + +struct libaxl_reply_set_modifier_mapping { + uint8_t __one; + uint8_t status; /* LIBAXL_SUCCESS, LIBAXL_BUSY, or LIBAXL_FAILED */ + uint16_t sequence_number; + uint32_t _reply_length; /* = 0 */ + uint8_t __unused[24]; +}; + +struct libaxl_reply_get_modifier_mapping { + uint8_t __one; + uint8_t keycodes_per_modifier; /* pairs */ + uint16_t sequence_number; + uint32_t _reply_length; /* = 2 * .keycodes_per_modifier */ + uint8_t __unused[24]; + libaxl_keycode_t *keycodes; +}; + +union libaxl_reply { + struct { + uint8_t __one; + uint8_t __data; + uint16_t sequence_number; + uint32_t _reply_length; + }; +#include "replies-structs.h" +}; diff --git a/libaxl/requests.h b/libaxl/requests.h new file mode 100644 index 0000000..7566dd6 --- /dev/null +++ b/libaxl/requests.h @@ -0,0 +1,1449 @@ +/* See LICENSE file for copyright and license details. */ + +#if !defined(LIBAXL_H) || (LIBAXL_H < 2) +# error Do not include directly, include instead. +#endif + +struct libaxl_request_create_window { +#define LIBAXL_REQUEST_CREATE_WINDOW 1 + uint8_t opcode; + uint8_t depth; + uint16_t _request_length; + libaxl_window_t wid; + libaxl_window_t parent; + int16_t x; + int16_t y; + uint16_t width; + uint16_t height; + uint16_t border_width; + uint16_t class; /* LIBAXL_COPY_FROM_PARENT, LIBAXL_INPUT_OUTPUT, or LIBAXL_INPUT_ONLY */ + libaxl_visual_t visual; /* Can be LIBAXL_COPY_FROM_PARENT */ + uint32_t value_mask; /* Determines which below are included, all are encoded as uint32_t */ +#define LIBAXL_REQUEST_CREATE_WINDOW_BACKGROUND_PIXMAP 0x00000001UL +#define LIBAXL_REQUEST_CREATE_WINDOW_BACKGROUND_PIXEL 0x00000002UL +#define LIBAXL_REQUEST_CREATE_WINDOW_BORDER_PIXMAP 0x00000004UL +#define LIBAXL_REQUEST_CREATE_WINDOW_BORDER_PIXEL 0x00000008UL +#define LIBAXL_REQUEST_CREATE_WINDOW_BIT_GRAVITY 0x00000010UL +#define LIBAXL_REQUEST_CREATE_WINDOW_WIN_GRAVITY 0x00000020UL +#define LIBAXL_REQUEST_CREATE_WINDOW_BACKING_STORE 0x00000040UL +#define LIBAXL_REQUEST_CREATE_WINDOW_BACKING_PLANES 0x00000080UL +#define LIBAXL_REQUEST_CREATE_WINDOW_BACKING_PIXEL 0x00000100UL +#define LIBAXL_REQUEST_CREATE_WINDOW_OVERRIDE_REDIRECT 0x00000200UL +#define LIBAXL_REQUEST_CREATE_WINDOW_SAVE_UNDER 0x00000400UL +#define LIBAXL_REQUEST_CREATE_WINDOW_EVENT_MASK 0x00000800UL +#define LIBAXL_REQUEST_CREATE_WINDOW_DO_NOT_PROPAGATE_MASK 0x00001000UL +#define LIBAXL_REQUEST_CREATE_WINDOW_COLORMAP 0x00002000UL +#define LIBAXL_REQUEST_CREATE_WINDOW_CURSOR 0x00004000UL + libaxl_pixmap_t background_pixmap; /* Can be LIBAXL_NONE or LIBAXL_PARENT_RELATIVE */ + uint32_t background_pixel; + libaxl_pixmap_t border_pixmap; /* Can be LIBAXL_COPY_FROM_PARENT */ + uint32_t border_pixel; + uint8_t bit_gravity; + uint8_t win_gravity; + uint8_t backing_store; /* LIBAXL_NOT_USEFUL, LIBAXL_WHEN_MAPPED, or LIBAXL_ALWAYS */ + uint8_t __omitted1; + uint32_t backing_planes; + uint32_t backing_pixel; + libaxl_bool_t override_redirect; + libaxl_bool_t save_under; + uint16_t __omitted2; + uint32_t event_mask; /* TODO SETofEVENT */ + uint32_t do_not_propagate_mask; /* TODO SETofDEVICEEVENT */ + libaxl_colormap_t colormap; /* Can be LIBAXL_COPY_FROM_PARENT */ + libaxl_cursor_t cursor; /* Can be LIBAXL_NONE */ +}; + +struct libaxl_request_change_window_attributes { +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES 2 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + libaxl_window_t window; + uint32_t value_mask; /* Determines which below are included, all are encoded as uint32_t */ +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BACKGROUND_PIXMAP 0x00000001UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BACKGROUND_PIXEL 0x00000002UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BORDER_PIXMAP 0x00000004UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BORDER_PIXEL 0x00000008UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BIT_GRAVITY 0x00000010UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_WIN_GRAVITY 0x00000020UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BACKING_STORE 0x00000040UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BACKING_PLANES 0x00000080UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_BACKING_PIXEL 0x00000100UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_OVERRIDE_REDIRECT 0x00000200UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_SAVE_UNDER 0x00000400UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_EVENT_MASK 0x00000800UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_DO_NOT_PROPAGATE_MASK 0x00001000UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_COLORMAP 0x00002000UL +#define LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES_CURSOR 0x00004000UL + libaxl_pixmap_t background_pixmap; /* Can be LIBAXL_NONE or LIBAXL_PARENT_RELATIVE */ + uint32_t background_pixel; + libaxl_pixmap_t border_pixmap; /* Can be LIBAXL_COPY_FROM_PARENT */ + uint32_t border_pixel; + uint8_t bit_gravity; + uint8_t win_gravity; + uint8_t backing_store; /* LIBAXL_NOT_USEFUL, LIBAXL_WHEN_MAPPED, or LIBAXL_ALWAYS */ + uint8_t __omitted1; + uint32_t backing_planes; + uint32_t backing_pixel; + libaxl_bool_t override_redirect; + libaxl_bool_t save_under; + uint16_t __omitted2; + uint32_t event_mask; /* TODO SETofEVENT */ + uint32_t do_not_propagate_mask; /* TODO SETofDEVICEEVENT */ + libaxl_colormap_t colormap; /* Can be LIBAXL_COPY_FROM_PARENT */ + libaxl_cursor_t cursor; /* Can be LIBAXL_NONE */ +}; + +struct libaxl_request_get_window_attributes { +#define LIBAXL_REQUEST_GET_WINDOW_ATTRIBUTES 3 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_window_t window; +}; + +struct libaxl_request_destroy_window { +#define LIBAXL_REQUEST_DESTROY_WINDOW 4 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_window_t window; +}; + +struct libaxl_request_destroy_subwindows { +#define LIBAXL_REQUEST_DESTROY_SUBWINDOWS 5 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_window_t window; +}; + +struct libaxl_request_change_save_set { +#define LIBAXL_REQUEST_CHANGE_SAVE_SET 6 + uint8_t opcode; + uint8_t mode; /* LIBAXL_INSERT or LIBAXL_DELETE */ + uint16_t _request_length; /* = 2 */ + libaxl_window_t window; +}; + +struct libaxl_request_reparent_window { +#define LIBAXL_REQUEST_REPARENT_WINDOW 7 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 4 */ + libaxl_window_t window; + libaxl_window_t parent; + int16_t x; + int16_t y; +}; + +struct libaxl_request_map_window { +#define LIBAXL_REQUEST_MAP_WINDOW 8 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_window_t window; +}; + +struct libaxl_request_map_subwindows { +#define LIBAXL_REQUEST_MAP_SUBWINDOWS 9 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_window_t window; +}; + +struct libaxl_request_unmap_window { +#define LIBAXL_REQUEST_UNMAP_WINDOW 10 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_window_t window; +}; + +struct libaxl_request_unmap_subwindows { +#define LIBAXL_REQUEST_UNMAP_SUBWINDOWS 11 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_window_t window; +}; + +struct libaxl_request_configure_window { +#define LIBAXL_REQUEST_CONFIGURE_WINDOW 12 + uint8_t opcode; + uint8_t __pad1; + uint16_t _request_length; + libaxl_window_t window; + uint16_t value_mask; /* Determines which below are included, all are encoded as uint32_t */ +#define LIBAXL_REQUEST_CONFIGURE_WINDOW_X 0x0001U +#define LIBAXL_REQUEST_CONFIGURE_WINDOW_Y 0x0002U +#define LIBAXL_REQUEST_CONFIGURE_WINDOW_WIDTH 0x0004U +#define LIBAXL_REQUEST_CONFIGURE_WINDOW_HEIGHT 0x0008U +#define LIBAXL_REQUEST_CONFIGURE_WINDOW_BORDER_WIDTH 0x0010U +#define LIBAXL_REQUEST_CONFIGURE_WINDOW_SIBLING 0x0020U +#define LIBAXL_REQUEST_CONFIGURE_WINDOW_STACK_MODE 0x0040U + uint16_t __pad2; + int16_t x; + int16_t y; + uint16_t width; + uint16_t height; + uint16_t border_width; + uint16_t __omitted1; + libaxl_window_t sibling; + uint8_t stack_mode; /* See "stack mode" in libaxl-consts.h */ + uint8_t __omitted2[3]; +}; + +struct libaxl_request_circulate_window { +#define LIBAXL_REQUEST_CIRCULATE_WINDOW 13 + uint8_t opcode; + uint8_t direction; /* LIBAXL_RAISE_LOWEST or LIBAXL_LOWER_HIGHEST */ + uint16_t _request_length; /* = 2 */ + libaxl_window_t window; +}; + +struct libaxl_request_get_geometry { +#define LIBAXL_REQUEST_GET_GEOMETRY 14 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_drawable_t drawable; +}; + +struct libaxl_request_query_tree { +#define LIBAXL_REQUEST_QUERY_TREE 15 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_window_t window; +}; + +struct libaxl_request_intern_atom { +#define LIBAXL_REQUEST_INTERN_ATOM 16 + uint8_t opcode; + libaxl_bool_t only_if_exists; + uint16_t _request_length; + uint16_t length_of_name; + uint16_t __pad; + char *name; +}; + +struct libaxl_request_get_atom_name { +#define LIBAXL_REQUEST_GET_ATOM_NAME 17 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_atom_t atom; +}; + +struct libaxl_request_change_property { +#define LIBAXL_REQUEST_CHANGE_PROPERTY 18 + uint8_t opcode; + uint8_t mode; /* See libaxl-consts.h */ + uint16_t _request_length; + libaxl_window_t window; + libaxl_atom_t property; + libaxl_atom_t type; + uint8_t format; /* {8, 16, 32} */ + uint8_t __pad[3]; + uint32_t length_of_data; /* in format units */ + union { + char *data; + uint8_t *data8; + uint16_t *data16; + uint32_t *data32; + }; +}; + +struct libaxl_request_delete_property { +#define LIBAXL_REQUEST_DELETE_PROPERTY 19 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 3 */ + libaxl_window_t window; + libaxl_atom_t property; +}; + +struct libaxl_request_get_property { +#define LIBAXL_REQUEST_GET_PROPERTY 20 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 6 */ + libaxl_window_t window; + libaxl_atom_t property; + libaxl_atom_t type; /* Can be LIBAXL_ANY_PROPERTY_TYPE */ + uint32_t offset; + uint32_t length; +}; + +struct libaxl_request_list_properties { +#define LIBAXL_REQUEST_LIST_PROPERTIES 21 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_window_t window; +}; + +struct libaxl_request_set_selection_owner { +#define LIBAXL_REQUEST_SET_SELECTION_OWNER 22 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 4 */ + libaxl_window_t owner; /* Can be LIBAXL_NONE */ + libaxl_atom_t selection; + libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ +}; + +struct libaxl_request_get_selection_owner { +#define LIBAXL_REQUEST_GET_SELECTION_OWNER 23 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_atom_t selection; +}; + +struct libaxl_request_convert_selection { +#define LIBAXL_REQUEST_CONVERT_SELECTION 24 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 5 */ + libaxl_atom_t selection; + libaxl_atom_t target; + libaxl_atom_t property; /* Can be LIBAXL_NONE */ + libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ +}; + +struct libaxl_request_send_event { +#define LIBAXL_REQUEST_SEND_EVENT 25 + uint8_t opcode; + libaxl_bool_t propagate; + uint16_t _request_length; /* = 11 */ + libaxl_window_t destination; /* Can be LIBAXL_POINTER_WINDOW or LIBAXL_INPUT_FOCUS */ + uint32_t event_mask; /* TODO SETofEVENT */ + union libaxl_event event; +}; + +struct libaxl_request_grab_pointer { +#define LIBAXL_REQUEST_GRAB_POINTER 26 + uint8_t opcode; + libaxl_bool_t owner_events; + uint16_t _request_length; /* = 6 */ + libaxl_window_t grab_window; + uint16_t event_mask; /* TODO SETofPOINTEREVENT */ + uint8_t pointer_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ + uint8_t keyboard_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ + libaxl_window_t confine_to; /* Can be LIBAXL_NONE */ + libaxl_cursor_t cursor; /* Can be LIBAXL_NONE */ + libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ +}; + +struct libaxl_request_ungrab_pointer { +#define LIBAXL_REQUEST_UNGRAB_POINTER 27 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ +}; + +struct libaxl_request_grab_button { +#define LIBAXL_REQUEST_GRAB_BUTTON 28 + uint8_t opcode; + uint8_t __pad1; + uint16_t _request_length; /* = 6 */ + libaxl_window_t grab_window; + uint16_t event_mask; /* TODO SETofPOINTEREVENT */ + uint8_t pointer_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ + uint8_t keyboard_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ + libaxl_window_t confine_to; /* Can be LIBAXL_NONE */ + libaxl_cursor_t cursor; /* Can be LIBAXL_NONE */ + uint8_t button; /* Can be LIBAXL_ANY_BUTTON */ + uint8_t __pad2; + uint16_t modifiers; /* TODO SETofKEYMASK, #x8000 = AnyModifier */ +}; + +struct libaxl_request_ungrab_button { +#define LIBAXL_REQUEST_UNGRAB_BUTTON 29 + uint8_t opcode; + uint8_t button; /* Can be LIBAXL_ANY_BUTTON */ + uint16_t _request_length; /* = 3 */ + libaxl_window_t grab_window; + uint16_t modifiers; /* TODO SETofKEYMASK, #x8000 = AnyModifier */ + uint16_t __pad; +}; + +struct libaxl_request_change_active_pointer_grab { +#define LIBAXL_REQUEST_CHANGE_ACTIVE_POINTER_GRAB 30 + uint8_t opcode; + uint8_t __pad1; + uint16_t _request_length; /* = 4 */ + libaxl_cursor_t cursor; /* Can be LIBAXL_NONE */ + libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ + uint16_t event_mask; /* TODO SETofPOINTEREVENT */ + uint16_t __pad2; +}; + +struct libaxl_request_grab_keyboard { +#define LIBAXL_REQUEST_GRAB_KEYBOARD 31 + uint8_t opcode; + libaxl_bool_t owner_events; + uint16_t _request_length; /* = 4 */ + libaxl_window_t grab_window; + libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ + uint8_t pointer_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ + uint8_t keyboard_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ + uint16_t __pad; +}; + +struct libaxl_request_ungrab_keyboard { +#define LIBAXL_REQUEST_UNGRAB_KEYBOARD 32 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ +}; + +struct libaxl_request_grab_key { +#define LIBAXL_REQUEST_GRAB_KEY 33 + uint8_t opcode; + libaxl_bool_t owner_events; + uint16_t _request_length; /* = 4 */ + libaxl_window_t grab_window; + uint16_t modifiers; /* TODO SETofKEYMASK, #x8000 = AnyModifier */ + libaxl_keycode_t key; /* Can be LIBAXL_ANY_KEY */ + uint8_t pointer_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ + uint8_t keyboard_mode; /* LIBAXL_SYNCHRONOUS or LIBAXL_ASYNCHRONOUS */ + uint8_t __pad[3]; +}; + +struct libaxl_request_ungrab_key { +#define LIBAXL_REQUEST_UNGRAB_KEY 34 + uint8_t opcode; + libaxl_keycode_t key; /* Can be LIBAXL_ANY_KEY */ + uint16_t _request_length; /* = 3 */ + libaxl_window_t grab_window; + uint16_t modifiers; /* TODO SETofKEYMASK, #x8000 = AnyModifier */ + uint16_t __pad; +}; + +struct libaxl_request_allow_events { +#define LIBAXL_REQUEST_ALLOW_EVENTS 35 + uint8_t opcode; + uint8_t mode; /* See libaxl-consts.h */ + uint16_t _request_length; /* = 2 */ + libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ +}; + +struct libaxl_request_grab_server { +#define LIBAXL_REQUEST_GRAB_SERVER 36 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_ungrab_server { +#define LIBAXL_REQUEST_UNGRAB_SERVER 37 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_query_pointer { +#define LIBAXL_REQUEST_QUERY_POINTER 38 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_window_t window; +}; + +struct libaxl_request_get_motion_events { +#define LIBAXL_REQUEST_GET_MOTION_EVENTS 39 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 4 */ + libaxl_window_t window; + libaxl_timestamp_t start; /* Can be LIBAXL_CURRENT_TIME */ + libaxl_timestamp_t end; /* Can be LIBAXL_CURRENT_TIME */ +}; + +struct libaxl_request_translate_coordinates { +#define LIBAXL_REQUEST_TRANSLATE_COORDINATES 40 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 4 */ + libaxl_window_t src_window; + libaxl_window_t dest_window; + int16_t src_x; + int16_t src_y; +}; + +struct libaxl_request_warp_pointer { +#define LIBAXL_REQUEST_WARP_POINTER 41 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 6 */ + libaxl_window_t src_window; /* Can be LIBAXL_NONE */ + libaxl_window_t dest_window; /* Can be LIBAXL_NONE */ + int16_t src_x; + int16_t src_y; + uint16_t src_width; + uint16_t src_height; + int16_t dest_x; + int16_t dest_y; +}; + +struct libaxl_request_set_input_focus { +#define LIBAXL_REQUEST_SET_INPUT_FOCUS 42 + uint8_t opcode; + uint8_t revert_to; /* LIBAXL_NONE, LIBAXL_POINTER_ROOT, or LIBAXL_PARENT */ + uint16_t _request_length; /* = 3 */ + libaxl_window_t focus; /* Can be LIBAXL_NONE or LIBAXL_POINTER_ROOT */ + libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ +}; + +struct libaxl_request_get_input_focus { +#define LIBAXL_REQUEST_GET_INPUT_FOCUS 43 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_query_keymap { +#define LIBAXL_REQUEST_QUERY_KEYMAP 44 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_open_font { +#define LIBAXL_REQUEST_OPEN_FONT 45 + uint8_t opcode; + uint8_t __pad1; + uint16_t _request_length; + libaxl_font_t fid; + uint16_t length_of_name; + uint16_t __pad2; + char *name; +}; + +struct libaxl_request_close_font { +#define LIBAXL_REQUEST_CLOSE_FONT 46 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + libaxl_font_t font; +}; + +struct libaxl_request_query_font { +#define LIBAXL_REQUEST_QUERY_FONT 47 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + libaxl_fontable_t font; +}; + +struct libaxl_request_query_text_extents { +#define LIBAXL_REQUEST_QUERY_TEXT_EXTENTS 48 + uint8_t opcode; + libaxl_bool_t _odd_length; + uint16_t _request_length; + libaxl_fontable_t font; + size_t length_of_string; + uint16_t *string; +}; + +struct libaxl_request_list_fonts { +#define LIBAXL_REQUEST_LIST_FONTS 49 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + uint16_t max_names; + uint16_t length_of_pattern; + char *pattern; +}; + +struct libaxl_request_list_fonts_with_info { +#define LIBAXL_REQUEST_LIST_FONTS_WITH_INFO 50 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + uint16_t max_names; + uint16_t length_of_pattern; + char *pattern; +}; + +struct libaxl_request_set_font_path { +#define LIBAXL_REQUEST_SET_FONT_PATH 51 + uint8_t opcode; + uint8_t __pad1; + uint16_t _request_length; + uint16_t number_of_strs; /* in path */ + uint16_t __pad2; + struct libaxl_str8 *path; +}; + +struct libaxl_request_get_font_path { +#define LIBAXL_REQUEST_GET_FONT_PATH 52 + uint8_t opcode; + uint8_t __pad1; + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_create_pixmap { +#define LIBAXL_REQUEST_CREATE_PIXMAP 53 + uint8_t opcode; + uint8_t depth; + uint16_t _request_length; /* = 4 */ + libaxl_pixmap_t pid; + libaxl_drawable_t drawable; + uint16_t width; + uint16_t height; +}; + +struct libaxl_request_free_pixmap { +#define LIBAXL_REQUEST_FREE_PIXMAP 54 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_pixmap_t pixmap; +}; + +struct libaxl_request_create_gc { +#define LIBAXL_REQUEST_CREATE_GC 55 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + libaxl_gcontext_t cid; + libaxl_drawable_t drawable; + uint32_t value_mask; /* Determines which below are included, all are encoded as uint32_t */ +#define LIBAXL_REQUEST_CREATE_GC_FUNCTION 0x00000001UL +#define LIBAXL_REQUEST_CREATE_GC_PLANE_MASK 0x00000002UL +#define LIBAXL_REQUEST_CREATE_GC_FOREGROUND 0x00000004UL +#define LIBAXL_REQUEST_CREATE_GC_BACKGROUND 0x00000008UL +#define LIBAXL_REQUEST_CREATE_GC_LINE_WIDTH 0x00000010UL +#define LIBAXL_REQUEST_CREATE_GC_LINE_STYLE 0x00000020UL +#define LIBAXL_REQUEST_CREATE_GC_CAP_STYLE 0x00000040UL +#define LIBAXL_REQUEST_CREATE_GC_JOIN_STYLE 0x00000080UL +#define LIBAXL_REQUEST_CREATE_GC_FILL_STYLE 0x00000100UL +#define LIBAXL_REQUEST_CREATE_GC_FILL_RULE 0x00000200UL +#define LIBAXL_REQUEST_CREATE_GC_TILE 0x00000400UL +#define LIBAXL_REQUEST_CREATE_GC_STIPPLE 0x00000800UL +#define LIBAXL_REQUEST_CREATE_GC_TILE_STIPPLE_X_ORIGIN 0x00001000UL +#define LIBAXL_REQUEST_CREATE_GC_TILE_STIPPLE_Y_ORIGIN 0x00002000UL +#define LIBAXL_REQUEST_CREATE_GC_FONT 0x00004000UL +#define LIBAXL_REQUEST_CREATE_GC_SUBWINDOW_MODE 0x00008000UL +#define LIBAXL_REQUEST_CREATE_GC_GRAPHICS_EXPOSURES 0x00010000UL +#define LIBAXL_REQUEST_CREATE_GC_CLIP_X_ORIGIN 0x00020000UL +#define LIBAXL_REQUEST_CREATE_GC_CLIP_Y_ORIGIN 0x00040000UL +#define LIBAXL_REQUEST_CREATE_GC_CLIP_MASK 0x00080000UL +#define LIBAXL_REQUEST_CREATE_GC_DASH_OFFSET 0x00100000UL +#define LIBAXL_REQUEST_CREATE_GC_DASHES 0x00200000UL +#define LIBAXL_REQUEST_CREATE_GC_ARC_MODE 0x00400000UL + uint8_t function; /* See "gcontext function" in libaxl-consts.h */ + uint8_t __omitted1[3]; + uint32_t plane_mask; + uint32_t foreground; + uint32_t background; + uint16_t line_width; + uint8_t line_style; /* LIBAXL_SOLID, LIBAXL_ON_OFF_DASH, or LIBAXL_DOUBLE_DASH */ + uint8_t cap_style; /* See "cap style" in libaxl-consts.h (Beware of namespacing) */ + uint8_t join_style; /* See "join style" in libaxl-consts.h (Beware of namespacing) */ + uint8_t fill_style; /* LIBAXL_SOLID, LIBAXL_TILED, LIBAXL_STIPPLED, or LIBAXL_OPAQUE_STIPPLED */ + uint8_t fill_rule; /* LIBAXL_EVEN_ODD or LIBAXL_WINDING */ + uint8_t __omitted2; + libaxl_pixmap_t tile; + libaxl_pixmap_t stipple; + int16_t tile_stipple_x_origin; + int16_t tile_stipple_y_origin; + libaxl_font_t font; + uint8_t subwindow_mode; /* CLIP_BY_CHILDREN or INCLUDE_INFERIORS */ + libaxl_bool_t graphics_exposures; + uint16_t __omitted3; + int16_t clip_x_origin; + int16_t clip_y_origin; + libaxl_pixmap_t clip_mask; /* Can be LIBAXL_NONE */ + uint16_t dash_offset; + uint8_t dashes; + uint8_t arc_mode; /* LIBAXL_CHORD or LIBAXL_PIE_SLICE */ +}; + +struct libaxl_request_change_gc { +#define LIBAXL_REQUEST_CHANGE_GC 56 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + libaxl_gcontext_t gc; + uint32_t value_mask; /* Determines which below are included, all are encoded as uint32_t */ +#define LIBAXL_REQUEST_CHANGE_GC_FUNCTION 0x00000001UL +#define LIBAXL_REQUEST_CHANGE_GC_PLANE_MASK 0x00000002UL +#define LIBAXL_REQUEST_CHANGE_GC_FOREGROUND 0x00000004UL +#define LIBAXL_REQUEST_CHANGE_GC_BACKGROUND 0x00000008UL +#define LIBAXL_REQUEST_CHANGE_GC_LINE_WIDTH 0x00000010UL +#define LIBAXL_REQUEST_CHANGE_GC_LINE_STYLE 0x00000020UL +#define LIBAXL_REQUEST_CHANGE_GC_CAP_STYLE 0x00000040UL +#define LIBAXL_REQUEST_CHANGE_GC_JOIN_STYLE 0x00000080UL +#define LIBAXL_REQUEST_CHANGE_GC_FILL_STYLE 0x00000100UL +#define LIBAXL_REQUEST_CHANGE_GC_FILL_RULE 0x00000200UL +#define LIBAXL_REQUEST_CHANGE_GC_TILE 0x00000400UL +#define LIBAXL_REQUEST_CHANGE_GC_STIPPLE 0x00000800UL +#define LIBAXL_REQUEST_CHANGE_GC_TILE_STIPPLE_X_ORIGIN 0x00001000UL +#define LIBAXL_REQUEST_CHANGE_GC_TILE_STIPPLE_Y_ORIGIN 0x00002000UL +#define LIBAXL_REQUEST_CHANGE_GC_FONT 0x00004000UL +#define LIBAXL_REQUEST_CHANGE_GC_SUBWINDOW_MODE 0x00008000UL +#define LIBAXL_REQUEST_CHANGE_GC_GRAPHICS_EXPOSURES 0x00010000UL +#define LIBAXL_REQUEST_CHANGE_GC_CLIP_X_ORIGIN 0x00020000UL +#define LIBAXL_REQUEST_CHANGE_GC_CLIP_Y_ORIGIN 0x00040000UL +#define LIBAXL_REQUEST_CHANGE_GC_CLIP_MASK 0x00080000UL +#define LIBAXL_REQUEST_CHANGE_GC_DASH_OFFSET 0x00100000UL +#define LIBAXL_REQUEST_CHANGE_GC_DASHES 0x00200000UL +#define LIBAXL_REQUEST_CHANGE_GC_ARC_MODE 0x00400000UL + uint8_t function; /* See "gcontext function" in libaxl-consts.h */ + uint8_t __omitted1[3]; + uint32_t plane_mask; + uint32_t foreground; + uint32_t background; + uint16_t line_width; + uint8_t line_style; /* LIBAXL_SOLID, LIBAXL_ON_OFF_DASH, or LIBAXL_DOUBLE_DASH */ + uint8_t cap_style; /* See "cap style" in libaxl-consts.h (Beware of namespacing) */ + uint8_t join_style; /* See "join style" in libaxl-consts.h (Beware of namespacing) */ + uint8_t fill_style; /* LIBAXL_SOLID, LIBAXL_TILED, LIBAXL_STIPPLED, or LIBAXL_OPAQUE_STIPPLED */ + uint8_t fill_rule; /* LIBAXL_EVEN_ODD or LIBAXL_WINDING */ + uint8_t __omitted2; + libaxl_pixmap_t tile; + libaxl_pixmap_t stipple; + int16_t tile_stipple_x_origin; + int16_t tile_stipple_y_origin; + libaxl_font_t font; + uint8_t subwindow_mode; /* CLIP_BY_CHILDREN or INCLUDE_INFERIORS */ + libaxl_bool_t graphics_exposures; + uint16_t __omitted3; + int16_t clip_x_origin; + int16_t clip_y_origin; + libaxl_pixmap_t clip_mask; /* Can be LIBAXL_NONE */ + uint16_t dash_offset; + uint8_t dashes; + uint8_t arc_mode; /* LIBAXL_CHORD or LIBAXL_PIE_SLICE */ +}; + +struct libaxl_request_copy_gc { +#define LIBAXL_REQUEST_COPY_GC 57 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 4 */ + libaxl_gcontext_t src_gc; + libaxl_gcontext_t dest_gc; + uint32_t value_mask; +#define LIBAXL_REQUEST_COPY_GC_FUNCTION 0x00000001UL +#define LIBAXL_REQUEST_COPY_GC_PLANE_MASK 0x00000002UL +#define LIBAXL_REQUEST_COPY_GC_FOREGROUND 0x00000004UL +#define LIBAXL_REQUEST_COPY_GC_BACKGROUND 0x00000008UL +#define LIBAXL_REQUEST_COPY_GC_LINE_WIDTH 0x00000010UL +#define LIBAXL_REQUEST_COPY_GC_LINE_STYLE 0x00000020UL +#define LIBAXL_REQUEST_COPY_GC_CAP_STYLE 0x00000040UL +#define LIBAXL_REQUEST_COPY_GC_JOIN_STYLE 0x00000080UL +#define LIBAXL_REQUEST_COPY_GC_FILL_STYLE 0x00000100UL +#define LIBAXL_REQUEST_COPY_GC_FILL_RULE 0x00000200UL +#define LIBAXL_REQUEST_COPY_GC_TILE 0x00000400UL +#define LIBAXL_REQUEST_COPY_GC_STIPPLE 0x00000800UL +#define LIBAXL_REQUEST_COPY_GC_TILE_STIPPLE_X_ORIGIN 0x00001000UL +#define LIBAXL_REQUEST_COPY_GC_TILE_STIPPLE_Y_ORIGIN 0x00002000UL +#define LIBAXL_REQUEST_COPY_GC_FONT 0x00004000UL +#define LIBAXL_REQUEST_COPY_GC_SUBWINDOW_MODE 0x00008000UL +#define LIBAXL_REQUEST_COPY_GC_GRAPHICS_EXPOSURES 0x00010000UL +#define LIBAXL_REQUEST_COPY_GC_CLIP_X_ORIGIN 0x00020000UL +#define LIBAXL_REQUEST_COPY_GC_CLIP_Y_ORIGIN 0x00040000UL +#define LIBAXL_REQUEST_COPY_GC_CLIP_MASK 0x00080000UL +#define LIBAXL_REQUEST_COPY_GC_DASH_OFFSET 0x00100000UL +#define LIBAXL_REQUEST_COPY_GC_DASHES 0x00200000UL +#define LIBAXL_REQUEST_COPY_GC_ARC_MODE 0x00400000UL +}; + +struct libaxl_request_set_dashes { +#define LIBAXL_REQUEST_SET_DASHES 58 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + libaxl_gcontext_t gc; + uint16_t dash_offset; + uint16_t length_of_dashes; + uint8_t *dashes; +}; + +struct libaxl_request_set_clip_rectangles { +#define LIBAXL_REQUEST_SET_CLIP_RECTANGLES 59 + uint8_t opcode; + uint8_t ordering; /* LIBAXL_UNSORTED, LIBAXL_YSORTED, LIBAXL_YXSORTED, or LIBAXL_YXBANDED */ + uint16_t _request_length; + libaxl_gcontext_t gc; + int16_t clip_x_origin; + int16_t clip_y_origin; + size_t number_of_rectangles; + struct libaxl_rectangle *rectangles; +}; + +struct libaxl_request_free_gc { +#define LIBAXL_REQUEST_FREE_GC 60 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_gcontext_t gc; +}; + +struct libaxl_request_clear_area { +#define LIBAXL_REQUEST_CLEAR_AREA 61 + uint8_t opcode; + libaxl_bool_t exposures; + uint16_t _request_length; /* = 4 */ + libaxl_window_t window; + int16_t x; + int16_t y; + uint16_t width; + uint16_t height; +}; + +struct libaxl_request_copy_area { +#define LIBAXL_REQUEST_COPY_AREA 62 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 7 */ + libaxl_drawable_t src_drawable; + libaxl_drawable_t dest_drawable; + libaxl_gcontext_t gc; + int16_t src_x; + int16_t src_y; + int16_t dest_x; + int16_t dest_y; + uint16_t width; + uint16_t height; +}; + +struct libaxl_request_copy_plane { +#define LIBAXL_REQUEST_COPY_PLANE 63 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 8 */ + libaxl_drawable_t src_drawable; + libaxl_drawable_t dest_drawable; + libaxl_gcontext_t gc; + int16_t src_x; + int16_t src_y; + int16_t dest_x; + int16_t dest_y; + uint16_t width; + uint16_t height; + uint32_t bit_plane; +}; + +struct libaxl_request_poly_point { +#define LIBAXL_REQUEST_POLY_POINT 64 + uint8_t opcode; + uint8_t coordinate_mode; /* LIBAXL_ORIGIN or LIBAXL_PREVIOUS */ + uint16_t _request_length; + libaxl_drawable_t drawable; + libaxl_gcontext_t gc; + size_t number_of_points; + struct libaxl_point *points; +}; + +struct libaxl_request_poly_line { +#define LIBAXL_REQUEST_POLY_LINE 65 + uint8_t opcode; + uint8_t coordinate_mode; /* LIBAXL_ORIGIN or LIBAXL_PREVIOUS */ + uint16_t _request_length; + libaxl_drawable_t drawable; + libaxl_gcontext_t gc; + struct libaxl_point *points; +}; + +struct libaxl_request_poly_segment { +#define LIBAXL_REQUEST_POLY_SEGMENT 66 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + libaxl_drawable_t drawable; + libaxl_gcontext_t gc; + size_t number_of_segments; + struct libaxl_segment *segments; +}; + +struct libaxl_request_poly_rectangle { +#define LIBAXL_REQUEST_POLY_RECTANGLE 67 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + libaxl_drawable_t drawable; + libaxl_gcontext_t gc; + size_t number_of_rectangles; + struct libaxl_rectangle *rectangle; +}; + +struct libaxl_request_poly_arc { +#define LIBAXL_REQUEST_POLY_ARC 68 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + libaxl_drawable_t drawable; + libaxl_gcontext_t gc; + size_t number_of_arcs; + struct libaxl_arc *arc; +}; + +struct libaxl_request_fill_poly { +#define LIBAXL_REQUEST_FILL_POLY 69 + uint8_t opcode; + uint8_t __pad1; + uint16_t _request_length; + libaxl_drawable_t drawable; + libaxl_gcontext_t gc; + uint8_t shape; /* LIBAXL_COMPLEX, LIBAXL_NONCONVEX, or LIBAXL_CONVEX */ + uint8_t coordinate_mode; /* LIBAXL_ORIGIN or LIBAXL_PREVIOUS */ + uint16_t __pad2; + size_t number_of_pointss; + struct libaxl_point *points; +}; + +struct libaxl_request_poly_fill_rectangle { +#define LIBAXL_REQUEST_POLY_FILL_RECTANGLE 70 + uint8_t opcode; + uint8_t __pad1; + uint16_t _request_length; + libaxl_drawable_t drawable; + libaxl_gcontext_t gc; + size_t number_of_rectangles; + struct libaxl_rectangle *rectangles; +}; + +struct libaxl_request_poly_fill_arc { +#define LIBAXL_REQUEST_POLY_FILL_ARC 71 + uint8_t opcode; + uint8_t __pad1; + uint16_t _request_length; + libaxl_drawable_t drawable; + libaxl_gcontext_t gc; + size_t number_of_arcs; + struct libaxl_arc *arcs; +}; + +struct libaxl_request_put_image { +#define LIBAXL_REQUEST_PUT_IMAGE 72 + uint8_t opcode; + uint8_t format; /* LIBAXL_BITMAP, LIBAXL_XYPIXMAP, or LIBAXL_ZPIXMAP */ + uint16_t _request_length; + libaxl_drawable_t drawable; + libaxl_gcontext_t gc; + uint16_t width; + uint16_t height; + int16_t dest_x; + int16_t dest_y; + uint8_t left_pad; + uint8_t depth; + uint16_t __pad; + size_t data_size; + uint8_t *data; +}; + +struct libaxl_request_get_image { +#define LIBAXL_REQUEST_GET_IMAGE 73 + uint8_t opcode; + uint8_t format; /* LIBAXL_XYPIXMAP (= 1) or LIBAXL_ZPIXMAP (= 2) */ + uint16_t _request_length; /* = 5 */ + libaxl_drawable_t drawable; + int16_t x; + int16_t y; + uint16_t width; + uint16_t height; + uint32_t plane_mask; +}; + +struct libaxl_request_poly_text8 { +#define LIBAXL_REQUEST_POLY_TEXT8 74 + uint8_t opcode; + uint8_t __unused; + uint16_t _request_length; + libaxl_drawable_t drawable; + libaxl_gcontext_t gc; + int16_t x; + int16_t y; + size_t number_of_items; + union libaxl_text_item8 *items; +}; + +struct libaxl_request_poly_text16 { +#define LIBAXL_REQUEST_POLY_TEXT16 75 + uint8_t opcode; + uint8_t __unused; + uint16_t _request_length; + libaxl_drawable_t drawable; + libaxl_gcontext_t gc; + int16_t x; + int16_t y; + size_t number_of_items; + union libaxl_text_item16 *items; +}; + +struct libaxl_request_image_text8 { +#define LIBAXL_REQUEST_IMAGE_TEXT8 76 + uint8_t opcode; + uint8_t length_of_string; + uint16_t _request_length; + libaxl_drawable_t drawable; + libaxl_gcontext_t gc; + int16_t x; + int16_t y; + char *string; +}; + +struct libaxl_request_image_text16 { +#define LIBAXL_REQUEST_IMAGE_TEXT16 77 + uint8_t opcode; + uint8_t length_of_string; + uint16_t _request_length; + libaxl_drawable_t drawable; + libaxl_gcontext_t gc; + int16_t x; + int16_t y; + uint16_t *string; +}; + +struct libaxl_request_create_colormap { +#define LIBAXL_REQUEST_CREATE_COLORMAP 78 + uint8_t opcode; + uint8_t alloc; /* LIBAXL_NONE or LIBAXL_ALL */ + uint16_t _request_length; /* = 4 */ + libaxl_colormap_t mid; + libaxl_window_t window; + libaxl_visual_t visual; +}; + +struct libaxl_request_free_colormap { +#define LIBAXL_REQUEST_FREE_COLORMAP 79 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_colormap_t cmap; +}; + +struct libaxl_request_copy_colormap_and_free { +#define LIBAXL_REQUEST_COPY_COLORMAP_AND_FREE 80 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 3 */ + libaxl_colormap_t mid; + libaxl_colormap_t src_cmap; +}; + +struct libaxl_request_install_colormap { +#define LIBAXL_REQUEST_INSTALL_COLORMAP 81 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_colormap_t cmap; +}; + +struct libaxl_request_uninstall_colormap { +#define LIBAXL_REQUEST_UNINSTALL_COLORMAP 82 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_colormap_t cmap; +}; + +struct libaxl_request_list_installed_colormaps { +#define LIBAXL_REQUEST_LIST_INSTALLED_COLORMAPS 83 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_window_t window; +}; + +struct libaxl_request_alloc_color { +#define LIBAXL_REQUEST_ALLOC_COLOR 84 + uint8_t opcode; + uint8_t __pad1; + uint16_t _request_length; /* = 4 */ + libaxl_colormap_t cmap; + uint16_t red; + uint16_t green; + uint16_t blue; + uint16_t __pad2; +}; + +struct libaxl_request_alloc_named_color { +#define LIBAXL_REQUEST_ALLOC_NAMED_COLOR 85 + uint8_t opcode; + uint8_t __pad1; + uint16_t _request_length; + libaxl_colormap_t cmap; + uint16_t length_of_name; + uint16_t __pad2; + char *name; +}; + +struct libaxl_request_alloc_color_cells { +#define LIBAXL_REQUEST_ALLOC_COLOR_CELLS 86 + uint8_t opcode; + libaxl_bool_t contiguous; + uint16_t _request_length; /* = 3 */ + libaxl_colormap_t cmap; + uint16_t colors; + uint16_t planes; +}; + +struct libaxl_request_alloc_color_planes { +#define LIBAXL_REQUEST_ALLOC_COLOR_PLANES 87 + uint8_t opcode; + libaxl_bool_t contiguous; + uint16_t _request_length; /* = 4 */ + libaxl_colormap_t cmap; + uint16_t colors; + uint16_t reds; + uint16_t greens; + uint16_t blues; +}; + +struct libaxl_request_free_colors { +#define LIBAXL_REQUEST_FREE_COLORS 88 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + libaxl_colormap_t cmap; + uint32_t plane_mask; + size_t number_of_pixels; + uint32_t *pixels; +}; + +struct libaxl_request_store_colors { +#define LIBAXL_REQUEST_STORE_COLORS 89 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + libaxl_colormap_t cmap; + size_t number_of_items; + struct libaxl_coloritem *items; +}; + +struct libaxl_request_store_named_color { +#define LIBAXL_REQUEST_STORE_NAMED_COLOR 90 + uint8_t opcode; + uint8_t flags; /* See libaxl-consts.h */ + uint16_t _request_length; + libaxl_colormap_t cmap; + uint32_t pixel; + uint16_t length_of_name; + uint16_t __unused; + char *name; +}; + +struct libaxl_request_query_colors { +#define LIBAXL_REQUEST_QUERY_COLORS 91 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + libaxl_colormap_t cmap; + size_t number_of_pixels; + uint32_t *pixels; +}; + +struct libaxl_request_lookup_color { +#define LIBAXL_REQUEST_LOOKUP_COLOR 92 + uint8_t opcode; + uint8_t __unused; + uint16_t _request_length; + libaxl_colormap_t cmap; + uint16_t length_of_name; + uint16_t __pad; + char *name; +}; + +struct libaxl_request_create_cursor { +#define LIBAXL_REQUEST_CREATE_CURSOR 93 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 8 */ + libaxl_cursor_t cid; + libaxl_pixmap_t source; + libaxl_pixmap_t mask; /* Can be LIBAXL_NONE */ + uint16_t fore_red; + uint16_t fore_green; + uint16_t fore_blue; + uint16_t back_red; + uint16_t back_green; + uint16_t back_blue; + uint16_t x; + uint16_t y; +}; + +struct libaxl_request_create_glyph_cursor { +#define LIBAXL_REQUEST_CREATE_GLYPH_CURSOR 94 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 8 */ + libaxl_cursor_t cid; + libaxl_font_t source_font; + libaxl_font_t mask_font; /* Can be LIBAXL_NONE */ + uint16_t source_char; + uint16_t mask_char; + uint16_t fore_red; + uint16_t fore_green; + uint16_t fore_blue; + uint16_t back_red; + uint16_t back_green; + uint16_t back_blue; +}; + +struct libaxl_request_free_cursor { +#define LIBAXL_REQUEST_FREE_CURSOR 95 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_cursor_t cursor; +}; + +struct libaxl_request_recolor_cursor { +#define LIBAXL_REQUEST_RECOLOR_CURSOR 96 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 5 */ + libaxl_cursor_t cursor; + uint16_t fore_red; + uint16_t fore_green; + uint16_t fore_blue; + uint16_t back_red; + uint16_t back_green; + uint16_t back_blue; +}; + +struct libaxl_request_query_best_size { +#define LIBAXL_REQUEST_QUERY_BEST_SIZE 97 + uint8_t opcode; + uint8_t class; /* LIBAXL_CURSOR, LIBAXL_TILE, or LIBAXL_STIPPLE */ + uint16_t _request_length; /* = 3 */ + libaxl_drawable_t drawable; + uint16_t width; + uint16_t height; +}; + +struct libaxl_request_query_extension { +#define LIBAXL_REQUEST_QUERY_EXTENSION 98 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + uint16_t length_of_name; + uint16_t __unused; + char *name; +}; + +struct libaxl_request_list_extensions { +#define LIBAXL_REQUEST_LIST_EXTENSIONS 99 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_change_keyboard_mapping { +#define LIBAXL_REQUEST_CHANGE_KEYBOARD_MAPPING 100 + uint8_t opcode; + uint8_t keycode_count; + uint16_t _request_length; + libaxl_keycode_t first_keycode; + uint8_t keysyms_per_keycode; + uint16_t __pad; + libaxl_keysym_t *keysyms; +}; + +struct libaxl_request_get_keyboard_mapping { +#define LIBAXL_REQUEST_GET_KEYBOARD_MAPPING 101 + uint8_t opcode; + uint8_t __pad1; + uint16_t _request_length; /* = 2 */ + libaxl_keycode_t first_keycode; + uint8_t count; + uint16_t __pad2; +}; + +struct libaxl_request_change_keyboard_control { +#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL 102 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + uint32_t value_mask; /* Determines which below are included, all are encoded as uint32_t */ +#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_KEY_CLICK_PERCENT 0x0001U +#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_BELL_PERCENT 0x0002U +#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_BELL_PITCH 0x0004U +#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_BELL_DURATION 0x0008U +#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_LED 0x0010U +#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_LED_MODE 0x0020U +#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_KEY 0x0040U +#define LIBAXL_REQUEST_CHANGE_KEYBOARD_CONTROL_AUTO_REPEAT_MODE 0x0080U + int8_t key_click_percent; + int8_t bell_percent; + int16_t bell_pitch; + int16_t bell_duration; + uint8_t led; + uint8_t led_mode; /* LIBAXL_OFF or LIBAXL_ON */ + libaxl_keycode_t key; + uint8_t auto_repeat_mode; /* LIBAXL_OFF, LIBAXL_ON, or LIBAXL_DEFAULT */ + uint16_t __omitted; +}; + +struct libaxl_request_get_keyboard_control { +#define LIBAXL_REQUEST_GET_KEYBOARD_CONTROL 103 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_bell { +#define LIBAXL_REQUEST_BELL 104 + uint8_t opcode; + int8_t percent; + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_change_pointer_control { +#define LIBAXL_REQUEST_CHANGE_POINTER_CONTROL 105 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 3 */ + int16_t acceleration_numerator; + int16_t acceleration_denominator; + int16_t threshold; + libaxl_bool_t do_acceleration; + libaxl_bool_t do_threshold; +}; + +struct libaxl_request_get_pointer_control { +#define LIBAXL_REQUEST_GET_POINTER_CONTROL 106 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_set_screen_saver { +#define LIBAXL_REQUEST_SET_SCREEN_SAVER 107 + uint8_t opcode; + uint8_t __pad1; + uint16_t _request_length; /* = 3 */ + int16_t timeout; + int16_t interval; + uint8_t prefer_blanking; /* LIBAXL_NO, LIBAXL_YES, or LIBAXL_DEFAULT */ + uint8_t allow_exposures; /* LIBAXL_NO, LIBAXL_YES, or LIBAXL_DEFAULT */ + uint16_t __pad2; +}; + +struct libaxl_request_get_screen_saver { +#define LIBAXL_REQUEST_GET_SCREEN_SAVER 108 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_change_hosts { +#define LIBAXL_REQUEST_CHANGE_HOSTS 109 + uint8_t opcode; + uint8_t mode; /* LIBAXL_INSERT or LIBAXL_DELETE */ + uint16_t _request_length; + uint8_t family; /* See libaxl-consts.h */ + uint8_t __pad; + uint16_t length_of_address; + uint8_t *address; +}; + +struct libaxl_request_list_hosts { +#define LIBAXL_REQUEST_LIST_HOSTS 110 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_set_access_control { +#define LIBAXL_REQUEST_SET_ACCESS_CONTROL 111 + uint8_t opcode; + uint8_t mode; /* LIBAXL_DISABLE or LIBAXL_ENABLE */ + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_set_close_down_mode { +#define LIBAXL_REQUEST_SET_CLOSE_DOWN_MODE 112 + uint8_t opcode; + uint8_t mode; /* LIBAXL_DESTROY, LIBAXL_RETAIN_PERMANENT, or LIBAXL_RETAIN_TEMPORARY */ + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_kill_client { +#define LIBAXL_REQUEST_KILL_CLIENT 113 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 2 */ + libaxl_id_t resource; /* Can be LIBAXL_ALL_TEMPORARY */ +}; + +struct libaxl_request_rotate_properties { +#define LIBAXL_REQUEST_ROTATE_PROPERTIES 114 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; + libaxl_window_t window; + uint16_t number_of_properties; + int16_t delta; + libaxl_atom_t *properties; +}; + +struct libaxl_request_force_screen_saver { +#define LIBAXL_REQUEST_FORCE_SCREEN_SAVER 115 + uint8_t opcode; + uint8_t mode; /* LIBAXL_RESET or LIBAXL_ACTIVATE */ + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_set_pointer_mapping { +#define LIBAXL_REQUEST_SET_POINTER_MAPPING 116 + uint8_t opcode; + uint8_t length_of_map; + uint16_t _request_length; + uint8_t *map; +}; + +struct libaxl_request_get_pointer_mapping { +#define LIBAXL_REQUEST_GET_POINTER_MAPPING 117 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_set_modifier_mapping { +#define LIBAXL_REQUEST_SET_MODIFIER_MAPPING 118 + uint8_t opcode; + uint8_t keycodes_per_modifier; /* number of pairs */ + uint16_t _request_length; + libaxl_keycode_t *keycodes; +}; + +struct libaxl_request_get_modifier_mapping { +#define LIBAXL_REQUEST_GET_MODIFIER_MAPPING 119 + uint8_t opcode; + uint8_t __pad; + uint16_t _request_length; /* = 1 */ +}; + +struct libaxl_request_no_operation { +#define LIBAXL_REQUEST_NO_OPERATION 127 + uint8_t opcode; + uint8_t __pad; + uint16_t request_length; +}; + +union libaxl_request { /* TODO man page */ + struct { + uint8_t opcode; + uint8_t __data; + uint16_t _request_length; + }; +# include "requests-structs.h" +}; + +union libaxl_request_const_ptr { /* TODO man page */ + void *as_voidptr; + union libaxl_request *as_union; +# include "requests-ptr-structs.h" +} _LIBAXL_GCC_ONLY(__attribute__((__transparent_union__))); diff --git a/libaxl/types.h b/libaxl/types.h new file mode 100644 index 0000000..f4af1d5 --- /dev/null +++ b/libaxl/types.h @@ -0,0 +1,137 @@ +/* See LICENSE file for copyright and license details. */ + +#if !defined(LIBAXL_H) || (LIBAXL_H < 2) +# error Do not include directly, include instead. +#endif + +#include +#include + +typedef uint32_t libaxl_id_t; +typedef libaxl_id_t libaxl_window_t; +typedef libaxl_id_t libaxl_pixmap_t; +typedef libaxl_id_t libaxl_cursor_t; +typedef libaxl_id_t libaxl_font_t; +typedef libaxl_id_t libaxl_gcontext_t; +typedef libaxl_id_t libaxl_colormap_t; +typedef libaxl_id_t libaxl_drawable_t; /* libaxl_window_t or libaxl_pixmap_t */ +typedef libaxl_id_t libaxl_fontable_t; /* libaxl_font_t or libaxl_gcontext_t */ +typedef libaxl_id_t libaxl_atom_t; +typedef libaxl_id_t libaxl_visual_t; +typedef uint32_t libaxl_timestamp_t; +typedef uint32_t libaxl_keysym_t; +typedef uint8_t libaxl_keycode_t; +typedef uint8_t libaxl_button_t; +typedef uint8_t libaxl_bool_t; +typedef uint16_t libaxl_keybutmask_t; + +struct libaxl_point { + int16_t x; + int16_t y; +}; + +struct libaxl_segment { + int16_t x1; + int16_t y1; + int16_t x2; + int16_t y2; +}; + +struct libaxl_rectangle { + int16_t x; /* rightward offset from upper-left corner */ + int16_t y; /* downward offset from upper-left corner */ + uint16_t width; + uint16_t height; +}; + +struct libaxl_arc { + int16_t x; + int16_t y; + uint16_t width; + uint16_t height; + int16_t angle1; + int16_t angle2; +}; + +struct libaxl_char2b { + uint8_t byte1; + uint8_t byte2; +}; + +union libaxl_text_item8 { + struct { + uint8_t length_of_string; /* cannot be LIBAXL_FONT_SHIFT_INDICATOR (= 255) */ + int8_t delta; + char *string; + }; + struct { + uint8_t font_shift_indicator; /* must be LIBAXL_FONT_SHIFT_INDICATOR (= 255) */ + uint8_t font_byte_3; /* (most-significant) */ + uint8_t font_byte_2; + uint8_t font_byte_1; + uint8_t font_byte_0; /* (least-significant) */ + }; +}; + +union libaxl_text_item16 { + struct { + uint8_t length_of_string; /* in number of CHAR2Bs, cannot be LIBAXL_FONT_SHIFT_INDICATOR (= 255) */ + int8_t delta; + uint16_t *string; + }; + struct { + uint8_t font_shift_indicator; /* must be LIBAXL_FONT_SHIFT_INDICATOR (= 255) */ + uint8_t font_byte_3; /* (most-significant) */ + uint8_t font_byte_2; + uint8_t font_byte_1; + uint8_t font_byte_0; /* (least-significant) */ + }; +}; + +struct libaxl_coloritem { + uint32_t pixel; + uint16_t red; + uint16_t green; + uint16_t blue; + uint8_t flags; /* See libaxl-consts.h */ + uint8_t __unused; +}; + +struct libaxl_timecoord { + libaxl_timestamp_t time; + int16_t x; + int16_t y; +}; + +struct libaxl_fontprop { + libaxl_atom_t name; + uint32_t value; /* <32-bits> */ +}; + +struct libaxl_charinfo { + int16_t left_side_bearing; + int16_t right_side_bearing; + int16_t character_width; + int16_t ascent; + int16_t descent; + uint16_t attributes; +}; + +struct libaxl_rgb16 { + uint16_t red; + uint16_t green; + uint16_t blue; + uint16_t __unused; +}; + +struct libaxl_str8 { + uint8_t length; + char *name; +}; + +struct libaxl_host { + uint8_t family; /* See libaxl-consts.h */ + uint8_t __pad; + uint16_t length_of_address; + uint8_t *address; +}; diff --git a/libaxl_attach.c b/libaxl_attach.c new file mode 100644 index 0000000..33ac3b5 --- /dev/null +++ b/libaxl_attach.c @@ -0,0 +1,8 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + +void +libaxl_attach(LIBAXL_CONNECTION *conn, int fd) +{ + conn->fd = fd; +} diff --git a/libaxl_close.c b/libaxl_close.c new file mode 100644 index 0000000..4d9c488 --- /dev/null +++ b/libaxl_close.c @@ -0,0 +1,8 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + +int +libaxl_close(LIBAXL_CONNECTION *conn) +{ + return close(libaxl_detach(conn)); +} diff --git a/libaxl_context_create.3 b/libaxl_context_create.3 new file mode 100644 index 0000000..5736645 --- /dev/null +++ b/libaxl_context_create.3 @@ -0,0 +1,37 @@ +.TH libaxl_context_create 3 libaxl +.SH NAME +libaxl_context_create - Create a context +.SH SYNOPSIS +.nf +#include + +LIBAXL_CONTEXT *libaxl_context_create(LIBAXL_CONNECTION *\fIconn\fP); +.fi +.SH DESCRIPTION +The +.BR libaxl_context_create () +function creates a context, for a thread, +to use when accessing the display server +via the connection specified in the +.I conn +parameter. +.SH RETURN VALUE +The +.BR libaxl_context_create () +returns the context on success completion, or +.I NULL +on failure. +.SH ERRORS +The +.BR libaxl_generate_id () +function can only fail if enough memory +cannot be allocates for the process, +which is corresponds to the +.I ENOMEM +error number and the +.I LIBAXL_ERROR_SYSTEM +libaxl error number. +.SH NOTES +None. +.SH SEE ALSO +.BR libaxl_context_free (3) diff --git a/libaxl_context_free.3 b/libaxl_context_free.3 new file mode 100644 index 0000000..8f68536 --- /dev/null +++ b/libaxl_context_free.3 @@ -0,0 +1,26 @@ +.TH libaxl_context_free 3 libaxl +.SH NAME +libaxl_context_free - Deallocation a context +.SH SYNOPSIS +.nf +#include + +void libaxl_context_free(LIBAXL_CONTEXT *\fIctx\fP); +.fi +.SH DESCRIPTION +The +.BR libaxl_context_free () +function deallocates the object specified in the +.I ctx +parameter, or does nothing if the argument is +.IR NULL . +.SH RETURN VALUE +None. +.SH ERRORS +The +.BR libaxl_context_free () +function cannot fail. +.SH NOTES +None. +.SH SEE ALSO +.BR libaxl_context_create (3) diff --git a/libaxl_create.c b/libaxl_create.c new file mode 100644 index 0000000..5c78c27 --- /dev/null +++ b/libaxl_create.c @@ -0,0 +1,15 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + +LIBAXL_CONNECTION * +libaxl_create(int fd) +{ + LIBAXL_CONNECTION *conn; + conn = calloc(1, sizeof(*conn)); + if (conn) { + conn->fd = fd; + atomic_init(&conn->xid_last, 0); + INIT_LIBAXL_CONNECTION_RWLOCK(conn); + } + return conn; +} diff --git a/libaxl_deallocate_id.3 b/libaxl_deallocate_id.3 new file mode 100644 index 0000000..f475bee --- /dev/null +++ b/libaxl_deallocate_id.3 @@ -0,0 +1,34 @@ +.TH libaxl_deallocate_id 3 libaxl +.SH NAME +libaxl_deallocate_id - Mark a resource ID as reusable +.SH SYNOPSIS +.nf +#include + +int libaxl_deallocate_id(LIBAXL_CONTEXT *\fIctx\fP, libaxl_id_t \fIid\fP); +.fi +.SH DESCRIPTION +The +.BR libaxl_deallocate_id () +function marks that the resource ID +specified in the +.I id +parameter is reusable. The value of the +.I ctx +parameter must be +.RI non- NULL +(the function will assume this to be +the case) and must be created for the +same connection as the ID was generated +for. +.SH RETURN VALUE +The +.BR libaxl_deallocate_id () +function returns 0 on successful completion +and a negative libaxl error code on failure. +.SH ERRORS +TODO \" errors for libaxl_deallocate_id +.SH NOTES +None. +.SH SEE ALSO +.BR libaxl_generate_id (3) diff --git a/libaxl_detach.c b/libaxl_detach.c new file mode 100644 index 0000000..c4a0a21 --- /dev/null +++ b/libaxl_detach.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + +int +libaxl_detach(LIBAXL_CONNECTION *conn) +{ + int fd = conn->fd; + LIBAXL_CONTEXT *ctx; + while (conn->pending_out) { + ctx = conn->pending_out; + conn->pending_out = ctx->next_pending_out; + libaxl_context_free(ctx); + } + free(conn->in_buf); + free(conn->info_buf); + free(conn); + return fd; +} diff --git a/libaxl_fileno.3 b/libaxl_fileno.3 new file mode 100644 index 0000000..b47e31e --- /dev/null +++ b/libaxl_fileno.3 @@ -0,0 +1,31 @@ +.TH libaxl_fileno 3 libaxl +.SH NAME +libaxl_fileno - Get file descriptor of connection +.SH SYNOPSIS +.nf +#include + +int libaxl_fileno(LIBAXL_CONNECTION *\fIconn\fP); +.fi +.SH DESCRIPTION +The +.BR libaxl_fileno () +function returns the number of the file descriptor +of a connection to the display server. The connection +is specified in the +.I conn +parameter, which the function assumes is +.RI non- NULL . +.SH RETURN VALUE +The +.BR libaxl_fileno () +function returns file descriptor. +.SH ERRORS +The +.BR libaxl_fileno () +function cannot fail. +.SH NOTES +None. +.SH SEE ALSO +.BR libaxl_attach (3), +.BR libaxl_detach (3) diff --git a/libaxl_generate_id.3 b/libaxl_generate_id.3 new file mode 100644 index 0000000..aa055f1 --- /dev/null +++ b/libaxl_generate_id.3 @@ -0,0 +1,38 @@ +.TH libaxl_generate_id 3 libaxl +.SH NAME +libaxl_generate_id - Generate a resource ID +.SH SYNOPSIS +.nf +#include + +libaxl_id_t libaxl_generate_id(LIBAXL_CONTEXT *\fIctx\fP); +.fi +.SH DESCRIPTION +The +.BR libaxl_generate_id () +function returns an X resource ID that +the client can assign to any resource +created for the connection for which +the object in the +.I ctx +parameter, which the function assumes is +.RI non- NULL , + is created for. +.SH RETURN VALUE +The +.BR libaxl_generate_id () +function returns an unused resource ID +allocated to the connection to the +display server, or 0 on failure. +.SH ERRORS +The +.BR libaxl_generate_id () +function can only fail if there are no +more resource IDs allocated to the +connection, which corresponds to the +.I LIBAXL_ERROR_OUT_OF_RESOURCE_IDS +error number. +.SH NOTES +None. +.SH SEE ALSO +.BR libaxl_deallocate_id (3) diff --git a/libaxl_get_tcp_port.3 b/libaxl_get_tcp_port.3 new file mode 100644 index 0000000..4162468 --- /dev/null +++ b/libaxl_get_tcp_port.3 @@ -0,0 +1,31 @@ +.TH libaxl_get_tcp_port 3 libaxl +.SH NAME +libaxl_get_tcp_port - Get file descriptor of connection +.SH SYNOPSIS +.nf +#include + +uint16_t libaxl_get_tcp_port(int *\fIdisplay\fP); +.fi +.SH DESCRIPTION +The +.BR libaxl_get_tcp_port () +function returns the number TCP port that +should be used to connect to a display based +on the display's number, which is specified +in the +.I display +parameter. +.SH RETURN VALUE +The +.BR libaxl_get_tcp_port () +function returns TCP port that the display +uses. +.SH ERRORS +The +.BR libaxl_get_tcp_port () +function cannot fail. +.SH NOTES +None. +.SH SEE ALSO +.BR libaxl_get_decnet_object (3) diff --git a/libaxl_protocol_version.3 b/libaxl_protocol_version.3 new file mode 100644 index 0000000..2064a14 --- /dev/null +++ b/libaxl_protocol_version.3 @@ -0,0 +1,40 @@ +.TH libaxl_protocol_version 3 libaxl +.SH NAME +libaxl_protocol_version - X protocol version +.SH SYNOPSIS +.nf +#include + +int libaxl_protocol_version(void); +.fi +.SH DESCRIPTION +The +.BR libaxl_protocol_version () +function returns the number, as the sum of the +major number multiplied by 1000 and the minor +number, of the highest version of the X protocol +that the library, as linked against, supports. +For example if the version number is 11.0, 11000 +is returned, and if it is 11.2, 11002 is returned. +.SH RETURN VALUE +The +.BR libaxl_protocol_version () +function returns the number, as a the +sum described in the +.B DESCRIPTION +section of the highest supported version +of the X protocol. +.SH ERRORS +The +.BR libaxl_protocol_version () +function cannot fail. +.SH NOTES +There is no corresponding function for the lowest +supported version. The lowest supported +version is 11.0 (X11); X11 was released in +September 1987 and predates Linux, thus +this is extremely unlikely this will change. +.SH SEE ALSO +.BR LIBAXL_PROTOCOL_VERSION (3), +.BR libaxl_protocol_version_major (3), +.BR libaxl_protocol_version_minor (3) diff --git a/libaxl_protocol_version_major.3 b/libaxl_protocol_version_major.3 new file mode 100644 index 0000000..0a816f0 --- /dev/null +++ b/libaxl_protocol_version_major.3 @@ -0,0 +1,34 @@ +.TH libaxl_protocol_version_major 3 libaxl +.SH NAME +libaxl_protocol_version_major - X protocol version, major number +.SH SYNOPSIS +.nf +#include + +int libaxl_protocol_version_major(void); +.fi +.SH DESCRIPTION +The +.BR libaxl_protocol_version_major () +function returns the major number of the +highest version of the X protocol that +the library, as linked against, supports. +.SH RETURN VALUE +The +.BR libaxl_protocol_version_major () +function returns the major number of the +highest supported version of the X protocol. +.SH ERRORS +The +.BR libaxl_protocol_version_major () +function cannot fail. +.SH NOTES +There is no corresponding function for the lowest +supported version. The lowest supported +version is 11.0 (X11); X11 was released in +September 1987 and predates Linux, thus +this is extremely unlikely this will change. +.SH SEE ALSO +.BR LIBAXL_PROTOCOL_VERSION_MAJOR (3), +.BR libaxl_protocol_version_minor (3), +.BR libaxl_protocol_version (3) diff --git a/libaxl_protocol_version_major.c b/libaxl_protocol_version_major.c index 7dc00da..6e3fd26 100644 --- a/libaxl_protocol_version_major.c +++ b/libaxl_protocol_version_major.c @@ -4,5 +4,5 @@ int libaxl_protocol_version_major(void) { - return LIBAXL_PROTOCOL_MAJOR; + return LIBAXL_PROTOCOL_VERSION_MAJOR; } diff --git a/libaxl_protocol_version_minor.3 b/libaxl_protocol_version_minor.3 new file mode 100644 index 0000000..3d2b5de --- /dev/null +++ b/libaxl_protocol_version_minor.3 @@ -0,0 +1,34 @@ +.TH libaxl_protocol_version_minor 3 libaxl +.SH NAME +libaxl_protocol_version_minor - X protocol version, minor number +.SH SYNOPSIS +.nf +#include + +int libaxl_protocol_version_minor(void); +.fi +.SH DESCRIPTION +The +.BR libaxl_protocol_version_minor () +function returns the minor number of the +highest version of the X protocol that +the library, as linked against, supports. +.SH RETURN VALUE +The +.BR libaxl_protocol_version_minor () +function returns the minor number of the +highest supported version of the X protocol. +.SH ERRORS +The +.BR libaxl_protocol_version_minor () +function cannot fail. +.SH NOTES +There is no corresponding function for the lowest +supported version. The lowest supported +version is 11.0 (X11); X11 was released in +September 1987 and predates Linux, thus +this is extremely unlikely this will change. +.SH SEE ALSO +.BR LIBAXL_PROTOCOL_VERSION_MINOR (3), +.BR libaxl_protocol_version_major (3), +.BR libaxl_protocol_version (3) diff --git a/libaxl_protocol_version_minor.c b/libaxl_protocol_version_minor.c index de1e688..f5bc27a 100644 --- a/libaxl_protocol_version_minor.c +++ b/libaxl_protocol_version_minor.c @@ -4,5 +4,5 @@ int libaxl_protocol_version_minor(void) { - return LIBAXL_PROTOCOL_MINOR; + return LIBAXL_PROTOCOL_VERSION_MINOR; } diff --git a/libaxl_send_handshake.c b/libaxl_send_handshake.c index 80d48aa..836cec9 100644 --- a/libaxl_send_handshake.c +++ b/libaxl_send_handshake.c @@ -29,8 +29,8 @@ libaxl_send_handshake(LIBAXL_CONTEXT *restrict ctx, const char *auth_name, size_ RLOCK_CONNECTION_SEND(conn); pending = conn->pending_out; - conn->info.protocol_version_major = LIBAXL_PROTOCOL_MAJOR; - conn->info.protocol_version_minor = LIBAXL_PROTOCOL_MINOR; + conn->info.protocol_version_major = LIBAXL_PROTOCOL_VERSION_MAJOR; + conn->info.protocol_version_minor = LIBAXL_PROTOCOL_VERSION_MINOR; conn->info.protocol_version = LIBAXL_PROTOCOL_VERSION; conn->info.protocol_byte_order = LIBAXL_MSB_FIRST; /* TODO Use LIBAXL_LSB_FIRST if preferable */ RUNLOCK_CONNECTION_SEND(conn); @@ -70,9 +70,9 @@ libaxl_send_handshake(LIBAXL_CONTEXT *restrict ctx, const char *auth_name, size_ buf[o++] = 'B'; /* TODO Use 'l' (LSB first) if preferable */ buf[o++] = 0; - *(uint16_t *)&buf[o] = htons(LIBAXL_PROTOCOL_MAJOR); + *(uint16_t *)&buf[o] = htons(LIBAXL_PROTOCOL_VERSION_MAJOR); o += 2; - *(uint16_t *)&buf[o] = htons(LIBAXL_PROTOCOL_MINOR); + *(uint16_t *)&buf[o] = htons(LIBAXL_PROTOCOL_VERSION_MINOR); o += 2; *(uint16_t *)&buf[o] = htons((uint16_t)auth_name_len); o += 2; -- cgit v1.2.3-70-g09d2