2008-07-01 22:57:50 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
2001-03-03 19:57:54 +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/>.
|
2001-03-03 19:57:54 +00:00
|
|
|
*
|
|
|
|
* Author: Owen Taylor <otaylor@redhat.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2001-03-03 19:57:54 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2008-05-27 23:55:28 +00:00
|
|
|
#include "gtk/gtk.h"
|
|
|
|
#include "gdk/gdkkeysyms.h"
|
2001-03-03 19:57:54 +00:00
|
|
|
|
|
|
|
#include "gtk/gtkimmodule.h"
|
2008-05-27 23:55:28 +00:00
|
|
|
#include "gtk/gtkintl.h"
|
2001-03-03 19:57:54 +00:00
|
|
|
|
|
|
|
GType type_ipa = 0;
|
|
|
|
|
|
|
|
static void ipa_class_init (GtkIMContextSimpleClass *class);
|
|
|
|
static void ipa_init (GtkIMContextSimple *im_context);
|
|
|
|
|
|
|
|
static void
|
|
|
|
ipa_register_type (GTypeModule *module)
|
|
|
|
{
|
2009-11-06 00:21:09 +00:00
|
|
|
const GTypeInfo object_info =
|
2001-03-03 19:57:54 +00:00
|
|
|
{
|
|
|
|
sizeof (GtkIMContextSimpleClass),
|
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) ipa_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GtkIMContextSimple),
|
|
|
|
0,
|
2002-10-13 20:44:18 +00:00
|
|
|
(GInstanceInitFunc) ipa_init,
|
2001-03-03 19:57:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
type_ipa =
|
|
|
|
g_type_module_register_type (module,
|
|
|
|
GTK_TYPE_IM_CONTEXT_SIMPLE,
|
|
|
|
"GtkIMContextIpa",
|
|
|
|
&object_info, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The sequences here match the sequences used in the emacs quail
|
|
|
|
* mode cryllic-translit; they allow entering all characters
|
|
|
|
* in iso-8859-5
|
|
|
|
*/
|
|
|
|
static guint16 ipa_compose_seqs[] = {
|
2010-09-08 17:35:51 +00:00
|
|
|
GDK_KEY_ampersand, 0, 0, 0, 0, 0x263, /* LATIN SMALL LETTER GAMMA */
|
|
|
|
GDK_KEY_apostrophe, 0, 0, 0, 0, 0x2C8, /* MODIFIER LETTER VERTICAL LINE */
|
|
|
|
GDK_KEY_slash, GDK_KEY_apostrophe, 0, 0, 0, 0x2CA, /* MODIFIER LETTER ACUTE ACCENT */
|
|
|
|
GDK_KEY_slash, GDK_KEY_slash, 0, 0, 0, 0x02F, /* SOLIDUS */
|
|
|
|
GDK_KEY_slash, GDK_KEY_3, 0, 0, 0, 0x25B, /* LATIN SMALL LETTER OPEN E */
|
|
|
|
GDK_KEY_slash, GDK_KEY_A, 0, 0, 0, 0x252, /* LATIN LETTER TURNED ALPHA */
|
|
|
|
GDK_KEY_slash, GDK_KEY_R, 0, 0, 0, 0x281, /* LATIN LETTER SMALL CAPITAL INVERTED R */
|
|
|
|
GDK_KEY_slash, GDK_KEY_a, 0, 0, 0, 0x250, /* LATIN SMALL LETTER TURNED A */
|
|
|
|
GDK_KEY_slash, GDK_KEY_c, 0, 0, 0, 0x254, /* LATIN SMALL LETTER OPEN O */
|
|
|
|
GDK_KEY_slash, GDK_KEY_e, 0, 0, 0, 0x259, /* LATIN SMALL LETTER SCHWA */
|
|
|
|
GDK_KEY_slash, GDK_KEY_h, 0, 0, 0, 0x265, /* LATIN SMALL LETTER TURNED H */
|
|
|
|
GDK_KEY_slash, GDK_KEY_m, 0, 0, 0, 0x26F, /* LATIN SMALL LETTER TURNED M */
|
|
|
|
GDK_KEY_slash, GDK_KEY_r, 0, 0, 0, 0x279, /* LATIN SMALL LETTER TURNED R */
|
|
|
|
GDK_KEY_slash, GDK_KEY_v, 0, 0, 0, 0x28C, /* LATIN SMALL LETTER TURNED V */
|
|
|
|
GDK_KEY_slash, GDK_KEY_w, 0, 0, 0, 0x28D, /* LATIN SMALL LETTER TURNED W */
|
|
|
|
GDK_KEY_slash, GDK_KEY_y, 0, 0, 0, 0x28E, /* LATIN SMALL LETTER TRUEND Y*/
|
|
|
|
GDK_KEY_3, 0, 0, 0, 0, 0x292, /* LATIN SMALL LETTER EZH */
|
|
|
|
GDK_KEY_colon, 0, 0, 0, 0, 0x2D0, /* MODIFIER LETTER TRIANGULAR COLON */
|
|
|
|
GDK_KEY_A, 0, 0, 0, 0, 0x251, /* LATIN SMALL LETTER ALPHA */
|
|
|
|
GDK_KEY_E, 0, 0, 0, 0, 0x25B, /* LATIN SMALL LETTER OPEN E */
|
|
|
|
GDK_KEY_I, 0, 0, 0, 0, 0x26A, /* LATIN LETTER SMALL CAPITAL I */
|
|
|
|
GDK_KEY_L, 0, 0, 0, 0, 0x29F, /* LATIN LETTER SMALL CAPITAL L */
|
|
|
|
GDK_KEY_M, 0, 0, 0, 0, 0x28D, /* LATIN SMALL LETTER TURNED W */
|
|
|
|
GDK_KEY_O, 0, 0, 0, 0, 0x04F, /* LATIN LETTER SMALL CAPITAL OE */
|
|
|
|
GDK_KEY_O, GDK_KEY_E, 0, 0, 0, 0x276, /* LATIN LETTER SMALL CAPITAL OE */
|
|
|
|
GDK_KEY_R, 0, 0, 0, 0, 0x280, /* LATIN LETTER SMALL CAPITAL R */
|
|
|
|
GDK_KEY_U, 0, 0, 0, 0, 0x28A, /* LATIN SMALL LETTER UPSILON */
|
|
|
|
GDK_KEY_Y, 0, 0, 0, 0, 0x28F, /* LATIN LETTER SMALL CAPITAL Y */
|
|
|
|
GDK_KEY_grave, 0, 0, 0, 0, 0x2CC, /* MODIFIER LETTER LOW VERTICAL LINE */
|
|
|
|
GDK_KEY_a, 0, 0, 0, 0, 0x061, /* LATIN SMALL LETTER A */
|
|
|
|
GDK_KEY_a, GDK_KEY_e, 0, 0, 0, 0x0E6, /* LATIN SMALL LETTER AE */
|
|
|
|
GDK_KEY_c, 0, 0, 0, 0, 0x063, /* LATIN SMALL LETTER C */
|
|
|
|
GDK_KEY_c, GDK_KEY_comma, 0, 0, 0, 0x0E7, /* LATIN SMALL LETTER C WITH CEDILLA */
|
|
|
|
GDK_KEY_d, 0, 0, 0, 0, 0x064, /* LATIN SMALL LETTER E */
|
|
|
|
GDK_KEY_d, GDK_KEY_apostrophe, 0, 0, 0, 0x064, /* LATIN SMALL LETTER D */
|
|
|
|
GDK_KEY_d, GDK_KEY_h, 0, 0, 0, 0x0F0, /* LATIN SMALL LETTER ETH */
|
|
|
|
GDK_KEY_e, 0, 0, 0, 0, 0x065, /* LATIN SMALL LETTER E */
|
|
|
|
GDK_KEY_e, GDK_KEY_minus, 0, 0, 0, 0x25A, /* LATIN SMALL LETTER SCHWA WITH HOOK */
|
|
|
|
GDK_KEY_e, GDK_KEY_bar, 0, 0, 0, 0x25A, /* LATIN SMALL LETTER SCHWA WITH HOOK */
|
|
|
|
GDK_KEY_g, 0, 0, 0, 0, 0x067, /* LATIN SMALL LETTER G */
|
|
|
|
GDK_KEY_g, GDK_KEY_n, 0, 0, 0, 0x272, /* LATIN SMALL LETTER N WITH LEFT HOOK */
|
|
|
|
GDK_KEY_i, 0, 0, 0, 0, 0x069, /* LATIN SMALL LETTER I */
|
|
|
|
GDK_KEY_i, GDK_KEY_minus, 0, 0, 0, 0x268, /* LATIN SMALL LETTER I WITH STROKE */
|
|
|
|
GDK_KEY_n, 0, 0, 0, 0, 0x06e, /* LATIN SMALL LETTER N */
|
|
|
|
GDK_KEY_n, GDK_KEY_g, 0, 0, 0, 0x14B, /* LATIN SMALL LETTER ENG */
|
|
|
|
GDK_KEY_o, 0, 0, 0, 0, 0x06f, /* LATIN SMALL LETTER O */
|
|
|
|
GDK_KEY_o, GDK_KEY_minus, 0, 0, 0, 0x275, /* LATIN LETTER BARRED O */
|
|
|
|
GDK_KEY_o, GDK_KEY_slash, 0, 0, 0, 0x0F8, /* LATIN SMALL LETTER O WITH STROKE */
|
|
|
|
GDK_KEY_o, GDK_KEY_e, 0, 0, 0, 0x153, /* LATIN SMALL LIGATURE OE */
|
|
|
|
GDK_KEY_o, GDK_KEY_bar, 0, 0, 0, 0x251, /* LATIN SMALL LETTER ALPHA */
|
|
|
|
GDK_KEY_s, 0, 0, 0, 0, 0x073, /* LATIN SMALL LETTER_ESH */
|
|
|
|
GDK_KEY_s, GDK_KEY_h, 0, 0, 0, 0x283, /* LATIN SMALL LETTER_ESH */
|
|
|
|
GDK_KEY_t, 0, 0, 0, 0, 0x074, /* LATIN SMALL LETTER T */
|
|
|
|
GDK_KEY_t, GDK_KEY_h, 0, 0, 0, 0x3B8, /* GREEK SMALL LETTER THETA */
|
|
|
|
GDK_KEY_u, 0, 0, 0, 0, 0x075, /* LATIN SMALL LETTER U */
|
|
|
|
GDK_KEY_u, GDK_KEY_minus, 0, 0, 0, 0x289, /* LATIN LETTER U BAR */
|
|
|
|
GDK_KEY_z, 0, 0, 0, 0, 0x07A, /* LATIN SMALL LETTER Z */
|
|
|
|
GDK_KEY_z, GDK_KEY_h, 0, 0, 0, 0x292, /* LATIN SMALL LETTER EZH */
|
|
|
|
GDK_KEY_bar, GDK_KEY_o, 0, 0, 0, 0x252, /* LATIN LETTER TURNED ALPHA */
|
2001-03-03 19:57:54 +00:00
|
|
|
|
2010-09-08 17:35:51 +00:00
|
|
|
GDK_KEY_asciitilde, 0, 0, 0, 0, 0x303, /* COMBINING TILDE */
|
2001-03-03 19:57:54 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
ipa_class_init (GtkIMContextSimpleClass *class)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ipa_init (GtkIMContextSimple *im_context)
|
|
|
|
{
|
|
|
|
gtk_im_context_simple_add_table (im_context,
|
|
|
|
ipa_compose_seqs,
|
|
|
|
4,
|
|
|
|
G_N_ELEMENTS (ipa_compose_seqs) / (4 + 2));
|
|
|
|
}
|
|
|
|
|
|
|
|
static const GtkIMContextInfo ipa_info = {
|
|
|
|
"ipa", /* ID */
|
2015-02-24 03:00:55 +00:00
|
|
|
NC_("input method menu", "IPA"), /* Human readable name */
|
2003-05-30 01:31:15 +00:00
|
|
|
GETTEXT_PACKAGE, /* Translation domain */
|
2001-03-03 19:57:54 +00:00
|
|
|
GTK_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+") */
|
|
|
|
"" /* Languages for which this module is the default */
|
|
|
|
};
|
|
|
|
|
|
|
|
static const GtkIMContextInfo *info_list[] = {
|
|
|
|
&ipa_info
|
|
|
|
};
|
|
|
|
|
2008-03-17 23:53:18 +00:00
|
|
|
#ifndef INCLUDE_IM_ipa
|
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_ipa_ ## function
|
2008-03-17 23:53:18 +00:00
|
|
|
#endif
|
|
|
|
|
2008-03-18 21:29:00 +00:00
|
|
|
MODULE_ENTRY (void, init) (GTypeModule *module)
|
2001-03-03 19:57:54 +00:00
|
|
|
{
|
|
|
|
ipa_register_type (module);
|
|
|
|
}
|
|
|
|
|
2008-03-18 21:29:00 +00:00
|
|
|
MODULE_ENTRY (void, exit) (void)
|
2001-03-03 19:57:54 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-03-18 21:29:00 +00:00
|
|
|
MODULE_ENTRY (void, list) (const GtkIMContextInfo ***contexts,
|
|
|
|
int *n_contexts)
|
2001-03-03 19:57:54 +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)
|
2001-03-03 19:57:54 +00:00
|
|
|
{
|
|
|
|
if (strcmp (context_id, "ipa") == 0)
|
2004-11-19 23:30:47 +00:00
|
|
|
return g_object_new (type_ipa, NULL);
|
2001-03-03 19:57:54 +00:00
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|