aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
l---------LIBAXL_SYNTHETIC_EVENT_BIT.31
-rw-r--r--Makefile1
-rw-r--r--libaxl.h10
-rw-r--r--libaxl_receive.c2
4 files changed, 12 insertions, 2 deletions
diff --git a/LIBAXL_SYNTHETIC_EVENT_BIT.3 b/LIBAXL_SYNTHETIC_EVENT_BIT.3
new file mode 120000
index 0000000..54e5c3e
--- /dev/null
+++ b/LIBAXL_SYNTHETIC_EVENT_BIT.3
@@ -0,0 +1 @@
+union_libaxl_input.3 \ No newline at end of file
diff --git a/Makefile b/Makefile
index 24cefb9..6fe9ae8 100644
--- a/Makefile
+++ b/Makefile
@@ -281,6 +281,7 @@ MAN3 =\
LIBAXL_REQUEST_UNMAP_SUBWINDOWS.3\
LIBAXL_REQUEST_UNMAP_WINDOW.3\
LIBAXL_REQUEST_WARP_POINTER.3\
+ LIBAXL_SYNTHETIC_EVENT_BIT.3\
libaxl_attach.3\
libaxl_close.3\
libaxl_context_create.3\
diff --git a/libaxl.h b/libaxl.h
index 7b6d733..e3e452c 100644
--- a/libaxl.h
+++ b/libaxl.h
@@ -50,14 +50,22 @@ typedef struct libaxl_context LIBAXL_CONTEXT; /* TODO man */
#define LIBAXL_ERROR_INVALID_HANDSHAKE_RESPONSE -12
#define LIBAXL_ERROR_OUT_OF_RESOURCE_IDS -13
#define LIBAXL_ERROR_PROTOCOL_NOT_SUPPORTED -14
+#define LIBAXL_ERROR_USER_DOES_NOT_EXIST -15
+#define LIBAXL_ERROR_USER_DOES_NOT_HAVE_A_HOME -16
-union libaxl_input { /* TODO doc, man */
+union libaxl_input { /* TODO doc, man (also LIBAXL_SYNTHETIC_EVENT_BIT) */
uint8_t type;
union libaxl_error error; /* if .type = LIBAXL_ERROR */
union libaxl_reply reply; /* if .type = LIBAXL_REPLY */
union libaxl_event event; /* otherwise (.type = event type) */
};
+/**
+ * Bit that is set in `.type` of `union libaxl_input` if the
+ * event a synthetic event.
+ */
+#define LIBAXL_SYNTHETIC_EVENT_BIT 0x80U
+
_LIBAXL_GCC_ONLY(__attribute__((__malloc__, __warn_unused_result__)))
LIBAXL_CONNECTION *libaxl_connect(const char *restrict, char **restrict); /* TODO man doc */
diff --git a/libaxl_receive.c b/libaxl_receive.c
index 227e149..b17cdc9 100644
--- a/libaxl_receive.c
+++ b/libaxl_receive.c
@@ -252,7 +252,7 @@ libaxl_receive(LIBAXL_CONTEXT *restrict ctx, union libaxl_input *restrict msgp,
}
code = *(uint8_t *)inbuf;
- code &= 0x7F; /* Synthetic events have the highest bit set. */
+ code &= ~LIBAXL_SYNTHETIC_EVENT_BIT;
if (code == LIBAXL_REPLY) {
n = (uint64_t)ntohl(*(uint32_t *)&inbuf[4]);