From: Samuel Thibault <sthibault@debian.org>
Date: Thu, 10 Dec 2015 20:31:04 +0100
Subject: Support KT_DEAD2 diacritics

Forwarded: no
Bug-Debian: http://bugs.debian.org/694169

Add support for KT_DEAD2 diacritics to loadkeys and dumpkeys using the
dead2_ prefix.

[ah@debian.org: update to patch libkeymap and use get_sym{,_size} helpers]
---
 src/libkeymap/dump.c  | 3 +++
 src/libkeymap/ksyms.c | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/src/libkeymap/dump.c b/src/libkeymap/dump.c
index 4dee51b..ac32a99 100644
--- a/src/libkeymap/dump.c
+++ b/src/libkeymap/dump.c
@@ -390,6 +390,9 @@ print_keysym(struct lk_ctx *ctx, FILE *fd, int code, char numeric)
 	else if (!numeric && t == KT_META && v < 128 && v < get_sym_size(ctx, KT_LATIN) &&
 	         (p = get_sym(ctx, KT_LATIN, v))[0])
 		fprintf(fd, "Meta_%-11s", p);
+	else if (!numeric && t == KT_DEAD2 && v < 256 && v < get_sym_size(ctx, KT_LATIN) &&
+		 (p = get_sym(ctx, KT_LATIN, v))[0])
+		printf("dead2_%-10s", p);
 	else
 		fprintf(fd, "0x%04x         %s", code, plus ? "" : " ");
 }
diff --git a/src/libkeymap/ksyms.c b/src/libkeymap/ksyms.c
index bc7d154..b0a7933 100644
--- a/src/libkeymap/ksyms.c
+++ b/src/libkeymap/ksyms.c
@@ -290,6 +290,14 @@ int ksymtocode(struct lk_ctx *ctx, const char *s, int direction)
 		/* fall through to error printf */
 	}
 
+	if (!strncmp(s, "dead2_", 6)) {
+		keycode = ksymtocode(ctx, s+6, TO_8BIT);
+		if (KTYP(keycode) == KT_LATIN)
+			return K(KT_DEAD2, KVAL(keycode));
+
+		/* fall through to error printf */
+	}
+
 	if ((n = kt_latin(ctx, s, direction)) >= 0) {
 		return n;
 	}
