Remove the acclerator mask
[mim] / src / ui / mim-immodule.c
index cd10312..2d37711 100644 (file)
 
 GType type_mim = 0;
 
-/* is this a character that could appear in a mim word */
 static gboolean
-is_mim_word_character(gunichar uc)
+mim_filter_keypress(GtkIMContext *context,
+                    GdkEventKey *event)
 {
-    return (((uc >= 0x0590 && uc <= 0x5ff) || (uc >= 0xfb1d && uc <= 0xfb4f))
-            && g_unichar_isdefined(uc) && !g_unichar_ispunct(uc));
-
-}
-
-static gboolean
-at_initial_position(GtkIMContext *context)
-{
-    gchar *text;
-    gchar *prevp;
-    gint cursor_index;
-    gunichar uc;
-
-    if (!gtk_im_context_get_surrounding(context, &text, &cursor_index))
-        return FALSE;
-
-    prevp = g_utf8_find_prev_char(text, text + cursor_index);
-    if (prevp == NULL)
-        return TRUE;
-
-    uc = g_utf8_get_char_validated(prevp, text + cursor_index - prevp);
-    g_return_val_if_fail(uc != (gunichar)(-1) && uc != (gunichar)(-2), FALSE);
-
-    if (is_mim_word_character(uc))
-        return FALSE;
-    else
-        return TRUE;
-}
-
-static gboolean
-mim_filter_keypress(GtkIMContext *context, GdkEventKey *event)
-{
-    gboolean is_initial;
-    gint i;
-
     if (event->type == GDK_KEY_RELEASE)
         return FALSE;
 
-    /* don't filter key events with accelerator modifiers held down */
-    if (event->state & (gtk_accelerator_get_default_mod_mask()
-            & ~GDK_SHIFT_MASK))
-        return FALSE;
-
-    is_initial = at_initial_position(context);
     return TRUE;
 }
 
@@ -71,7 +30,7 @@ mim_set_client_window(GtkIMContext *context,
                       GdkWindow *window)
 {
     if (window == NULL) {
-        /* create new client window */
+        /*TODO: create new client window */
         //mim_mui_create_window();
     }
 }
@@ -138,6 +97,8 @@ im_module_init(GTypeModule *module)
 {
     g_debug("mim-immodule imported!");
     mim_register_type(module);
+    /*TODO: Mask off the accelerators, except the CTRL (need for CTRL
+     * ^SPACE) */
 }
 
 void
@@ -157,7 +118,7 @@ im_module_list(const GtkIMContextInfo ***contexts,
 GtkIMContext *
 im_module_create(const gchar *context_id)
 {
-    if (strcmp(context_id, "mim-n") == 0)
+    if (strcmp(context_id, "mim") == 0)
         return GTK_IM_CONTEXT(g_object_new(type_mim, NULL));
     else
         return NULL;