From d270a00d21ce4a04e6a9d8c0cf0128a1ffe950c6 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Fri, 15 Aug 2003 21:30:44 +0000 Subject: [PATCH] Improve Cedilla handling - based on a patch from Gustavo De Nardin, Fri Aug 15 16:54:39 2003 Owen Taylor Improve Cedilla handling - based on a patch from Gustavo De Nardin, #111334 * modules/input/imcedilla.c po/POTFILES.in: Input method that produces C_WITH_CEDILLA rather than C_WITH_ACUTE for dead_acute+c combinations. Make this the default for fr and pt. * gtk/gtkimmulticontext.c (gtk_im_multicontext_get_slave): Use LC_CTYPE instead of LC_MESSAGES to pick the default input method. Fri Aug 15 17:00:19 2003 Owen Taylor * gtk/gtkimcontextsimple.c: Fix missing compose sequence for Multi_key+c+apostrophe. --- ChangeLog | 19 ++++++ ChangeLog.pre-2-10 | 19 ++++++ ChangeLog.pre-2-4 | 19 ++++++ ChangeLog.pre-2-6 | 19 ++++++ ChangeLog.pre-2-8 | 19 ++++++ gtk/gtkimcontextsimple.c | 1 + gtk/gtkimmulticontext.c | 5 +- modules/input/Makefile.am | 5 ++ modules/input/imcedilla.c | 126 ++++++++++++++++++++++++++++++++++++++ po/POTFILES.in | 1 + 10 files changed, 229 insertions(+), 4 deletions(-) create mode 100644 modules/input/imcedilla.c diff --git a/ChangeLog b/ChangeLog index 929751c50c..1ccedb6a72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Fri Aug 15 16:54:39 2003 Owen Taylor + + Improve Cedilla handling - based on a patch from Gustavo + De Nardin, #111334 + + * modules/input/imcedilla.c po/POTFILES.in: Input method that + produces C_WITH_CEDILLA rather than C_WITH_ACUTE for + dead_acute+c combinations. Make this the default for + fr and pt. + + * gtk/gtkimmulticontext.c (gtk_im_multicontext_get_slave): + Use LC_CTYPE instead of LC_MESSAGES to pick the default + input method. + +Fri Aug 15 17:00:19 2003 Owen Taylor + + * gtk/gtkimcontextsimple.c: Fix missing compose sequence + for Multi_key+c+apostrophe. + Fri Aug 15 21:57:34 2003 Kristian Rietveld Merged from stable. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 929751c50c..1ccedb6a72 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,22 @@ +Fri Aug 15 16:54:39 2003 Owen Taylor + + Improve Cedilla handling - based on a patch from Gustavo + De Nardin, #111334 + + * modules/input/imcedilla.c po/POTFILES.in: Input method that + produces C_WITH_CEDILLA rather than C_WITH_ACUTE for + dead_acute+c combinations. Make this the default for + fr and pt. + + * gtk/gtkimmulticontext.c (gtk_im_multicontext_get_slave): + Use LC_CTYPE instead of LC_MESSAGES to pick the default + input method. + +Fri Aug 15 17:00:19 2003 Owen Taylor + + * gtk/gtkimcontextsimple.c: Fix missing compose sequence + for Multi_key+c+apostrophe. + Fri Aug 15 21:57:34 2003 Kristian Rietveld Merged from stable. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 929751c50c..1ccedb6a72 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,22 @@ +Fri Aug 15 16:54:39 2003 Owen Taylor + + Improve Cedilla handling - based on a patch from Gustavo + De Nardin, #111334 + + * modules/input/imcedilla.c po/POTFILES.in: Input method that + produces C_WITH_CEDILLA rather than C_WITH_ACUTE for + dead_acute+c combinations. Make this the default for + fr and pt. + + * gtk/gtkimmulticontext.c (gtk_im_multicontext_get_slave): + Use LC_CTYPE instead of LC_MESSAGES to pick the default + input method. + +Fri Aug 15 17:00:19 2003 Owen Taylor + + * gtk/gtkimcontextsimple.c: Fix missing compose sequence + for Multi_key+c+apostrophe. + Fri Aug 15 21:57:34 2003 Kristian Rietveld Merged from stable. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 929751c50c..1ccedb6a72 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,22 @@ +Fri Aug 15 16:54:39 2003 Owen Taylor + + Improve Cedilla handling - based on a patch from Gustavo + De Nardin, #111334 + + * modules/input/imcedilla.c po/POTFILES.in: Input method that + produces C_WITH_CEDILLA rather than C_WITH_ACUTE for + dead_acute+c combinations. Make this the default for + fr and pt. + + * gtk/gtkimmulticontext.c (gtk_im_multicontext_get_slave): + Use LC_CTYPE instead of LC_MESSAGES to pick the default + input method. + +Fri Aug 15 17:00:19 2003 Owen Taylor + + * gtk/gtkimcontextsimple.c: Fix missing compose sequence + for Multi_key+c+apostrophe. + Fri Aug 15 21:57:34 2003 Kristian Rietveld Merged from stable. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 929751c50c..1ccedb6a72 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,22 @@ +Fri Aug 15 16:54:39 2003 Owen Taylor + + Improve Cedilla handling - based on a patch from Gustavo + De Nardin, #111334 + + * modules/input/imcedilla.c po/POTFILES.in: Input method that + produces C_WITH_CEDILLA rather than C_WITH_ACUTE for + dead_acute+c combinations. Make this the default for + fr and pt. + + * gtk/gtkimmulticontext.c (gtk_im_multicontext_get_slave): + Use LC_CTYPE instead of LC_MESSAGES to pick the default + input method. + +Fri Aug 15 17:00:19 2003 Owen Taylor + + * gtk/gtkimcontextsimple.c: Fix missing compose sequence + for Multi_key+c+apostrophe. + Fri Aug 15 21:57:34 2003 Kristian Rietveld Merged from stable. diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c index b78fe17fa9..28f5a828cf 100644 --- a/gtk/gtkimcontextsimple.c +++ b/gtk/gtkimcontextsimple.c @@ -708,6 +708,7 @@ static const guint16 gtk_compose_seqs[] = { GDK_Multi_key, GDK_a, GDK_diaeresis, 0, 0, 0x00E4, /* LATIN_SMALL_LETTER_A_WITH_DIAERESIS */ GDK_Multi_key, GDK_a, GDK_acute, 0, 0, 0x00E1, /* LATIN_SMALL_LETTER_A_WITH_ACUTE */ GDK_Multi_key, GDK_b, GDK_period, 0, 0, 0x1E03, /* LATIN_SMALL_LETTER_B_WITH_DOT_ABOVE */ + GDK_Multi_key, GDK_c, GDK_apostrophe, 0, 0, 0x0107, /* LATIN_SMALL_LETTER_C_WITH_ACUTE */ GDK_Multi_key, GDK_c, GDK_comma, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */ GDK_Multi_key, GDK_c, GDK_period, 0, 0, 0x010B, /* LATIN_SMALL_LETTER_C_WITH_DOT_ABOVE */ GDK_Multi_key, GDK_c, GDK_slash, 0, 0, 0x00A2, /* CENT_SIGN */ diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c index 66104e9cc2..cc29f71e0e 100644 --- a/gtk/gtkimmulticontext.c +++ b/gtk/gtkimmulticontext.c @@ -231,11 +231,8 @@ gtk_im_multicontext_get_slave (GtkIMMulticontext *multicontext) { const char *locale; -#ifdef HAVE_LC_MESSAGES - locale = setlocale (LC_MESSAGES, NULL); -#else locale = setlocale (LC_CTYPE, NULL); -#endif + global_context_id = _gtk_im_module_get_default_context_id (locale); } diff --git a/modules/input/Makefile.am b/modules/input/Makefile.am index 3deeeb896b..dc552b5886 100644 --- a/modules/input/Makefile.am +++ b/modules/input/Makefile.am @@ -43,6 +43,10 @@ im_am_et_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined) im_am_et_la_SOURCES = imam-et.c im_am_et_la_LIBADD = $(LDADDS) +im_cedilla_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined) +im_cedilla_la_SOURCES = imcedilla.c +im_cedilla_la_LIBADD = $(LDADDS) + im_cyrillic_translit_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module $(no_undefined) im_cyrillic_translit_la_SOURCES = imcyrillic-translit.c im_cyrillic_translit_la_LIBADD = $(LDADDS) @@ -104,6 +108,7 @@ uninstall-local: module_LTLIBRARIES = \ $(IM_XIM_MODULE) \ im-am-et.la \ + im-cedilla.la \ im-cyrillic-translit.la \ im-hangul.la \ im-inuktitut.la \ diff --git a/modules/input/imcedilla.c b/modules/input/imcedilla.c new file mode 100644 index 0000000000..34c2336ba2 --- /dev/null +++ b/modules/input/imcedilla.c @@ -0,0 +1,126 @@ +/* GTK - The GIMP Toolkit + * 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 + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Owen Taylor + * + */ + +#include + +#include + +#include "gtk/gtkintl.h" +#include "gtk/gtkimcontextsimple.h" +#include "gtk/gtkimmodule.h" + +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) +{ + static const GTypeInfo object_info = + { + 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[] = { + GDK_dead_acute, GDK_C, 0, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */ + GDK_dead_acute, GDK_c, 0, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */ + GDK_Multi_key, GDK_apostrophe, GDK_C, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */ + GDK_Multi_key, GDK_apostrophe, GDK_c, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */ + GDK_Multi_key, GDK_C, GDK_apostrophe, 0, 0, 0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */ + GDK_Multi_key, GDK_c, GDK_apostrophe, 0, 0, 0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */ +}; + +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 */ + N_("Cedilla"), /* Human readable name */ + "gtk+", /* Translation domain */ + GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */ + "fr:pt" /* Languages for which this module is the default */ +}; + +static const GtkIMContextInfo *info_list[] = { + ¸la_info +}; + +void +im_module_init (GTypeModule *module) +{ + cedilla_register_type (module); +} + +void +im_module_exit (void) +{ +} + +void +im_module_list (const GtkIMContextInfo ***contexts, + int *n_contexts) +{ + *contexts = info_list; + *n_contexts = G_N_ELEMENTS (info_list); +} + +GtkIMContext * +im_module_create (const gchar *context_id) +{ + if (strcmp (context_id, "cedilla") == 0) + return GTK_IM_CONTEXT (g_object_new (type_cedilla, NULL)); + else + return NULL; +} diff --git a/po/POTFILES.in b/po/POTFILES.in index 10e0e224b9..aa9dc05716 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -102,6 +102,7 @@ gtk/gtkwidget.c gtk/gtkwindow.c modules/input/gtkimcontextxim.c modules/input/imam-et.c +modules/input/imcedilla.c modules/input/imcyrillic-translit.c modules/input/imhangul.c modules/input/iminuktitut.c