2008-07-01 22:57:50 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
2003-08-15 21:30:44 +00:00
|
|
|
* Copyright (C) 2000 Red Hat Software
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2003-08-15 21:30:44 +00:00
|
|
|
*
|
|
|
|
* Author: Owen Taylor <otaylor@redhat.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2003-08-15 21:30:44 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2008-05-27 23:55:28 +00:00
|
|
|
#include "gtk/gtk.h"
|
|
|
|
#include "gdk/gdkkeysyms.h"
|
2003-08-15 21:30:44 +00:00
|
|
|
|
|
|
|
#include "gtk/gtkimmodule.h"
|
2008-05-27 23:55:28 +00:00
|
|
|
#include "gtk/gtkintl.h"
|
|
|
|
|
2003-08-15 21:30:44 +00:00
|
|
|
|
|
|
|
GType type_cedilla = 0;
|
|
|
|
|
|
|
|
static void cedilla_class_init (GtkIMContextSimpleClass *class);
|
|
|
|
static void cedilla_init (GtkIMContextSimple *im_context);
|
|
|
|
|
|
|
|
static void
|
|
|
|
cedilla_register_type (GTypeModule *module)
|
|
|
|
{
|
2009-11-06 00:21:09 +00:00
|
|
|
const GTypeInfo object_info =
|
2003-08-15 21:30:44 +00:00
|
|
|
{
|
|
|
|
sizeof (GtkIMContextSimpleClass),
|
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) cedilla_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GtkIMContextSimple),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) cedilla_init,
|
|
|
|
};
|
|
|
|
|
|
|
|
type_cedilla =
|
|
|
|
g_type_module_register_type (module,
|
|
|
|
GTK_TYPE_IM_CONTEXT_SIMPLE,
|
|
|
|
"GtkIMContextCedillaTranslit",
|
|
|
|
&object_info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The difference between this and the default input method is the handling
|
|
|
|
* of C+acute - this method produces C WITH CEDILLA rather than C WITH ACUTE.
|
|
|
|
* For languages that use CCedilla and not acute, this is the preferred mapping,
|
|
|
|
* and is particularly important for pt_BR, where the us-intl keyboard is
|
|
|
|
* used extensively.
|
|
|
|
*/
|
|
|
|
static guint16 cedilla_compose_seqs[] = {
|
2010-09-08 17:35:51 +00:00
|
|
|
GDK_KEY_dead_acute, GDK_KEY_C, 0, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
|
|
|
|
GDK_KEY_dead_acute, GDK_KEY_c, 0, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
|
|
|
|
GDK_KEY_Multi_key, GDK_KEY_apostrophe, GDK_KEY_C, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
|
|
|
|
GDK_KEY_Multi_key, GDK_KEY_apostrophe, GDK_KEY_c, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
|
|
|
|
GDK_KEY_Multi_key, GDK_KEY_C, GDK_KEY_apostrophe, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
|
|
|
|
GDK_KEY_Multi_key, GDK_KEY_c, GDK_KEY_apostrophe, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
|
2003-08-15 21:30:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
cedilla_class_init (GtkIMContextSimpleClass *class)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
cedilla_init (GtkIMContextSimple *im_context)
|
|
|
|
{
|
|
|
|
gtk_im_context_simple_add_table (im_context,
|
|
|
|
cedilla_compose_seqs,
|
|
|
|
4,
|
|
|
|
G_N_ELEMENTS (cedilla_compose_seqs) / (4 + 2));
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GtkIMContextInfo cedilla_info = {
|
|
|
|
"cedilla", /* ID */
|
2015-02-24 03:00:55 +00:00
|
|
|
NC_("input method menu", "Cedilla"), /* Human readable name */
|
2006-12-23 21:25:16 +00:00
|
|
|
GETTEXT_PACKAGE, /* Translation domain */
|
|
|
|
GTK_LOCALEDIR, /* Dir for bindtextdomain */
|
2003-08-16 14:44:00 +00:00
|
|
|
"az:ca:co:fr:gv:oc:pt:sq:tr:wa" /* Languages for which this module is the default */
|
2003-08-15 21:30:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const GtkIMContextInfo *info_list[] = {
|
|
|
|
¸la_info
|
|
|
|
};
|
|
|
|
|
2008-03-17 23:53:18 +00:00
|
|
|
#ifndef INCLUDE_IM_cedilla
|
2008-03-18 21:29:00 +00:00
|
|
|
#define MODULE_ENTRY(type, function) G_MODULE_EXPORT type im_module_ ## function
|
2008-03-17 23:53:18 +00:00
|
|
|
#else
|
2008-03-18 21:29:00 +00:00
|
|
|
#define MODULE_ENTRY(type, function) type _gtk_immodule_cedilla_ ## function
|
2008-03-17 23:53:18 +00:00
|
|
|
#endif
|
|
|
|
|
2008-03-18 21:29:00 +00:00
|
|
|
MODULE_ENTRY (void, init) (GTypeModule *module)
|
2003-08-15 21:30:44 +00:00
|
|
|
{
|
|
|
|
cedilla_register_type (module);
|
|
|
|
}
|
|
|
|
|
2008-03-18 21:29:00 +00:00
|
|
|
MODULE_ENTRY (void, exit) (void)
|
2003-08-15 21:30:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-03-18 21:29:00 +00:00
|
|
|
MODULE_ENTRY (void, list) (const GtkIMContextInfo ***contexts,
|
|
|
|
int *n_contexts)
|
2003-08-15 21:30:44 +00:00
|
|
|
{
|
|
|
|
*contexts = info_list;
|
|
|
|
*n_contexts = G_N_ELEMENTS (info_list);
|
|
|
|
}
|
|
|
|
|
2008-03-18 21:29:00 +00:00
|
|
|
MODULE_ENTRY (GtkIMContext *, create) (const gchar *context_id)
|
2003-08-15 21:30:44 +00:00
|
|
|
{
|
|
|
|
if (strcmp (context_id, "cedilla") == 0)
|
2004-11-19 23:30:47 +00:00
|
|
|
return g_object_new (type_cedilla, NULL);
|
2003-08-15 21:30:44 +00:00
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|