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 Inuktitut - Robert Brady <robert@suse.co.uk>
30 #include "gdk/gdkkeysyms.h"
32 #include "gtk/gtkimmodule.h"
33 #include "gtk/gtkintl.h"
35 GType type_inuktitut_translit = 0;
37 static void inuktitut_class_init (GtkIMContextSimpleClass *class);
38 static void inuktitut_init (GtkIMContextSimple *im_context);
41 inuktitut_register_type (GTypeModule *module)
43 const GTypeInfo object_info =
45 sizeof (GtkIMContextSimpleClass),
47 (GBaseFinalizeFunc) NULL,
48 (GClassInitFunc) inuktitut_class_init,
49 NULL, /* class_finalize */
50 NULL, /* class_data */
51 sizeof (GtkIMContextSimple),
53 (GInstanceInitFunc) inuktitut_init,
56 type_inuktitut_translit =
57 g_type_module_register_type (module,
58 GTK_TYPE_IM_CONTEXT_SIMPLE,
59 "GtkIMContextInuktitut",
63 #define SYL(a,b,c,d) \
65 a, 'a', 0, 0, 0, b+7-d, \
66 a, 'a','a',0, 0, b+8-d, \
68 a, 'i','i',0, 0, b+1, \
69 a, 'o', 0, 0, 0, b+2, \
70 a, 'o','o',0, 0, b+3, \
71 a, 'u', 0, 0, 0, b+2, \
74 static guint16 inuktitut_compose_seqs[] = {
75 'a', 0, 0, 0 , 0, 0x140a,
76 'a', 'a', 0, 0, 0, 0x140b,
78 SYL('c', 0x148b, 0x14a1, 2) /* As g */
79 SYL('f', 0x1555, 0x155d, 2)
80 SYL('g', 0x148b, 0x14a1, 2)
81 SYL('h', 0x14ef, 0x1505, 2)
83 'i', 0, 0, 0 , 0, 0x1403,
84 'i', 'i', 0, 0, 0, 0x1404,
86 SYL('j', 0x1528, 0x153e, 2)
87 SYL('k', 0x146d, 0x1483, 2)
88 SYL('l', 0x14d5, 0x14ea, 2)
89 SYL('m', 0x14a5, 0x14bb, 2)
90 SYL('n', 0x14c2, 0x14d0, 2)
92 'o', 0, 0, 0 , 0, 0x1405, /* as u */
93 'o', 'o', 0, 0, 0, 0x1406,
95 SYL('p', 0x1431, 0x1449, 0)
96 SYL('q', 0x157f, 0x1585, 3)
97 SYL('r', 0x1546, 0x1550, 2)
98 SYL('s', 0x14ef, 0x1505, 2) /* As h */
99 SYL('t', 0x144e, 0x1466, 0)
101 'u', 0, 0, 0 , 0, 0x1405,
102 'u', 'u', 0, 0, 0, 0x1406,
104 SYL('v', 0x1555, 0x155d, 2) /* as f */
105 SYL('y', 0x1528, 0x153e, 2) /* As j */
107 SYL(GDK_KEY_lstroke, 0x15a0, 0x15a6, 3) /* l- */
108 SYL(GDK_KEY_eng, 0x158f, 0x1595, 3) /* ng */
112 inuktitut_class_init (GtkIMContextSimpleClass *class)
117 inuktitut_init (GtkIMContextSimple *im_context)
119 gtk_im_context_simple_add_table (im_context,
120 inuktitut_compose_seqs,
122 G_N_ELEMENTS (inuktitut_compose_seqs) / (4 + 2));
125 static const GtkIMContextInfo inuktitut_info = {
126 "inuktitut", /* ID */
127 N_("Inuktitut (Transliterated)"), /* Human readable name */
128 GETTEXT_PACKAGE, /* Translation domain */
129 GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
130 "iu" /* Languages for which this module is the default */
133 static const GtkIMContextInfo *info_list[] = {
137 #ifndef INCLUDE_IM_inuktitut
138 #define MODULE_ENTRY(type, function) G_MODULE_EXPORT type im_module_ ## function
140 #define MODULE_ENTRY(type, function) type _gtk_immodule_inuktitut_ ## function
143 MODULE_ENTRY (void, init) (GTypeModule *module)
145 inuktitut_register_type (module);
148 MODULE_ENTRY (void, exit) (void)
152 MODULE_ENTRY (void, list) (const GtkIMContextInfo ***contexts,
155 *contexts = info_list;
156 *n_contexts = G_N_ELEMENTS (info_list);
159 MODULE_ENTRY (GtkIMContext *, create) (const gchar *context_id)
161 if (strcmp (context_id, "inuktitut") == 0)
162 return g_object_new (type_inuktitut_translit, NULL);