aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-05-10 13:44:06 +0200
committerMattias Andrée <maandree@kth.se>2020-05-10 13:44:06 +0200
commit4a968d807d2ec611f443d704ae875911894c04e2 (patch)
treea7c1d4f178842bb6971c7a4b2c159049df794dd0
parentFix struct for ClientMessage event (diff)
downloadlibaxl-4a968d807d2ec611f443d704ae875911894c04e2.tar.gz
libaxl-4a968d807d2ec611f443d704ae875911894c04e2.tar.bz2
libaxl-4a968d807d2ec611f443d704ae875911894c04e2.tar.xz
A few things
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--.gitignore2
l---------LIBAXL_HANDSHAKE_AUTHENTICATE.31
l---------LIBAXL_HANDSHAKE_FAILED.31
l---------LIBAXL_HANDSHAKE_SUCCESS.31
-rw-r--r--LIBAXL_PROTOCOL_VERSION.327
-rw-r--r--LIBAXL_PROTOCOL_VERSION_MAJOR.325
-rw-r--r--LIBAXL_PROTOCOL_VERSION_MINOR.325
-rw-r--r--Makefile544
-rw-r--r--TODO1
-rw-r--r--common.h6
-rw-r--r--internal-linux.h4
-rw-r--r--libaxl.h227
-rw-r--r--libaxl/advanced.h85
-rw-r--r--libaxl/atoms.h (renamed from libaxl-atoms.h)4
-rw-r--r--libaxl/consts.h (renamed from libaxl-consts.h)4
-rw-r--r--libaxl/display-info.h (renamed from libaxl-display-info.h)4
-rw-r--r--libaxl/errors.h (renamed from libaxl-errors.h)6
-rw-r--r--libaxl/events.h (renamed from libaxl-events.h)6
-rw-r--r--libaxl/low-level.h139
-rw-r--r--libaxl/replies.h (renamed from libaxl-replies.h)6
-rw-r--r--libaxl/requests.h (renamed from libaxl-requests.h)8
-rw-r--r--libaxl/types.h (renamed from libaxl-types.h)4
-rw-r--r--libaxl_attach.c8
-rw-r--r--libaxl_close.c8
-rw-r--r--libaxl_context_create.337
-rw-r--r--libaxl_context_free.326
-rw-r--r--libaxl_create.c15
-rw-r--r--libaxl_deallocate_id.334
-rw-r--r--libaxl_detach.c18
-rw-r--r--libaxl_fileno.331
-rw-r--r--libaxl_generate_id.338
-rw-r--r--libaxl_get_tcp_port.331
-rw-r--r--libaxl_protocol_version.340
-rw-r--r--libaxl_protocol_version_major.334
-rw-r--r--libaxl_protocol_version_major.c2
-rw-r--r--libaxl_protocol_version_minor.334
-rw-r--r--libaxl_protocol_version_minor.c2
-rw-r--r--libaxl_send_handshake.c8
38 files changed, 1025 insertions, 471 deletions
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 <libaxl.h>
+
+#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 <libaxl.h>
+
+#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 <libaxl.h>
+
+#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.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 <stddef.h>
#include <stdint.h>
@@ -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
- *
- * [<protocol>/][<host>]:<display>[.<screen>]
- *
- * or for the "unix" protocol
- *
- * <path>[.<screen>]
- *
- * @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
@@ -367,38 +232,6 @@ _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
*
* Be aware: order of replies and events is not guaranteed,
@@ -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 <libaxl/advanced.h> directly, include <libaxl.h> 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
index 140d769..e41ac74 100644
--- a/libaxl-atoms.h
+++ b/libaxl/atoms.h
@@ -1,5 +1,9 @@
/* See LICENSE file for copyright and license details. */
+#if !defined(LIBAXL_H) || (LIBAXL_H < 2)
+# error Do not include <libaxl/atoms.h> directly, include <libaxl.h> instead.
+#endif
+
#define LIBAXL_ATOM_PRIMARY 1
#define LIBAXL_ATOM_SECONDARY 2
#define LIBAXL_ATOM_ARC 3
diff --git a/libaxl-consts.h b/libaxl/consts.h
index cf6a119..a57a9de 100644
--- a/libaxl-consts.h
+++ b/libaxl/consts.h
@@ -1,5 +1,9 @@
/* See LICENSE file for copyright and license details. */
+#if !defined(LIBAXL_H) || (LIBAXL_H < 2)
+# error Do not include <libaxl/consts.h> directly, include <libaxl.h> instead.
+#endif
+
/* libaxl_keycode_t */
#define LIBAXL_ANY_KEY 0
diff --git a/libaxl-display-info.h b/libaxl/display-info.h
index 1d00a67..714e833 100644
--- a/libaxl-display-info.h
+++ b/libaxl/display-info.h
@@ -1,5 +1,9 @@
/* See LICENSE file for copyright and license details. */
+#if !defined(LIBAXL_H) || (LIBAXL_H < 2)
+# error Do not include <libaxl/display-info.h> directly, include <libaxl.h> instead.
+#endif
+
/**
* The highest number of the `struct_version` field in
* `struct libaxl_display_info` that this header file
diff --git a/libaxl-errors.h b/libaxl/errors.h
index c1b8a92..baccc2d 100644
--- a/libaxl-errors.h
+++ b/libaxl/errors.h
@@ -1,5 +1,9 @@
/* See LICENSE file for copyright and license details. */
+#if !defined(LIBAXL_H) || (LIBAXL_H < 2)
+# error Do not include <libaxl/errors.h> directly, include <libaxl.h> instead.
+#endif
+
#define LIBAXL_ERROR 0
struct libaxl_error_request {
@@ -198,5 +202,5 @@ union libaxl_error {
uint16_t minor_opcode;
uint8_t major_opcode;
};
-#include "libaxl-errors-structs.h"
+#include "errors-structs.h"
};
diff --git a/libaxl-events.h b/libaxl/events.h
index ed47f3d..9191a92 100644
--- a/libaxl-events.h
+++ b/libaxl/events.h
@@ -1,5 +1,9 @@
/* See LICENSE file for copyright and license details. */
+#if !defined(LIBAXL_H) || (LIBAXL_H < 2)
+# error Do not include <libaxl/events.h> directly, include <libaxl.h> instead.
+#endif
+
struct libaxl_event_key_press {
#define LIBAXL_EVENT_KEY_PRESS 2
uint8_t code;
@@ -534,5 +538,5 @@ struct libaxl_event_mapping_notify {
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"
+#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 <libaxl/low-level.h> directly, include <libaxl.h> 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
+ *
+ * [<protocol>/][<host>]:<display>[.<screen>]
+ *
+ * or for the "unix" protocol
+ *
+ * <path>[.<screen>]
+ *
+ * @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
index 30e02a1..ded2d51 100644
--- a/libaxl-replies.h
+++ b/libaxl/replies.h
@@ -1,5 +1,9 @@
/* See LICENSE file for copyright and license details. */
+#if !defined(LIBAXL_H) || (LIBAXL_H < 2)
+# error Do not include <libaxl/replies.h> directly, include <libaxl.h> instead.
+#endif
+
#define LIBAXL_REPLY 1 /* TODO man */
struct libaxl_reply_get_window_attributes {
@@ -486,5 +490,5 @@ union libaxl_reply {
uint16_t sequence_number;
uint32_t _reply_length;
};
-#include "libaxl-replies-structs.h"
+#include "replies-structs.h"
};
diff --git a/libaxl-requests.h b/libaxl/requests.h
index f0a6279..7566dd6 100644
--- a/libaxl-requests.h
+++ b/libaxl/requests.h
@@ -1,5 +1,9 @@
/* See LICENSE file for copyright and license details. */
+#if !defined(LIBAXL_H) || (LIBAXL_H < 2)
+# error Do not include <libaxl/requests.h> directly, include <libaxl.h> instead.
+#endif
+
struct libaxl_request_create_window {
#define LIBAXL_REQUEST_CREATE_WINDOW 1
uint8_t opcode;
@@ -1435,11 +1439,11 @@ union libaxl_request { /* TODO man page */
uint8_t __data;
uint16_t _request_length;
};
-# include "libaxl-requests-structs.h"
+# include "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"
+# include "requests-ptr-structs.h"
} _LIBAXL_GCC_ONLY(__attribute__((__transparent_union__)));
diff --git a/libaxl-types.h b/libaxl/types.h
index c55a319..f4af1d5 100644
--- a/libaxl-types.h
+++ b/libaxl/types.h
@@ -1,5 +1,9 @@
/* See LICENSE file for copyright and license details. */
+#if !defined(LIBAXL_H) || (LIBAXL_H < 2)
+# error Do not include <libaxl/types.h> directly, include <libaxl.h> instead.
+#endif
+
#include <stddef.h>
#include <stdint.h>
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.h>
+
+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 <libaxl.h>
+
+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 <libaxl.h>
+
+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 <libaxl.h>
+
+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.h>
+
+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 <libaxl.h>
+
+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 <libaxl.h>
+
+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 <libaxl.h>
+
+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 <libaxl.h>
+
+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;