diff options
author | Ulrich Eckhardt <doomster@knuut.de> | 2008-09-29 16:35:10 -0700 |
---|---|---|
committer | Arnaud Fontaine <arnau@debian.org> | 2010-11-14 19:50:37 +0900 |
commit | e96984a40f43114b8ff7640a2c017442105ab28a (patch) | |
tree | 7288eb95b342ef8571ca9664f275b6c4811ff80f | |
parent | 1b81ef7e1abffb9a244183d6fbf4a1e6e2cb11e1 (diff) |
"Clean up" magic structure stuff for C++.
Signed-off-by: Bart Massey <bart@cs.pdx.edu>
-rw-r--r-- | aux/xcb_aux.h | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/aux/xcb_aux.h b/aux/xcb_aux.h index 952b0c3..011736e 100644 --- a/aux/xcb_aux.h +++ b/aux/xcb_aux.h @@ -26,18 +26,26 @@ xcb_aux_find_visual_by_id (xcb_screen_t *screen, xcb_visualtype_t * xcb_aux_find_visual_by_attrs (xcb_screen_t *screen, - int8_t class, + int8_t class_, int8_t depth); void xcb_aux_sync (xcb_connection_t *c); -/* less error prone to use structs instead of value lists */ - -#define _XCB_AUX_OFFSETOF(paramsp, param) \ - ((void*)(&((paramsp)->param))-(void*)(paramsp)) - +/* internal helper macro for XCB_AUX_ADD_PARAM +It gives the offset of the field 'param' in the structure pointed to by +'paramsp' in multiples of an uint32_t's size. */ +#define XCB_AUX_INTERNAL_OFFSETOF(paramsp, param) \ + ((uint32_t const*)(&((paramsp)->param))-(uint32_t const*)(paramsp)) + +/* add an optional parameter to an xcb_params_* structure +parameters: + maskp: pointer to bitmask whos bits mark used parameters + paramsp: pointer to structure with parameters + param: parameter to set + value: value to set the parameter to +*/ #define XCB_AUX_ADD_PARAM(maskp, paramsp, param, value) \ - ((*(maskp)|=1<<(_XCB_AUX_OFFSETOF((paramsp),param)/sizeof(uint32_t))), \ + ((*(maskp)|=1<<XCB_AUX_INTERNAL_OFFSETOF((paramsp),param)), \ ((paramsp)->param=(value))) typedef struct { @@ -68,7 +76,7 @@ xcb_aux_create_window (xcb_connection_t *c, uint16_t width, uint16_t height, uint16_t border_width, - uint16_t _class, + uint16_t class_, xcb_visualid_t visual, uint32_t mask, const xcb_params_cw_t *params); @@ -83,7 +91,7 @@ xcb_aux_create_window_checked (xcb_connection_t *c, uint16_t width, uint16_t height, uint16_t border_width, - uint16_t _class, + uint16_t class_, xcb_visualid_t visual, uint32_t mask, const xcb_params_cw_t *params); |