1 /*********************************************************************
3 ** Copyright (C) 2009 MiM
5 ** Contact: Handspring <xhealer@gmail.com>
9 ** This file is part of MiM Pinyin.
11 ** This is free software: you can redistribute it and/or modify
12 ** it under the terms of the GNU General Public License as published by
13 ** the Free Software Foundation, either version 3 of the License, or
14 ** (at your option) any later version.
16 ** This is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ** GNU General Public License for more details.
21 ** You should have received a copy of the GNU General Public License
22 ** along with Sigil. If not, see <http://www.gnu.org/licenses/>.
24 *********************************************************************/
29 * GTK+ MiM input module
31 #include <gtk/gtkimcontext.h>
32 #include <gtk/gtkimmodule.h>
33 #include <gdk/gdkkeysyms.h>
36 #include "im-extra-intl.h"
41 mim_filter_keypress(GtkIMContext *context,
44 if (event->type == GDK_KEY_RELEASE)
51 mim_set_client_window(GtkIMContext *context,
55 /*TODO: create new client window */
56 //mim_mui_create_window();
61 mim_reset(GtkIMContext *context)
66 mim_class_init(GtkIMContextClass *clazz)
68 clazz->filter_keypress = mim_filter_keypress;
69 clazz->reset = mim_reset;
70 clazz->set_client_window = mim_set_client_window;
74 mim_init(GtkIMContext *im_context)
79 mim_register_type(GTypeModule *module)
81 static const GTypeInfo object_info =
83 sizeof(GtkIMContextClass),
85 (GBaseFinalizeFunc) NULL,
86 (GClassInitFunc) mim_class_init,
87 NULL, /* class_finalize */
88 NULL, /* class_data */
91 (GInstanceInitFunc) mim_init,
94 type_mim = g_type_module_register_type(module,
96 "GtkIMContextYiddishNoah",
102 GtkIMContextInfo mim_info =
105 N_("MiM"), /* Human readable name */
106 GETTEXT_PACKAGE, /* Translation domain */
107 LOCALEDIR, /* Dir for bindtextdomain */
108 "zh_CN", /* Languages for which this module is the default */
112 GtkIMContextInfo *info_list[] =
118 im_module_init(GTypeModule *module)
120 g_debug("mim-immodule imported!");
121 mim_register_type(module);
122 /*TODO: Mask off the accelerators, except the CTRL (need for CTRL
129 g_debug("mim-immodule released!");
133 im_module_list(const GtkIMContextInfo ***contexts,
136 *contexts = info_list;
137 *n_contexts = G_N_ELEMENTS(info_list);
141 im_module_create(const gchar *context_id)
143 if (strcmp(context_id, "mim") == 0)
144 return GTK_IM_CONTEXT(g_object_new(type_mim, NULL));