1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2000 Red Hat Software
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
19 * Author: Owen Taylor <otaylor@redhat.com>
25 #include <gdk/gdkkeysyms.h>
27 #include "gtk/gtkintl.h"
28 #include "gtk/gtkimcontextsimple.h"
29 #include "gtk/gtkimmodule.h"
31 GType type_cedilla = 0;
33 static void cedilla_class_init (GtkIMContextSimpleClass *class);
34 static void cedilla_init (GtkIMContextSimple *im_context);
37 cedilla_register_type (GTypeModule *module)
39 static const GTypeInfo object_info =
41 sizeof (GtkIMContextSimpleClass),
43 (GBaseFinalizeFunc) NULL,
44 (GClassInitFunc) cedilla_class_init,
45 NULL, /* class_finalize */
46 NULL, /* class_data */
47 sizeof (GtkIMContextSimple),
49 (GInstanceInitFunc) cedilla_init,
53 g_type_module_register_type (module,
54 GTK_TYPE_IM_CONTEXT_SIMPLE,
55 "GtkIMContextCedillaTranslit",
59 /* The difference between this and the default input method is the handling
60 * of C+acute - this method produces C WITH CEDILLA rather than C WITH ACUTE.
61 * For languages that use CCedilla and not acute, this is the preferred mapping,
62 * and is particularly important for pt_BR, where the us-intl keyboard is
65 static guint16 cedilla_compose_seqs[] = {
66 GDK_dead_acute, GDK_C, 0, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
67 GDK_dead_acute, GDK_c, 0, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
68 GDK_Multi_key, GDK_apostrophe, GDK_C, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
69 GDK_Multi_key, GDK_apostrophe, GDK_c, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
70 GDK_Multi_key, GDK_C, GDK_apostrophe, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
71 GDK_Multi_key, GDK_c, GDK_apostrophe, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
75 cedilla_class_init (GtkIMContextSimpleClass *class)
80 cedilla_init (GtkIMContextSimple *im_context)
82 gtk_im_context_simple_add_table (im_context,
85 G_N_ELEMENTS (cedilla_compose_seqs) / (4 + 2));
88 static const GtkIMContextInfo cedilla_info = {
90 N_("Cedilla"), /* Human readable name */
91 "gtk+", /* Translation domain */
92 GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
93 "fr:pt" /* Languages for which this module is the default */
96 static const GtkIMContextInfo *info_list[] = {
101 im_module_init (GTypeModule *module)
103 cedilla_register_type (module);
107 im_module_exit (void)
112 im_module_list (const GtkIMContextInfo ***contexts,
115 *contexts = info_list;
116 *n_contexts = G_N_ELEMENTS (info_list);
120 im_module_create (const gchar *context_id)
122 if (strcmp (context_id, "cedilla") == 0)
123 return GTK_IM_CONTEXT (g_object_new (type_cedilla, NULL));