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
50
51
|
commit 7b3c387af9e9c6c37c5751258ded6708094d4c73
Author: Matthias Clasen <mclasen@redhat.com>
Date: Sun Mar 21 20:53:24 2021 -0400
compose-parse: Add a negative lookaside
Make this script parse gtk-compose-remove.txt for
sequences to remove from the xorg Compose file.
This will be used for removing some deadkey combinations
that we can handle better in code.
Also, make this script explicitly python2. I tried
porting it to python3, but gave up in the end.
diff --git a/gtk/compose-parse.py b/gtk/compose-parse.py
index 9a6513a70a..bf0f5bc953 100755
--- a/gtk/compose-parse.py
+++ b/gtk/compose-parse.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# compose-parse.py, version 1.4
@@ -26,6 +26,7 @@ URL_KEYSYMSTXT = "http://www.cl.cam.ac.uk/~mgk25/ucs/keysyms.txt"
URL_GDKKEYSYMSH = "http://git.gnome.org/browse/gtk%2B/plain/gdk/gdkkeysyms.h"
URL_UNICODEDATATXT = 'http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt'
FILENAME_COMPOSE_SUPPLEMENTARY = 'gtk-compose-lookaside.txt'
+FILENAME_COMPOSE_NEGATIVE_SUPPLEMENTARY = 'gtk-compose-remove.txt'
# We currently support keysyms of size 2; once upstream xorg gets sorted,
# we might produce some tables with size 2 and some with size 4.
@@ -448,6 +449,18 @@ xorg_compose_sequences_raw = []
for seq in composefile.readlines():
xorg_compose_sequences_raw.append(seq)
+try:
+ composefile_lookaside = open(FILENAME_COMPOSE_NEGATIVE_SUPPLEMENTARY, 'r')
+ for seq in composefile_lookaside.readlines():
+ xorg_compose_sequences_raw.remove(seq)
+except IOError, (errno, strerror):
+ if opt_verbose:
+ print "I/O error(%s): %s" % (errno, strerror)
+ print "Did not find negative lookaside compose file. Continuing..."
+except:
+ print "Unexpected error: ", sys.exc_info()[0]
+ sys.exit(-1)
+
try:
composefile_lookaside = open(FILENAME_COMPOSE_SUPPLEMENTARY, 'r')
for seq in composefile_lookaside.readlines():
|