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, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Original author: Owen Taylor <otaylor@redhat.com>
22 * Modified for VIQR - Robert Brady <robert@suse.co.uk>
28 #include <gdk/gdkkeysyms.h>
30 #include "gtk/gtkintl.h"
31 #include "gtk/gtkimcontextsimple.h"
32 #include "gtk/gtkimmodule.h"
34 GType type_viqr_translit = 0;
36 static void viqr_class_init (GtkIMContextSimpleClass *class);
37 static void viqr_init (GtkIMContextSimple *im_context);
40 viqr_register_type (GTypeModule *module)
42 static const GTypeInfo object_info =
44 sizeof (GtkIMContextSimpleClass),
46 (GBaseFinalizeFunc) NULL,
47 (GClassInitFunc) viqr_class_init,
48 NULL, /* class_finalize */
49 NULL, /* class_data */
50 sizeof (GtkIMContextSimple),
52 (GtkObjectInitFunc) viqr_init,
56 g_type_module_register_type (module,
57 GTK_TYPE_IM_CONTEXT_SIMPLE,
62 static guint16 viqr_compose_seqs[] = {
63 GDK_A, 0, 0, 0, 0, 'A',
64 GDK_A, GDK_apostrophe, 0, 0, 0, 0xc1,
65 GDK_A, GDK_parenleft, 0, 0, 0, 0x102,
66 GDK_A, GDK_parenleft, GDK_apostrophe, 0, 0, 0x1eae,
67 GDK_A, GDK_parenleft, GDK_period, 0, 0, 0x1eb6,
68 GDK_A, GDK_parenleft, GDK_question, 0, 0, 0x1eb2,
69 GDK_A, GDK_parenleft, GDK_grave, 0, 0, 0x1eb0,
70 GDK_A, GDK_parenleft, GDK_asciitilde, 0, 0, 0x1eb4,
71 GDK_A, GDK_period, 0, 0, 0, 0x1ea0,
72 GDK_A, GDK_question, 0, 0, 0, 0x1ea2,
73 GDK_A, GDK_asciicircum, 0, 0, 0, 0xc2,
74 GDK_A, GDK_asciicircum, GDK_apostrophe, 0, 0, 0x1ea4,
75 GDK_A, GDK_asciicircum, GDK_period, 0, 0, 0x1eac,
76 GDK_A, GDK_asciicircum, GDK_question, 0, 0, 0x1ea8,
77 GDK_A, GDK_asciicircum, GDK_grave, 0, 0, 0x1ea6,
78 GDK_A, GDK_asciicircum, GDK_asciitilde, 0, 0, 0x1eaa,
79 GDK_A, GDK_grave, 0, 0, 0, 0xc0,
80 GDK_A, GDK_asciitilde, 0, 0, 0, 0xc3,
81 GDK_D, 0, 0, 0, 0, 'D',
82 GDK_D, GDK_D, 0, 0, 0, 0x110,
83 GDK_D, GDK_d, 0, 0, 0, 0x110,
84 GDK_E, 0, 0, 0, 0, 'E',
85 GDK_E, GDK_apostrophe, 0, 0, 0, 0xc9,
86 GDK_E, GDK_period, 0, 0, 0, 0x1eb8,
87 GDK_E, GDK_question, 0, 0, 0, 0x1eba,
88 GDK_E, GDK_asciicircum, 0, 0, 0, 0xca,
89 GDK_E, GDK_asciicircum, GDK_apostrophe, 0, 0, 0x1ebe,
90 GDK_E, GDK_asciicircum, GDK_period, 0, 0, 0x1ec6,
91 GDK_E, GDK_asciicircum, GDK_question, 0, 0, 0x1ec2,
92 GDK_E, GDK_asciicircum, GDK_grave, 0, 0, 0x1ec0,
93 GDK_E, GDK_asciicircum, GDK_asciitilde, 0, 0, 0x1ec4,
94 GDK_E, GDK_grave, 0, 0, 0, 0xc8,
95 GDK_E, GDK_asciitilde, 0, 0, 0, 0x1ebc,
96 GDK_I, 0, 0, 0, 0, 'I',
97 GDK_I, GDK_apostrophe, 0, 0, 0, 0xcd,
98 GDK_I, GDK_period, 0, 0, 0, 0x1eca,
99 GDK_I, GDK_question, 0, 0, 0, 0x1ec8,
100 GDK_I, GDK_grave, 0, 0, 0, 0xcc,
101 GDK_I, GDK_asciitilde, 0, 0, 0, 0x128,
102 GDK_O, 0, 0, 0, 0, 'O',
103 GDK_O, GDK_apostrophe, 0, 0, 0, 0xD3,
104 GDK_O, GDK_plus, 0, 0, 0, 0x1a0,
105 GDK_O, GDK_plus, GDK_apostrophe, 0, 0, 0x1eda,
106 GDK_O, GDK_plus, GDK_period, 0, 0, 0x1ee2,
107 GDK_O, GDK_plus, GDK_question, 0, 0, 0x1ede,
108 GDK_O, GDK_plus, GDK_grave, 0, 0, 0x1edc,
109 GDK_O, GDK_plus, GDK_asciitilde, 0, 0, 0x1ee0,
110 GDK_O, GDK_period, 0, 0, 0, 0x1ecc,
111 GDK_O, GDK_question, 0, 0, 0, 0x1ece,
112 GDK_O, GDK_asciicircum, 0, 0, 0, 0xd4,
113 GDK_O, GDK_asciicircum, GDK_apostrophe, 0, 0, 0x1ed0,
114 GDK_O, GDK_asciicircum, GDK_period, 0, 0, 0x1ed8,
115 GDK_O, GDK_asciicircum, GDK_question, 0, 0, 0x1ed4,
116 GDK_O, GDK_asciicircum, GDK_grave, 0, 0, 0x1ed2,
117 GDK_O, GDK_asciicircum, GDK_asciitilde, 0, 0, 0x1ed6,
118 GDK_O, GDK_grave, 0, 0, 0, 0xD2,
119 GDK_O, GDK_asciitilde, 0, 0, 0, 0xD5,
120 GDK_U, 0, 0, 0, 0, 'U',
121 GDK_U, GDK_apostrophe, 0, 0, 0, 0xDA,
122 GDK_U, GDK_plus, 0, 0, 0, 0x1af,
123 GDK_U, GDK_plus, GDK_apostrophe, 0, 0, 0x1ee8,
124 GDK_U, GDK_plus, GDK_period, 0, 0, 0x1ef0,
125 GDK_U, GDK_plus, GDK_question, 0, 0, 0x1eec,
126 GDK_U, GDK_plus, GDK_grave, 0, 0, 0x1eea,
127 GDK_U, GDK_plus, GDK_asciitilde, 0, 0, 0x1eee,
128 GDK_U, GDK_period, 0, 0, 0, 0x1ee4,
129 GDK_U, GDK_question, 0, 0, 0, 0x1ee6,
130 GDK_U, GDK_grave, 0, 0, 0, 0xd9,
131 GDK_U, GDK_asciitilde, 0, 0, 0, 0x168,
132 GDK_Y, 0, 0, 0, 0, 'Y',
133 GDK_Y, GDK_apostrophe, 0, 0, 0, 0xdd,
134 GDK_Y, GDK_period, 0, 0, 0, 0x1ef4,
135 GDK_Y, GDK_question, 0, 0, 0, 0x1ef6,
136 GDK_Y, GDK_grave, 0, 0, 0, 0x1ef2,
137 GDK_Y, GDK_asciitilde, 0, 0, 0, 0x1ef8,
138 /* Do we need anything else here? */
139 GDK_backslash, 0, 0, 0, 0, 0,
140 GDK_backslash, GDK_apostrophe, 0, 0, 0, '\'',
141 GDK_backslash, GDK_parenleft, 0, 0, 0, '(',
142 GDK_backslash, GDK_plus, 0, 0, 0, '+',
143 GDK_backslash, GDK_period, 0, 0, 0, '.',
144 GDK_backslash, GDK_question, 0, 0, 0, '?',
145 GDK_backslash, GDK_D, 0, 0, 0, 'D',
146 GDK_backslash, GDK_backslash, 0, 0, 0, '\\',
147 GDK_backslash, GDK_asciicircum, 0, 0, 0, '^',
148 GDK_backslash, GDK_grave, 0, 0, 0, '`',
149 GDK_backslash, GDK_d, 0, 0, 0, 'd',
150 GDK_backslash, GDK_asciitilde, 0, 0, 0, '~',
151 GDK_a, 0, 0, 0, 0, 'a',
152 GDK_a, GDK_apostrophe, 0, 0, 0, 0xe1,
153 GDK_a, GDK_parenleft, 0, 0, 0, 0x103,
154 GDK_a, GDK_parenleft, GDK_apostrophe, 0, 0, 0x1eaf,
155 GDK_a, GDK_parenleft, GDK_period, 0, 0, 0x1eb7,
156 GDK_a, GDK_parenleft, GDK_question, 0, 0, 0x1eb3,
157 GDK_a, GDK_parenleft, GDK_grave, 0, 0, 0x1eb1,
158 GDK_a, GDK_parenleft, GDK_asciitilde, 0, 0, 0x1eb5,
159 GDK_a, GDK_period, 0, 0, 0, 0x1ea1,
160 GDK_a, GDK_question, 0, 0, 0, 0x1ea3,
161 GDK_a, GDK_asciicircum, 0, 0, 0, 0xe2,
162 GDK_a, GDK_asciicircum, GDK_apostrophe, 0, 0, 0x1ea5,
163 GDK_a, GDK_asciicircum, GDK_period, 0, 0, 0x1ead,
164 GDK_a, GDK_asciicircum, GDK_question, 0, 0, 0x1ea9,
165 GDK_a, GDK_asciicircum, GDK_grave, 0, 0, 0x1ea7,
166 GDK_a, GDK_asciicircum, GDK_asciitilde, 0, 0, 0x1eab,
167 GDK_a, GDK_grave, 0, 0, 0, 0xe0,
168 GDK_a, GDK_asciitilde, 0, 0, 0, 0xe3,
169 GDK_d, 0, 0, 0, 0, 'd',
170 GDK_d, GDK_d, 0, 0, 0, 0x111,
171 GDK_e, 0, 0, 0, 0, 'e',
172 GDK_e, GDK_apostrophe, 0, 0, 0, 0xe9,
173 GDK_e, GDK_period, 0, 0, 0, 0x1eb9,
174 GDK_e, GDK_question, 0, 0, 0, 0x1ebb,
175 GDK_e, GDK_asciicircum, 0, 0, 0, 0xea,
176 GDK_e, GDK_asciicircum, GDK_apostrophe, 0, 0, 0x1ebf,
177 GDK_e, GDK_asciicircum, GDK_period, 0, 0, 0x1ec7,
178 GDK_e, GDK_asciicircum, GDK_question, 0, 0, 0x1ec3,
179 GDK_e, GDK_asciicircum, GDK_grave, 0, 0, 0x1ec1,
180 GDK_e, GDK_asciicircum, GDK_asciitilde, 0, 0, 0x1ec5,
181 GDK_e, GDK_grave, 0, 0, 0, 0xe8,
182 GDK_e, GDK_asciitilde, 0, 0, 0, 0x1ebd,
183 GDK_i, 0, 0, 0, 0, 'i',
184 GDK_i, GDK_apostrophe, 0, 0, 0, 0xed,
185 GDK_i, GDK_period, 0, 0, 0, 0x1ecb,
186 GDK_i, GDK_question, 0, 0, 0, 0x1ec9,
187 GDK_i, GDK_grave, 0, 0, 0, 0xec,
188 GDK_i, GDK_asciitilde, 0, 0, 0, 0x129,
189 GDK_o, 0, 0, 0, 0, 'o',
190 GDK_o, GDK_apostrophe, 0, 0, 0, 0xF3,
191 GDK_o, GDK_plus, 0, 0, 0, 0x1a1,
192 GDK_o, GDK_plus, GDK_apostrophe, 0, 0, 0x1edb,
193 GDK_o, GDK_plus, GDK_period, 0, 0, 0x1ee3,
194 GDK_o, GDK_plus, GDK_question, 0, 0, 0x1edf,
195 GDK_o, GDK_plus, GDK_grave, 0, 0, 0x1edd,
196 GDK_o, GDK_plus, GDK_asciitilde, 0, 0, 0x1ee1,
197 GDK_o, GDK_period, 0, 0, 0, 0x1ecd,
198 GDK_o, GDK_question, 0, 0, 0, 0x1ecf,
199 GDK_o, GDK_asciicircum, 0, 0, 0, 0xf4,
200 GDK_o, GDK_asciicircum, GDK_apostrophe, 0, 0, 0x1ed1,
201 GDK_o, GDK_asciicircum, GDK_period, 0, 0, 0x1ed9,
202 GDK_o, GDK_asciicircum, GDK_question, 0, 0, 0x1ed5,
203 GDK_o, GDK_asciicircum, GDK_grave, 0, 0, 0x1ed3,
204 GDK_o, GDK_asciicircum, GDK_asciitilde, 0, 0, 0x1ed7,
205 GDK_o, GDK_grave, 0, 0, 0, 0xF2,
206 GDK_o, GDK_asciitilde, 0, 0, 0, 0xF5,
207 GDK_u, 0, 0, 0, 0, 'u',
208 GDK_u, GDK_apostrophe, 0, 0, 0, 0xFA,
209 GDK_u, GDK_plus, 0, 0, 0, 0x1b0,
210 GDK_u, GDK_plus, GDK_apostrophe, 0, 0, 0x1ee9,
211 GDK_u, GDK_plus, GDK_period, 0, 0, 0x1ef1,
212 GDK_u, GDK_plus, GDK_question, 0, 0, 0x1eed,
213 GDK_u, GDK_plus, GDK_grave, 0, 0, 0x1eeb,
214 GDK_u, GDK_plus, GDK_asciitilde, 0, 0, 0x1eef,
215 GDK_u, GDK_period, 0, 0, 0, 0x1ee5,
216 GDK_u, GDK_question, 0, 0, 0, 0x1ee7,
217 GDK_u, GDK_grave, 0, 0, 0, 0xf9,
218 GDK_u, GDK_asciitilde, 0, 0, 0, 0x169,
219 GDK_y, 0, 0, 0, 0, 'y',
220 GDK_y, GDK_apostrophe, 0, 0, 0, 0xfd,
221 GDK_y, GDK_period, 0, 0, 0, 0x1ef5,
222 GDK_y, GDK_question, 0, 0, 0, 0x1ef7,
223 GDK_y, GDK_grave, 0, 0, 0, 0x1ef3,
224 GDK_y, GDK_asciitilde, 0, 0, 0, 0x1ef9,
228 viqr_class_init (GtkIMContextSimpleClass *class)
233 viqr_init (GtkIMContextSimple *im_context)
235 gtk_im_context_simple_add_table (im_context,
238 G_N_ELEMENTS (viqr_compose_seqs) / (4 + 2));
241 static const GtkIMContextInfo viqr_info = {
243 N_("Vietnamese (VIQR)"), /* Human readable name */
244 "gtk+", /* Translation domain */
245 GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
246 "vi" /* Languages for which this module is the default */
249 static const GtkIMContextInfo *info_list[] = {
254 im_module_init (GTypeModule *module)
256 viqr_register_type (module);
260 im_module_exit (void)
265 im_module_list (const GtkIMContextInfo ***contexts,
268 *contexts = info_list;
269 *n_contexts = G_N_ELEMENTS (info_list);
273 im_module_create (const gchar *context_id)
275 if (strcmp (context_id, "viqr") == 0)
276 return GTK_IM_CONTEXT (g_object_new (type_viqr_translit, NULL));