File: Support-KT_DEAD2-diacritics.patch

package info (click to toggle)
kbd 2.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 15,932 kB
  • sloc: ansic: 13,832; javascript: 3,038; sh: 829; pascal: 643; makefile: 628; lex: 532; yacc: 354; perl: 126
file content (49 lines) | stat: -rw-r--r-- 1,602 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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;
 	}