Magellan Linux

Contents of /trunk/eterm/patches/eterm-0.9.3-deadkeys.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 144 - (show annotations) (download)
Tue May 8 20:06:05 2007 UTC (17 years ago) by niro
File size: 4673 byte(s)
-import

1 http://bugs.gentoo.org/91878
2
3 Tue Mar 15 16:44:09 2005 Michael Jennings (mej)
4
5 Reverted part of a patch from Chris Schoeneman <crs23@bigfoot.com>
6 (changelog entry "Fri Jun 25 17:48:24 2004") which broke dead keys and
7 compose-key sequences.
8
9 Fixed error in saving of cut_chars attribute.
10
11 Index: src/misc.c
12 ===================================================================
13 RCS file: /cvsroot/enlightenment/eterm/Eterm/src/misc.c,v
14 retrieving revision 1.25
15 retrieving revision 1.26
16 diff -u -r1.25 -r1.26
17 --- src/misc.c 11 Jan 2004 22:10:29 -0000 1.25
18 +++ src/misc.c 15 Mar 2005 21:48:02 -0000 1.26
19 @@ -223,6 +223,53 @@
20 return (pnew - str);
21 }
22
23 +spif_charptr_t
24 +escape_string(spif_charptr_t str, spif_char_t quote, spif_int32_t maxlen)
25 +{
26 + spif_charptr_t buff, s = str, pbuff;
27 +
28 + D_STRINGS(("escape_string(%s %c %ld)\n", (char *) str, quote, maxlen));
29 + if (! quote) {
30 + quote = '\"';
31 + }
32 +
33 + /* The escaped string will be at most twice the length of the original. */
34 + buff = SPIF_CAST(charptr) MALLOC(strlen(SPIF_CAST_PTR(char) str) * 2 + 1);
35 +
36 + /* Copy and escape the string from str into buff. */
37 + for (pbuff = buff; (*s); s++, pbuff++) {
38 + if (*s == quote) {
39 + D_STRINGS(("Double-escaping \'%c\' at position %d\n", *s, s - str));
40 + *pbuff = '\\';
41 + pbuff++;
42 + *pbuff = '\\';
43 + pbuff++;
44 + } else {
45 + if (quote == '\"') {
46 + if ((*s == '\\') || (*s == '`')) {
47 + D_STRINGS(("Escaping \'%c\' at position %d\n", *s, s - str));
48 + *pbuff = '\\';
49 + pbuff++;
50 + }
51 + }
52 + }
53 + D_STRINGS(("Copying \'%c\' at position %d\n", *s, s - str));
54 + *pbuff = *s;
55 + }
56 + *pbuff = 0;
57 +
58 + if (maxlen) {
59 + /* Given maxlen, we know "str" can hold at least "maxlen" chars. */
60 + if (!spiftool_safe_strncpy(str, buff, maxlen)) {
61 + str[maxlen] = 0;
62 + }
63 + FREE(buff);
64 + return str;
65 + } else {
66 + return buff;
67 + }
68 +}
69 +
70 char *
71 safe_print_string(const char *str, unsigned long len)
72 {
73 Index: src/misc.h
74 ===================================================================
75 RCS file: /cvsroot/enlightenment/eterm/Eterm/src/misc.h,v
76 retrieving revision 1.15
77 retrieving revision 1.16
78 diff -u -r1.15 -r1.16
79 --- src/misc.h 11 Jan 2004 22:10:29 -0000 1.15
80 +++ src/misc.h 15 Mar 2005 21:48:02 -0000 1.16
81 @@ -40,6 +40,7 @@
82 extern unsigned long str_leading_match(register const char *, register const char *);
83 extern char *str_trim(char *str);
84 extern int parse_escaped_string(char *str);
85 +extern spif_charptr_t escape_string(spif_charptr_t str, spif_char_t quote, spif_int32_t maxlen);
86 extern char *safe_print_string(const char *buff, unsigned long len);
87 extern unsigned long add_carriage_returns(unsigned char *buff, unsigned long cnt);
88 extern unsigned char mkdirhier(const char *);
89 Index: src/options.c
90 ===================================================================
91 RCS file: /cvsroot/enlightenment/eterm/Eterm/src/options.c,v
92 retrieving revision 1.135
93 retrieving revision 1.136
94 diff -u -r1.135 -r1.136
95 --- src/options.c 23 Feb 2005 20:38:19 -0000 1.135
96 +++ src/options.c 15 Mar 2005 21:48:02 -0000 1.136
97 @@ -3850,7 +3863,10 @@
98 }
99 #ifdef CUTCHAR_OPTION
100 if (rs_cutchars) {
101 - fprintf(fp, " cut_chars '%s'\n", rs_cutchars);
102 + spif_charptr_t cut_chars_escaped;
103 +
104 + cut_chars_escaped = escape_string(SPIF_CAST(charptr) rs_cutchars, '\"', 0);
105 + fprintf(fp, " cut_chars \"%s\"\n", (char *) cut_chars_escaped);
106 }
107 #endif
108 fprintf(fp, "end misc\n\n");
109 Index: src/windows.c
110 ===================================================================
111 RCS file: /cvsroot/enlightenment/eterm/Eterm/src/windows.c,v
112 retrieving revision 1.68
113 retrieving revision 1.69
114 diff -u -r1.68 -r1.69
115 --- src/windows.c 14 Dec 2004 23:24:33 -0000 1.68
116 +++ src/windows.c 15 Mar 2005 21:48:12 -0000 1.69
117 @@ -473,9 +473,7 @@
118 XClearWindow(Xdisplay, TermWin.vt);
119 }
120 XDefineCursor(Xdisplay, TermWin.vt, TermWin_cursor);
121 - TermWin.mask = (KeyPressMask | EnterWindowMask | LeaveWindowMask | ExposureMask
122 - | ButtonPressMask | ButtonReleaseMask | Button1MotionMask
123 - | Button2MotionMask | Button3MotionMask);
124 + TermWin.mask = (EnterWindowMask | LeaveWindowMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask);
125 XSelectInput(Xdisplay, TermWin.vt, TermWin.mask);
126
127 /* If the user wants a specific desktop, tell the WM that */