From 9a9b8edfa9b8727d0a63c4f8a0975d4cfa91fe64 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98ystein=20Bech=20Gadmar?= Date: Mon, 29 Jan 2018 00:10:35 +0100 Subject: [PATCH] core: Add utility macros in action_macro.h (#532) --- tmk_core/common/action_macro.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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) -- 2.46.2