Back to index

im-sdk  12.3.91
Functions | Variables
key_event.c File Reference
#include <stdio.h>
#include <assert.h>
#include "koinput.h"
#include "key_event.h"
#include "le.h"
#include "le_proc.h"
#include "iml.h"
#include "method.h"
#include "encode.h"
#include "xaux_locale.h"
#include "fullwidth.h"
#include "util.h"
#include "kolelog.h"

Go to the source code of this file.

Functions

static void keyevent_toggle_junjabanja_handler (iml_session_t *s, int junjabanja)
static void keyevent_input_handler (iml_session_t *s, IMKeyEventStruct *key_event)
static Bool imekeycmp (IMEKeyEventStruct *key_a, IMEKeyEventStruct *key_b)
static Bool is_hotkey (iml_session_t *s, IMEKeyEventStruct *key_event)
void keyevent_handler (iml_session_t *s, IMKeyListEvent *keylistevent)
void keyevent_switch_conversion_handler (iml_session_t *s, int on)
void proc_key_switch_keyboard_layout_event (iml_session_t *s, int nKeyboardID)
void proc_symbol_input_event (iml_session_t *s, IMKeyEventStruct *key_event)
int proc_junja (iml_session_t *s, IMKeyEventStruct *key_event)

Variables

int g_number_of_engines
int default_engine_id
IMEEngineRecg_engines [MAX_ENGINE_NUM]

Function Documentation

static Bool imekeycmp ( IMEKeyEventStruct *  key_a,
IMEKeyEventStruct *  key_b 
) [static]

Definition at line 350 of file key_event.c.

{
  assert (key_a != NULL);
  assert (key_b != NULL);

  if ( (key_a->key_code == key_b->key_code) &&
       (key_a->key_char == key_b->key_char) &&
       (key_a->key_modifier == key_b->key_modifier))
    return 0;
  else
    return -1;
}

Here is the caller graph for this function:

static Bool is_hotkey ( iml_session_t s,
IMEKeyEventStruct *  key_event 
) [static]

Definition at line 326 of file key_event.c.

{
  int n;
  IMEHotKey photkey;
  IMEEngine p_engine;
  IMECore p_core;
  MyDataPerSession *sd = (MyDataPerSession *) s->specific_data;
  p_engine = sd->p_engine;
  p_core = &p_engine->core;
  photkey = &p_core->hotkeys;

  assert (photkey != NULL);
  
  if (photkey->n_count){
    for (n = 0 ;n < photkey->n_count; n++){
      if (!imekeycmp (key_event, photkey->keylist[n]))
       return True;
    }
    return False;
  }
  return False;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void keyevent_handler ( iml_session_t s,
IMKeyListEvent keylistevent 
)

Definition at line 56 of file key_event.c.

{
  MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
  MyDataPerDesktop *desktop_data =
    (MyDataPerDesktop *)(s->desktop->specific_data);
  IMKeyEventStruct *key_event =
    (IMKeyEventStruct *) keylistevent->keylist;
  IMEBufferMethods mthds = session_data->session_core.ime_methods_table;
  IMEBuffer a_buffer = session_data->session_core.ime_buffer;
  
  INPUT_MODE_T imode_return;
  Bool mthd_return;

  KOLE_LOG (LOGDEST_STDOUT, " proc_keyevent:   session:%x\n", s);

  keyevent_input_handler (s, key_event);
  
  mthd_return = (*mthds->ime_buffer_get_input_mode) (a_buffer,  &imode_return);
  if (!mthd_return){
    KOLE_LOG (LOGDEST_STDERR,
             "keyevent_handler: error in getting current input mode\n");
    return;
  }
  return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void keyevent_input_handler ( iml_session_t s,
IMKeyEventStruct key_event 
) [static]

Definition at line 275 of file key_event.c.

{

  MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
  MyDataPerDesktop *desktop_data = (MyDataPerDesktop *)(s->desktop->specific_data);
  IMEBufferMethods ime_methods =  session_data->session_core.ime_methods_table;
  IMEBuffer pbuffer = session_data->session_core.ime_buffer;
  IMEKeyEventStruct  ime_keyevent;
  int ret, cur_engine_id, junjabanja, punct;
  Bool method_return;
  

  punct = session_data->paletteaux_status.punct;
  KOLE_LOG (LOGDEST_STDOUT, "punct:%d", punct);
       
  junjabanja = session_data->paletteaux_status.junjabanja;

  KOLE_LOG (LOGDEST_STDOUT, "junjabanja:%d", junjabanja);

  if (junjabanja == True) {
    ret = proc_junja(s, key_event);
    if (ret == IMM_USED_KEY) 
      return;
  }
       
  cur_engine_id = session_data->paletteaux_status.engine_id;
  KOLE_LOG (LOGDEST_STDOUT, "cur_engine_id:%d", cur_engine_id);
  if (cur_engine_id == 0xff) {
    iml_sendback_key(s, key_event);
    return;
  }

  ime_keyevent.key_code = key_event->keyCode;
  ime_keyevent.key_char = key_event->keyChar;
  ime_keyevent.key_modifier = key_event->modifier;

  method_return =
    (*ime_methods->ime_buffer_process_key_input) (pbuffer, &ime_keyevent);

  if (!method_return)
    iml_sendback_key (s, key_event);
  else
    {
      if (is_hotkey (s, &ime_keyevent)){
       auxhandler_send_session_property (s, XAUX_PALETTE_CLASS_NAME);
      }
      le_output_ime_buffer(s, session_data->session_core.ime_buffer, &ime_keyevent);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 130 of file key_event.c.

{
  MyDataPerSession *sd = (MyDataPerSession *) s->specific_data;
  MyDataPerDesktop *dd = (MyDataPerDesktop *)(s->desktop->specific_data);
  int engine_id;
  IMEBufferMethods ime_methods =  sd->session_core.ime_methods_table;
  INPUT_MODE_T imt;
  Bool mthd_return;
  
  KOLE_LOG (LOGDEST_STDOUT,
           "ENGLISH_KOREAN SWITCH IME KEY, on:%d", on);

  sd->paletteaux_status.on = on;
  engine_id = sd->paletteaux_status.engine_id;
  ime_methods = g_engines[engine_id]->so_methods;

  if (on == CONVERSION_OFF) {
    
    (*ime_methods->ime_buffer_conversion_end)(sd->session_core.ime_buffer);

    iml_conversion_off (s);
    iml_status_draw (s);
    
    mthd_return =
      (*ime_methods->ime_buffer_get_input_mode)(sd->session_core.ime_buffer, &imt);
    if (mthd_return)
      le_update_paletteaux_input_mode_info (s, imt);

  } else {

    (*ime_methods->ime_buffer_conversion_start)(sd->session_core.ime_buffer);
    
    iml_conversion_on(s);
    iml_status_draw (s);

    mthd_return =
      (*ime_methods->ime_buffer_get_input_mode)(sd->session_core.ime_buffer, &imt);
    if (mthd_return)
      le_update_paletteaux_input_mode_info (s, imt);
    /*
      iml_status_draw (s);
      if (engine_id != 0xff)
      le_switch_engine(s, engine_id);
    */
  }
#if 0
  /* test code */
  iml_inst *lp;
  iml_inst *rrv = NULL;
  lp = s->If->m->iml_make_lookup_done_inst(s);
  s->If->m->iml_link_inst_tail (&rrv, lp);
  s->If->m->iml_execute (s, &rrv);

  le_change_focus_notify(s);

  /* If PaletteAux can be started */
  if (dd->paletteaux_ready == True) {
    return;
  }

  /* PaletteAux can not be started */
  if (on == CONVERSION_ON && engine_id == 0xff) {
    system_locale_id = dd->aux_locale_id;
    engine_id = 0;
    for (i = 0; i< g_number_of_engines; i++) {
      locale_id = g_engines[i]->core.baseinfo.locale_id;
      if (locale_id == system_locale_id || locale_id == ENCODES_NUM) {
       engine_id = i;
       break;
      }
    }
    KOLE_LOG (LOGDEST_STDOUT, "engine_id:%d", engine_id);
    le_switch_engine(s, engine_id);
  }
#endif
}

Here is the call graph for this function:

void keyevent_toggle_junjabanja_handler ( iml_session_t s,
int  junjabanja 
) [static]

Definition at line 232 of file key_event.c.

{
  MyDataPerSession *session_data = (MyDataPerSession *) s->specific_data;
  IMEBufferMethods methods_table = session_data->session_core.ime_methods_table;
  IMEBuffer session_ime_buffer = session_data->session_core.ime_buffer;

  KOLE_LOG (LOGDEST_STDOUT, "FULL_HALF_WIDTH_SWITCH_KEY: %d\n", junjabanja);

  session_data->paletteaux_status.junjabanja = junjabanja;
  (*methods_table->ime_buffer_initialize)(session_ime_buffer);
  le_switch_junjabanja_notify (s, junjabanja);
}

Here is the call graph for this function:

int proc_junja ( iml_session_t s,
IMKeyEventStruct key_event 
)

Definition at line 246 of file key_event.c.

{
  MyDataPerDesktop *desktop_data =
    (MyDataPerDesktop *)(s->desktop->specific_data);
  int lang_id, locale_id;
  char *commit_buf;
  int keycode, keystatus, keychar;

  keycode = key_event->keyCode;
  keychar = key_event->keyChar;
  keystatus = key_event->modifier;

  /* normal ASCII key */
  if ((keychar != 0) && (keystatus == IM_SHIFT_MASK || keystatus == 0)) {
    locale_id = desktop_data->aux_locale_id;
    lang_id = get_langid_from_localeid(locale_id);
    commit_buf = (char *)get_junja_str(keychar);
    if (commit_buf != NULL) {
#if 0
      encode_commit(s, ENCODE_EUC_KO, (unsigned char *)commit_buf);
#endif
      return (IMM_USED_KEY);
    }
  }

  return (IMM_NOT_USED_KEY);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void proc_key_switch_keyboard_layout_event ( iml_session_t s,
int  nKeyboardID 
)

Definition at line 209 of file key_event.c.

{
  MyDataPerSession *session_data = (MyDataPerSession *)s->specific_data;
  if(nKeyboardID == -1){ /* no change, this would be for hiding the keyboad aux */
    iml_status_draw (s);
    return;
  }

  if(nKeyboardID < -1 || nKeyboardID > 3)
    nKeyboardID = 0;

  iml_status_draw (s);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void proc_symbol_input_event ( iml_session_t s,
IMKeyEventStruct key_event 
)

Definition at line 224 of file key_event.c.

Here is the call graph for this function:


Variable Documentation

Definition at line 44 of file koinput.c.

Definition at line 42 of file koinput.c.