aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-06-19 16:54:54 +0200
committerMattias Andrée <maandree@kth.se>2020-06-19 16:54:54 +0200
commit755b5086e8a5c50328a1bbccc499058f5f87cc47 (patch)
tree51ebedbcc6c39a0bfc06eb913d7f4f0fd5c65d6f
parentFix libaxl_receive (diff)
downloadlibaxl-755b5086e8a5c50328a1bbccc499058f5f87cc47.tar.gz
libaxl-755b5086e8a5c50328a1bbccc499058f5f87cc47.tar.bz2
libaxl-755b5086e8a5c50328a1bbccc499058f5f87cc47.tar.xz
Minor fixes
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--common.h2
-rw-r--r--libaxl/consts.h27
-rw-r--r--libaxl/requests.h28
-rw-r--r--libaxl_send_request.c4
4 files changed, 44 insertions, 17 deletions
diff --git a/common.h b/common.h
index ee68661..5dae5a1 100644
--- a/common.h
+++ b/common.h
@@ -77,7 +77,7 @@ struct libaxl_connection {
int fd;
uint16_t last_seqnum;
LIBAXL_CONNECTION_RWLOCK;
- LIBAXL_CONTEXT *pending_out;
+ LIBAXL_CONTEXT *pending_out; /* TODO can _Atomic be used instead of mutex */
size_t in_progress;
size_t in_buf_size;
char *in_buf;
diff --git a/libaxl/consts.h b/libaxl/consts.h
index 686de2b..a378c73 100644
--- a/libaxl/consts.h
+++ b/libaxl/consts.h
@@ -272,3 +272,30 @@
#define LIBAXL_COPY_FROM_PARENT 0
#define LIBAXL_POINTER_ROOT 1
#define LIBAXL_PARENT 2
+
+/* window event mask */
+#define LIBAXL_EVENT_MASK_KEY_PRESS UINT32_C(0x00000001)
+#define LIBAXL_EVENT_MASK_KEY_RELEASE UINT32_C(0x00000002)
+#define LIBAXL_EVENT_MASK_BUTTON_PRESS UINT32_C(0x00000004)
+#define LIBAXL_EVENT_MASK_BUTTON_RELEASE UINT32_C(0x00000008)
+#define LIBAXL_EVENT_MASK_ENTER_WINDOW UINT32_C(0x00000010)
+#define LIBAXL_EVENT_MASK_LEAVE_WINDOW UINT32_C(0x00000020)
+#define LIBAXL_EVENT_MASK_POINTER_MOTION UINT32_C(0x00000040)
+#define LIBAXL_EVENT_MASK_POINTER_MOTION_HINT UINT32_C(0x00000080)
+#define LIBAXL_EVENT_MASK_BUTTON_1_MOTION UINT32_C(0x00000100)
+#define LIBAXL_EVENT_MASK_BUTTON_2_MOTION UINT32_C(0x00000200)
+#define LIBAXL_EVENT_MASK_BUTTON_3_MOTION UINT32_C(0x00000400)
+#define LIBAXL_EVENT_MASK_BUTTON_4_MOTION UINT32_C(0x00000800)
+#define LIBAXL_EVENT_MASK_BUTTON_5_MOTION UINT32_C(0x00001000)
+#define LIBAXL_EVENT_MASK_BUTTON_MOTION UINT32_C(0x00002000)
+#define LIBAXL_EVENT_MASK_KEYMAP_STATE UINT32_C(0x00004000)
+#define LIBAXL_EVENT_MASK_EXPOSURE UINT32_C(0x00008000)
+#define LIBAXL_EVENT_MASK_VISIBILITY_CHANGE UINT32_C(0x00010000)
+#define LIBAXL_EVENT_MASK_STRUCTURE_NOTIFY UINT32_C(0x00020000)
+#define LIBAXL_EVENT_MASK_RESIZE_REDIRECT UINT32_C(0x00040000)
+#define LIBAXL_EVENT_MASK_SUBSTRUCTURE_NOTIFY UINT32_C(0x00080000)
+#define LIBAXL_EVENT_MASK_SUBSTRUCTURE_REDIRECT UINT32_C(0x00100000)
+#define LIBAXL_EVENT_MASK_FOCUS_CHANGE UINT32_C(0x00200000)
+#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)
diff --git a/libaxl/requests.h b/libaxl/requests.h
index bbb4442..4517b46 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; /* TODO SETofEVENT */
+ uint32_t event_mask; /* See "window event mask" in libaxl/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; /* TODO SETofEVENT */
+ uint32_t event_mask; /* See "window event mask" in libaxl/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 libaxl/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 libaxl/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; /* TODO SETofEVENT */
+ uint32_t event_mask; /* See "window event mask" in libaxl/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 libaxl/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 libaxl/consts.h */
uint8_t __omitted1[3];
uint32_t plane_mask;
uint32_t foreground;
uint32_t background;
uint16_t line_width;
uint8_t line_style; /* LIBAXL_{SOLID, 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 libaxl/consts.h (Beware of namespacing) */
+ uint8_t join_style; /* See "join style" in libaxl/consts.h (Beware of namespacing) */
uint8_t fill_style; /* LIBAXL_{SOLID, 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 libaxl/consts.h */
uint8_t __omitted1[3];
uint32_t plane_mask;
uint32_t foreground;
uint32_t background;
uint16_t line_width;
uint8_t line_style; /* LIBAXL_{SOLID, 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 libaxl/consts.h (Beware of namespacing) */
+ uint8_t join_style; /* See "join style" in libaxl/consts.h (Beware of namespacing) */
uint8_t fill_style; /* LIBAXL_{SOLID, 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 libaxl/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 libaxl/consts.h */
uint8_t __pad;
uint16_t length_of_address;
const uint8_t *address;
diff --git a/libaxl_send_request.c b/libaxl_send_request.c
index 7172cdf..4e795da 100644
--- a/libaxl_send_request.c
+++ b/libaxl_send_request.c
@@ -28,7 +28,7 @@ static const char *const req_formats[] = {
* the length field and will be filled in by the function
*/
[LIBAXL_REQUEST_CREATE_WINDOW] = "11,44ss222244|4444111.44!!,4444",
- [LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES] = "1_44|4444111.44111.44!!,4444",
+ [LIBAXL_REQUEST_CHANGE_WINDOW_ATTRIBUTES] = "1_44|4444111.44!!,4444",
[LIBAXL_REQUEST_GET_WINDOW_ATTRIBUTES] = "1_4",
[LIBAXL_REQUEST_DESTROY_WINDOW] = "1_4",
[LIBAXL_REQUEST_DESTROY_SUBWINDOWS] = "1_4",
@@ -436,7 +436,7 @@ again:
case '4':
case 'S':
if (mask & 1) {
- u32 = *(const uint16_t *)&req[i];
+ u32 = *(const uint32_t *)&req[i];
if (*fmt == 'S')
TWOS_COMPLEMENT32(&u32);
*(uint32_t *)&buf[o] = htonl(u32);