aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-06-21 16:09:40 +0200
committerMattias Andrée <maandree@kth.se>2020-06-21 16:09:40 +0200
commitde733140c2b842080ea93eb38bde0f41a3a23665 (patch)
tree6fabc30b5916febfa145be94763b1529998b712a
parentMove man pages into a separate directory (diff)
downloadlibaxl-de733140c2b842080ea93eb38bde0f41a3a23665.tar.gz
libaxl-de733140c2b842080ea93eb38bde0f41a3a23665.tar.bz2
libaxl-de733140c2b842080ea93eb38bde0f41a3a23665.tar.xz
Misc.
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--README4
-rw-r--r--libaxl/consts.h20
-rw-r--r--libaxl/events.h22
-rw-r--r--libaxl/replies.h2
-rw-r--r--libaxl/requests.h8
-rw-r--r--libaxl/types.h5
-rw-r--r--libaxl_connect.c5
-rw-r--r--libaxl_receive.c4
8 files changed, 49 insertions, 21 deletions
diff --git a/README b/README
index bc93a6d..30f0b51 100644
--- a/README
+++ b/README
@@ -21,3 +21,7 @@ The goals of libaxl are:
* Be thread-safe by default (unlike libX11)
* Use liberror for error handling (unlike XCB and libX11, obviously)
+
+libaxl is faster than Xlib because it is asynchronous,
+however it is slower than xcb because it parses format
+strings rather than specialised functions.
diff --git a/libaxl/consts.h b/libaxl/consts.h
index 8629651..ac9e43b 100644
--- a/libaxl/consts.h
+++ b/libaxl/consts.h
@@ -299,3 +299,23 @@
#define LIBAXL_EVENT_MASK_PROPERTY_CHANGE UINT32_C(0x00400000)
#define LIBAXL_EVENT_MASK_COLOR_MAP_CHANGE UINT32_C(0x00800000)
#define LIBAXL_EVENT_MASK_OWNER_GRAB_BUTTON UINT32_C(0x01000000)
+
+/* key button mask { */
+/* key mask */
+#define LIBAXL_MASK_SHIFT 0x0001
+#define LIBAXL_MASK_LOCK 0x0002
+#define LIBAXL_MASK_CONTROL 0x0004
+#define LIBAXL_MASK_MOD_1 0x0008
+#define LIBAXL_MASK_MOD_2 0x0010
+#define LIBAXL_MASK_MOD_3 0x0020
+#define LIBAXL_MASK_MOD_4 0x0040
+#define LIBAXL_MASK_MOD_5 0x0080
+/* button mask */
+#define LIBAXL_MASK_BUTTON_1 0x0100
+#define LIBAXL_MASK_BUTTON_2 0x0200
+#define LIBAXL_MASK_BUTTON_3 0x0400
+#define LIBAXL_MASK_BUTTON_4 0x0800
+#define LIBAXL_MASK_BUTTON_5 0x1000
+/* use in both above, but not in key button mask */
+#define LIBAXL_ANY_MODIFIER 0x8000
+/* } */
diff --git a/libaxl/events.h b/libaxl/events.h
index 13c2304..3361693 100644
--- a/libaxl/events.h
+++ b/libaxl/events.h
@@ -17,7 +17,7 @@ struct libaxl_event_key_press {
int16_t root_y;
int16_t event_x;
int16_t event_y;
- libaxl_keybutmask_t state;
+ uint16_t state; /* See "key button mask" in "consts.h" */
libaxl_bool_t same_screen;
uint8_t __unused[1];
};
@@ -35,7 +35,7 @@ struct libaxl_event_key_release {
int16_t root_y;
int16_t event_x;
int16_t event_y;
- libaxl_keybutmask_t state;
+ uint16_t state; /* See "key button mask" in "consts.h" */
libaxl_bool_t same_screen;
uint8_t __unused[1];
};
@@ -53,7 +53,7 @@ struct libaxl_event_key_press_release {
int16_t root_y;
int16_t event_x;
int16_t event_y;
- libaxl_keybutmask_t state;
+ uint16_t state; /* See "key button mask" in "consts.h" */
libaxl_bool_t same_screen;
uint8_t __unused[1];
};
@@ -71,7 +71,7 @@ struct libaxl_event_button_press {
int16_t root_y;
int16_t event_x;
int16_t event_y;
- libaxl_keybutmask_t state;
+ uint16_t state; /* See "key button mask" in "consts.h" */
libaxl_bool_t same_screen;
uint8_t __unused[1];
};
@@ -89,7 +89,7 @@ struct libaxl_event_button_release {
int16_t root_y;
int16_t event_x;
int16_t event_y;
- libaxl_keybutmask_t state;
+ uint16_t state; /* See "key button mask" in "consts.h" */
libaxl_bool_t same_screen;
uint8_t __unused[1];
};
@@ -107,7 +107,7 @@ struct libaxl_event_button_press_release {
int16_t root_y;
int16_t event_x;
int16_t event_y;
- libaxl_keybutmask_t state;
+ uint16_t state; /* See "key button mask" in "consts.h" */
libaxl_bool_t same_screen;
uint8_t __unused[1];
};
@@ -125,7 +125,7 @@ struct libaxl_event_motion_notify {
int16_t root_y;
int16_t event_x;
int16_t event_y;
- libaxl_keybutmask_t state;
+ uint16_t state; /* See "key button mask" in "consts.h" */
libaxl_bool_t same_screen;
uint8_t __unused[1];
};
@@ -143,7 +143,7 @@ struct libaxl_event_input_device_event {
int16_t root_y;
int16_t event_x;
int16_t event_y;
- libaxl_keybutmask_t state;
+ uint16_t state; /* See "key button mask" in "consts.h" */
libaxl_bool_t same_screen;
uint8_t __unused[1];
};
@@ -161,7 +161,7 @@ struct libaxl_event_enter_notify {
int16_t root_y;
int16_t event_x;
int16_t event_y;
- libaxl_keybutmask_t state;
+ uint16_t state; /* See "key button mask" in "consts.h" */
uint8_t mode; /* LIBAXL_{NORMAL, GRAB, or UNGRAB} */
uint8_t flags; /* Bitmask: LIBAXL_{FOCUS, SAME_SCREEN} */
};
@@ -179,7 +179,7 @@ struct libaxl_event_leave_notify {
int16_t root_y;
int16_t event_x;
int16_t event_y;
- libaxl_keybutmask_t state;
+ uint16_t state; /* See "key button mask" in "consts.h" */
uint8_t mode; /* LIBAXL_{NORMAL, GRAB, or UNGRAB} */
uint8_t flags; /* Bitmask: LIBAXL_{FOCUS, SAME_SCREEN} */
};
@@ -197,7 +197,7 @@ struct libaxl_event_pointer_window_event {
int16_t root_y;
int16_t event_x;
int16_t event_y;
- libaxl_keybutmask_t state;
+ uint16_t state; /* See "key button mask" in "consts.h" */
uint8_t mode; /* LIBAXL_{NORMAL, GRAB, or UNGRAB} */
uint8_t flags; /* Bitmask: LIBAXL_{FOCUS, SAME_SCREEN} */
};
diff --git a/libaxl/replies.h b/libaxl/replies.h
index 8c48047..d3865d7 100644
--- a/libaxl/replies.h
+++ b/libaxl/replies.h
@@ -136,7 +136,7 @@ struct libaxl_reply_query_pointer {
int16_t root_y;
int16_t win_x;
int16_t win_y;
- libaxl_keybutmask_t mask; /* TODO ? SETofKEYBUTMASK shouldn't have its own type */
+ uint16_t mask; /* See "key button mask" in "consts.h" */
uint8_t __unused[6];
};
diff --git a/libaxl/requests.h b/libaxl/requests.h
index 27ba705..eaf7816 100644
--- a/libaxl/requests.h
+++ b/libaxl/requests.h
@@ -359,7 +359,7 @@ struct libaxl_request_grab_button {
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 */
+ uint16_t modifiers; /* See "key mask" in "consts.h", also LIBAXL_ANY_MODIFIER */
};
struct libaxl_request_ungrab_button {
@@ -368,7 +368,7 @@ struct libaxl_request_ungrab_button {
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 modifiers; /* See "key mask" in "consts.h", also LIBAXL_ANY_MODIFIER */
uint16_t __pad;
};
@@ -409,7 +409,7 @@ struct libaxl_request_grab_key {
libaxl_bool_t owner_events;
uint16_t _request_length; /* = 4 */
libaxl_window_t grab_window;
- uint16_t modifiers; /* TODO SETofKEYMASK, #x8000 = AnyModifier */
+ uint16_t modifiers; /* See "key mask" in "consts.h", also LIBAXL_ANY_MODIFIER */
libaxl_keycode_t key; /* Can be LIBAXL_ANY_KEY */
uint8_t pointer_mode; /* LIBAXL_{SYNCHRONOUS or ASYNCHRONOUS} */
uint8_t keyboard_mode; /* LIBAXL_{SYNCHRONOUS or ASYNCHRONOUS} */
@@ -422,7 +422,7 @@ struct libaxl_request_ungrab_key {
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 modifiers; /* See "key mask" in "consts.h", also LIBAXL_ANY_MODIFIER */
uint16_t __pad;
};
diff --git a/libaxl/types.h b/libaxl/types.h
index ad44576..0ece759 100644
--- a/libaxl/types.h
+++ b/libaxl/types.h
@@ -14,8 +14,8 @@ 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_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;
@@ -23,7 +23,6 @@ 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;
diff --git a/libaxl_connect.c b/libaxl_connect.c
index 529295d..27b89e1 100644
--- a/libaxl_connect.c
+++ b/libaxl_connect.c
@@ -271,7 +271,12 @@ libaxl_connect(const char *restrict display, char **restrict reasonp)
goto fail;
}
+ if (xauthfile_free)
+ free(xauthfile);
libaxl_context_free(ctx);
+ free(authbuf);
+ free(host);
+ free(protocol);
return conn;
fail:
diff --git a/libaxl_receive.c b/libaxl_receive.c
index 8455237..80719bd 100644
--- a/libaxl_receive.c
+++ b/libaxl_receive.c
@@ -110,8 +110,8 @@ static const char *const reply_formats[] = {
[LIBAXL_REQUEST_GET_MOTION_EVENTS] = "1!244$==-*4ss/",
[LIBAXL_REQUEST_TRANSLATE_COORDINATES] = "1!244ss",
[LIBAXL_REQUEST_WARP_POINTER] = NULL,
- [LIBAXL_REQUEST_SET_INPUT_FOCUS] = "11244",
- [LIBAXL_REQUEST_GET_INPUT_FOCUS] = NULL,
+ [LIBAXL_REQUEST_SET_INPUT_FOCUS] = NULL,
+ [LIBAXL_REQUEST_GET_INPUT_FOCUS] = "11244",
[LIBAXL_REQUEST_QUERY_KEYMAP] = "1.24#",
[LIBAXL_REQUEST_OPEN_FONT] = NULL,
[LIBAXL_REQUEST_CLOSE_FONT] = NULL,