Back to index

gcompris  8.2.2
Functions
gcompris_im.c File Reference
#include "gcompris.h"

Go to the source code of this file.

Functions

static gint im_context_commit_callback (GtkIMContext *imcontext, gchar *arg1, gpointer user_data)
static gint im_context_preedit_callback (GtkIMContext *imcontext, gpointer user_data)
static gint window_focus_callback (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
void gc_im_init (GtkWidget *window)
void gc_im_reset ()

Function Documentation

void gc_im_init ( GtkWidget *  window)

Definition at line 37 of file gcompris_im.c.

{
  GcomprisProperties *properties = gc_prop_get ();


  /* set IMContext */
  properties->context = gtk_im_multicontext_new ();

  if(gc_profile_get_current())
    {
      GHashTable *init_im =  g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
      init_im = gc_db_conf_with_table_get (gc_profile_get_current()->profile_id, 
                                         -1, 
                                         init_im );

      properties->default_context = g_hash_table_lookup ( init_im, "default_im");

      if (properties->default_context)
       g_setenv ("GTK_IM_MODULE",
                properties->default_context,
                TRUE);
    }

  gtk_im_context_set_client_window (properties->context,
                                    window->window);

  g_signal_connect (G_OBJECT (properties->context), "commit",
                  G_CALLBACK(im_context_commit_callback), NULL);

  g_signal_connect (G_OBJECT (properties->context), "preedit-changed",
                  G_CALLBACK(im_context_preedit_callback), NULL);

  g_signal_connect (GTK_WIDGET (window), "focus-in-event",
                  G_CALLBACK(window_focus_callback), NULL);

  g_signal_connect (GTK_WIDGET (window), "focus-out-event",
                  G_CALLBACK(window_focus_callback), NULL);
 
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_im_reset ( )

Definition at line 78 of file gcompris_im.c.

{
  GcomprisProperties *properties = gc_prop_get ();
  gtk_im_context_reset (properties->context);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static gint im_context_commit_callback ( GtkIMContext *  imcontext,
gchar *  arg1,
gpointer  user_data 
) [static]

Definition at line 86 of file gcompris_im.c.

{
  if (gc_board_get_current_board_plugin()!=NULL && gc_board_get_current_board_plugin()->key_press)
    {
      int result = gc_board_get_current_board_plugin()->key_press (0, arg1, NULL);
      //      g_free(arg1);
      return(result);
    }
  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static gint im_context_preedit_callback ( GtkIMContext *  imcontext,
gpointer  user_data 
) [static]

Definition at line 100 of file gcompris_im.c.

{
  gchar *preedit_string;
  PangoAttrList *attrs;
  gint cursor_pos;

  gtk_im_context_get_preedit_string (imcontext,
                                 &preedit_string,
                                 &attrs,
                                 &cursor_pos);

  if (gc_board_get_current_board_plugin()!=NULL && gc_board_get_current_board_plugin()->key_press)
    {
      int result = gc_board_get_current_board_plugin()->key_press (0, NULL, preedit_string);
      g_free(preedit_string);
      pango_attr_list_unref (attrs);
      return(result);
    }
  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static gint window_focus_callback ( GtkWidget *  widget,
GdkEventFocus *  event,
gpointer  user_data 
) [static]

Definition at line 123 of file gcompris_im.c.

{
  GcomprisProperties *properties = gc_prop_get ();
  if (event->in)
    gtk_im_context_focus_in (properties->context);
  else
    gtk_im_context_focus_out (properties->context);
  
  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function: