1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2000 Red Hat Software
3 * Copyright (C) 2000 SuSE Linux Ltd
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 * Original author: Owen Taylor <otaylor@redhat.com>
20 * Modified for VIQR - Robert Brady <robert@suse.co.uk>
28 #include "gdk/gdkkeysyms.h"
30 #include "gtk/gtkimmodule.h"
31 #include "gtk/gtkintl.h"
33 GType type_viqr_translit = 0;
35 static void viqr_class_init (GtkIMContextSimpleClass *class);
36 static void viqr_init (GtkIMContextSimple *im_context);
39 viqr_register_type (GTypeModule *module)
41 const GTypeInfo object_info =
43 sizeof (GtkIMContextSimpleClass),
45 (GBaseFinalizeFunc) NULL,
46 (GClassInitFunc) viqr_class_init,
47 NULL, /* class_finalize */
48 NULL, /* class_data */
49 sizeof (GtkIMContextSimple),
51 (GInstanceInitFunc) viqr_init,
55 g_type_module_register_type (module,
56 GTK_TYPE_IM_CONTEXT_SIMPLE,
61 static guint16 viqr_compose_seqs[] = {
62 GDK_KEY_A, 0, 0, 0, 0, 'A',
63 GDK_KEY_A, GDK_KEY_apostrophe, 0, 0, 0, 0xc1,
64 GDK_KEY_A, GDK_KEY_parenleft, 0, 0, 0, 0x102,
65 GDK_KEY_A, GDK_KEY_parenleft, GDK_KEY_apostrophe, 0, 0, 0x1eae,
66 GDK_KEY_A, GDK_KEY_parenleft, GDK_KEY_period, 0, 0, 0x1eb6,
67 GDK_KEY_A, GDK_KEY_parenleft, GDK_KEY_question, 0, 0, 0x1eb2,
68 GDK_KEY_A, GDK_KEY_parenleft, GDK_KEY_grave, 0, 0, 0x1eb0,
69 GDK_KEY_A, GDK_KEY_parenleft, GDK_KEY_asciitilde, 0, 0, 0x1eb4,
70 GDK_KEY_A, GDK_KEY_period, 0, 0, 0, 0x1ea0,
71 GDK_KEY_A, GDK_KEY_question, 0, 0, 0, 0x1ea2,
72 GDK_KEY_A, GDK_KEY_asciicircum, 0, 0, 0, 0xc2,
73 GDK_KEY_A, GDK_KEY_asciicircum, GDK_KEY_apostrophe, 0, 0, 0x1ea4,
74 GDK_KEY_A, GDK_KEY_asciicircum, GDK_KEY_period, 0, 0, 0x1eac,
75 GDK_KEY_A, GDK_KEY_asciicircum, GDK_KEY_question, 0, 0, 0x1ea8,
76 GDK_KEY_A, GDK_KEY_asciicircum, GDK_KEY_grave, 0, 0, 0x1ea6,
77 GDK_KEY_A, GDK_KEY_asciicircum, GDK_KEY_asciitilde, 0, 0, 0x1eaa,
78 GDK_KEY_A, GDK_KEY_grave, 0, 0, 0, 0xc0,
79 GDK_KEY_A, GDK_KEY_asciitilde, 0, 0, 0, 0xc3,
80 GDK_KEY_D, 0, 0, 0, 0, 'D',
81 GDK_KEY_D, GDK_KEY_D, 0, 0, 0, 0x110,
82 GDK_KEY_D, GDK_KEY_d, 0, 0, 0, 0x110,
83 GDK_KEY_E, 0, 0, 0, 0, 'E',
84 GDK_KEY_E, GDK_KEY_apostrophe, 0, 0, 0, 0xc9,
85 GDK_KEY_E, GDK_KEY_period, 0, 0, 0, 0x1eb8,
86 GDK_KEY_E, GDK_KEY_question, 0, 0, 0, 0x1eba,
87 GDK_KEY_E, GDK_KEY_asciicircum, 0, 0, 0, 0xca,
88 GDK_KEY_E, GDK_KEY_asciicircum, GDK_KEY_apostrophe, 0, 0, 0x1ebe,
89 GDK_KEY_E, GDK_KEY_asciicircum, GDK_KEY_period, 0, 0, 0x1ec6,
90 GDK_KEY_E, GDK_KEY_asciicircum, GDK_KEY_question, 0, 0, 0x1ec2,
91 GDK_KEY_E, GDK_KEY_asciicircum, GDK_KEY_grave, 0, 0, 0x1ec0,
92 GDK_KEY_E, GDK_KEY_asciicircum, GDK_KEY_asciitilde, 0, 0, 0x1ec4,
93 GDK_KEY_E, GDK_KEY_grave, 0, 0, 0, 0xc8,
94 GDK_KEY_E, GDK_KEY_asciitilde, 0, 0, 0, 0x1ebc,
95 GDK_KEY_I, 0, 0, 0, 0, 'I',
96 GDK_KEY_I, GDK_KEY_apostrophe, 0, 0, 0, 0xcd,
97 GDK_KEY_I, GDK_KEY_period, 0, 0, 0, 0x1eca,
98 GDK_KEY_I, GDK_KEY_question, 0, 0, 0, 0x1ec8,
99 GDK_KEY_I, GDK_KEY_grave, 0, 0, 0, 0xcc,
100 GDK_KEY_I, GDK_KEY_asciitilde, 0, 0, 0, 0x128,
101 GDK_KEY_O, 0, 0, 0, 0, 'O',
102 GDK_KEY_O, GDK_KEY_apostrophe, 0, 0, 0, 0xD3,
103 GDK_KEY_O, GDK_KEY_plus, 0, 0, 0, 0x1a0,
104 GDK_KEY_O, GDK_KEY_plus, GDK_KEY_apostrophe, 0, 0, 0x1eda,
105 GDK_KEY_O, GDK_KEY_plus, GDK_KEY_period, 0, 0, 0x1ee2,
106 GDK_KEY_O, GDK_KEY_plus, GDK_KEY_question, 0, 0, 0x1ede,
107 GDK_KEY_O, GDK_KEY_plus, GDK_KEY_grave, 0, 0, 0x1edc,
108 GDK_KEY_O, GDK_KEY_plus, GDK_KEY_asciitilde, 0, 0, 0x1ee0,
109 GDK_KEY_O, GDK_KEY_period, 0, 0, 0, 0x1ecc,
110 GDK_KEY_O, GDK_KEY_question, 0, 0, 0, 0x1ece,
111 GDK_KEY_O, GDK_KEY_asciicircum, 0, 0, 0, 0xd4,
112 GDK_KEY_O, GDK_KEY_asciicircum, GDK_KEY_apostrophe, 0, 0, 0x1ed0,
113 GDK_KEY_O, GDK_KEY_asciicircum, GDK_KEY_period, 0, 0, 0x1ed8,
114 GDK_KEY_O, GDK_KEY_asciicircum, GDK_KEY_question, 0, 0, 0x1ed4,
115 GDK_KEY_O, GDK_KEY_asciicircum, GDK_KEY_grave, 0, 0, 0x1ed2,
116 GDK_KEY_O, GDK_KEY_asciicircum, GDK_KEY_asciitilde, 0, 0, 0x1ed6,
117 GDK_KEY_O, GDK_KEY_grave, 0, 0, 0, 0xD2,
118 GDK_KEY_O, GDK_KEY_asciitilde, 0, 0, 0, 0xD5,
119 GDK_KEY_U, 0, 0, 0, 0, 'U',
120 GDK_KEY_U, GDK_KEY_apostrophe, 0, 0, 0, 0xDA,
121 GDK_KEY_U, GDK_KEY_plus, 0, 0, 0, 0x1af,
122 GDK_KEY_U, GDK_KEY_plus, GDK_KEY_apostrophe, 0, 0, 0x1ee8,
123 GDK_KEY_U, GDK_KEY_plus, GDK_KEY_period, 0, 0, 0x1ef0,
124 GDK_KEY_U, GDK_KEY_plus, GDK_KEY_question, 0, 0, 0x1eec,
125 GDK_KEY_U, GDK_KEY_plus, GDK_KEY_grave, 0, 0, 0x1eea,
126 GDK_KEY_U, GDK_KEY_plus, GDK_KEY_asciitilde, 0, 0, 0x1eee,
127 GDK_KEY_U, GDK_KEY_period, 0, 0, 0, 0x1ee4,
128 GDK_KEY_U, GDK_KEY_question, 0, 0, 0, 0x1ee6,
129 GDK_KEY_U, GDK_KEY_grave, 0, 0, 0, 0xd9,
130 GDK_KEY_U, GDK_KEY_asciitilde, 0, 0, 0, 0x168,
131 GDK_KEY_Y, 0, 0, 0, 0, 'Y',
132 GDK_KEY_Y, GDK_KEY_apostrophe, 0, 0, 0, 0xdd,
133 GDK_KEY_Y, GDK_KEY_period, 0, 0, 0, 0x1ef4,
134 GDK_KEY_Y, GDK_KEY_question, 0, 0, 0, 0x1ef6,
135 GDK_KEY_Y, GDK_KEY_grave, 0, 0, 0, 0x1ef2,
136 GDK_KEY_Y, GDK_KEY_asciitilde, 0, 0, 0, 0x1ef8,
137 /* Do we need anything else here? */
138 GDK_KEY_backslash, 0, 0, 0, 0, 0,
139 GDK_KEY_backslash, GDK_KEY_apostrophe, 0, 0, 0, '\'',
140 GDK_KEY_backslash, GDK_KEY_parenleft, 0, 0, 0, '(',
141 GDK_KEY_backslash, GDK_KEY_plus, 0, 0, 0, '+',
142 GDK_KEY_backslash, GDK_KEY_period, 0, 0, 0, '.',
143 GDK_KEY_backslash, GDK_KEY_question, 0, 0, 0, '?',
144 GDK_KEY_backslash, GDK_KEY_D, 0, 0, 0, 'D',
145 GDK_KEY_backslash, GDK_KEY_backslash, 0, 0, 0, '\\',
146 GDK_KEY_backslash, GDK_KEY_asciicircum, 0, 0, 0, '^',
147 GDK_KEY_backslash, GDK_KEY_grave, 0, 0, 0, '`',
148 GDK_KEY_backslash, GDK_KEY_d, 0, 0, 0, 'd',
149 GDK_KEY_backslash, GDK_KEY_asciitilde, 0, 0, 0, '~',
150 GDK_KEY_a, 0, 0, 0, 0, 'a',
151 GDK_KEY_a, GDK_KEY_apostrophe, 0, 0, 0, 0xe1,
152 GDK_KEY_a, GDK_KEY_parenleft, 0, 0, 0, 0x103,
153 GDK_KEY_a, GDK_KEY_parenleft, GDK_KEY_apostrophe, 0, 0, 0x1eaf,
154 GDK_KEY_a, GDK_KEY_parenleft, GDK_KEY_period, 0, 0, 0x1eb7,
155 GDK_KEY_a, GDK_KEY_parenleft, GDK_KEY_question, 0, 0, 0x1eb3,
156 GDK_KEY_a, GDK_KEY_parenleft, GDK_KEY_grave, 0, 0, 0x1eb1,
157 GDK_KEY_a, GDK_KEY_parenleft, GDK_KEY_asciitilde, 0, 0, 0x1eb5,
158 GDK_KEY_a, GDK_KEY_period, 0, 0, 0, 0x1ea1,
159 GDK_KEY_a, GDK_KEY_question, 0, 0, 0, 0x1ea3,
160 GDK_KEY_a, GDK_KEY_asciicircum, 0, 0, 0, 0xe2,
161 GDK_KEY_a, GDK_KEY_asciicircum, GDK_KEY_apostrophe, 0, 0, 0x1ea5,
162 GDK_KEY_a, GDK_KEY_asciicircum, GDK_KEY_period, 0, 0, 0x1ead,
163 GDK_KEY_a, GDK_KEY_asciicircum, GDK_KEY_question, 0, 0, 0x1ea9,
164 GDK_KEY_a, GDK_KEY_asciicircum, GDK_KEY_grave, 0, 0, 0x1ea7,
165 GDK_KEY_a, GDK_KEY_asciicircum, GDK_KEY_asciitilde, 0, 0, 0x1eab,
166 GDK_KEY_a, GDK_KEY_grave, 0, 0, 0, 0xe0,
167 GDK_KEY_a, GDK_KEY_asciitilde, 0, 0, 0, 0xe3,
168 GDK_KEY_d, 0, 0, 0, 0, 'd',
169 GDK_KEY_d, GDK_KEY_d, 0, 0, 0, 0x111,
170 GDK_KEY_e, 0, 0, 0, 0, 'e',
171 GDK_KEY_e, GDK_KEY_apostrophe, 0, 0, 0, 0xe9,
172 GDK_KEY_e, GDK_KEY_period, 0, 0, 0, 0x1eb9,
173 GDK_KEY_e, GDK_KEY_question, 0, 0, 0, 0x1ebb,
174 GDK_KEY_e, GDK_KEY_asciicircum, 0, 0, 0, 0xea,
175 GDK_KEY_e, GDK_KEY_asciicircum, GDK_KEY_apostrophe, 0, 0, 0x1ebf,
176 GDK_KEY_e, GDK_KEY_asciicircum, GDK_KEY_period, 0, 0, 0x1ec7,
177 GDK_KEY_e, GDK_KEY_asciicircum, GDK_KEY_question, 0, 0, 0x1ec3,
178 GDK_KEY_e, GDK_KEY_asciicircum, GDK_KEY_grave, 0, 0, 0x1ec1,
179 GDK_KEY_e, GDK_KEY_asciicircum, GDK_KEY_asciitilde, 0, 0, 0x1ec5,
180 GDK_KEY_e, GDK_KEY_grave, 0, 0, 0, 0xe8,
181 GDK_KEY_e, GDK_KEY_asciitilde, 0, 0, 0, 0x1ebd,
182 GDK_KEY_i, 0, 0, 0, 0, 'i',
183 GDK_KEY_i, GDK_KEY_apostrophe, 0, 0, 0, 0xed,
184 GDK_KEY_i, GDK_KEY_period, 0, 0, 0, 0x1ecb,
185 GDK_KEY_i, GDK_KEY_question, 0, 0, 0, 0x1ec9,
186 GDK_KEY_i, GDK_KEY_grave, 0, 0, 0, 0xec,
187 GDK_KEY_i, GDK_KEY_asciitilde, 0, 0, 0, 0x129,
188 GDK_KEY_o, 0, 0, 0, 0, 'o',
189 GDK_KEY_o, GDK_KEY_apostrophe, 0, 0, 0, 0xF3,
190 GDK_KEY_o, GDK_KEY_plus, 0, 0, 0, 0x1a1,
191 GDK_KEY_o, GDK_KEY_plus, GDK_KEY_apostrophe, 0, 0, 0x1edb,
192 GDK_KEY_o, GDK_KEY_plus, GDK_KEY_period, 0, 0, 0x1ee3,
193 GDK_KEY_o, GDK_KEY_plus, GDK_KEY_question, 0, 0, 0x1edf,
194 GDK_KEY_o, GDK_KEY_plus, GDK_KEY_grave, 0, 0, 0x1edd,
195 GDK_KEY_o, GDK_KEY_plus, GDK_KEY_asciitilde, 0, 0, 0x1ee1,
196 GDK_KEY_o, GDK_KEY_period, 0, 0, 0, 0x1ecd,
197 GDK_KEY_o, GDK_KEY_question, 0, 0, 0, 0x1ecf,
198 GDK_KEY_o, GDK_KEY_asciicircum, 0, 0, 0, 0xf4,
199 GDK_KEY_o, GDK_KEY_asciicircum, GDK_KEY_apostrophe, 0, 0, 0x1ed1,
200 GDK_KEY_o, GDK_KEY_asciicircum, GDK_KEY_period, 0, 0, 0x1ed9,
201 GDK_KEY_o, GDK_KEY_asciicircum, GDK_KEY_question, 0, 0, 0x1ed5,
202 GDK_KEY_o, GDK_KEY_asciicircum, GDK_KEY_grave, 0, 0, 0x1ed3,
203 GDK_KEY_o, GDK_KEY_asciicircum, GDK_KEY_asciitilde, 0, 0, 0x1ed7,
204 GDK_KEY_o, GDK_KEY_grave, 0, 0, 0, 0xF2,
205 GDK_KEY_o, GDK_KEY_asciitilde, 0, 0, 0, 0xF5,
206 GDK_KEY_u, 0, 0, 0, 0, 'u',
207 GDK_KEY_u, GDK_KEY_apostrophe, 0, 0, 0, 0xFA,
208 GDK_KEY_u, GDK_KEY_plus, 0, 0, 0, 0x1b0,
209 GDK_KEY_u, GDK_KEY_plus, GDK_KEY_apostrophe, 0, 0, 0x1ee9,
210 GDK_KEY_u, GDK_KEY_plus, GDK_KEY_period, 0, 0, 0x1ef1,
211 GDK_KEY_u, GDK_KEY_plus, GDK_KEY_question, 0, 0, 0x1eed,
212 GDK_KEY_u, GDK_KEY_plus, GDK_KEY_grave, 0, 0, 0x1eeb,
213 GDK_KEY_u, GDK_KEY_plus, GDK_KEY_asciitilde, 0, 0, 0x1eef,
214 GDK_KEY_u, GDK_KEY_period, 0, 0, 0, 0x1ee5,
215 GDK_KEY_u, GDK_KEY_question, 0, 0, 0, 0x1ee7,
216 GDK_KEY_u, GDK_KEY_grave, 0, 0, 0, 0xf9,
217 GDK_KEY_u, GDK_KEY_asciitilde, 0, 0, 0, 0x169,
218 GDK_KEY_y, 0, 0, 0, 0, 'y',
219 GDK_KEY_y, GDK_KEY_apostrophe, 0, 0, 0, 0xfd,
220 GDK_KEY_y, GDK_KEY_period, 0, 0, 0, 0x1ef5,
221 GDK_KEY_y, GDK_KEY_question, 0, 0, 0, 0x1ef7,
222 GDK_KEY_y, GDK_KEY_grave, 0, 0, 0, 0x1ef3,
223 GDK_KEY_y, GDK_KEY_asciitilde, 0, 0, 0, 0x1ef9,
227 viqr_class_init (GtkIMContextSimpleClass *class)
232 viqr_init (GtkIMContextSimple *im_context)
234 gtk_im_context_simple_add_table (im_context,
237 G_N_ELEMENTS (viqr_compose_seqs) / (4 + 2));
240 static const GtkIMContextInfo viqr_info = {
242 N_("Vietnamese (VIQR)"), /* Human readable name */
243 GETTEXT_PACKAGE, /* Translation domain */
244 GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
245 "vi" /* Languages for which this module is the default */
248 static const GtkIMContextInfo *info_list[] = {
252 #ifndef INCLUDE_IM_viqr
253 #define MODULE_ENTRY(type, function) G_MODULE_EXPORT type im_module_ ## function
255 #define MODULE_ENTRY(type, function) type _gtk_immodule_viqr_ ## function
258 MODULE_ENTRY (void, init) (GTypeModule *module)
260 viqr_register_type (module);
263 MODULE_ENTRY (void, exit) (void)
267 MODULE_ENTRY (void, list) (const GtkIMContextInfo ***contexts,
270 *contexts = info_list;
271 *n_contexts = G_N_ELEMENTS (info_list);
274 MODULE_ENTRY (GtkIMContext *, create) (const gchar *context_id)
276 if (strcmp (context_id, "viqr") == 0)
277 return g_object_new (type_viqr_translit, NULL);