From: Øystein Bech Gadmar Date: Sun, 28 Jan 2018 23:10:35 +0000 (+0100) Subject: core: Add utility macros in action_macro.h (#532) X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;h=9a9b8edfa9b8727d0a63c4f8a0975d4cfa91fe64;p=max%2Ftmk_keyboard.git core: Add utility macros in action_macro.h (#532) --- diff --git a/tmk_core/common/action_macro.h b/tmk_core/common/action_macro.h index 4cf2216d..73937864 100644 --- a/tmk_core/common/action_macro.h +++ b/tmk_core/common/action_macro.h @@ -105,6 +105,19 @@ enum macro_command_id{ #define RM() RESTORE() /* clear modifier(s) */ #define CM() CLEAR() +/* key shift-type */ +#define ST(key) D(LSFT), T(key), U(LSFT) +/* modifier utility macros */ +/* Example: Ctrl+Alt+[Shift+] is CTL_( ALT_( [S]T(key1), [S]T(key2) )) . */ +#define SFT_(...) D(LSFT), __VA_ARGS__, U(LSFT) +#define CTL_(...) D(LCTL), __VA_ARGS__, U(LCTL) +#define ALT_(...) D(LALT), __VA_ARGS__, U(LALT) +#define AGR_(...) D(RALT), __VA_ARGS__, U(RALT) +/* Unicode macros for XOrg/MacOs/Win. */ +/* Example: UNIW_(0,1,4,9) enters a bullet glyph on Windows using Alt+KeyPad(####). */ +#define UNIX_(d1,d2,d3,d4) CTL_(ST(U)), T(d1), T(d2), T(d3), T(d4) , T(ENT) +#define UNIM_(d1,d2,d3,d4) ALT_( T(d1), T(d2), T(d3), T(d4) ) +#define UNIW_(d1,d2,d3,d4) ALT_( T(P##d1), T(P##d2), T(P##d3), T(P##d4) ) /* for backward comaptibility */ #define MD(key) DOWN(KC_##key)