From eaa7732901a91300e4a9f18d0e21b0a673f71eb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Sun, 18 Apr 2021 18:05:09 +0300 Subject: [PATCH] Add bare +altgr/-altgr modifier support to kblayout-compiler(1) --- kblayout-compiler/kblayout-compiler.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/kblayout-compiler/kblayout-compiler.c b/kblayout-compiler/kblayout-compiler.c index a6664543..4954fb6d 100644 --- a/kblayout-compiler/kblayout-compiler.c +++ b/kblayout-compiler/kblayout-compiler.c @@ -49,6 +49,20 @@ bool accept_no_shift(uint32_t combination) return true; } +bool accept_no_altgr(uint32_t combination) +{ + if ( combination & 0b0100 ) + return false; + return true; +} + +bool accept_altgr(uint32_t combination) +{ + if ( !(combination & 0b0100) ) + return false; + return true; +} + bool accept_no_shift_no_alt_gr(uint32_t combination) { if ( combination & 0b0101 ) @@ -529,6 +543,10 @@ int main(int argc, char* argv[]) line[--line_length] = '\0'; if ( !strcmp(line, "-shift") ) condition = accept_no_shift; + else if ( !strcmp(line, "-altgr") ) + condition = accept_no_altgr; + else if ( !strcmp(line, "+altgr") ) + condition = accept_altgr; else if ( !strcmp(line, "-shift & -altgr") ) condition = accept_no_shift_no_alt_gr; else if ( !strcmp(line, "+shift & -altgr") )