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 Inuktitut - Robert Brady <robert@suse.co.uk>
28 #include "gdk/gdkkeysyms.h"
30 #include "gtk/gtkimmodule.h"
31 #include "gtk/gtkintl.h"
33 GType type_inuktitut_translit = 0;
35 static void inuktitut_class_init (GtkIMContextSimpleClass *class);
36 static void inuktitut_init (GtkIMContextSimple *im_context);
39 inuktitut_register_type (GTypeModule *module)
41 const GTypeInfo object_info =
43 sizeof (GtkIMContextSimpleClass),
45 (GBaseFinalizeFunc) NULL,
46 (GClassInitFunc) inuktitut_class_init,
47 NULL, /* class_finalize */
48 NULL, /* class_data */
49 sizeof (GtkIMContextSimple),
51 (GInstanceInitFunc) inuktitut_init,
54 type_inuktitut_translit =
55 g_type_module_register_type (module,
56 GTK_TYPE_IM_CONTEXT_SIMPLE,
57 "GtkIMContextInuktitut",
61 #define SYL(a,b,c,d) \
63 a, 'a', 0, 0, 0, b+7-d, \
64 a, 'a','a',0, 0, b+8-d, \
66 a, 'i','i',0, 0, b+1, \
67 a, 'o', 0, 0, 0, b+2, \
68 a, 'o','o',0, 0, b+3, \
69 a, 'u', 0, 0, 0, b+2, \
72 static guint16 inuktitut_compose_seqs[] = {
73 'a', 0, 0, 0 , 0, 0x140a,
74 'a', 'a', 0, 0, 0, 0x140b,
76 SYL('c', 0x148b, 0x14a1, 2) /* As g */
77 SYL('f', 0x1555, 0x155d, 2)
78 SYL('g', 0x148b, 0x14a1, 2)
79 SYL('h', 0x14ef, 0x1505, 2)
81 'i', 0, 0, 0 , 0, 0x1403,
82 'i', 'i', 0, 0, 0, 0x1404,
84 SYL('j', 0x1528, 0x153e, 2)
85 SYL('k', 0x146d, 0x1483, 2)
86 SYL('l', 0x14d5, 0x14ea, 2)
87 SYL('m', 0x14a5, 0x14bb, 2)
88 SYL('n', 0x14c2, 0x14d0, 2)
90 'o', 0, 0, 0 , 0, 0x1405, /* as u */
91 'o', 'o', 0, 0, 0, 0x1406,
93 SYL('p', 0x1431, 0x1449, 0)
94 SYL('q', 0x157f, 0x1585, 3)
95 SYL('r', 0x1546, 0x1550, 2)
96 SYL('s', 0x14ef, 0x1505, 2) /* As h */
97 SYL('t', 0x144e, 0x1466, 0)
99 'u', 0, 0, 0 , 0, 0x1405,
100 'u', 'u', 0, 0, 0, 0x1406,
102 SYL('v', 0x1555, 0x155d, 2) /* as f */
103 SYL('y', 0x1528, 0x153e, 2) /* As j */
105 SYL(GDK_KEY_lstroke, 0x15a0, 0x15a6, 3) /* l- */
106 SYL(GDK_KEY_eng, 0x158f, 0x1595, 3) /* ng */
110 inuktitut_class_init (GtkIMContextSimpleClass *class)
115 inuktitut_init (GtkIMContextSimple *im_context)
117 gtk_im_context_simple_add_table (im_context,
118 inuktitut_compose_seqs,
120 G_N_ELEMENTS (inuktitut_compose_seqs) / (4 + 2));
123 static const GtkIMContextInfo inuktitut_info = {
124 "inuktitut", /* ID */
125 N_("Inuktitut (Transliterated)"), /* Human readable name */
126 GETTEXT_PACKAGE, /* Translation domain */
127 GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
128 "iu" /* Languages for which this module is the default */
131 static const GtkIMContextInfo *info_list[] = {
135 #ifndef INCLUDE_IM_inuktitut
136 #define MODULE_ENTRY(type, function) G_MODULE_EXPORT type im_module_ ## function
138 #define MODULE_ENTRY(type, function) type _gtk_immodule_inuktitut_ ## function
141 MODULE_ENTRY (void, init) (GTypeModule *module)
143 inuktitut_register_type (module);
146 MODULE_ENTRY (void, exit) (void)
150 MODULE_ENTRY (void, list) (const GtkIMContextInfo ***contexts,
153 *contexts = info_list;
154 *n_contexts = G_N_ELEMENTS (info_list);
157 MODULE_ENTRY (GtkIMContext *, create) (const gchar *context_id)
159 if (strcmp (context_id, "inuktitut") == 0)
160 return g_object_new (type_inuktitut_translit, NULL);