diff options
author | Mattias Andrée <maandree@kth.se> | 2020-06-19 23:55:30 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2020-06-19 23:55:30 +0200 |
commit | 77200e73fd50f3bb28710c84d3aaf14aabd735be (patch) | |
tree | 399edb4356a3ff5ea5c4529490a946f2d8b59c42 | |
parent | Add support for synthetic events (diff) | |
download | libaxl-77200e73fd50f3bb28710c84d3aaf14aabd735be.tar.gz libaxl-77200e73fd50f3bb28710c84d3aaf14aabd735be.tar.bz2 libaxl-77200e73fd50f3bb28710c84d3aaf14aabd735be.tar.xz |
Misc trivial fixes and improvements
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | libaxl.h | 2 | ||||
-rw-r--r-- | libaxl/display-info.h | 3 | ||||
-rw-r--r-- | libaxl/events.h | 52 | ||||
-rw-r--r-- | libaxl/replies.h | 36 | ||||
-rw-r--r-- | libaxl/requests.h | 28 | ||||
-rw-r--r-- | libaxl/types.h | 4 | ||||
-rw-r--r-- | libaxl_receive.c | 2 | ||||
-rw-r--r-- | libaxl_send_request.c | 19 |
8 files changed, 78 insertions, 68 deletions
@@ -221,7 +221,7 @@ int libaxl_deallocate_id(LIBAXL_CONTEXT *, libaxl_id_t); * and set `errno` to EINPROGRESS, or such happened in another * thread. */ -_LIBAXL_GCC_ONLY(__attribute__((__nonnull__))) +_LIBAXL_GCC_ONLY(__attribute__((__nonnull__(1)))) int libaxl_send_request(LIBAXL_CONTEXT *restrict, union libaxl_request_const_ptr, int, uint16_t *restrict); /* TODO man */ /** diff --git a/libaxl/display-info.h b/libaxl/display-info.h index 966614c..f01ade1 100644 --- a/libaxl/display-info.h +++ b/libaxl/display-info.h @@ -50,8 +50,7 @@ struct libaxl_format { 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 class; /* LIBAXL_{STATIC_GRAY, GRAY_SCALE, STATIC_COLOR, PSEUDO_COLOR, TRUE_COLOR, DIRECT_COLOR} */ uint8_t bits_per_rgb_value; uint16_t colormap_entries; uint32_t red_mask; diff --git a/libaxl/events.h b/libaxl/events.h index d6be648..13c2304 100644 --- a/libaxl/events.h +++ b/libaxl/events.h @@ -115,7 +115,7 @@ struct libaxl_event_button_press_release { struct libaxl_event_motion_notify { #define LIBAXL_EVENT_MOTION_NOTIFY 6 uint8_t code; - uint8_t detail; /* LIBAXL_NORMAL or LIBAXL_HINT */ + uint8_t detail; /* LIBAXL_{NORMAL or HINT} */ uint16_t sequence_number; libaxl_timestamp_t time; libaxl_window_t root; @@ -151,7 +151,7 @@ struct libaxl_event_input_device_event { 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 */ + uint8_t detail; /* See "pointer window details" in "consts.h" */ uint16_t sequence_number; libaxl_timestamp_t time; libaxl_window_t root; @@ -162,14 +162,14 @@ struct libaxl_event_enter_notify { 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; /* Bitmask: LIBAXL_FOCUS, LIBAXL_SAME_SCREEN */ + uint8_t mode; /* LIBAXL_{NORMAL, GRAB, or UNGRAB} */ + uint8_t flags; /* Bitmask: LIBAXL_{FOCUS, 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 */ + uint8_t detail; /* See "pointer window details" in "consts.h" */ uint16_t sequence_number; libaxl_timestamp_t time; libaxl_window_t root; @@ -180,14 +180,14 @@ struct libaxl_event_leave_notify { 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; /* Bitmask: LIBAXL_FOCUS, LIBAXL_SAME_SCREEN */ + uint8_t mode; /* LIBAXL_{NORMAL, GRAB, or UNGRAB} */ + uint8_t flags; /* Bitmask: LIBAXL_{FOCUS, 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 */ + uint8_t detail; /* See "pointer window details" in "consts.h" */ uint16_t sequence_number; libaxl_timestamp_t time; libaxl_window_t root; @@ -198,37 +198,37 @@ struct libaxl_event_pointer_window_event { 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; /* Bitmask: LIBAXL_FOCUS, LIBAXL_SAME_SCREEN */ + uint8_t mode; /* LIBAXL_{NORMAL, GRAB, or UNGRAB} */ + uint8_t flags; /* Bitmask: LIBAXL_{FOCUS, 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!) */ + uint8_t detail; /* See "window focus details" in "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 mode; /* LIBAXL_{NORMAL, GRAB, UNGRAB, or 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!) */ + uint8_t detail; /* See "window focus details" in "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 mode; /* LIBAXL_{NORMAL, GRAB, UNGRAB, or 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!) */ + uint8_t detail; /* See "window focus details" in "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 mode; /* LIBAXL_{NORMAL, GRAB, UNGRAB, or WHILE_GRABBED} */ uint8_t __unused[23]; }; @@ -285,7 +285,7 @@ struct libaxl_event_visibility_notify { 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 state; /* LIBAXL_{UNOBSCURED, PARTIALLY_OBSCURED, or FULLY_OBSCURED} */ uint8_t __unused[23]; }; @@ -298,9 +298,9 @@ struct libaxl_event_create_notify { libaxl_window_t window; int16_t x; int16_t y; - int16_t width; - int16_t height; - int16_t border_width; + uint16_t width; + uint16_t height; + uint16_t border_width; libaxl_bool_t override_redirect; uint8_t __unused[9]; }; @@ -381,7 +381,7 @@ struct libaxl_event_configure_notify { 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 */ + uint8_t stack_mode; /* See "stack mode" in "consts.h" */ uint16_t sequence_number; libaxl_window_t event; libaxl_window_t window; @@ -433,7 +433,7 @@ struct libaxl_event_circulate_notify { libaxl_window_t event; libaxl_window_t window; uint32_t __unused1; - uint8_t place; /* LIBAXL_TOP or LIBAXL_BOTTOM */ + uint8_t place; /* LIBAXL_{TOP or BOTTOM} */ uint8_t __unused[15]; }; @@ -445,7 +445,7 @@ struct libaxl_event_circulate_request { libaxl_window_t parent; libaxl_window_t window; uint32_t __unused1; - uint8_t place; /* LIBAXL_TOP or LIBAXL_BOTTOM */ + uint8_t place; /* LIBAXL_{TOP or BOTTOM} */ uint8_t __unused[15]; }; @@ -456,7 +456,7 @@ struct libaxl_event_property_notify { uint16_t sequence_number; libaxl_window_t window; libaxl_atom_t atom; - uint8_t state; /* LIBAXL_NEW_VALUE or LIBAXL_DELETED */ + uint8_t state; /* LIBAXL_{NEW_VALUE or DELETED} */ uint8_t __unused[15]; }; @@ -506,7 +506,7 @@ struct libaxl_event_colormap_notify { 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 state; /* LIBAXL_{UNINSTALLED or INSTALLED} */ uint8_t __unused[18]; }; @@ -529,7 +529,7 @@ struct libaxl_event_mapping_notify { uint8_t code; uint8_t __pad; uint16_t sequence_number; - uint8_t request; /* LIBAXL_MODIFIER, LIBAXL_KEYBOARD, or LIBAXL_POINTER */ + uint8_t request; /* LIBAXL_{MODIFIER, KEYBOARD, or POINTER} */ libaxl_keycode_t first_keycode; uint8_t count; uint8_t __unused[25]; diff --git a/libaxl/replies.h b/libaxl/replies.h index ded2d51..c8de403 100644 --- a/libaxl/replies.h +++ b/libaxl/replies.h @@ -8,22 +8,22 @@ struct libaxl_reply_get_window_attributes { uint8_t __one; - uint8_t backing_store; /* LIBAXL_NOT_USEFUL, LIBAXL_WHEN_MAPPED, or LIBAXL_ALWAYS */ + uint8_t backing_store; /* LIBAXL_{NOT_USEFUL, WHEN_MAPPED, or 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) */ + uint16_t class; /* LIBAXL_{INPUT_OUTPUT (= 1) or 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 */ + uint8_t map_state; /* LIBAXL_{UNMAPPED, UNVIEWABLE, or 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 */ + uint32_t all_event_masks; /* See "window event mask" in "consts.h" */ + uint32_t your_event_mask; /* See "window event mask" in "consts.h" */ uint16_t do_not_propagate_mask; /* TODO SETofDEVICEEVENT */ uint16_t __pad; }; @@ -111,7 +111,7 @@ struct libaxl_reply_get_selection_owner { struct libaxl_reply_grab_pointer { uint8_t __one; - uint8_t status; /* See "grab status" in libaxl-consts.h */ + uint8_t status; /* See "grab status" in "consts.h" */ uint16_t sequence_number; uint32_t _reply_length; /* = 0 */ uint8_t __unused[24]; @@ -119,7 +119,7 @@ struct libaxl_reply_grab_pointer { struct libaxl_reply_grab_keyboard { uint8_t __one; - uint8_t status; /* See "grab status" in libaxl-consts.h */ + uint8_t status; /* See "grab status" in "consts.h" */ uint16_t sequence_number; uint32_t _reply_length; /* = 0 */ uint8_t __unused[24]; @@ -163,10 +163,10 @@ struct libaxl_reply_translate_coordinates { struct libaxl_reply_get_input_focus { uint8_t __one; - uint8_t revert_to; /* LIBAXL_NONE, LIBAXL_POINTER_ROOT, or LIBAXL_PARENT */ + uint8_t revert_to; /* LIBAXL_{NONE, POINTER_ROOT, or PARENT} */ uint16_t sequence_number; uint32_t _reply_length; /* = 0 */ - libaxl_window_t focus; /* Can be LIBAXL_NONE or LIBAXL_POINTER_ROOT */ + libaxl_window_t focus; /* Can be LIBAXL_{NONE or POINTER_ROOT} */ int8_t __unused[20]; }; @@ -191,7 +191,7 @@ struct libaxl_reply_query_font { 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 draw_direction; /* LIBAXL_{LEFT_TO_RIGHT or RIGHT_TO_LEFT} */ uint8_t min_byte1; uint8_t max_byte1; libaxl_bool_t all_chars_exist; @@ -204,7 +204,7 @@ struct libaxl_reply_query_font { struct libaxl_reply_query_text_extents { uint8_t __one; - uint8_t draw_direction; /* LIBAXL_LEFT_TO_RIGHT or LIBAXL_RIGHT_TO_LEFT */ + uint8_t draw_direction; /* LIBAXL_{LEFT_TO_RIGHT or RIGHT_TO_LEFT} */ uint16_t sequence_number; uint32_t _reply_length; /* = 0 */ int16_t font_ascent; @@ -242,7 +242,7 @@ struct libaxl_reply_list_fonts_with_info { 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 draw_direction; /* LIBAXL_{LEFT_TO_RIGHT or RIGHT_TO_LEFT} */ uint8_t min_byte1; uint8_t max_byte1; libaxl_bool_t all_chars_exist; @@ -404,7 +404,7 @@ struct libaxl_reply_get_keyboard_mapping { struct libaxl_reply_get_keyboard_control { uint8_t __one; - uint8_t global_auto_repeat; /* LIBAXL_OFF or LIBAXL_ON */ + uint8_t global_auto_repeat; /* LIBAXL_{OFF or ON} */ uint16_t sequence_number; uint32_t _reply_length; /* = 5 */ uint32_t led_mask; @@ -434,14 +434,14 @@ struct libaxl_reply_get_screen_saver { 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 prefer_blanking; /* LIBAXL_{NO or YES} */ + uint8_t allow_exposures; /* LIBAXL_{NO or YES} */ uint8_t __unused[18]; }; struct libaxl_reply_list_hosts { uint8_t __one; - uint8_t mode; /* LIBAXL_DISABLED or LIBAXL_ENABLED */ + uint8_t mode; /* LIBAXL_{DISABLED or ENABLED} */ uint16_t sequence_number; uint32_t _reply_length; /* = 0 */ uint16_t number_of_hosts; @@ -451,7 +451,7 @@ struct libaxl_reply_list_hosts { struct libaxl_reply_set_pointer_mapping { uint8_t __one; - uint8_t status; /* LIBAXL_SUCCESS or LIBAXL_BUSY */ + uint8_t status; /* LIBAXL_{SUCCESS or BUSY} */ uint16_t sequence_number; uint32_t _reply_length; /* = 0 */ uint8_t __unused[24]; @@ -468,7 +468,7 @@ struct libaxl_reply_get_pointer_mapping { struct libaxl_reply_set_modifier_mapping { uint8_t __one; - uint8_t status; /* LIBAXL_SUCCESS, LIBAXL_BUSY, or LIBAXL_FAILED */ + uint8_t status; /* LIBAXL_{SUCCESS, BUSY, or FAILED} */ uint16_t sequence_number; uint32_t _reply_length; /* = 0 */ uint8_t __unused[24]; diff --git a/libaxl/requests.h b/libaxl/requests.h index 4517b46..dffb904 100644 --- a/libaxl/requests.h +++ b/libaxl/requests.h @@ -47,7 +47,7 @@ struct libaxl_request_create_window { libaxl_bool_t override_redirect; libaxl_bool_t save_under; uint16_t __omitted2; - uint32_t event_mask; /* See "window event mask" in libaxl/consts.h */ + uint32_t event_mask; /* See "window event mask" in "consts.h" */ 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 */ @@ -88,7 +88,7 @@ struct libaxl_request_change_window_attributes { libaxl_bool_t override_redirect; libaxl_bool_t save_under; uint16_t __omitted2; - uint32_t event_mask; /* See "window event mask" in libaxl/consts.h */ + uint32_t event_mask; /* See "window event mask" in "consts.h" */ 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 */ @@ -191,7 +191,7 @@ struct libaxl_request_configure_window { uint16_t border_width; uint16_t __omitted1; libaxl_window_t sibling; - uint8_t stack_mode; /* See "stack mode" in libaxl/consts.h */ + uint8_t stack_mode; /* See "stack mode" in "consts.h" */ uint8_t __omitted2[3]; }; @@ -240,7 +240,7 @@ struct libaxl_request_get_atom_name { struct libaxl_request_change_property { #define LIBAXL_REQUEST_CHANGE_PROPERTY 18 uint8_t opcode; - uint8_t mode; /* See libaxl/consts.h */ + uint8_t mode; /* See "consts.h" */ uint16_t _request_length; libaxl_window_t window; libaxl_atom_t property; @@ -320,7 +320,7 @@ struct libaxl_request_send_event { libaxl_bool_t propagate; uint16_t _request_length; /* = 11 */ libaxl_window_t destination; /* Can be LIBAXL_{POINTER_WINDOW or INPUT_FOCUS} */ - uint32_t event_mask; /* See "window event mask" in libaxl/consts.h */ + uint32_t event_mask; /* See "window event mask" in "consts.h" */ union libaxl_event event; }; @@ -429,7 +429,7 @@ struct libaxl_request_ungrab_key { struct libaxl_request_allow_events { #define LIBAXL_REQUEST_ALLOW_EVENTS 35 uint8_t opcode; - uint8_t mode; /* See libaxl/consts.h */ + uint8_t mode; /* See "consts.h" */ uint16_t _request_length; /* = 2 */ libaxl_timestamp_t time; /* Can be LIBAXL_CURRENT_TIME */ }; @@ -639,15 +639,15 @@ struct libaxl_request_create_gc { #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 function; /* See "gcontext function" in "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, ON_OFF_DASH, or 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 cap_style; /* See "cap style" in "consts.h" (Beware of namespacing) */ + uint8_t join_style; /* See "join style" in "consts.h" (Beware of namespacing) */ uint8_t fill_style; /* LIBAXL_{SOLID, TILED, STIPPLED, or OPAQUE_STIPPLED} */ uint8_t fill_rule; /* LIBAXL_{EVEN_ODD or WINDING} */ uint8_t __omitted2; @@ -697,15 +697,15 @@ struct libaxl_request_change_gc { #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 function; /* See "gcontext function" in "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, ON_OFF_DASH, or 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 cap_style; /* See "cap style" in "consts.h" (Beware of namespacing) */ + uint8_t join_style; /* See "join style" in "consts.h" (Beware of namespacing) */ uint8_t fill_style; /* LIBAXL_{SOLID, TILED, STIPPLED, or OPAQUE_STIPPLED} */ uint8_t fill_rule; /* LIBAXL_{EVEN_ODD or WINDING} */ uint8_t __omitted2; @@ -1125,7 +1125,7 @@ struct libaxl_request_store_colors { struct libaxl_request_store_named_color { #define LIBAXL_REQUEST_STORE_NAMED_COLOR 90 uint8_t opcode; - uint8_t flags; /* See libaxl/consts.h */ + uint8_t flags; /* See "consts.h" */ uint16_t _request_length; libaxl_colormap_t cmap; uint32_t pixel; @@ -1343,7 +1343,7 @@ struct libaxl_request_change_hosts { uint8_t opcode; uint8_t mode; /* LIBAXL_{INSERT or DELETE} */ uint16_t _request_length; - uint8_t family; /* See libaxl/consts.h */ + uint8_t family; /* See "consts.h" */ uint8_t __pad; uint16_t length_of_address; const uint8_t *address; diff --git a/libaxl/types.h b/libaxl/types.h index f4af1d5..f30c434 100644 --- a/libaxl/types.h +++ b/libaxl/types.h @@ -93,7 +93,7 @@ struct libaxl_coloritem { uint16_t red; uint16_t green; uint16_t blue; - uint8_t flags; /* See libaxl-consts.h */ + uint8_t flags; /* See "consts.h" */ uint8_t __unused; }; @@ -130,7 +130,7 @@ struct libaxl_str8 { }; struct libaxl_host { - uint8_t family; /* See libaxl-consts.h */ + uint8_t family; /* See "consts.h" */ uint8_t __pad; uint16_t length_of_address; uint8_t *address; diff --git a/libaxl_receive.c b/libaxl_receive.c index 797ba06..2e4fc20 100644 --- a/libaxl_receive.c +++ b/libaxl_receive.c @@ -33,7 +33,7 @@ static const char *const event_formats[] = { [LIBAXL_EVENT_GRAPHICS_EXPOSURE] = "1.242222221", [LIBAXL_EVENT_NO_EXPOSURE] = "1.242", [LIBAXL_EVENT_VISIBILITY_NOTIFY] = "1.241", - [LIBAXL_EVENT_CREATE_NOTIFY] = "1.244sssss!", + [LIBAXL_EVENT_CREATE_NOTIFY] = "1.244ss222!", [LIBAXL_EVENT_DESTROY_NOTIFY] = "1.244", [LIBAXL_EVENT_UNMAP_NOTIFY] = "1.244!", [LIBAXL_EVENT_MAP_NOTIFY] = "1.244!", diff --git a/libaxl_send_request.c b/libaxl_send_request.c index 4e795da..0e96177 100644 --- a/libaxl_send_request.c +++ b/libaxl_send_request.c @@ -22,7 +22,7 @@ static const char *const req_formats[] = { * e = event, align input to (union libaxl_event) * ? = jump to special encoding routine * * = following are repeated, align input to (void *) and enter - * | = following are included and encoded as uint32_t if corresponding bit is set in previous + * | = following are included and encoded as uint32_t (align output accordingly) if corresponding bit is set in previous * * The bytes 2–3 (starting at 0) are ignored here because its * the length field and will be filled in by the function @@ -38,7 +38,7 @@ static const char *const req_formats[] = { [LIBAXL_REQUEST_MAP_SUBWINDOWS] = "1_4", [LIBAXL_REQUEST_UNMAP_WINDOW] = "1_4", [LIBAXL_REQUEST_UNMAP_SUBWINDOWS] = "1_4", - [LIBAXL_REQUEST_CONFIGURE_WINDOW] = "1_42|,ss222,1", + [LIBAXL_REQUEST_CONFIGURE_WINDOW] = "1_42|,ss222,41", [LIBAXL_REQUEST_CIRCULATE_WINDOW] = "11,4", [LIBAXL_REQUEST_GET_GEOMETRY] = "1_4", [LIBAXL_REQUEST_QUERY_TREE] = "1_4", @@ -373,6 +373,16 @@ again: mask = (uint32_t)*(const uint16_t *)&req[i - 2]; else mask = (uint32_t)*(const uint8_t *)&req[i - 1]; + if (o + 4 > size) { + size += 32; + new = liberror_realloc(buf, size); + if (!new) + return LIBAXL_ERROR_SYSTEM; + ctx->out_buf = buf = new; + ctx->out_buf_size = size; + } + memset(&buf[o], 0, 4 - (fmt[-1] - '0')); + o += 4 - (fmt[-1] - '0'); for (fmt++;; fmt++) { if (o + 4 > size) { size += 32; @@ -523,8 +533,9 @@ done: WLOCK_CONNECTION_SEND(conn); - *seqnump = ++conn->last_seqnum; - conn->request_map[*seqnump] = code; + conn->request_map[++conn->last_seqnum] = code; + if (seqnump) + *seqnump = conn->last_seqnum; if (send_all(conn->fd, ctx->out_buf, ctx->out_length, flags, &ctx->out_progress)) { ctx->next_pending_out = NULL; pendingp = &conn->pending_out; |