int hime_FocusIn(ClientState *cs) { // dbg("hime_FocusIn\n"); Window win = cs->client_win; #if UNIX && 0 if (skip_window(win)) return FALSE; #endif reset_current_in_win_xy(); if (cs) { Window win = cs->client_win; if (focus_win != win) { #if 1 hime_reset(); #endif hide_in_win(current_CS); focus_win = win; } } current_CS = cs; save_CS_temp_to_current(); // dbg("current_CS %x %d %d\n", cs, cs->im_state, current_CS->im_state); if (win == focus_win) { if (cs->im_state != HIME_STATE_DISABLED) { show_in_win(cs); move_IC_in_win(cs); } else hide_in_win(cs); } if (inmd[cs->in_method].selkey) set_wselkey(inmd[cs->in_method].selkey); else { set_wselkey(pho_selkey); gtab_set_win1_cb(); tsin_set_win1_cb(); } update_win_kbm(); #if TRAY_ENABLED disp_tray_icon(); #endif #if 0 dbg_time("hime_FocusIn %x %x\n",cs, current_CS); #endif return True; }
int hime_FocusOut(ClientState *cs) { gint64 t = current_time(); // dbg("hime_FocusOut\n"); if (cs != current_CS) return FALSE; #if UNIX && 0 // dbg("hime_FocusOut\n"); if (skip_window(cs->client_win)) return FALSE; #endif if (t - last_focus_out_time < 100000) { last_focus_out_time = t; return FALSE; } last_focus_out_time = t; if (cs == current_CS) { hide_in_win(cs); } reset_current_in_win_xy(); if (cs == current_CS) temp_CS = *current_CS; #if 0 dbg("focus out\n"); #endif return True; }
static void shutdown_client(int fd) { // dbg("client shutdown rn %d\n", rn); g_source_remove(hime_clients[fd].tag); int idx = fd; if (hime_clients[idx].cs == current_CS) { hide_in_win(current_CS); current_CS = NULL; } free(hime_clients[idx].cs); hime_clients[idx].cs = NULL; hime_clients[idx].fd = 0; /* Now we use "is_special_user" */ #if 0 int uid = getuid(); struct passwd *pwd; if ((pwd=getpwuid(uid)) && (!strcmp(pwd->pw_name, "gdm") || !strcmp(pwd->pw_name, "kdm"))) { exit(0); } #endif close(fd); }
void load_IC(IC *rec) { ClientState *cs = &rec->cs; Window win = cs->client_win; if (win == focus_win && !current_CS) { current_CS = cs; save_CS_temp_to_current(); } if (win == focus_win) { if (cs->im_state == HIME_STATE_DISABLED) hide_in_win(cs); else if (cs->im_state != HIME_STATE_DISABLED) show_in_win(cs); } if (cs->input_style & InputStyleOnSpot) { if (cs->im_state != HIME_STATE_DISABLED) move_IC_in_win(cs); } else if (cs->input_style & InputStyleOverSpot) { if (cs->im_state != HIME_STATE_DISABLED) move_IC_in_win(cs); } else if (cs->input_style & InputStyleRoot) { move_IC_in_win(cs); } }
void toggle_im_enabled() { // dbg("toggle_im_enabled\n"); check_CS(); if (current_CS->in_method < 0 || current_CS->in_method > MAX_GTAB_NUM_KEY) p_err("err found"); if (current_CS->im_state != GCIN_STATE_DISABLED) { if (current_CS->im_state == GCIN_STATE_ENG_FULL) { current_CS->im_state = GCIN_STATE_CHINESE; disp_im_half_full(); return; } if (current_method_type() == method_type_TSIN) { #if USE_TSIN flush_tsin_buffer(); #endif } else { output_gbuf(); reset_gtab_all(); } hide_in_win(current_CS); #if 0 hide_win_status(); #endif current_CS->im_state = GCIN_STATE_DISABLED; update_win_kbm(); #if TRAY_ENABLED disp_tray_icon(); #endif } else { if (!current_method_type()) init_gtab(current_CS->in_method); init_state_chinese(current_CS); reset_current_in_win_xy(); #if 1 show_in_win(current_CS); update_in_win_pos(); #else update_in_win_pos(); show_in_win(current_CS); #endif update_win_kbm(); #if TRAY_ENABLED disp_tray_icon(); #endif } }
int gcin_FocusIn(ClientState *cs) { Window win = cs->client_win; gcin_reset(); #if UNIX if (skip_window(win)) return FALSE; #endif reset_current_in_win_xy(); if (cs) { Window win = cs->client_win; if (focus_win != win) { hide_in_win(current_CS); focus_win = win; } } current_CS = cs; // dbg("current_CS %x %d %d\n", cs, cs->im_state, current_CS->im_state); if (win == focus_win) { if (cs->im_state != GCIN_STATE_DISABLED) { show_in_win(cs); move_IC_in_win(cs); #if 0 set_win_status_inmd(inmd[cs->in_method].cname); #endif } else hide_in_win(cs); } update_win_kbm(); #if TRAY_ENABLED disp_tray_icon(); #endif #if 0 dbg_time("gcin_FocusIn %x %x\n",cs, current_CS); #endif return True; }
void toggle_half_full_char() { #if WIN32 if (test_mode) return; #endif check_CS(); if (!hime_shift_space_eng_full) { current_CS->b_half_full_char = 0; tss.tsin_half_full=0; disp_im_half_full(); return; } // dbg("toggle_half_full_char\n"); if (current_method_type() == method_type_TSIN && current_CS->im_state == HIME_STATE_CHINESE) { tsin_toggle_half_full(); } else { if (current_CS->im_state == HIME_STATE_ENG_FULL) { current_CS->im_state = HIME_STATE_DISABLED; hide_in_win(current_CS); } else if (current_CS->im_state == HIME_STATE_DISABLED) { toggle_im_enabled(); current_CS->im_state = HIME_STATE_ENG_FULL; } else if (current_CS->im_state == HIME_STATE_CHINESE) { current_CS->b_half_full_char = !current_CS->b_half_full_char; } // dbg("current_CS->in_method %d\n", current_CS->in_method); disp_im_half_full(); } save_CS_current_to_temp(); // dbg("half full toggle\n"); }
// <Shift><Space> is pressed void toggle_half_full_char() { check_CS(); if (!hime_shift_space_eng_full) { current_CS->b_half_full_char = 0; tss.tsin_half_full=0; disp_im_half_full(); return; } // dbg("toggle_half_full_char\n"); if (current_method_type() == method_type_TSIN && current_CS->im_state == HIME_STATE_CHINESE) { tsin_toggle_half_full(); } else { switch (current_CS->im_state) { case HIME_STATE_ENG_FULL: current_CS->im_state = HIME_STATE_DISABLED; hide_in_win(current_CS); break; case HIME_STATE_DISABLED: toggle_im_enabled(); current_CS->im_state = HIME_STATE_ENG_FULL; break; case HIME_STATE_CHINESE: current_CS->b_half_full_char = !current_CS->b_half_full_char; break; } // dbg("current_CS->in_method %d\n", current_CS->in_method); disp_im_half_full(); } save_CS_current_to_temp(); // dbg("half full toggle\n"); }
void DeleteIC(CARD16 icid) { IC *rec, *last; last = NULL; for (rec = ic_list; rec != NULL; last = rec, rec = rec->next) { if (rec->id == icid) { if (&rec->cs == current_CS) { hide_in_win(&rec->cs); } if (last != NULL) last->next = rec->next; else ic_list = rec->next; rec->next = free_list; free_list = rec; return; } } return; }
gboolean init_in_method(int in_no) { gboolean init_im = !(cur_inmd && (cur_inmd->flag & FLAG_GTAB_SYM_KBM)); if (in_no < 0) return FALSE; check_CS(); if (current_CS->in_method != in_no) { if (!(inmd[in_no].flag & FLAG_GTAB_SYM_KBM)) { if (current_method_type() == method_type_TSIN) { flush_tsin_buffer(); } else output_gbuf(); hide_in_win(current_CS); } if (cur_inmd && (cur_inmd->flag & FLAG_GTAB_SYM_KBM)) hide_win_kbm(); } reset_current_in_win_xy(); // dbg("switch init_in_method %x %d\n", current_CS, in_no); set_tsin_pho_mode0(current_CS); tsin_set_win1_cb(); switch (inmd[in_no].method_type) { case method_type_PHO: current_CS->in_method = in_no; init_tab_pho(); break; case method_type_TSIN: set_wselkey(pho_selkey); current_CS->in_method = in_no; init_tab_pp(init_im); break; case method_type_MODULE: { HIME_module_main_functions gmf; init_HIME_module_main_functions(&gmf); if (!inmd[in_no].mod_cb_funcs) { char ttt[256]; strcpy(ttt, inmd[in_no].filename); dbg("module %s\n", ttt); if (!(inmd[in_no].mod_cb_funcs = init_HIME_module_callback_functions(ttt))) { dbg("module not found\n"); return FALSE; } } if (inmd[in_no].mod_cb_funcs->module_init_win(&gmf)) { current_CS->in_method = in_no; module_cb()->module_show_win(); set_wselkey(pho_selkey); } else { return FALSE; } break; } default: init_gtab(in_no); if (!inmd[in_no].DefChars) return FALSE; current_CS->in_method = in_no; if (!(inmd[in_no].flag & FLAG_GTAB_SYM_KBM)) show_win_gtab(); else { win_kbm_inited = 1; show_win_kbm(); } set_gtab_input_method_name(inmd[in_no].cname); break; } #if WIN32 if (current_CS && current_CS->in_method != last_input_method) last_input_method = current_CS->in_method; #endif #if TRAY_ENABLED disp_tray_icon(); #endif if (inmd[current_CS->in_method].selkey) { set_wselkey(inmd[current_CS->in_method].selkey); gtab_set_win1_cb(); // dbg("aa selkey %s\n", inmd[current_CS->in_method].selkey); } update_in_win_pos(); update_win_kbm_inited(); return TRUE; }
void toggle_im_enabled() { // dbg("toggle_im_enabled\n"); check_CS(); if (current_CS->in_method < 0) p_err("err found"); if (current_CS->im_state != HIME_STATE_DISABLED) { if (current_CS->im_state == HIME_STATE_ENG_FULL) { current_CS->im_state = HIME_STATE_CHINESE; disp_im_half_full(); save_CS_current_to_temp(); return; } if (current_method_type() == method_type_TSIN) { #if USE_TSIN flush_tsin_buffer(); #endif } else if (current_method_type () == method_type_MODULE) { module_cb ()->module_flush_input (); } else { output_gbuf(); reset_gtab_all(); } hide_in_win(current_CS); #if 0 hide_win_status(); #endif current_CS->im_state = HIME_STATE_DISABLED; update_win_kbm(); #if TRAY_ENABLED disp_tray_icon(); #endif } else { if (!current_method_type()) init_gtab(current_CS->in_method); init_state_chinese(current_CS); reset_current_in_win_xy(); #if 1 show_in_win(current_CS); update_in_win_pos(); #else update_in_win_pos(); show_in_win(current_CS); #endif update_win_kbm(); #if TRAY_ENABLED disp_tray_icon(); #endif } save_CS_current_to_temp(); }
gboolean init_in_method(int in_no) { gboolean init_im = !(cur_inmd && (cur_inmd->flag & FLAG_GTAB_SYM_KBM)); if (in_no < 0 || in_no > MAX_GTAB_NUM_KEY) return FALSE; check_CS(); if (current_CS->in_method != in_no) { if (!(inmd[in_no].flag & FLAG_GTAB_SYM_KBM)) { if (current_method_type() == method_type_TSIN) { #if USE_TSIN flush_tsin_buffer(); #endif } else output_gbuf(); hide_in_win(current_CS); } if (cur_inmd && (cur_inmd->flag & FLAG_GTAB_SYM_KBM)) hide_win_kbm(); } reset_current_in_win_xy(); // dbg("switch init_in_method %x %d\n", current_CS, in_no); switch (inmd[in_no].method_type) { case method_type_PHO: current_CS->in_method = in_no; init_tab_pho(); break; #if USE_TSIN case method_type_TSIN: current_CS->in_method = in_no; set_tsin_pho_mode0(current_CS); init_tab_pp(init_im); break; #endif case method_type_INT_CODE: current_CS->in_method = in_no; init_inter_code(); break; #if USE_ANTHY case method_type_ANTHY: if (init_win_anthy()) { current_CS->in_method = in_no; show_win_anthy(); } else { return FALSE; } break; #endif default: init_gtab(in_no); if (!inmd[in_no].DefChars) return FALSE; current_CS->in_method = in_no; if (!(inmd[in_no].flag & FLAG_GTAB_SYM_KBM)) show_win_gtab(); else { win_kbm_inited = 1; show_win_kbm(); } set_gtab_input_method_name(inmd[in_no].cname); break; } #if WIN32 if (current_CS && current_CS->in_method != last_input_method) last_input_method = current_CS->in_method; #endif #if TRAY_ENABLED disp_tray_icon(); #endif update_in_win_pos(); update_win_kbm_inited(); return TRUE; }