]> Pileus Git - ~andy/gtk/blob - modules/input/imthai-broken.c
Fixes #136082 and #135265, patch by Morten Welinder.
[~andy/gtk] / modules / input / imthai-broken.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2000 Red Hat Software
3  * Copyright (C) 2000 SuSE Linux Ltd
4  *
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.
9  *
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.
14  *
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.
19  *
20  * Original author: Owen Taylor <otaylor@redhat.com>
21  * 
22  * Modified for Thai (Broken) - Robert Brady <robert@suse.co.uk>
23  *
24  */
25
26 #include <config.h>
27 #include <string.h>
28
29 #include <gdk/gdkkeysyms.h>
30
31 #include "gtk/gtkintl.h"
32 #include "gtk/gtkimcontextsimple.h"
33 #include "gtk/gtkimmodule.h"
34
35 GType type_thai_broken = 0;
36
37 static void thai_broken_class_init (GtkIMContextSimpleClass *class);
38 static void thai_broken_init (GtkIMContextSimple *im_context);
39
40 static void
41 thai_broken_register_type (GTypeModule *module)
42 {
43   static const GTypeInfo object_info =
44   {
45     sizeof (GtkIMContextSimpleClass),
46     (GBaseInitFunc) NULL,
47     (GBaseFinalizeFunc) NULL,
48     (GClassInitFunc) thai_broken_class_init,
49     NULL,           /* class_finalize */
50     NULL,           /* class_data */
51     sizeof (GtkIMContextSimple),
52     0,
53     (GInstanceInitFunc) thai_broken_init,
54   };
55
56   type_thai_broken = 
57     g_type_module_register_type (module,
58                                  GTK_TYPE_IM_CONTEXT_SIMPLE,
59                                  "GtkIMContextThaiBroken",
60                                  &object_info, 0);
61 }
62
63 static guint16 thai_broken_compose_seqs[] = {
64   0xa0, 0, 0, 0, 0, 0x0e00,
65   0xa1, 0, 0, 0, 0, 0x0e01,
66   0xa2, 0, 0, 0, 0, 0x0e02,
67   0xa3, 0, 0, 0, 0, 0x0e03,
68   0xa4, 0, 0, 0, 0, 0x0e04,
69   0xa5, 0, 0, 0, 0, 0x0e05,
70   0xa6, 0, 0, 0, 0, 0x0e06,
71   0xa7, 0, 0, 0, 0, 0x0e07,
72   0xa8, 0, 0, 0, 0, 0x0e08,
73   0xa9, 0, 0, 0, 0, 0x0e09,
74   0xaa, 0, 0, 0, 0, 0x0e0a,
75   0xab, 0, 0, 0, 0, 0x0e0b,
76   0xac, 0, 0, 0, 0, 0x0e0c,
77   0xad, 0, 0, 0, 0, 0x0e0d,
78   0xae, 0, 0, 0, 0, 0x0e0e,
79   0xaf, 0, 0, 0, 0, 0x0e0f,
80   0xb0, 0, 0, 0, 0, 0x0e10,
81   0xb1, 0, 0, 0, 0, 0x0e11,
82   0xb2, 0, 0, 0, 0, 0x0e12,
83   0xb3, 0, 0, 0, 0, 0x0e13,
84   0xb4, 0, 0, 0, 0, 0x0e14,
85   0xb5, 0, 0, 0, 0, 0x0e15,
86   0xb6, 0, 0, 0, 0, 0x0e16,
87   0xb7, 0, 0, 0, 0, 0x0e17,
88   0xb8, 0, 0, 0, 0, 0x0e18,
89   0xb9, 0, 0, 0, 0, 0x0e19,
90   0xba, 0, 0, 0, 0, 0x0e1a,
91   0xbb, 0, 0, 0, 0, 0x0e1b,
92   0xbc, 0, 0, 0, 0, 0x0e1c,
93   0xbd, 0, 0, 0, 0, 0x0e1d,
94   0xbe, 0, 0, 0, 0, 0x0e1e,
95   0xbf, 0, 0, 0, 0, 0x0e1f,
96   0xc0, 0, 0, 0, 0, 0x0e20,
97   0xc1, 0, 0, 0, 0, 0x0e21,
98   0xc2, 0, 0, 0, 0, 0x0e22,
99   0xc3, 0, 0, 0, 0, 0x0e23,
100   0xc4, 0, 0, 0, 0, 0x0e24,
101   0xc5, 0, 0, 0, 0, 0x0e25,
102   0xc6, 0, 0, 0, 0, 0x0e26,
103   0xc7, 0, 0, 0, 0, 0x0e27,
104   0xc8, 0, 0, 0, 0, 0x0e28,
105   0xc9, 0, 0, 0, 0, 0x0e29,
106   0xca, 0, 0, 0, 0, 0x0e2a,
107   0xcb, 0, 0, 0, 0, 0x0e2b,
108   0xcc, 0, 0, 0, 0, 0x0e2c,
109   0xcd, 0, 0, 0, 0, 0x0e2d,
110   0xce, 0, 0, 0, 0, 0x0e2e,
111   0xcf, 0, 0, 0, 0, 0x0e2f,
112   0xd0, 0, 0, 0, 0, 0x0e30,
113   0xd1, 0, 0, 0, 0, 0x0e31,
114   0xd2, 0, 0, 0, 0, 0x0e32,
115   0xd3, 0, 0, 0, 0, 0x0e33,
116   0xd4, 0, 0, 0, 0, 0x0e34,
117   0xd5, 0, 0, 0, 0, 0x0e35,
118   0xd6, 0, 0, 0, 0, 0x0e36,
119   0xd7, 0, 0, 0, 0, 0x0e37,
120   0xd8, 0, 0, 0, 0, 0x0e38,
121   0xd9, 0, 0, 0, 0, 0x0e39,
122   0xda, 0, 0, 0, 0, 0x0e3a,
123   0xdb, 0, 0, 0, 0, 0x0e3b,
124   0xdc, 0, 0, 0, 0, 0x0e3c,
125   0xdd, 0, 0, 0, 0, 0x0e3d,
126   0xde, 0, 0, 0, 0, 0x0e3e,
127   0xdf, 0, 0, 0, 0, 0x0e3f,
128   0xe0, 0, 0, 0, 0, 0x0e40,
129   0xe1, 0, 0, 0, 0, 0x0e41,
130   0xe2, 0, 0, 0, 0, 0x0e42,
131   0xe3, 0, 0, 0, 0, 0x0e43,
132   0xe4, 0, 0, 0, 0, 0x0e44,
133   0xe5, 0, 0, 0, 0, 0x0e45,
134   0xe6, 0, 0, 0, 0, 0x0e46,
135   0xe7, 0, 0, 0, 0, 0x0e47,
136   0xe8, 0, 0, 0, 0, 0x0e48,
137   0xe9, 0, 0, 0, 0, 0x0e49,
138   0xea, 0, 0, 0, 0, 0x0e4a,
139   0xeb, 0, 0, 0, 0, 0x0e4b,
140   0xec, 0, 0, 0, 0, 0x0e4c,
141   0xed, 0, 0, 0, 0, 0x0e4d,
142   0xee, 0, 0, 0, 0, 0x0e4e,
143   0xef, 0, 0, 0, 0, 0x0e4f,
144   0xf0, 0, 0, 0, 0, 0x0e50,
145   0xf1, 0, 0, 0, 0, 0x0e51,
146   0xf2, 0, 0, 0, 0, 0x0e52,
147   0xf3, 0, 0, 0, 0, 0x0e53,
148   0xf4, 0, 0, 0, 0, 0x0e54,
149   0xf5, 0, 0, 0, 0, 0x0e55,
150   0xf6, 0, 0, 0, 0, 0x0e56,
151   0xf7, 0, 0, 0, 0, 0x0e57,
152   0xf8, 0, 0, 0, 0, 0x0e58,
153   0xf9, 0, 0, 0, 0, 0x0e59,
154   0xfa, 0, 0, 0, 0, 0x0e5a,
155   0xfb, 0, 0, 0, 0, 0x0e5b,
156   0xfc, 0, 0, 0, 0, 0x0e5c,
157   0xfd, 0, 0, 0, 0, 0x0e5d,
158   0xfe, 0, 0, 0, 0, 0x0e5e,
159   0xff, 0, 0, 0, 0, 0x0e5f,
160 };
161
162 static void
163 thai_broken_class_init (GtkIMContextSimpleClass *class)
164 {
165 }
166
167 static void
168 thai_broken_init (GtkIMContextSimple *im_context)
169 {
170   gtk_im_context_simple_add_table (im_context,
171                                    thai_broken_compose_seqs,
172                                    4,
173                                    G_N_ELEMENTS (thai_broken_compose_seqs) / (4 + 2));
174 }
175
176 static const GtkIMContextInfo thai_broken_info = { 
177   "thai_broken",           /* ID */
178   N_("Thai (Broken)"),     /* Human readable name */
179   GETTEXT_PACKAGE,         /* Translation domain */
180    GTK_LOCALEDIR,          /* Dir for bindtextdomain (not strictly needed for "gtk+") */
181   ""                       /* Languages for which this module is the default */
182 };
183
184 static const GtkIMContextInfo *info_list[] = {
185   &thai_broken_info
186 };
187
188 void
189 im_module_init (GTypeModule *module)
190 {
191   thai_broken_register_type (module);
192 }
193
194 void 
195 im_module_exit (void)
196 {
197 }
198
199 void 
200 im_module_list (const GtkIMContextInfo ***contexts,
201                 int                      *n_contexts)
202 {
203   *contexts = info_list;
204   *n_contexts = G_N_ELEMENTS (info_list);
205 }
206
207 GtkIMContext *
208 im_module_create (const gchar *context_id)
209 {
210   if (strcmp (context_id, "thai_broken") == 0)
211     return GTK_IM_CONTEXT (g_object_new (type_thai_broken, NULL));
212   else
213     return NULL;
214 }