Move get_mod_mask to libi3, use it in i3 and i3-config-wizard

Also, the API changed a bit. There are two functions now, both assume you
already got the keysyms (which is the case for i3 and i3-config-wizard),
one gets the modifier mapping for you (aio_get_mod_mask_for) while the other
assumes you also got that. No roundtrips are required for the latter.
This commit is contained in:
Michael Stapelberg
2011-10-23 21:26:15 +01:00
parent a512b99a51
commit 91134f75c0
9 changed files with 109 additions and 130 deletions

View File

@ -8,6 +8,7 @@
#include <stdarg.h>
#include <xcb/xcb.h>
#include <xcb/xproto.h>
#include <xcb/xcb_keysyms.h>
/**
* Try to get the socket path from X11 and return NULL if it doesnt work.
@ -121,4 +122,25 @@ char *strndup(const char *str, size_t n);
#endif
/**
* All-in-one function which returns the modifier mask (XCB_MOD_MASK_*) for the
* given keysymbol, for example for XCB_NUM_LOCK (usually configured to mod2).
*
* This function initiates one round-trip. Use get_mod_mask_for() directly if
* you already have the modifier mapping and key symbols.
*
*/
uint32_t aio_get_mod_mask_for(uint32_t keysym, xcb_key_symbols_t *symbols);
/**
* Returns the modifier mask (XCB_MOD_MASK_*) for the given keysymbol, for
* example for XCB_NUM_LOCK (usually configured to mod2).
*
* This function does not initiate any round-trips.
*
*/
uint32_t get_mod_mask_for(uint32_t keysym,
xcb_key_symbols_t *symbols,
xcb_get_modifier_mapping_reply_t *modmap_reply);
#endif