Input: add generic support for sparse keymaps