summaryrefslogtreecommitdiff
path: root/chinese/xcin25/files/patch-af
diff options
context:
space:
mode:
authorVanilla I. Shu <vanilla@FreeBSD.org>2000-03-06 01:00:00 +0000
committerVanilla I. Shu <vanilla@FreeBSD.org>2000-03-06 01:00:00 +0000
commite80422978a5d80421b543ee71f8015d0902c197c (patch)
treef1b1fce8397fc43c71ac428e0eb09aec2a87abe7 /chinese/xcin25/files/patch-af
parentChange package name to "junkbuster" (diff)
Correct the BROKEN on my last commit :(
Diffstat (limited to '')
-rw-r--r--chinese/xcin25/files/patch-af2189
1 files changed, 1989 insertions, 200 deletions
diff --git a/chinese/xcin25/files/patch-af b/chinese/xcin25/files/patch-af
index e7cd753ebdbe..108e6a6aab47 100644
--- a/chinese/xcin25/files/patch-af
+++ b/chinese/xcin25/files/patch-af
@@ -1,41 +1,238 @@
---- src/include/gui.h.orig Wed Feb 23 09:47:57 2000
-+++ src/include/gui.h Thu Feb 24 01:55:36 2000
-@@ -30,6 +30,7 @@
- */
- #define WIN_CHANGE_IM_CONTENT 0x0001
- #define WIN_CHANGE_IM 0x00ff
-+#define WIN_CHANGE_FOCUS 0x0100
+--- doc/CREDITS.orig Thu Feb 17 08:32:52 2000
++++ doc/CREDITS Mon Mar 6 08:48:05 2000
+@@ -14,6 +14,11 @@
+ Contribution: Donate GB cin tables: biaoxingma.cin, pinyin.cin, shuangpin.cin,
+ wubizixing.cin.
- /*
- * Window Identifier.
---- src/include/xcin_core.h.orig Wed Feb 23 09:47:57 2000
-+++ src/include/xcin_core.h Thu Feb 24 01:55:36 2000
-@@ -88,7 +88,7 @@
++Name: Array: 行列科技有限公司, 負責人: 廖明德先生
++ (http://www.array.com.tw/)
++Email: array30@ms10.hinet.net
++Contribution: Donate array30.cin table.
++
+ Name: 邱智偉 (Chao, Weichung)
+ Email: weichung@mail.cynix.com.tw
+ Contribution: XCIN po file Big5 translation.
+@@ -50,7 +55,8 @@
+ Contribution: GPL translation modification.
- /* XIM &amp; Input Method configuration. */
- XIMS ims;
-- IC *ic;
-+ IC *ic, *icp;
- xmode_t xcin_mode;
- inp_state_t default_im;
- inp_state_t default_im_sinmd;
+ Name: PhantomCat (Hung, Peter)
+-Email: peter@phantom.wahoo.com.tw
++ (美商網虎 XLinux 軟體工程師)
++Email: peter@xlinux.com
+ Contribution: Add the OverTheSpot input style support.
+
+ Name: Joe
+--- doc/Changes.orig Wed Feb 23 09:47:57 2000
++++ doc/Changes Mon Mar 6 08:48:05 2000
+@@ -1,3 +1,35 @@
++xcin-2.5.2-pre3: 2000/03/
++------------------------------
++1. Fix the bug of multiply creating GC in gui_overspot & gui_menusel.
++ Thanks to Peter Hung <peter@phantom.wahoo.com.tw>
++
++2. Fix bugs when xcin is going to exit and xccore->ic = NULL case;
++
++3. Change the mechanism of IMC windows' map change during IC focus changes.
++ Add a gui->winchange flag: WIN_CHANGE_FOCUS.
++
++4. Remove the check_focus() function. Let xim_trigger_handler() to set
++ xccore->ic and xccore->ic->imc->icid.
++
++5. Fix a bug when IM_FOCUS_ON in xcinrc truned on, xcin will only initially
++ start from Setkey=0 input method.
++
++6. Move the fontset data from gui_t to winlist_t.
++
++7. Change the OverTheSpot styles:
++ 1. the candidate window will always follow the spot location of the client.
++ 2. the candidate window will use the fontset specified by the client if
++ possible.
++ 3. the length of the candidate window will be adjusted according to the
++ amount of the data being drawed.
++ 4. add xcinrc option "OVERSPOT_DRAW_AREA3".
++ 5. change testprog for valid OverTheSpot styles.
++ Thanks to Peter Hung <peter@phantom.wahoo.com.tw>
++
++8. Fix bug in gen_inp: to remove the handling of CapsLock ON.
++ Thanks to loneeagle <loneeagle@cle.linux.org.tw>.
++
++
+ xcin-2.5.2-pre2: 2000/02/23
+ ------------------------------
+ 1. Register a WM protocol into testprog such that it can be terminated by WM.
+--- src/Cinput/gen_inp/gen_inp.c.orig Thu Feb 17 08:33:05 2000
++++ src/Cinput/gen_inp/gen_inp.c Mon Mar 6 08:48:05 2000
+@@ -903,8 +903,10 @@
+ else if ((keyinfo->keystate & Mod1Mask) &&
+ (ret1 = modifier_escape(cf, QPHR_ALT)))
+ return (ret | ret1);
++/*
+ else if ((keyinfo->keystate & LockMask))
+ return (ret | IMKEY_SHIFTESC);
++*/
+
+ else if (! wch.wch)
+ return (ret | IMKEY_IGNORE);
--- src/gui.c.orig Wed Feb 23 09:47:57 2000
-+++ src/gui.c Thu Feb 24 01:55:36 2000
-@@ -191,31 +191,19 @@
++++ src/gui.c Mon Mar 6 08:48:05 2000
+@@ -36,73 +36,6 @@
+
+ ----------------------------------------------------------------------------*/
+
+-static void
+-x_set_font(gui_t *gui, char *fontset_name, char *indexfont_name)
+-{
+- int fsize;
+- char *s, *s1;
+- int charset_count, fontset_count=0;
+- char **charset_list;
+- char *def_string;
+- XFontStruct **font_structs;
+- int i;
+-
+-/*
+- * Compute the number of input font names.
+- */
+- if (*fontset_name != '\0')
+- fontset_count ++;
+- s1 = fontset_name;
+- while ((s=strchr(s1, ',')) != NULL) {
+- if (*(s+1) != '\0') {
+- fontset_count ++;
+- s1 = s + 1;
+- }
+- }
+-
+-/*
+- * Create the fontset.
+- */
+- gui->fontset = XCreateFontSet(gui->display, fontset_name,
+- &charset_list, &charset_count, &def_string);
+- if (charset_count || ! gui->fontset) {
+- for (i=0; i<charset_count; i++)
+- perr(XCINMSG_NORMAL, "invalid font %s.\n", charset_list[i]);
+- perr(XCINMSG_ERROR, "fontset setting error.\n");
+- }
+- charset_count = XFontsOfFontSet(gui->fontset, &font_structs, &charset_list);
+- if (charset_count != fontset_count) {
+- for (i=0; i<charset_count; i++)
+- perr(XCINMSG_NORMAL, "only valid font %s.\n", charset_list[i]);
+- perr(XCINMSG_ERROR, "fontset setting error.\n");
+- }
+-
+- for (i=0; i<charset_count; i++) {
+- fsize = font_structs[i]->max_bounds.width / 2;
+- if (fsize > gui->ef_width)
+- gui->ef_width = fsize;
+- fsize = font_structs[i]->ascent + font_structs[i]->descent;
+- if (fsize > gui->ef_height) {
+- gui->ef_height = fsize;
+- gui->ef_ascent = font_structs[i]->ascent;
+- }
+- }
+-
+-/*
+- * Create the index font.
+- */
+- for (i=0; i<charset_count; i++) {
+- if (! strcmp(indexfont_name, charset_list[i]))
+- break;
+- }
+- if (i < charset_count)
+- gui->indexfont = font_structs[i];
+- else if(! (gui->indexfont = XLoadQueryFont(gui->display, indexfont_name))) {
+- perr(XCINMSG_ERROR, "invalid INDEX_FONT: %s\n", indexfont_name);
+- gui->if_descent = gui->indexfont->descent;
+- }
+-}
+-
+ static unsigned long
+ x_set_color(gui_t *gui, char *color_name)
+ {
+@@ -131,7 +64,6 @@
+ gui->display_width = DisplayWidth(gui->display, gui->screen);
+ gui->display_height = DisplayHeight(gui->display, gui->screen);
+ gui->root = RootWindow(gui->display, gui->screen);
+- x_set_font(gui, xc->fontset, xc->indexfont);
+
+ gui->fg_color = x_set_color(gui, xc->fg_color);
+ gui->bg_color = x_set_color(gui, xc->bg_color);
+@@ -153,6 +85,52 @@
+
+ ----------------------------------------------------------------------------*/
+
++XFontSet
++gui_create_fontset(gui_t *gui, char *base_font, int *ef_width,
++ int *ef_height, int *ef_ascent, int verbose)
++{
++ int charset_count=0, i, fsize;
++ char **charset_list=NULL;
++ char *def_string=NULL;
++ XFontSet fontset=(XFontSet)NULL;
++ XFontStruct **font_structs;
++
++ if (! base_font)
++ return (XFontSet)NULL;
++
++ fontset = XCreateFontSet(gui->display, base_font,
++ &charset_list, &charset_count, &def_string);
++ if (charset_count || ! fontset) {
++ for (i=0; i<charset_count; i++) {
++ if (verbose)
++ perr(XCINMSG_WARNING, "invalid font %s.\n", charset_list[i]);
++ XFree(charset_list[i]);
++ }
++ if (charset_list)
++ XFree(charset_list);
++ if (fontset)
++ XFreeFontSet(gui->display, fontset);
++ return (XFontSet)NULL;
++ }
++
++ charset_count = XFontsOfFontSet(fontset, &font_structs, &charset_list);
++ *ef_width = 0;
++ *ef_height = 0;
++ *ef_ascent = 0;
++
++ for (i=0; i<charset_count; i++) {
++ fsize = font_structs[i]->max_bounds.width / 2;
++ if (fsize > *ef_width)
++ *ef_width = fsize;
++ fsize = font_structs[i]->ascent + font_structs[i]->descent;
++ if (fsize > *ef_height) {
++ *ef_height = fsize;
++ *ef_ascent = font_structs[i]->ascent;
++ }
++ }
++ return fontset;
++}
++
+ void
+ gui_freewin(Window window)
+ {
+@@ -176,6 +154,7 @@
+
+ if (w->winmap != (byte_t)-1) {
+ w->winmap = (byte_t)-1;
++ XUnmapWindow(xccore->gui.display, w->window);
+ if (w->win_destroy_func)
+ w->win_destroy_func(&(xccore->gui), w);
+ else
+@@ -191,31 +170,19 @@
return;
if (state) {
-- if (! win-&gt;winmap) {
-+ if (win-&gt;winmap == (ubyte_t)0) {
- XMapWindow(gui-&gt;display, win-&gt;window);
- win-&gt;winmap = (byte_t)1;
+- if (! win->winmap) {
++ if (win->winmap == (ubyte_t)0) {
+ XMapWindow(gui->display, win->window);
+ win->winmap = (byte_t)1;
}
}
else {
-- if (win-&gt;winmap) {
-+ if (win-&gt;winmap == (ubyte_t)1) {
- XUnmapWindow(gui-&gt;display, win-&gt;window);
- win-&gt;winmap = (byte_t)0;
+- if (win->winmap) {
++ if (win->winmap == (ubyte_t)1) {
+ XUnmapWindow(gui->display, win->window);
+ win->winmap = (byte_t)0;
}
}
}
@@ -46,8 +243,8 @@
- winlist_t *w;
- int i;
-
-- for (i=0; i&lt;greqw-&gt;n_greq; i++) {
-- w = (winlist_t *)(greqw-&gt;win[i]);
+- for (i=0; i<greqw->n_greq; i++) {
+- w = (winlist_t *)(greqw->win[i]);
- gui_winmap_change(gui, w, state);
- }
-}
@@ -55,30 +252,30 @@
void
gui_greq_win_destroy(greq_win_t *greqw)
{
-@@ -229,22 +217,6 @@
+@@ -229,22 +196,6 @@
}
void
-gui_overspot_winmap_change(gui_t *gui, int imid, int state)
-{
-- winlist_t *w = xccore-&gt;win;
+- winlist_t *w = xccore->win;
-
- while (w) {
-- if (w-&gt;imid == imid &amp;&amp; w-&gt;wid == WID_OVERSPOT) {
+- if (w->imid == imid && w->wid == WID_OVERSPOT) {
- gui_winmap_change(gui, w, state);
- if (state == 1)
-- XRaiseWindow(gui-&gt;display, w-&gt;window);
+- XRaiseWindow(gui->display, w->window);
- break;
- }
-- w = w-&gt;next;
+- w = w->next;
- }
-}
-
-void
gui_overspot_destroy(int imid)
{
- winlist_t *w = xccore-&gt;win;
-@@ -351,6 +323,20 @@
+ winlist_t *w = xccore->win;
+@@ -351,6 +302,20 @@
return win;
}
@@ -88,205 +285,1313 @@
+ winlist_t *w;
+ int i;
+
-+ for (i=0; i&lt;greqw-&gt;n_greq; i++) {
-+ w = (winlist_t *)(greqw-&gt;win[i]);
++ for (i=0; i<greqw->n_greq; i++) {
++ w = (winlist_t *)(greqw->win[i]);
+ gui_winmap_change(gui, w, state);
+ if (state)
-+ w-&gt;win_draw_func(&amp;(xccore-&gt;gui), w);
++ w->win_draw_func(&(xccore->gui), w);
+ }
+}
+
static void
update_gui_request(void)
{
-@@ -360,6 +346,13 @@
+@@ -360,6 +325,13 @@
greq_win_t gw_handling;
int i, j;
-+ if ((xccore-&gt;gui.winchange &amp; WIN_CHANGE_FOCUS) &amp;&amp; xccore-&gt;icp) {
-+ greq_win_t *greqw = &amp;(xccore-&gt;icp-&gt;imc-&gt;gwin);
-+ for (i=0; i&lt;greqw-&gt;n_greq; i++) {
-+ win = (winlist_t *)(greqw-&gt;win[i]);
-+ gui_winmap_change(&amp;(xccore-&gt;gui), win, 0);
++ if ((xccore->gui.winchange & WIN_CHANGE_FOCUS) && xccore->icp) {
++ greq_win_t *greqw = &(xccore->icp->imc->gwin);
++ for (i=0; i<greqw->n_greq; i++) {
++ win = (winlist_t *)(greqw->win[i]);
++ gui_winmap_change(&(xccore->gui), win, 0);
+ }
+ }
- if (! greqd &amp;&amp; imc-&gt;gwin.n_greq == 0)
+ if (! greqd && imc->gwin.n_greq == 0)
return;
-@@ -384,14 +377,11 @@
- gw_handling.win[gw_handling.n_greq] = imc-&gt;gwin.win[i];
+@@ -384,14 +356,11 @@
+ gw_handling.win[gw_handling.n_greq] = imc->gwin.win[i];
(gw_handling.n_greq) ++;
-- if ((win = search_winlist(xccore-&gt;win, WID_GUIREQ,
-- imc-&gt;id, greqd-&gt;reqid)))
-- win-&gt;win_draw_func(&amp;(xccore-&gt;gui), win);
+- if ((win = search_winlist(xccore->win, WID_GUIREQ,
+- imc->id, greqd->reqid)))
+- win->win_draw_func(&(xccore->gui), win);
- else {
- if ((win=gui_request_init(imc, greqd))) {
-- xccore-&gt;win_end-&gt;next = win;
-- xccore-&gt;win_end = win;
+- xccore->win_end->next = win;
+- xccore->win_end = win;
- }
-+ if (! search_winlist(xccore-&gt;win,
-+ WID_GUIREQ, imc-&gt;id, greqd-&gt;reqid) &amp;&amp;
++ if (! search_winlist(xccore->win,
++ WID_GUIREQ, imc->id, greqd->reqid) &&
+ (win=gui_request_init(imc, greqd))) {
-+ xccore-&gt;win_end-&gt;next = win;
-+ xccore-&gt;win_end = win;
++ xccore->win_end->next = win;
++ xccore->win_end = win;
}
}
- greqd = greqd-&gt;next;
-@@ -407,15 +397,13 @@
+ greqd = greqd->next;
+@@ -407,15 +376,11 @@
}
- memcpy(&amp;(imc-&gt;gwin), &amp;(gw_handling), sizeof(greq_win_t));
+ memcpy(&(imc->gwin), &(gw_handling), sizeof(greq_win_t));
-- if ((xccore-&gt;xcin_mode &amp; XCIN_SINGLE_IMC)) {
-+// if ((xccore-&gt;xcin_mode &amp; XCIN_SINGLE_IMC)) {
- if (! xccore-&gt;ic || !(xccore-&gt;ic-&gt;imc-&gt;inp_state &amp; IM_CINPUT) ||
-- !(xccore-&gt;ic-&gt;imc-&gt;inp_state &amp; IM_XIMFOCUS)) {
-- gui_greq_winmap_change(&amp;(xccore-&gt;gui), &amp;(imc-&gt;gwin), 0);
+- if ((xccore->xcin_mode & XCIN_SINGLE_IMC)) {
+- if (! xccore->ic || !(xccore->ic->imc->inp_state & IM_CINPUT) ||
+- !(xccore->ic->imc->inp_state & IM_XIMFOCUS)) {
+- gui_greq_winmap_change(&(xccore->gui), &(imc->gwin), 0);
- return;
- }
-+ !(xccore-&gt;ic-&gt;imc-&gt;inp_state &amp; IM_XIMFOCUS))
-+ gui_greq_windraw(&amp;(xccore-&gt;gui), &amp;(imc-&gt;gwin), 0);
- else
-- gui_greq_winmap_change(&amp;(xccore-&gt;gui), &amp;(imc-&gt;gwin), 1);
+- else
+- gui_greq_winmap_change(&(xccore->gui), &(imc->gwin), 1);
- }
-+ gui_greq_windraw(&amp;(xccore-&gt;gui), &amp;(imc-&gt;gwin), 1);
-+// }
++ if (! xccore->ic || !(xccore->ic->imc->inp_state & IM_CINPUT) ||
++ !(xccore->ic->imc->inp_state & IM_XIMFOCUS))
++ gui_greq_windraw(&(xccore->gui), &(imc->gwin), 0);
++ else
++ gui_greq_windraw(&(xccore->gui), &(imc->gwin), 1);
}
/*--------------------------------------------------------------------------*/
-@@ -425,16 +413,17 @@
+@@ -425,17 +390,18 @@
update_gui_overspot(void)
{
winlist_t *win;
-- IC *ic = xccore-&gt;ic;
-+ IC *ic = xccore-&gt;ic, *icp = xccore-&gt;icp;
-
-- if (ic-&gt;imc-&gt;pre_attr == NULL)
-- ic-&gt;imc-&gt;pre_attr = &amp;(ic-&gt;pre_attr);
-- if (ic-&gt;imc-&gt;sts_attr == NULL)
-- ic-&gt;imc-&gt;sts_attr = &amp;(ic-&gt;sts_attr);
-+ if ((xccore-&gt;gui.winchange &amp; WIN_CHANGE_FOCUS) &amp;&amp; icp &amp;&amp;
-+ (win = search_winlist(xccore-&gt;win, WID_OVERSPOT, icp-&gt;imc-&gt;id, 0)))
-+ gui_winmap_change(&amp;(xccore-&gt;gui), win, 0);
-
- if ((win = search_winlist(xccore-&gt;win, WID_OVERSPOT, ic-&gt;imc-&gt;id, 0)))
- win-&gt;win_draw_func(&amp;(xccore-&gt;gui), win);
+- IC *ic = xccore->ic;
++ IC *ic = xccore->ic, *icp = xccore->icp;
+
+- if (ic->imc->pre_attr == NULL)
+- ic->imc->pre_attr = &(ic->pre_attr);
+- if (ic->imc->sts_attr == NULL)
+- ic->imc->sts_attr = &(ic->sts_attr);
++ if ((xccore->gui.winchange & WIN_CHANGE_FOCUS) && icp &&
++ (win = search_winlist(xccore->win, WID_OVERSPOT, icp->imc->id, 0)))
++ gui_winmap_change(&(xccore->gui), win, 0);
+
+ if ((win = search_winlist(xccore->win, WID_OVERSPOT, ic->imc->id, 0)))
+ win->win_draw_func(&(xccore->gui), win);
else {
-+ ic-&gt;imc-&gt;pre_attr = &amp;(ic-&gt;pre_attr);
-+ ic-&gt;imc-&gt;sts_attr = &amp;(ic-&gt;sts_attr);
- win = gui_overspot_init(&amp;(xccore-&gt;gui), xccore-&gt;main_win, ic-&gt;imc);
- xccore-&gt;win_end-&gt;next = win;
- xccore-&gt;win_end = win;
+- win = gui_overspot_init(&(xccore->gui), xccore->main_win, ic->imc);
++ ic->imc->ic_rec = &(ic->ic_rec);
++ win = gui_overspot_init(&(xccore->gui), xccore->main_win, ic->imc,
++ (xccore->xcin_mode & XCIN_OVERSPOT_AREA3));
+ xccore->win_end->next = win;
+ xccore->win_end = win;
+ }
+@@ -454,7 +420,7 @@
+ if (xccore->ic) {
+ update_gui_request();
+
+- if (xccore->ic->input_style == XIMSTY_OverSpot)
++ if (xccore->ic->ic_rec.input_style == XIMSTY_OverSpot)
+ update_gui_overspot();
+ }
+ xccore->gui.winchange = 0;
+--- src/gui_main.c.orig Wed Feb 23 09:47:57 2000
++++ src/gui_main.c Mon Mar 6 08:48:05 2000
+@@ -46,6 +46,8 @@
+ GC gcm; /* For spot mark: mfg_color, mbg_color */
+ GC gcrm; /* For keystroke area background: mbg_color */
+ GC gcline; /* For underline mark: uline_color */
++
++ XFontStruct *indexfont;
+ } xcin_main_win_t;
+
+ static xcin_main_win_t xmw;
+@@ -58,7 +60,8 @@
+ ----------------------------------------------------------------------------*/
+
+ static void
+-inpstate_content(gui_t *gui, IC *ic, xmode_t xcin_mode, inp_state_t inp_state)
++inpstate_content(gui_t *gui, winlist_t *win,
++ IC *ic, xmode_t xcin_mode, inp_state_t inp_state)
+ {
+ char *inpn, *inpb, *str;
+
+@@ -70,11 +73,11 @@
+ snprintf(xmw.s_inpname, CIN_CNAME_LENGTH*2, "[%s][%s]", inpn, inpb);
+ xmw.w_inpname.x = FIELD_STEP;
+ xmw.w_inpname.width = XmbTextEscapement(
+- gui->fontset, xmw.s_inpname, strlen(xmw.s_inpname));
++ win->fontset, xmw.s_inpname, strlen(xmw.s_inpname));
+ if (! ic)
+ return;
+
+- xmw.w_coding.width = ic->imc->inpinfo.area3_len * gui->ef_width;
++ xmw.w_coding.width = ic->imc->inpinfo.area3_len * win->ef_width;
+ xmw.w_coding.x = 2*FIELD_STEP + xmw.w_inpname.x + xmw.w_inpname.width;
+ xmw.w_show_coding.x = 2*FIELD_STEP + xmw.w_coding.x + xmw.w_coding.width;
+
+@@ -85,12 +88,12 @@
+ else
+ snprintf(xmw.e_inpname, CIN_ENAME_LENGTH,
+ "*%s", ic->imc->inpinfo.inp_ename);
+- xmw.w_e_inpname.width = XTextWidth(gui->indexfont, str, strlen(str));
++ xmw.w_e_inpname.width = XTextWidth(xmw.indexfont, str, strlen(str));
+ }
+ }
+
+ static void
+-win_draw_multich(gui_t *gui, Window window, inpinfo_t *inpinfo)
++win_draw_multich(gui_t *gui, winlist_t *win, inpinfo_t *inpinfo)
+ {
+ int i, j, n_groups, n, x, y, len=0;
+ byte_t toggle_flag;
+@@ -101,7 +104,7 @@
+ if ((cch = inpinfo->mcch) == NULL)
+ return;
+ x = FIELD_STEP;
+- y = gui->ef_ascent;
++ y = win->ef_ascent;
+ selkey = inpinfo->s_selkey;
+ spot_gc = ((inpinfo->guimode & GUIMOD_SELKEYSPOT)) ? xmw.gcm : xmw.gc;
+ if (! inpinfo->mcch_grouping || inpinfo->mcch_grouping[0]==0) {
+@@ -116,18 +119,18 @@
+ for (i=0; i<n_groups && toggle_flag!=-1; i++, selkey++) {
+ n = (toggle_flag > 0) ? inpinfo->mcch_grouping[i+1] : 1;
+ if ((len = strlen(selkey->s))) {
+- XmbDrawImageString(gui->display, window,
+- gui->fontset, spot_gc, x, y, selkey->s, len);
+- x += (XmbTextEscapement(gui->fontset, selkey->s, len) + 5);
++ XmbDrawImageString(gui->display, win->window,
++ win->fontset, spot_gc, x, y, selkey->s, len);
++ x += (XmbTextEscapement(win->fontset, selkey->s, len) + 5);
+ }
+ for (j=0; j<n; j++, cch++) {
+ if (! (len = strlen(cch->s))) {
+ toggle_flag = -1;
+ break;
+ }
+- XmbDrawImageString(gui->display, window,
+- gui->fontset, xmw.gc, x, y, cch->s, len);
+- x += XmbTextEscapement(gui->fontset, cch->s, len);
++ XmbDrawImageString(gui->display, win->window,
++ win->fontset, xmw.gc, x, y, cch->s, len);
++ x += XmbTextEscapement(win->fontset, cch->s, len);
+ }
+ x += FIELD_STEP;
+ }
+@@ -150,12 +153,12 @@
+ break;
+ }
+ if (pgstate)
+- XmbDrawImageString(gui->display, window,
+- gui->fontset, xmw.gc, x, y, pgstate, len);
++ XmbDrawImageString(gui->display, win->window,
++ win->fontset, xmw.gc, x, y, pgstate, len);
+ }
+
+ static void
+-draw_lcch_grouping(gui_t *gui, Window window,
++draw_lcch_grouping(gui_t *gui, winlist_t *win,
+ wch_t *lcch, int n, ubyte_t *glist)
+ {
+ int i, x1, x2, y, n_cch=0, n_seg;
+@@ -163,7 +166,7 @@
+ wch_t tmpch;
+
+ x1 = FIELD_STEP;
+- y = gui->ef_height+1;
++ y = win->ef_height+1;
+ for (i=0; i<n; i++) {
+ n_seg = glist[i];
+
+@@ -172,16 +175,16 @@
+ wchs_to_mbs(str, lcch+n_cch, 65);
+ lcch[n_cch+n_seg].wch = tmpch.wch;
+
+- x2 = x1 + XmbTextEscapement(gui->fontset, str, strlen(str));
++ x2 = x1 + XmbTextEscapement(win->fontset, str, strlen(str));
+ if (n_seg > 1)
+- XDrawLine(gui->display, window, xmw.gcline, x1+2, y, x2-5, y);
++ XDrawLine(gui->display, win->window, xmw.gcline, x1+2, y, x2-5, y);
+ x1 = x2;
+ n_cch += n_seg;
+ }
+ }
+
+ static void
+-win_draw_listcch(gui_t *gui, Window window, inpinfo_t *inpinfo)
++win_draw_listcch(gui_t *gui, winlist_t *win, inpinfo_t *inpinfo)
+ {
+ int x, y, edit_pos, len;
+ wch_t tmp;
+@@ -191,10 +194,10 @@
+ if (! inpinfo->lcch)
+ return;
+ if (inpinfo->lcch_grouping)
+- draw_lcch_grouping(gui, window, inpinfo->lcch,
++ draw_lcch_grouping(gui, win, inpinfo->lcch,
+ inpinfo->lcch_grouping[0], inpinfo->lcch_grouping+1);
+ x = FIELD_STEP;
+- y = gui->ef_ascent;
++ y = win->ef_ascent;
+ len = WCH_SIZE * inpinfo->n_lcch;
+
+ if (len >= str_size) {
+@@ -212,20 +215,20 @@
+ if (edit_pos > 0) {
+ wchs_to_mbs(str, inpinfo->lcch, str_size);
+ len = strlen(str);
+- XmbDrawImageString(gui->display, window,
+- gui->fontset, xmw.gc, x, y, str, len);
+- x += XmbTextEscapement(gui->fontset, str, len);
++ XmbDrawImageString(gui->display, win->window,
++ win->fontset, xmw.gc, x, y, str, len);
++ x += XmbTextEscapement(win->fontset, str, len);
+ }
+
+ len = strlen(tmp.s);
+- XmbDrawImageString(gui->display, window,
+- gui->fontset, xmw.gcm, x, y, tmp.s, len);
+- x += XmbTextEscapement(gui->fontset, str, len);
++ XmbDrawImageString(gui->display, win->window,
++ win->fontset, xmw.gcm, x, y, tmp.s, len);
++ x += XmbTextEscapement(win->fontset, str, len);
+
+ if (edit_pos < inpinfo->n_lcch - 1) {
+ wchs_to_mbs(str, inpinfo->lcch+edit_pos+1, str_size);
+- XmbDrawImageString(gui->display, window,
+- gui->fontset, xmw.gc, x, y, str, strlen(str));
++ XmbDrawImageString(gui->display, win->window,
++ win->fontset, xmw.gc, x, y, str, strlen(str));
+ }
+ inpinfo->lcch[edit_pos].wch = tmp.wch;
+ }
+@@ -233,14 +236,14 @@
+ wchs_to_mbs(str, inpinfo->lcch, str_size);
+ len = strlen(str);
+ if (len) {
+- XmbDrawImageString(gui->display, window,
+- gui->fontset, xmw.gc, x, y, str, len);
+- x += XmbTextEscapement(gui->fontset, str, len);
++ XmbDrawImageString(gui->display, win->window,
++ win->fontset, xmw.gc, x, y, str, len);
++ x += XmbTextEscapement(win->fontset, str, len);
+ }
+ else
+ x = FIELD_STEP;
+- XFillRectangle(gui->display, window, xmw.gcrm,
+- x, 0, gui->ef_width, gui->ef_height);
++ XFillRectangle(gui->display, win->window, xmw.gcrm,
++ x, 0, win->ef_width, win->ef_height);
+ }
+ }
+
+@@ -254,35 +257,37 @@
+ if ((gui->winchange & WIN_CHANGE_IM)) {
+ XClearWindow(gui->display, win->window);
+ if ((gui->winchange & WIN_CHANGE_IM) == WIN_CHANGE_IM)
+- inpstate_content(gui, ic, xcin_mode, inp_state);
++ inpstate_content(gui, win, ic, xcin_mode, inp_state);
+ }
+
+ /* Draw area 2. */
+ x = xmw.w_inpname.x;
+- y = gui->ef_height + gui->ef_ascent + 5;
++ y = (win->c_height == 1) ? win->ef_ascent + 5:
++ win->ef_height + win->ef_ascent + 5;
+ str = xmw.s_inpname;
+ XmbDrawImageString(gui->display, win->window,
+- gui->fontset, xmw.gc, x, y, str, strlen(str));
++ win->fontset, xmw.gc, x, y, str, strlen(str));
+
+ if (ic && (ic->imc->inp_state & IM_CINPUT) &&
+ (ic->imc->inp_state & IM_XIMFOCUS)) {
+ IM_Context_t *imc = ic->imc;
+ /* Draw area 1. */
+ if ((imc->inpinfo.guimode & GUIMOD_LISTCHAR))
+- win_draw_listcch(gui, win->window, &(imc->inpinfo));
++ win_draw_listcch(gui, win, &(imc->inpinfo));
+ else if (imc->inpinfo.n_mcch > 0) {
+- if (ic->input_style == XIMSTY_Root)
+- win_draw_multich(gui, win->window, &(imc->inpinfo));
++ if (ic->ic_rec.input_style == XIMSTY_Root)
++ win_draw_multich(gui, win, &(imc->inpinfo));
+ }
+
+ /* Draw area 3. */
+- if (ic->input_style == XIMSTY_Root) {
++ if (ic->ic_rec.input_style == XIMSTY_Root ||
++ ! (xcin_mode & XCIN_OVERSPOT_AREA3)) {
+ x = xmw.w_coding.x;
+ XFillRectangle(gui->display, win->window, xmw.gcrm, x,
+- y-gui->ef_ascent, xmw.w_coding.width, gui->ef_height);
++ y-win->ef_ascent, xmw.w_coding.width, win->ef_height);
+ if (wchs_to_mbs(buf, imc->inpinfo.s_keystroke, 256))
+ XmbDrawImageString(gui->display, win->window,
+- gui->fontset, xmw.gcm, x, y, buf, strlen(buf));
++ win->fontset, xmw.gcm, x, y, buf, strlen(buf));
+ }
+
+ /* Draw area 4. */
+@@ -295,12 +300,12 @@
+ wchs_to_mbs(str, imc->sinmd_keystroke, 256-slen)) {
+ if ((imc->inpinfo.guimode & GUIMOD_SINMDLINE1)) {
+ x = FIELD_STEP;
+- y = gui->ef_ascent;
++ y = win->ef_ascent;
+ }
+ else
+ x = xmw.w_show_coding.x;
+ XmbDrawImageString(gui->display, win->window,
+- gui->fontset, xmw.gc, x, y, buf, strlen(buf));
++ win->fontset, xmw.gc, x, y, buf, strlen(buf));
+ }
+ }
+
+@@ -308,7 +313,7 @@
+ str = xmw.e_inpname;
+ if (str[0]) {
+ x = win->width - FIELD_STEP - xmw.w_e_inpname.width;
+- y = win->height - gui->if_descent;
++ y = win->height - xmw.indexfont->descent;
+ XDrawString(gui->display, win->window,
+ xmw.gce, x, y, str, strlen(str));
+ }
+@@ -362,7 +367,7 @@
+ win->pos_y = event->y;
+ }
+ win->width = event->width;
+- win->c_width = win->width / gui->ef_width;
++ win->c_width = win->width / win->ef_width;
+ }
+
+ static void
+@@ -394,10 +399,8 @@
+ win->c_width = MIN_WIN_WIDTH;
+ if ((r & WidthValue))
+ win->c_width = (width < MIN_WIN_WIDTH) ? MIN_WIN_WIDTH : width;
+- win->c_height = 2;
+
+- win->width = win->c_width * gui->ef_width;
+- win->height = win->c_height * gui->ef_height + 5;
++ win->width = win->c_width * win->ef_width;
+ if (win->pos_x < 0) {
+ win->pos_x += (gui->display_width - win->width);
+ *negx = 1;
+@@ -427,11 +430,11 @@
+ size_hints.y = win->pos_y;
+ size_hints.width = win->width;
+ size_hints.height = win->height;
+- size_hints.min_width = MIN_WIN_WIDTH * gui->ef_width;
+- size_hints.max_width = MAX_WIN_WIDTH * gui->ef_width;
++ size_hints.min_width = MIN_WIN_WIDTH * win->ef_width;
++ size_hints.max_width = MAX_WIN_WIDTH * win->ef_width;
+ size_hints.min_height = win->height;
+ size_hints.max_height = size_hints.min_height;
+- size_hints.width_inc = gui->ef_width * 2;
++ size_hints.width_inc = win->ef_width * 2;
+ size_hints.height_inc = 0;
+ if (negative_x)
+ size_hints.win_gravity =
+@@ -464,7 +467,7 @@
+ xmw.gce = XCreateGC(gui->display, window, 0, NULL);
+ XSetForeground(gui->display, xmw.gce, gui->fg_color);
+ XSetBackground(gui->display, xmw.gce, gui->bg_color);
+- XSetFont(gui->display, xmw.gce, gui->indexfont->fid);
++ XSetFont(gui->display, xmw.gce, xmw.indexfont->fid);
+
+ xmw.gcm = XCreateGC(gui->display, window, 0, NULL);
+ XSetForeground(gui->display, xmw.gcm, gui->mfg_color);
+@@ -486,6 +489,7 @@
+ winlist_t *win;
+ Bool negative_x=0, negative_y=0;
+
++/* Initially Setup */
+ xmw.inpn_english = strdup(xc->inpn_english);
+ xmw.inpn_sbyte = strdup(xc->inpn_sbyte);
+ xmw.inpn_2bytes = strdup(xc->inpn_2bytes);
+@@ -495,7 +499,21 @@
+ win->imid = 0;
+ win->reqid = 0;
+ win->winmap = (ubyte_t)0;
++
++/* Create Font & FontSet */
++ win->fontset = gui_create_fontset(gui, xc->fontset, &(win->ef_width),
++ &(win->ef_height), &(win->ef_ascent), 1);
++ if (! win->fontset)
++ perr(XCINMSG_ERROR, "fontset setting error.\n");
++ if (! (xmw.indexfont = XLoadQueryFont(gui->display, xc->indexfont)))
++ perr(XCINMSG_ERROR, "invalid INDEX_FONT: %s\n", xc->indexfont);
++
++/* Window Geometry */
++ win->c_height = 2;
++ win->height = 2 * win->ef_height + 5;
+ x_set_geometry(gui, win, xc->geometry, &negative_x, &negative_y);
++
++/* Winlist Setup */
+ win->window = XCreateSimpleWindow(gui->display, gui->root,
+ win->pos_x, win->pos_y, win->width, win->height, 1,
+ gui->fg_color, gui->bg_color);
+@@ -505,6 +523,7 @@
+ win->win_destroy_func = xcin_mainwin_destroy;
+ win->next = NULL;
+
++/* Window Manager Property Setup */
+ set_wm_property(gui, win, negative_x, negative_y);
+ set_GC(gui, win->window);
+ XSelectInput(gui->display, win->window, (ExposureMask|StructureNotifyMask));
+@@ -515,5 +534,4 @@
+ gui_winmap_change(gui, win, 1);
+ return win;
+ }
+-
+
--- src/gui_menusel.c.orig Wed Feb 23 09:47:57 2000
-+++ src/gui_menusel.c Thu Feb 24 01:55:36 2000
-@@ -246,18 +246,21 @@
- XSetWMProtocols(gui-&gt;display, win-&gt;window, &amp;(gui-&gt;wm_del_win), 1);
++++ src/gui_menusel.c Mon Mar 6 08:48:05 2000
+@@ -85,13 +85,13 @@
+ for (i=0, h1=info->head_item;
+ i<win->c_height && h1<=info->n_item; i++, h1++) {
+ wchs_to_mbs(buf, info->item[h1-1].title, 256);
+- len = XmbTextEscapement(gui->fontset, buf, strlen(buf));
++ len = XmbTextEscapement(win->fontset, buf, strlen(buf));
+ if (max_len < len)
+ max_len = len;
+
+- y = i*(gui->ef_height+LINE_STEP) + gui->ef_ascent + LINE_STEP/2;
++ y = i*(win->ef_height+LINE_STEP) + win->ef_ascent + LINE_STEP/2;
+ gc = (h1 == info->focus_item) ? msw.gcm : msw.gc;
+- XmbDrawImageString(gui->display, win->window, gui->fontset,
++ XmbDrawImageString(gui->display, win->window, win->fontset,
+ gc, FIELD_STEP, y, buf, strlen(buf));
+ }
+
+@@ -99,7 +99,7 @@
+ * Draw the grid lines.
+ */
+ for (i=1; i<win->c_height; i++) {
+- y = i * (gui->ef_height+LINE_STEP);
++ y = i * (win->ef_height+LINE_STEP);
+ XDrawLine(gui->display, win->window, msw.gcline, 1, y, win->width, y);
+ }
+ x = max_len + FIELD_STEP*2;
+@@ -124,7 +124,7 @@
+
+ if (! info->item[h1-1].elements)
+ continue;
+- y = i*(gui->ef_height+LINE_STEP) + gui->ef_ascent + LINE_STEP/2;
++ y = i*(win->ef_height+LINE_STEP) + win->ef_ascent + LINE_STEP/2;
+ n_elem = (info->item[h1-1].elem_group) ?
+ info->item[h1-1].elem_group[0] : info->item[h1-1].n_elem;
+
+@@ -139,15 +139,15 @@
+ get_elem(buf, 256, h2, info->item[h1-1].elements,
+ info->item[h1-1].elem_group, selkeys);
+ len = strlen(buf);
+- max_len = XmbTextEscapement(gui->fontset, selkeys+j, 1);
+- max_len2 = XmbTextEscapement(gui->fontset, buf, len);
++ max_len = XmbTextEscapement(win->fontset, selkeys+j, 1);
++ max_len2 = XmbTextEscapement(win->fontset, buf, len);
+ if (xx+max_len+max_len2+FIELD_STEP > win->width)
+ break;
+
+- XmbDrawImageString(gui->display, win->window, gui->fontset,
++ XmbDrawImageString(gui->display, win->window, win->fontset,
+ gc_sel, xx, y, selkeys+j, 1);
+ xx += (max_len + FIELD_STEP);
+- XmbDrawImageString(gui->display, win->window, gui->fontset,
++ XmbDrawImageString(gui->display, win->window, win->fontset,
+ gc, xx, y, buf, len);
+ xx += (max_len2 + FIELD_STEP*2);
+ }
+@@ -176,7 +176,7 @@
+ XConfigureEvent *event, int keep_flag)
+ {
+ win->width = event->width;
+- win->c_width = win->width / gui->ef_width;
++ win->c_width = win->width / win->ef_width;
+ }
+
+ static void
+@@ -196,11 +196,11 @@
+ size_hints.y = win->pos_y;
+ size_hints.width = win->width;
+ size_hints.height = win->height;
+- size_hints.min_width = MIN_WIN_WIDTH * gui->ef_width;
+- size_hints.max_width = MAX_WIN_WIDTH * gui->ef_width;
++ size_hints.min_width = MIN_WIN_WIDTH * win->ef_width;
++ size_hints.max_width = MAX_WIN_WIDTH * win->ef_width;
+ size_hints.min_height = win->height;
+ size_hints.max_height = win->height;
+- size_hints.width_inc = gui->ef_width;
++ size_hints.width_inc = win->ef_width;
+ size_hints.height_inc = 0;
+
+ wm_hints.flags = InputHint | StateHint;
+@@ -224,10 +224,14 @@
+ win->reqid = greqd->reqid;
+ win->winmap = (ubyte_t)0;
+
++ win->fontset = main_win->fontset;
++ win->ef_width = main_win->ef_width;
++ win->ef_height = main_win->ef_height;
++ win->ef_ascent = main_win->ef_ascent;
+ win->c_width = main_win->c_width;
+ win->c_height = (info->n_item<=MENUSEL_NROW) ? info->n_item : MENUSEL_NROW;
+ win->width = main_win->width;
+- win->height = win->c_height * (gui->ef_height + LINE_STEP);
++ win->height = win->c_height * (win->ef_height + LINE_STEP);
+ win->pos_x = main_win->pos_x;
+ win->pos_y = main_win->pos_y - win->height - 10*FIELD_STEP;
+ if (win->pos_y <= 0)
+@@ -246,18 +250,21 @@
+ XSetWMProtocols(gui->display, win->window, &(gui->wm_del_win), 1);
/* Setup GC */
-- msw.gc = XCreateGC(gui-&gt;display, win-&gt;window, 0, NULL);
-- XSetForeground(gui-&gt;display, msw.gc, gui-&gt;fg_color);
-- XSetBackground(gui-&gt;display, msw.gc, gui-&gt;bg_color);
+- msw.gc = XCreateGC(gui->display, win->window, 0, NULL);
+- XSetForeground(gui->display, msw.gc, gui->fg_color);
+- XSetBackground(gui->display, msw.gc, gui->bg_color);
-
-- msw.gcm = XCreateGC(gui-&gt;display, win-&gt;window, 0, NULL);
-- XSetForeground(gui-&gt;display, msw.gcm, gui-&gt;fg_color);
-- XSetBackground(gui-&gt;display, msw.gcm, gui-&gt;mbg_color);
+- msw.gcm = XCreateGC(gui->display, win->window, 0, NULL);
+- XSetForeground(gui->display, msw.gcm, gui->fg_color);
+- XSetBackground(gui->display, msw.gcm, gui->mbg_color);
-
-- msw.gcline = XCreateGC(gui-&gt;display, win-&gt;window, 0, NULL);
-- XSetForeground(gui-&gt;display, msw.gcline, gui-&gt;grid_color);
-- XSetBackground(gui-&gt;display, msw.gcline, gui-&gt;bg_color);
+- msw.gcline = XCreateGC(gui->display, win->window, 0, NULL);
+- XSetForeground(gui->display, msw.gcline, gui->grid_color);
+- XSetBackground(gui->display, msw.gcline, gui->bg_color);
-
+ if (msw.gc == (GC)0) {
-+ msw.gc = XCreateGC(gui-&gt;display, win-&gt;window, 0, NULL);
-+ XSetForeground(gui-&gt;display, msw.gc, gui-&gt;fg_color);
-+ XSetBackground(gui-&gt;display, msw.gc, gui-&gt;bg_color);
++ msw.gc = XCreateGC(gui->display, win->window, 0, NULL);
++ XSetForeground(gui->display, msw.gc, gui->fg_color);
++ XSetBackground(gui->display, msw.gc, gui->bg_color);
+ }
+ if (msw.gcm == (GC)0) {
-+ msw.gcm = XCreateGC(gui-&gt;display, win-&gt;window, 0, NULL);
-+ XSetForeground(gui-&gt;display, msw.gcm, gui-&gt;fg_color);
-+ XSetBackground(gui-&gt;display, msw.gcm, gui-&gt;mbg_color);
++ msw.gcm = XCreateGC(gui->display, win->window, 0, NULL);
++ XSetForeground(gui->display, msw.gcm, gui->fg_color);
++ XSetBackground(gui->display, msw.gcm, gui->mbg_color);
+ }
+ if (msw.gcline == (GC)0) {
-+ msw.gcline = XCreateGC(gui-&gt;display, win-&gt;window, 0, NULL);
-+ XSetForeground(gui-&gt;display, msw.gcline, gui-&gt;grid_color);
-+ XSetBackground(gui-&gt;display, msw.gcline, gui-&gt;bg_color);
++ msw.gcline = XCreateGC(gui->display, win->window, 0, NULL);
++ XSetForeground(gui->display, msw.gcline, gui->grid_color);
++ XSetBackground(gui->display, msw.gcline, gui->bg_color);
+ }
gui_winmap_change(gui, win, 1);
gui_menusel_draw(gui, win);
return win;
--- src/gui_overspot.c.orig Wed Feb 23 09:47:57 2000
-+++ src/gui_overspot.c Thu Feb 24 01:55:36 2000
-@@ -175,8 +175,7 @@
- if ((imc-&gt;inp_state &amp; IM_XIMFOCUS) &amp;&amp; (imc-&gt;inp_state &amp; IM_CINPUT) &amp;&amp;
- (imc-&gt;inpinfo.n_mcch &gt; 0 ||
- (imc-&gt;inpinfo.s_keystroke &amp;&amp; imc-&gt;inpinfo.s_keystroke[0].wch))) {
-- if (! win-&gt;winmap)
-- XRaiseWindow(gui-&gt;display, win-&gt;window);
-+ XRaiseWindow(gui-&gt;display, win-&gt;window);
- overspot_win_location(gui, win, imc);
++++ src/gui_overspot.c Mon Mar 6 08:48:05 2000
+@@ -32,6 +32,7 @@
+ GC gc; /* Window fg_color, bg_color */
+ GC gcs; /* For multi-cch selection key */
+ GC gcm; /* For spot mark: mfg_color, mbg_color */
++ ubyte_t display_area3;
+ } overspot_win_t;
+
+ static overspot_win_t osw;
+@@ -44,37 +45,40 @@
+
+ static void
+ overspot_location(gui_t *gui, winlist_t *win,
+- IM_Context_t *imc, int *pos_x, int *pos_y)
++ ic_rec_t *ic_rec, int *pos_x, int *pos_y)
+ {
+ int new_x, new_y;
++ Window junkwin;
+
+- new_x = imc->pre_attr->spot_location.x + imc->pre_attr->area.x;
+- new_y = imc->pre_attr->spot_location.y + imc->pre_attr->area.y + 15;
+- if (new_x + win->width > gui->display_width)
+- new_x = gui->display_width - win->width;
+- if (new_y + win->height > gui->display_height)
+- new_y = gui->display_height - win->height;
+-
+- *pos_x = new_x;
+- *pos_y = new_y;
++ new_x = ic_rec->pre_attr.spot_location.x + ic_rec->pre_attr.area.x;
++ new_y = ic_rec->pre_attr.spot_location.y + ic_rec->pre_attr.area.y + 15;
++ XTranslateCoordinates(gui->display, ic_rec->focus_win, gui->root,
++ new_x, new_y, pos_x, pos_y, &junkwin);
++
++ if (*pos_x + win->width > gui->display_width)
++ *pos_x = gui->display_width - win->width;
++ if (*pos_y + win->height > gui->display_height)
++ *pos_y = *pos_y - 40 - win->height;
+ }
+
+ static void
+-overspot_win_location(gui_t *gui, winlist_t *win, IM_Context_t *imc)
++overspot_win_adjust(gui_t *gui, winlist_t *win, ic_rec_t *ic_rec, int winlen)
+ {
+ int new_x, new_y;
+
+- overspot_location(gui, win, imc, &new_x, &new_y);
+- if (new_x != win->pos_x || new_y != win->pos_y) {
++ overspot_location(gui, win, ic_rec, &new_x, &new_y);
++ if (new_x != win->pos_x || new_y != win->pos_y || winlen != win->width) {
+ win->pos_x = new_x;
+ win->pos_y = new_y;
+- XMoveWindow(gui->display, win->window, win->pos_x, win->pos_y);
++ win->width = winlen;
++ XMoveResizeWindow(gui->display, win->window,
++ win->pos_x, win->pos_y, win->width, win->height);
+ XRaiseWindow(gui->display, win->window);
+ }
+ }
+
+-static void
+-overspot_draw_multich(gui_t *gui, Window window, int x, inpinfo_t *inpinfo)
++static int
++overspot_draw_multich(gui_t *gui, winlist_t *win, int x, inpinfo_t *inpinfo)
+ {
+ int i, j, n_groups, n, y, len=0;
+ byte_t toggle_flag;
+@@ -83,8 +87,8 @@
+ GC spot_gc;
+
+ if ((cch = inpinfo->mcch) == NULL)
+- return;
+- y = gui->ef_ascent;
++ return 0;
++ y = win->ef_ascent;
+ selkey = inpinfo->s_selkey;
+ spot_gc = ((inpinfo->guimode & GUIMOD_SELKEYSPOT)) ? osw.gcm : osw.gcs;
+ if (! inpinfo->mcch_grouping || inpinfo->mcch_grouping[0]==0) {
+@@ -99,18 +103,18 @@
+ for (i=0; i<n_groups && toggle_flag!=-1; i++, selkey++) {
+ n = (toggle_flag > 0) ? inpinfo->mcch_grouping[i+1] : 1;
+ if ((len = strlen(selkey->s))) {
+- XmbDrawImageString(gui->display, window,
+- gui->fontset, spot_gc, x, y, selkey->s, len);
+- x += (XmbTextEscapement(gui->fontset, selkey->s, len) + 2);
++ XmbDrawImageString(gui->display, win->window,
++ win->fontset, spot_gc, x, y, selkey->s, len);
++ x += (XmbTextEscapement(win->fontset, selkey->s, len) + 2);
+ }
+ for (j=0; j<n; j++, cch++) {
+ if (! (len = strlen(cch->s))) {
+ toggle_flag = -1;
+ break;
+ }
+- XmbDrawImageString(gui->display, window,
+- gui->fontset, osw.gc, x, y, cch->s, len);
+- x += XmbTextEscapement(gui->fontset, cch->s, len);
++ XmbDrawImageString(gui->display, win->window,
++ win->fontset, osw.gc, x, y, cch->s, len);
++ x += XmbTextEscapement(win->fontset, cch->s, len);
+ }
+ x += FIELD_STEP;
+ }
+@@ -132,54 +136,59 @@
+ pgstate = NULL;
+ break;
+ }
+- if (pgstate)
+- XmbDrawImageString(gui->display, window,
+- gui->fontset, osw.gc, x, y, pgstate, len);
++ if (pgstate) {
++ XmbDrawImageString(gui->display, win->window,
++ win->fontset, osw.gc, x, y, pgstate, len);
++ x += XmbTextEscapement(win->fontset, pgstate, len);
++ }
++ return x;
+ }
+
+-static void
++static int
+ overspot_win_draw(gui_t *gui, winlist_t *win, IM_Context_t *imc)
+ {
++ int x;
+
+ if ((gui->winchange & WIN_CHANGE_IM))
+ XClearWindow(gui->display, win->window);
+
+ if ((imc->inpinfo.guimode & GUIMOD_SELKEYSPOT))
+- overspot_draw_multich(gui,win->window, FIELD_STEP,&(imc->inpinfo));
++ x = overspot_draw_multich(gui, win, FIELD_STEP, &(imc->inpinfo));
+ else {
+- int x, y, len;
++ int y, len;
+ char buf[256];
+
+ x = FIELD_STEP;
+- y = gui->ef_ascent;
+- wchs_to_mbs(buf, imc->inpinfo.s_keystroke, 256);
+- len = strlen(buf);
+- XmbDrawImageString(gui->display, win->window,
+- gui->fontset, osw.gc, x, y, buf, len);
+-
+- if (imc->inpinfo.n_mcch > 0) {
+- x += (2*FIELD_STEP + XmbTextEscapement(gui->fontset, buf, len));
+- overspot_draw_multich(gui, win->window, x, &(imc->inpinfo));
++ y = win->ef_ascent;
++ if (osw.display_area3) {
++ wchs_to_mbs(buf, imc->inpinfo.s_keystroke, 256);
++ len = strlen(buf);
++ XmbDrawImageString(gui->display, win->window,
++ win->fontset, osw.gc, x, y, buf, len);
++ x += (2*FIELD_STEP + XmbTextEscapement(win->fontset, buf, len));
+ }
++ if (imc->inpinfo.n_mcch > 0)
++ x = overspot_draw_multich(gui, win, x, &(imc->inpinfo));
+ }
++ return x;
+ }
+
+ static void
+ gui_overspot_draw(gui_t *gui, winlist_t *win)
+ {
+ IM_Context_t *imc = (IM_Context_t *)win->data;
++ int x;
+
+ if (win->winmap == (byte_t)-1)
+ return;
+
+ if ((imc->inp_state & IM_XIMFOCUS) && (imc->inp_state & IM_CINPUT) &&
+- (imc->inpinfo.n_mcch > 0 ||
+- (imc->inpinfo.s_keystroke && imc->inpinfo.s_keystroke[0].wch))) {
+- if (! win->winmap)
+- XRaiseWindow(gui->display, win->window);
+- overspot_win_location(gui, win, imc);
++ (imc->inpinfo.n_mcch > 0 || (osw.display_area3 &&
++ imc->inpinfo.s_keystroke && imc->inpinfo.s_keystroke[0].wch))) {
++ XRaiseWindow(gui->display, win->window);
gui_winmap_change(gui, win, 1);
- overspot_win_draw(gui, win, imc);
-@@ -225,18 +224,21 @@
- XSelectInput(gui-&gt;display, win-&gt;window, (ExposureMask|StructureNotifyMask));
+- overspot_win_draw(gui, win, imc);
++ x = overspot_win_draw(gui, win, imc);
++ overspot_win_adjust(gui, win, imc->ic_rec, x+FIELD_STEP*2);
+ }
+ else
+ gui_winmap_change(gui, win, 0);
+@@ -192,28 +201,51 @@
+
+ ----------------------------------------------------------------------------*/
+
++static void
++overspot_destroy(gui_t *gui, winlist_t *win)
++{
++ IM_Context_t *imc = (IM_Context_t *)win->data;
++ PreeditAttributes *pre_attr = &(imc->ic_rec->pre_attr);
++
++ if (pre_attr->base_font)
++ XFreeFontSet(gui->display, win->fontset);
++}
++
+ winlist_t *
+-gui_overspot_init(gui_t *gui, winlist_t *main_win, IM_Context_t *imc)
++gui_overspot_init(gui_t *gui, winlist_t *main_win, IM_Context_t *imc, int flag)
+ {
+ winlist_t *win=NULL;
+ XSetWindowAttributes win_attr;
+
++ osw.display_area3 = (flag) ? (ubyte_t)1 : (ubyte_t)0;
+ win = malloc(sizeof(winlist_t));
+ win->wid = WID_OVERSPOT;
+ win->imid = imc->id;
+ win->reqid = 0;
+ win->winmap = (ubyte_t)0;
+
+- win->c_width = main_win->c_width * 4/5;
++ if (imc->ic_rec->pre_attr.base_font)
++ win->fontset = gui_create_fontset(gui, imc->ic_rec->pre_attr.base_font,
++ &(win->ef_width), &(win->ef_height), &(win->ef_ascent), 0);
++ else
++ win->fontset = (XFontSet)NULL;
++ if (! win->fontset) {
++ win->fontset = main_win->fontset;
++ win->ef_width = main_win->ef_width;
++ win->ef_height = main_win->ef_height;
++ win->ef_ascent = main_win->ef_ascent;
++ }
++
++ win->c_width = 1;
+ win->c_height = 1;
+- win->width = win->c_width * gui->ef_width;
+- win->height = win->c_height * gui->ef_height + 3;
+- overspot_location(gui, win, imc, &(win->pos_x), &(win->pos_y));
++ win->width = win->c_width * win->ef_width;
++ win->height = win->c_height * win->ef_height + 3;
++ overspot_location(gui, win, imc->ic_rec, &(win->pos_x), &(win->pos_y));
+
+ win->data = (void *)imc;
+ win->win_draw_func = gui_overspot_draw;
+ win->win_attrib_func = NULL;
+- win->win_destroy_func = NULL;
++ win->win_destroy_func = overspot_destroy;
+ win->next = NULL;
+
+ win->window = XCreateSimpleWindow(gui->display, gui->root,
+@@ -225,17 +257,21 @@
+ XSelectInput(gui->display, win->window, (ExposureMask|StructureNotifyMask));
/* Setup GC */
-- osw.gc = XCreateGC(gui-&gt;display, win-&gt;window, 0, NULL);
-- XSetForeground(gui-&gt;display, osw.gc, gui-&gt;fg_color);
-- XSetBackground(gui-&gt;display, osw.gc, gui-&gt;bg_color);
+- osw.gc = XCreateGC(gui->display, win->window, 0, NULL);
+- XSetForeground(gui->display, osw.gc, gui->fg_color);
+- XSetBackground(gui->display, osw.gc, gui->bg_color);
-
-- osw.gcs = XCreateGC(gui-&gt;display, win-&gt;window, 0, NULL);
-- XSetForeground(gui-&gt;display, osw.gcs, gui-&gt;fg_color);
-- XSetBackground(gui-&gt;display, osw.gcs, gui-&gt;mbg_color);
--
-- osw.gcm = XCreateGC(gui-&gt;display, win-&gt;window, 0, NULL);
-- XSetForeground(gui-&gt;display, osw.gcm, gui-&gt;mfg_color);
-- XSetBackground(gui-&gt;display, osw.gcm, gui-&gt;mbg_color);
+- osw.gcs = XCreateGC(gui->display, win->window, 0, NULL);
+- XSetForeground(gui->display, osw.gcs, gui->fg_color);
+- XSetBackground(gui->display, osw.gcs, gui->mbg_color);
-
+- osw.gcm = XCreateGC(gui->display, win->window, 0, NULL);
+- XSetForeground(gui->display, osw.gcm, gui->mfg_color);
+- XSetBackground(gui->display, osw.gcm, gui->mbg_color);
+ if (osw.gc == (GC)0) {
-+ osw.gc = XCreateGC(gui-&gt;display, win-&gt;window, 0, NULL);
-+ XSetForeground(gui-&gt;display, osw.gc, gui-&gt;fg_color);
-+ XSetBackground(gui-&gt;display, osw.gc, gui-&gt;bg_color);
++ osw.gc = XCreateGC(gui->display, win->window, 0, NULL);
++ XSetForeground(gui->display, osw.gc, gui->fg_color);
++ XSetBackground(gui->display, osw.gc, gui->bg_color);
+ }
+ if (osw.gcs == (GC)0) {
-+ osw.gcs = XCreateGC(gui-&gt;display, win-&gt;window, 0, NULL);
-+ XSetForeground(gui-&gt;display, osw.gcs, gui-&gt;fg_color);
-+ XSetBackground(gui-&gt;display, osw.gcs, gui-&gt;mbg_color);
++ osw.gcs = XCreateGC(gui->display, win->window, 0, NULL);
++ XSetForeground(gui->display, osw.gcs, gui->fg_color);
++ XSetBackground(gui->display, osw.gcs, gui->mbg_color);
+ }
+ if (osw.gcm == (GC)0) {
-+ osw.gcm = XCreateGC(gui-&gt;display, win-&gt;window, 0, NULL);
-+ XSetForeground(gui-&gt;display, osw.gcm, gui-&gt;mfg_color);
-+ XSetBackground(gui-&gt;display, osw.gcm, gui-&gt;mbg_color);
++ osw.gcm = XCreateGC(gui->display, win->window, 0, NULL);
++ XSetForeground(gui->display, osw.gcm, gui->mfg_color);
++ XSetBackground(gui->display, osw.gcm, gui->mbg_color);
+ }
+
gui_overspot_draw(gui, win);
return win;
+--- src/include/IC.h.orig Wed Feb 23 09:47:57 2000
++++ src/include/IC.h Mon Mar 6 08:48:06 2000
+@@ -36,17 +36,20 @@
+
+ typedef struct {
+ XRectangle area; /* area */
+- XRectangle area_needed; /* area needed */
+ XPoint spot_location; /* spot location */
++ char *base_font; /* base font of fontset */
++#ifdef XIM_COMPLETE
++ XRectangle area_needed; /* area needed */
+ Colormap cmap; /* colormap */
+ CARD32 foreground; /* foreground */
+ CARD32 background; /* background */
+ Pixmap bg_pixmap; /* background pixmap */
+- char *base_font; /* base font of fontset */
+ CARD32 line_space; /* line spacing */
+ Cursor cursor; /* cursor */
++#endif
+ } PreeditAttributes;
+
++#ifdef XIM_COMPLETE
+ typedef struct {
+ XRectangle area; /* area */
+ XRectangle area_needed; /* area needed */
+@@ -58,22 +61,19 @@
+ CARD32 line_space; /* line spacing */
+ Cursor cursor; /* cursor */
+ } StatusAttributes;
++#endif
+
+-enum {
+- SPELLING_INCOMPLETE,
+- SPELLING_COMPLETE, /* just before posting selection */
+-};
+-enum {
+- PREEDIT_EDITING,
+- PREEDIT_SELECTION
+-};
+-
+-enum {
+- SEL_LEFT,
+- SEL_MID,
+- SEL_RIGHT
+-};
+-
++typedef struct {
++ INT32 input_style; /* input style */
++ Window client_win; /* client window */
++ Window focus_win; /* focus window */
++ PreeditAttributes pre_attr; /* preedit attributes */
++#ifdef XIM_COMPLETE
++ StatusAttributes sts_attr; /* status attributes */
++ char *resource_name; /* resource name */
++ char *resource_class; /* resource class */
++#endif
++} ic_rec_t;
+
+ /*
+ * Flags for inp_state of each IC.
+@@ -91,8 +91,10 @@
+ } greq_win_t;
+
+ typedef struct {
+- unsigned short id;
+- unsigned int icid;
++ unsigned short id; /* id of this IMC */
++ unsigned int icid; /* id of the current attached IC */
++ ic_rec_t *ic_rec; /* point to the current IC resource */
++
+ inp_state_t inp_state; /* ic cinput state */
+ inp_state_t inp_num; /* ic cinput num */
+ inp_state_t sinp_num; /* ic cinput num (sinmd) */
+@@ -104,9 +106,6 @@
+ unsigned int cch_size; /* cch buf size. */
+ char *cch; /* composed char for commit. */
+ greq_win_t gwin; /* IM GUI request window recorder. */
+-
+- PreeditAttributes *pre_attr; /* preedit attributes */
+- StatusAttributes *sts_attr; /* status attributes */
+ } IM_Context_t;
+
+ #define IC_NEWIC 0x01
+@@ -118,26 +117,15 @@
+ #define XIMSTY_OffSpot (XIMPreeditArea|XIMStatusArea)
+ #define XIMSTY_OnSpot (XIMPreeditCallbacks|XIMStatusCallbacks)
+
+-typedef struct _IC IC; /* forward declaration */
++typedef struct _IC IC;
+ struct _IC {
+ CARD16 id; /* ic id */
+ CARD16 connect_id; /* id of connected client */
+ time_t exec_time; /* recent excution time */
+ xmode_t ic_state; /* status of the IC */
++ ic_rec_t ic_rec; /* the IC resource setting by client */
++ IM_Context_t *imc; /* the IM Context */
+ struct _IC *next;
+- IM_Context_t *imc;
+-
+-/*
+- * Set from: XICAttribute *ic_attr, *pre_attr, *sts_attr;
+- * ic_set_value_by_name();
+- */
+- INT32 input_style; /* input style */
+- Window client_win; /* client window */
+- Window focus_win; /* focus window */
+- char *resource_name; /* resource name */
+- char *resource_class; /* resource class */
+- PreeditAttributes pre_attr; /* preedit attributes */
+- StatusAttributes sts_attr; /* status attributes */
+ };
+
+ #endif /* _IC_H */
+--- src/include/gui.h.orig Wed Feb 23 09:47:57 2000
++++ src/include/gui.h Mon Mar 6 08:48:06 2000
+@@ -30,6 +30,7 @@
+ */
+ #define WIN_CHANGE_IM_CONTENT 0x0001
+ #define WIN_CHANGE_IM 0x00ff
++#define WIN_CHANGE_FOCUS 0x0100
+
+ /*
+ * Window Identifier.
+@@ -43,21 +44,19 @@
+ */
+ typedef struct {
+ Display *display;
+- int screen;
+ int display_width, display_height;
++ int screen;
++ int argc;
++ char **argv;
++
+ Window root;
+ Atom wm_del_win;
+-
+- XFontSet fontset;
+- XFontStruct *indexfont;
+- int ef_width, ef_height, ef_ascent, if_descent;
+ Colormap colormap;
+- unsigned long fg_color, bg_color, mfg_color, mbg_color, uline_color,
+- grid_color;
++ unsigned long fg_color, bg_color;
++ unsigned long mfg_color, mbg_color;
++ unsigned long uline_color, grid_color;
+
+ xmode_t winchange;
+- int argc;
+- char **argv;
+ } gui_t;
+
+ /*
+@@ -70,8 +69,9 @@
+ byte_t winmap;
+
+ int pos_x, pos_y;
+- unsigned int width, height;
+- unsigned int c_width, c_height;
++ unsigned int width, height, c_width, c_height;
++ XFontSet fontset;
++ int ef_width, ef_height, ef_ascent;
+
+ void *data;
+ void (*win_draw_func)(gui_t *, winlist_t *);
+--- src/include/xcin_core.h.orig Wed Feb 23 09:47:57 2000
++++ src/include/xcin_core.h Mon Mar 6 08:48:06 2000
+@@ -38,6 +38,7 @@
+ #define XCIN_ICCHECK_OFF 0x00000010 /* disable IC check */
+ #define XCIN_SINGLE_IMC 0x00000020 /* single inpinfo for all IC */
+ #define XCIN_KEEP_POSITION 0x00000040 /* keep position enable */
++#define XCIN_OVERSPOT_AREA3 0x00000080 /* draw area3 in cand_win */
+ #define XCIN_RUN_FIRSTIM 0x00010000 /* before first IM switch in */
+ #define XCIN_RUN_IM_FOCUS 0x00020000 /* run time IM focus on */
+ #define XCIN_RUN_2B_FOCUS 0x00040000 /* run time 2B focus on */
+@@ -75,6 +76,7 @@
+ uline_color[64], grid_color[64], label_color[64];
+ char geometry[64];
+ char xim_name[64];
++ char input_styles[1024];
+
+ char inpn_english[64];
+ char inpn_sbyte[64];
+@@ -88,7 +90,7 @@
+
+ /* XIM & Input Method configuration. */
+ XIMS ims;
+- IC *ic;
++ IC *ic, *icp;
+ xmode_t xcin_mode;
+ inp_state_t default_im;
+ inp_state_t default_im_sinmd;
+@@ -96,17 +98,18 @@
+
+ /* The following are for common IM Context */
+ IM_Context_t *imc;
++ XIMStyles input_styles;
+ } core_config_t;
+
+
+-extern void gui_init(core_config_t *xccore, inner_rc_t *xc);
++extern void gui_init(core_config_t *xccore, inner_rc_t *inner_rc);
+ extern void gui_loop(void);
++extern XFontSet gui_create_fontset(gui_t *gui, char *base_font, int *ef_width,
++ int *ef_height, int *ef_ascent, int verbose);
+ extern void gui_freewin(Window window);
+ extern void gui_update_winlist(void);
+ extern void gui_winmap_change(gui_t *gui, winlist_t *win, int state);
+-extern void gui_greq_winmap_change(gui_t *gui, greq_win_t *greqw, int state);
+ extern void gui_greq_win_destroy(greq_win_t *greqw);
+-extern void gui_overspot_winmap_change(gui_t *gui, int imid, int state);
+ extern void gui_overspot_destroy(int imid);
+
+ extern winlist_t *xcin_mainwin_init(gui_t *gui, inner_rc_t *xc,
+@@ -114,9 +117,9 @@
+ extern winlist_t *gui_menusel_init(gui_t *gui, winlist_t *main_win,
+ int imid, greq_t *greqd);
+ extern winlist_t *gui_overspot_init(gui_t *gui, winlist_t *main_win,
+- IM_Context_t *imc);
++ IM_Context_t *imc, int flag);
+
+-extern void xim_init(core_config_t *core, xcin_rc_t *xc, char *server_name);
++extern void xim_init(core_config_t *core, xcin_rc_t *xc, inner_rc_t *inner_rc);
+ extern void xim_close(void);
+ extern void call_xim_init(IC *ic, int reset_inpinfo);
+ extern void call_xim_end(IC *ic, int ic_delete, int reset_inpinfo);
+@@ -129,8 +132,9 @@
+ core_config_t *xccore);
+ extern int ic_destroy(XIMS ims, IMDestroyICStruct *call_data,
+ core_config_t *xccore);
+-extern int ic_clean_all(CARD16 connect_id, int clear);
+-extern void ic_get_values(IC *ic, IMChangeICStruct *call_data);
++extern int ic_clean_all(CARD16 connect_id, core_config_t *xccore);
++extern void ic_get_values(IC *ic, IMChangeICStruct *call_data,
++ core_config_t *xccore);
+ extern void ic_set_values(IC *ic, IMChangeICStruct *call_data,
+ core_config_t *xccore);
+ extern void check_ic_exist(int icid, core_config_t *xccore);
+--- src/util/testprog/testprog.c.orig Wed Feb 23 09:47:57 2000
++++ src/util/testprog/testprog.c Mon Mar 6 08:48:06 2000
+@@ -126,6 +126,7 @@
+
+ XVaNestedList preedit_attr = NULL;
+ XPoint spot;
++ XRectangle local_win_rect;
+
+ /*
+ * Open connection to IM server.
+@@ -205,8 +206,12 @@
+ if (style == (XIMPreeditPosition | XIMStatusNothing)) {
+ spot.x = 5;
+ spot.y = 2*ef_height + 3*(ef_ascent+5);
++ local_win_rect.x = 1;
++ local_win_rect.y = 1;
++ local_win_rect.width = win_rect.width;
++ local_win_rect.height = win_rect.height;
+ preedit_attr = XVaCreateNestedList(0,
+- XNArea, &win_rect,
++ XNArea, &local_win_rect,
+ XNSpotLocation, &spot,
+ XNFontSet, fontset,
+ NULL);
+@@ -254,8 +259,7 @@
+
+ spot.x = XwcTextEscapement(fontset, input_buf, idx) + 5;
+ spot.y = 2*ef_height + 3*(ef_ascent+5);
+- preedit_attr = XVaCreateNestedList(0, XNArea, &win_rect,
+- XNSpotLocation, &spot, NULL);
++ preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
+ XSetICValues(ic, XNPreeditAttributes, preedit_attr, NULL);
+ XFree(preedit_attr);
+ }
+@@ -520,8 +524,6 @@
+ win_rect.y = event->y;
+ win_rect.width = event->width;
+ win_rect.height = event->height;
+-
+- send_spot_loc();
+ }
+
+ /*--------------------------------------------------------------------------
+--- src/xcin_main.c.orig Wed Feb 23 09:47:57 2000
++++ src/xcin_main.c Mon Mar 6 08:48:06 2000
+@@ -184,57 +184,57 @@
+ */
+ cmd[0] = "INDEX_FONT";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(inner_rc->indexfont, RC_STRARR, value, 0,
++ set_data(inner_rc->indexfont, RC_STRARR, value, 0,
+ sizeof(inner_rc->indexfont));
+ else
+ perr(XCINMSG_ERROR, "%s: %s: value not specified.\n",
+ xcin_rc.rcfile, cmd[0]);
+ cmd[0] = "FG_COLOR";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(inner_rc->fg_color, RC_STRARR, value, 0,
++ set_data(inner_rc->fg_color, RC_STRARR, value, 0,
+ sizeof(inner_rc->fg_color));
+ cmd[0] = "BG_COLOR";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(inner_rc->bg_color, RC_STRARR, value, 0,
++ set_data(inner_rc->bg_color, RC_STRARR, value, 0,
+ sizeof(inner_rc->bg_color));
+ cmd[0] = "M_FG_COLOR";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(inner_rc->mfg_color, RC_STRARR, value, 0,
++ set_data(inner_rc->mfg_color, RC_STRARR, value, 0,
+ sizeof(inner_rc->mfg_color));
+ cmd[0] = "M_BG_COLOR";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(inner_rc->mbg_color, RC_STRARR, value, 0,
++ set_data(inner_rc->mbg_color, RC_STRARR, value, 0,
+ sizeof(inner_rc->mbg_color));
+ cmd[0] = "ULINE_COLOR";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(inner_rc->uline_color, RC_STRARR, value, 0,
++ set_data(inner_rc->uline_color, RC_STRARR, value, 0,
+ sizeof(inner_rc->uline_color));
+ cmd[0] = "GRID_COLOR";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(inner_rc->grid_color, RC_STRARR, value, 0,
++ set_data(inner_rc->grid_color, RC_STRARR, value, 0,
+ sizeof(inner_rc->grid_color));
+ cmd[0] = "XCIN_HIDE";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(&(xcin_core.xcin_mode), RC_IFLAG, value, XCIN_MODE_HIDE, 0);
++ set_data(&(xcin_core.xcin_mode), RC_IFLAG, value, XCIN_MODE_HIDE, 0);
+ cmd[0] = "X_GEOMETRY";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(inner_rc->geometry, RC_STRARR, value, 0,
++ set_data(inner_rc->geometry, RC_STRARR, value, 0,
+ sizeof(inner_rc->geometry));
+ cmd[0] = "XKILL_DISABLE";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(&(xcin_core.xcin_mode), RC_IFLAG, value, XCIN_XKILL_OFF, 0);
++ set_data(&(xcin_core.xcin_mode), RC_IFLAG, value, XCIN_XKILL_OFF, 0);
+ cmd[0] = "ICCHECK_DISABLE";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(&(xcin_core.xcin_mode), RC_IFLAG, value, XCIN_ICCHECK_OFF, 0);
++ set_data(&(xcin_core.xcin_mode), RC_IFLAG, value, XCIN_ICCHECK_OFF, 0);
+ cmd[0] = "SINGLE_IM_CONTEXT";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(&(xcin_core.xcin_mode), RC_IFLAG, value, XCIN_SINGLE_IMC, 0);
++ set_data(&(xcin_core.xcin_mode), RC_IFLAG, value, XCIN_SINGLE_IMC, 0);
+ cmd[0] = "IM_FOCUS_ON";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(&(xcin_core.xcin_mode), RC_IFLAG, value, XCIN_IM_FOCUS, 0);
++ set_data(&(xcin_core.xcin_mode), RC_IFLAG, value, XCIN_IM_FOCUS, 0);
+ cmd[0] = "KEEP_POSITION_ON";
+ if (get_resource(cmd, value, 256, 1))
+- set_data(&(xcin_core.xcin_mode), RC_IFLAG, value, XCIN_KEEP_POSITION,0);
++ set_data(&(xcin_core.xcin_mode), RC_IFLAG, value, XCIN_KEEP_POSITION,0);
+
+ cmd[0] = "FKEY_ZHEN";
+ if (get_resource(cmd, value, 256, 1))
+@@ -264,6 +264,14 @@
+ if (get_resource(cmd, value, 256, 1))
+ set_funckey(FKEY_QPHRASE, value);
+ check_funckey();
++
++ cmd[0] = "INPUT_STYLE";
++ if (get_resource(cmd, value, 256, 1))
++ set_data(inner_rc->input_styles, RC_STRARR, value, 0,
++ sizeof(inner_rc->input_styles));
++ cmd[0] = "OVERSPOT_DRAW_AREA3";
++ if (get_resource(cmd, value, 256, 1))
++ set_data(&(xcin_core.xcin_mode), RC_IFLAG, value,XCIN_OVERSPOT_AREA3,0);
}
+
+ static void
+@@ -426,7 +434,7 @@
+ free_cinput(cp);
+ }
+ else {
+- xcin_core.default_im = (inp_state_t)idx;
++ xcin_core.im_focus = xcin_core.default_im = (inp_state_t)idx;
+ return;
+ }
+ }
+@@ -447,7 +455,7 @@
+ else {
+ strncpy(inner_rc->default_im_name, cp->objname,
+ sizeof(inner_rc->default_im_name));
+- xcin_core.default_im = (inp_state_t)idx;
++ xcin_core.im_focus = xcin_core.default_im = (inp_state_t)idx;
+ break;
+ }
+ }
+@@ -503,7 +511,7 @@
+ load_default_sinmd();
+ qphrase_init(inner_rc->phrase_fn);
+ gui_init(&xcin_core, inner_rc);
+- xim_init(&xcin_core, &xcin_rc, inner_rc->xim_name);
++ xim_init(&xcin_core, &xcin_rc, inner_rc);
+ free(inner_rc);
+
+ gui_loop();
+--- src/xcinrc.in.orig Mon Mar 6 08:47:32 2000
++++ src/xcinrc.in Mon Mar 6 08:48:06 2000
+@@ -30,6 +30,7 @@
+ (define IM_FOCUS_ON "NO")
+ (define KEEP_POSITION_ON "NO")
+ (define INPUT_STYLE '(Root))
++(define OVERSPOT_DRAW_AREA3 "YES")
+
+ ;(define FKEY_ZHEN "ctrl space")
+ ;(define FKEY_2BSB "shift space")
--- src/xim.c.orig Wed Feb 23 09:47:57 2000
-+++ src/xim.c Thu Feb 24 01:55:36 2000
++++ src/xim.c Mon Mar 6 08:48:06 2000
@@ -165,12 +165,11 @@
- if (imc-&gt;icid != ic-&gt;id)
+ if (imc->icid != ic->id)
return;
-- xccore-&gt;ic = ic;
- if ((imc-&gt;inp_state &amp; IM_CINPUT)) {
- imc-&gt;inp_state |= IM_XIMFOCUS;
- xccore-&gt;gui.winchange |= WIN_CHANGE_IM;
+- xccore->ic = ic;
+ if ((imc->inp_state & IM_CINPUT)) {
+ imc->inp_state |= IM_XIMFOCUS;
+ xccore->gui.winchange |= WIN_CHANGE_IM;
}
-- else if (imc-&gt;inp_state &amp; IM_2BYTES)
-+ else if ((imc-&gt;inp_state &amp; IM_2BYTES))
- xccore-&gt;gui.winchange |= WIN_CHANGE_IM;
+- else if (imc->inp_state & IM_2BYTES)
++ else if ((imc->inp_state & IM_2BYTES))
+ xccore->gui.winchange |= WIN_CHANGE_IM;
+ }
+
+@@ -411,9 +410,8 @@
+ xim_close_handler(XIMS ims, IMCloseStruct *call_data)
+ {
+ DebugLog("XIM_CLOSE\n");
+- ic_clean_all(call_data->connect_id, !(xccore->xcin_mode & XCIN_SINGLE_IMC));
++ ic_clean_all(call_data->connect_id, xccore);
+ xccore->gui.winchange |= WIN_CHANGE_IM;
+- xccore->ic = NULL;
+ return True;
}
-@@ -460,6 +459,7 @@
- ic-&gt;imc-&gt;icid = ic-&gt;id;
+@@ -460,6 +458,7 @@
+ ic->imc->icid = ic->id;
call_switch_in(ic);
- ic-&gt;ic_state |= IC_FOCUS;
-+ xccore-&gt;ic = ic;
+ ic->ic_state |= IC_FOCUS;
++ xccore->ic = ic;
- if ((ic-&gt;ic_state &amp; IC_NEWIC)) {
- if ((xccore-&gt;xcin_mode &amp; XCIN_RUN_IM_FOCUS) ||
-@@ -484,23 +484,8 @@
- ic-&gt;imc-&gt;sts_attr = &amp;(ic-&gt;sts_attr);
- }
- }
+ if ((ic->ic_state & IC_NEWIC)) {
+ if ((xccore->xcin_mode & XCIN_RUN_IM_FOCUS) ||
+@@ -479,28 +478,11 @@
+ xim_connect(xccore->ims, ic);
+ else
+ xim_disconnect(ic);
+- if (ic->input_style == XIMSTY_OverSpot) {
+- ic->imc->pre_attr = &(ic->pre_attr);
+- ic->imc->sts_attr = &(ic->sts_attr);
+- }
+- }
- else {
-/*
- * For XCIN_SINGLE_IMC off, we should change the GUI-request windows' mapping
@@ -300,68 +1605,552 @@
- * update_gui_request() in gui.c. This way can also improve the graphical
- * performance.
- */
-- gui_greq_winmap_change(&amp;(xccore-&gt;gui), &amp;(ic-&gt;imc-&gt;gwin), 1);
-- if (ic-&gt;input_style == XIMSTY_OverSpot)
-- gui_overspot_winmap_change(&amp;(xccore-&gt;gui), ic-&gt;imc-&gt;id, 1);
-- }
+- gui_greq_winmap_change(&(xccore->gui), &(ic->imc->gwin), 1);
+- if (ic->input_style == XIMSTY_OverSpot)
+- gui_overspot_winmap_change(&(xccore->gui), ic->imc->id, 1);
++ if (ic->ic_rec.input_style == XIMSTY_OverSpot)
++ ic->imc->ic_rec = &(ic->ic_rec);
+ }
+ else
-+ xccore-&gt;gui.winchange |= WIN_CHANGE_FOCUS;
++ xccore->gui.winchange |= WIN_CHANGE_FOCUS;
return True;
}
-@@ -517,12 +502,10 @@
+@@ -517,12 +499,10 @@
return False;
call_switch_out(ic);
-+ xccore-&gt;icp = ic;
- ic-&gt;ic_state &amp;= ~(IC_FOCUS);
-- if (! (xccore-&gt;xcin_mode &amp; XCIN_SINGLE_IMC)) {
-- gui_greq_winmap_change(&amp;(xccore-&gt;gui), &amp;(ic-&gt;imc-&gt;gwin), 0);
-- if (ic-&gt;input_style == XIMSTY_OverSpot)
-- gui_overspot_winmap_change(&amp;(xccore-&gt;gui), ic-&gt;imc-&gt;id, 0);
++ xccore->icp = ic;
+ ic->ic_state &= ~(IC_FOCUS);
+- if (! (xccore->xcin_mode & XCIN_SINGLE_IMC)) {
+- gui_greq_winmap_change(&(xccore->gui), &(ic->imc->gwin), 0);
+- if (ic->input_style == XIMSTY_OverSpot)
+- gui_overspot_winmap_change(&(xccore->gui), ic->imc->id, 0);
- }
-+ if (! (xccore-&gt;xcin_mode &amp; XCIN_SINGLE_IMC))
-+ xccore-&gt;gui.winchange |= WIN_CHANGE_FOCUS;
++ if (! (xccore->xcin_mode & XCIN_SINGLE_IMC))
++ xccore->gui.winchange |= WIN_CHANGE_FOCUS;
return True;
}
+@@ -537,6 +517,10 @@
+ *icid = call_data->icid;
+ if (! (ic = ic_find(call_data->icid)))
+ return False;
++
++ xccore->icp = xccore->ic;
++ xccore->ic = ic;
++ ic->imc->icid = ic->id;
+ if (call_data->flag == 0) { /* on key */
+ /*
+ * Here, the start of preediting is notified from
+@@ -722,7 +706,7 @@
+
+ if (! (ic = ic_find(call_data->icid)))
+ return False;
+- ic_get_values(ic, call_data);
++ ic_get_values(ic, call_data, xccore);
+ return True;
+ }
+
+@@ -796,7 +780,6 @@
+ ret = False;
+ break;
+ }
+-
+ if (! (xccore->xcin_mode & XCIN_ICCHECK_OFF))
+ check_ic_exist(icid, xccore);
+ gui_update_winlist();
+@@ -855,18 +838,18 @@
+ }
+
+ static void
+-setup_input_styles(XIMStyles *input_styles, XIMStyle *defaultStyles, int n)
++setup_input_styles(char *style_list, XIMStyles *input_styles)
+ {
+- char *cmd[1], value[256];
++ static XIMStyle defaultStyles[10];
++ int n = sizeof(defaultStyles);
+
+- cmd[0] = "INPUT_STYLE";
+- if (! get_resource(cmd, value, 256, 1)) {
++ if (style_list[0] == '\0') {
+ defaultStyles[0] = toggle_im_styles("Root");
+ input_styles->count_styles = 1;
+ input_styles->supported_styles = defaultStyles;
+ }
+ else {
+- char *s=value, word[256];
++ char *s=style_list, word[256];
+ int n_set=0;
+
+ while (get_word(&s, word, 256, NULL)) {
+@@ -884,12 +867,10 @@
+ }
+
+ void
+-xim_init(core_config_t *core, xcin_rc_t *xc, char *server_name)
++xim_init(core_config_t *core, xcin_rc_t *xc, inner_rc_t *inner_rc)
+ {
+ char transport[128], xim_name[128];
+ unsigned int transport_type;
+- XIMStyles input_styles;
+- XIMStyle defaultStyles[10];
+ XIMTriggerKeys on_keys;
+ XIMEncodings encodings;
+
+@@ -912,27 +893,29 @@
+ else
+ strcpy(transport, "X/");
+
+- setup_input_styles(&input_styles, defaultStyles, sizeof(defaultStyles));
+-
++ setup_input_styles(inner_rc->input_styles, &(xccore->input_styles));
+ encodings.count_encodings = sizeof(zhEncodings)/sizeof(XIMEncoding) - 1;
+ encodings.supported_encodings = zhEncodings;
+ make_trigger_keys(&on_keys);
+
+- if (server_name[0] == '\0') {
++ if (inner_rc->xim_name[0] == '\0') {
+ if (strcasecmp("zh_TW.Big5", xc->locale.lc_ctype))
+ sprintf(xim_name, "%s-%s", DEFAULT_XIMNAME, xc->locale.lc_ctype);
+ else
+ strncpy(xim_name, DEFAULT_XIMNAME, sizeof(xim_name));
+ }
++ else
++ strncpy(xim_name, inner_rc->xim_name, sizeof(xim_name));
++
+ if ((xccore->xcin_mode & XCIN_SINGLE_IMC))
+- xccore->imc = new_IMC(1);
++ xccore->imc = new_IMC(0);
+ xccore->ims = IMOpenIM(xccore->gui.display,
+ IMServerWindow, xccore->win->window,
+ IMModifiers, "Xi18n",
+ IMServerName, xim_name,
+ IMLocale, xc->locale.lc_ctype,
+ IMServerTransport, transport,
+- IMInputStyles, &input_styles,
++ IMInputStyles, &(xccore->input_styles),
+ IMEncodingList, &encodings,
+ IMProtocolHandler, im_protocol_handler,
+ IMFilterEventMask, KeyPressMask,
@@ -962,12 +945,15 @@
{
IMSyncXlibStruct pass_data;
-- xim_disconnect(xccore-&gt;ic);
- xccore-&gt;xcin_mode |= (XCIN_RUN_EXIT | XCIN_ICCHECK_OFF);
+- xim_disconnect(xccore->ic);
+ xccore->xcin_mode |= (XCIN_RUN_EXIT | XCIN_ICCHECK_OFF);
-
- pass_data.major_code = XIM_SYNC;
- pass_data.minor_code = 0;
-- pass_data.connect_id = xccore-&gt;ic-&gt;connect_id;
-- pass_data.icid = xccore-&gt;ic-&gt;id;
-- IMSyncXlib(xccore-&gt;ims, (XPointer)&amp;pass_data);
-+ if (xccore-&gt;ic) {
-+ xim_disconnect(xccore-&gt;ic);
+- pass_data.connect_id = xccore->ic->connect_id;
+- pass_data.icid = xccore->ic->id;
+- IMSyncXlib(xccore->ims, (XPointer)&pass_data);
++ if (xccore->ic) {
++ xim_disconnect(xccore->ic);
+ pass_data.major_code = XIM_SYNC;
+ pass_data.minor_code = 0;
-+ pass_data.connect_id = xccore-&gt;ic-&gt;connect_id;
-+ pass_data.icid = xccore-&gt;ic-&gt;id;
-+ IMSyncXlib(xccore-&gt;ims, (XPointer)&amp;pass_data);
++ pass_data.connect_id = xccore->ic->connect_id;
++ pass_data.icid = xccore->ic->id;
++ IMSyncXlib(xccore->ims, (XPointer)&pass_data);
+ }
+ else
+ exit(0);
}
---- doc/Changes.orig Wed Feb 23 09:47:57 2000
-+++ doc/Changes Thu Feb 24 01:55:36 2000
-@@ -1,3 +1,14 @@
-+xcin-2.5.2-pre3: 2000/03/
-+------------------------------
-+1. Fix the bug of multiply creating GC in gui_overspot &amp; gui_menusel.
-+ Thanks to Peter Hung &lt;peter@phantom.wahoo.com.tw&gt;
+--- src/xim_IC.c.orig Wed Feb 23 09:47:57 2000
++++ src/xim_IC.c Mon Mar 6 08:48:06 2000
+@@ -96,8 +96,11 @@
+ }
+
+ static void
+-delete_IC(IC *ic, IC *last, int clear)
++delete_IC(IC *ic, IC *last, core_config_t *xccore)
+ {
++ int clear = ((xccore->xcin_mode & XCIN_SINGLE_IMC)) ? 0 : 1;
++ ic_rec_t *ic_rec = &(ic->ic_rec);
+
-+2. Fix bugs when xcin is going to exit and xccore-&gt;ic = NULL case;
+ if (last != NULL)
+ last->next = ic->next;
+ else
+@@ -105,43 +108,39 @@
+ ic->next = free_list;
+ free_list = ic;
+
++ if (xccore->ic == ic)
++ xccore->ic = NULL;
++ if (xccore->icp == ic)
++ xccore->icp = NULL;
+ /*
+ * The IC is eventually being deleted, so don't process any IMKEY send back.
+ */
+ call_switch_out(ic);
+ call_xim_end(ic, 1, clear);
+- gui_update_winlist();
+- if (ic->resource_name)
+- free(ic->resource_name);
+- if (ic->resource_class)
+- free(ic->resource_class);
++ xccore->gui.winchange |= WIN_CHANGE_IM;
+
-+3. Change the mechanism of IMC windows' map change during IC focus changes.
-+ Add a gui-&gt;winchange flag: WIN_CHANGE_FOCUS.
++ if (ic_rec->pre_attr.base_font)
++ free(ic_rec->pre_attr.base_font);
++#ifdef XIM_COMPLETE
++ if (ic_rec->sts_attr.base_font)
++ free(ic_rec->sts_attr.base_font);
++ if (ic_rec->resource_name)
++ free(ic_rec->resource_name);
++ if (ic_rec->resource_class)
++ free(ic_rec->resource_class);
++#endif
+
+ if (clear) {
+ if (ic->imc->cch)
+ free(ic->imc->cch);
+ if (ic->imc->sinmd_keystroke)
+ free(ic->imc->sinmd_keystroke);
+- if (ic->input_style == XIMSTY_OverSpot)
++ if (ic_rec->input_style == XIMSTY_OverSpot)
+ gui_overspot_destroy(ic->imc->id);
+ free(ic->imc);
+ }
+ }
+
+-static void
+-check_focus(IC *ic, core_config_t *core)
+-{
+- Window focus_return;
+- int revert_to_return;
+- static ubyte_t gotit=0;
+-
+- if (gotit)
+- return;
+- XGetInputFocus(core->gui.display, &focus_return, &revert_to_return);
+- if (focus_return == ic->focus_win) {
+- gotit = 1;
+- core->ic = ic;
+- }
+-}
+-
+
+ /*----------------------------------------------------------------------------
+
+@@ -181,7 +180,6 @@
+ ic->imc->inp_num = xccore->default_im;
+ ic->ic_state |= IC_NEWIC;
+ ic->imc->inpinfo.imid = (int)(ic->imc->id);
+- ic->imc->icid = ic->id;
+
+ ic_set_values(ic, call_data, xccore);
+ return True;
+@@ -194,8 +192,7 @@
+
+ for (ic=ic_list; ic!=NULL; last=ic, ic=ic->next) {
+ if (ic->id == call_data->icid) {
+- delete_IC(ic, last, !(xccore->xcin_mode & XCIN_SINGLE_IMC));
+- xccore->ic = NULL;
++ delete_IC(ic, last, xccore);
+ return True;
+ }
+ }
+@@ -203,14 +200,14 @@
+ }
+
+ int
+-ic_clean_all(CARD16 connect_id, int clear)
++ic_clean_all(CARD16 connect_id, core_config_t *xccore)
+ {
+ IC *ic=ic_list, *last=NULL;
+ int clean_count=0;
+
+ while (ic != NULL) {
+ if (ic->connect_id == connect_id) {
+- delete_IC(ic, last, clear);
++ delete_IC(ic, last, xccore);
+ ic = (last) ? last->next : ic_list;
+ clean_count ++;
+ }
+@@ -223,23 +220,26 @@
+ }
+
+ void
+-ic_get_values(IC *ic, IMChangeICStruct *call_data)
++ic_get_values(IC *ic, IMChangeICStruct *call_data, core_config_t *xccore)
+ {
+- XICAttribute *ic_attr = call_data->ic_attr;
++ XICAttribute *ic_attr = call_data->ic_attr;
+ XICAttribute *pre_attr = call_data->preedit_attr;
++#ifdef XIM_COMPLETE
+ XICAttribute *sts_attr = call_data->status_attr;
+- register int i;
++#endif
++ ic_rec_t *ic_rec = &(ic->ic_rec);
++ register int i;
+
+ for (i=0; i < (int)call_data->ic_attr_num; i++, ic_attr++) {
+- if (match (XNFilterEvents, ic_attr)) { /* hardwired XNFilterEvents */
++ if (match (XNFilterEvents, ic_attr)) {
+ ic_attr->value = (void *)malloc(sizeof(CARD32));
+ ic_attr->value_length = sizeof(CARD32);
+- *(CARD32*)ic_attr->value = KeyPressMask|KeyReleaseMask;
++ *(CARD32*)ic_attr->value = KeyPressMask;
+ }
+ else if (match (XNInputStyle, ic_attr)) {
+ ic_attr->value = (void *)malloc(sizeof(INT32));
+ ic_attr->value_length = sizeof(INT32);
+- *(INT32*)ic_attr->value = ic->input_style;
++ *(INT32*)ic_attr->value = ic_rec->input_style;
+ }
+ else if (match (XNSeparatorofNestedList, ic_attr)) {
+ ic_attr->value = (void *)malloc(sizeof(CARD16));
+@@ -249,29 +249,22 @@
+ else {
+ perr(XCINMSG_WARNING,
+ "ic_get: unknown IC attr: %s\n", ic_attr->name);
+- return;
+ }
+ }
+
+- /* preedit attributes */
+ for (i=0; i < (int)call_data->preedit_attr_num; i++, pre_attr++) {
+ if (match (XNArea, pre_attr)) {
+ pre_attr->value = (void *)malloc(sizeof(XRectangle));
+- *(XRectangle*)pre_attr->value = ic->pre_attr.area;
++ *(XRectangle*)pre_attr->value = ic_rec->pre_attr.area;
+ pre_attr->value_length = sizeof(XRectangle);
+ }
+- else if (match (XNAreaNeeded, pre_attr)) {
+- pre_attr->value = (void *)malloc(sizeof(XRectangle));
+- *(XRectangle*)pre_attr->value = ic->pre_attr.area_needed;
+- pre_attr->value_length = sizeof(XRectangle);
+- }
+ else if (match (XNSpotLocation, pre_attr)) {
+ pre_attr->value = (void *)malloc(sizeof(XPoint));
+- *(XPoint*)pre_attr->value = ic->pre_attr.spot_location;
++ *(XPoint*)pre_attr->value = ic_rec->pre_attr.spot_location;
+ pre_attr->value_length = sizeof(XPoint);
+ }
+ else if (match (XNFontSet, pre_attr)) {
+- CARD16 base_len = (CARD16)strlen(ic->pre_attr.base_font);
++ CARD16 base_len = (CARD16)strlen(ic_rec->pre_attr.base_font);
+ int total_len = sizeof(CARD16) + (CARD16)base_len;
+ char *p;
+
+@@ -279,35 +272,39 @@
+ p = (char *)pre_attr->value;
+ memmove(p, &base_len, sizeof(CARD16));
+ p += sizeof(CARD16);
+- strncpy(p, ic->pre_attr.base_font, base_len);
++ strncpy(p, ic_rec->pre_attr.base_font, base_len);
+ pre_attr->value_length = total_len;
+ }
+ else if (match (XNForeground, pre_attr)) {
+ pre_attr->value = (void *)malloc(sizeof(long));
+- *(long*)pre_attr->value = ic->pre_attr.foreground;
++ *(long*)pre_attr->value = xccore->gui.fg_color;
+ pre_attr->value_length = sizeof(long);
+ }
+ else if (match (XNBackground, pre_attr)) {
+ pre_attr->value = (void *)malloc(sizeof(long));
+- *(long*)pre_attr->value = ic->pre_attr.background;
++ *(long*)pre_attr->value = xccore->gui.bg_color;
+ pre_attr->value_length = sizeof(long);
+ }
+
- xcin-2.5.2-pre2: 2000/02/23
- ------------------------------
- 1. Register a WM protocol into testprog such that it can be terminated by WM.
++#ifdef XIM_COMPLETE
++ else if (match (XNAreaNeeded, pre_attr)) {
++ pre_attr->value = (void *)malloc(sizeof(XRectangle));
++ *(XRectangle*)pre_attr->value = ic_rec->pre_attr.area_needed;
++ pre_attr->value_length = sizeof(XRectangle);
++ }
+ else if (match (XNLineSpace, pre_attr)) {
+ pre_attr->value = (void *)malloc(sizeof(long));
+-/*
+ *(long*)pre_attr->value = ic->pre_attr.line_space;
+-*/
+- *(long*)pre_attr->value = 18;
+ pre_attr->value_length = sizeof(long);
+ }
++#endif
+ else {
+ perr(XCINMSG_WARNING,
+ "ic_get: unknown IC pre_attr: %s\n", ic_attr->name);
+- return;
+ }
+ }
+
+- /* status attributes */
++#ifdef XIM_COMPLETE
+ for (i = 0; i < (int)call_data->status_attr_num; i++, sts_attr++) {
+ if (match (XNArea, sts_attr)) {
+ sts_attr->value = (void *)malloc(sizeof(XRectangle));
+@@ -343,18 +340,15 @@
+ }
+ else if (match (XNLineSpace, sts_attr)) {
+ sts_attr->value = (void *)malloc(sizeof(long));
+-/*
+ *(long*)sts_attr->value = ic->sts_attr.line_space;
+-*/
+- *(long*)sts_attr->value = 18;
+ sts_attr->value_length = sizeof(long);
+ }
+ else {
+ perr(XCINMSG_WARNING,
+ "ic_get: unknown IC sts_attr: %s\n", ic_attr->name);
+- return;
+ }
+ }
++#endif
+ return;
+ }
+
+@@ -362,51 +356,57 @@
+ ic_set_values(IC *ic, IMChangeICStruct *call_data, core_config_t *xccore)
+ /* For details, see Xlib Ref, Chap 11.6 */
+ {
+- XICAttribute *ic_attr = call_data->ic_attr;
++ XICAttribute *ic_attr = call_data->ic_attr;
+ XICAttribute *pre_attr = call_data->preedit_attr;
++#ifdef XIM_COMPLETE
+ XICAttribute *sts_attr = call_data->status_attr;
+- register int i;
++#endif
++ ic_rec_t *ic_rec = &(ic->ic_rec);
++ register int i;
+
+ for (i=0; i < (int)(call_data->ic_attr_num); i++, ic_attr++) {
+ if (match (XNInputStyle, ic_attr)) {
+- ic->input_style = *((INT32 *)ic_attr->value);
+-/*
+- if (ic->input_style != (XIMPreeditNothing|XIMStatusNothing)) {
++ int j;
++ ic_rec->input_style = *((INT32 *)ic_attr->value);
++
++ for (j=0; j < xccore->input_styles.count_styles &&
++ ic_rec->input_style !=
++ xccore->input_styles.supported_styles[j]; j++);
++ if (j >= xccore->input_styles.count_styles) {
+ perr(XCINMSG_WARNING,
+- "XNInputStyle: only PreeditNothing|XIMStatusNothing "
+- "mode implemented.\n");
+- ic->input_style = XIMPreeditNothing|XIMStatusNothing;
+- }
+-*/
++ "client input style not enabled, set to \"Root\".\n");
++ ic_rec->input_style = XIMSTY_Root;
++ }
+ }
+ else if (match (XNClientWindow, ic_attr))
+- ic->client_win = *(Window *)ic_attr->value;
+- else if (match (XNFocusWindow, ic_attr)) {
+- ic->focus_win = *(Window *)ic_attr->value;
+- check_focus(ic, xccore);
+- }
++ ic_rec->client_win = *(Window *)ic_attr->value;
++ else if (match (XNFocusWindow, ic_attr))
++ ic_rec->focus_win = *(Window *)ic_attr->value;
++#ifdef XIM_COMPLETE
+ else if (match (XNResourceName, ic_attr))
+ ic->resource_name = strdup((char *)ic_attr->value);
+ else if (match (XNResourceClass, ic_attr))
+ ic->resource_class = strdup((char *)ic_attr->value);
++#endif
+ else
+ perr(XCINMSG_WARNING,
+ "ic_set: unknown IC attr: %s\n", ic_attr->name);
+ }
+
+ for (i=0; i < (int)(call_data->preedit_attr_num); i++, pre_attr++) {
+- if (match (XNArea, pre_attr)) {
+- ic->pre_attr.area.x = (*(XRectangle *)pre_attr->value).x;
+- ic->pre_attr.area.y = (*(XRectangle *)pre_attr->value).y;
+- ic->pre_attr.area.width = (*(XRectangle *)pre_attr->value).width;
+- ic->pre_attr.area.height = (*(XRectangle *)pre_attr->value).height;
+- }
++ if (match (XNArea, pre_attr))
++ ic_rec->pre_attr.area = *(XRectangle *)pre_attr->value;
++ else if (match (XNSpotLocation, pre_attr))
++ ic_rec->pre_attr.spot_location = *(XPoint *)pre_attr->value;
++ else if (match (XNFontSet, pre_attr)) {
++ if (ic_rec->pre_attr.base_font != NULL)
++ XFree(ic_rec->pre_attr.base_font);
++ ic_rec->pre_attr.base_font = strdup(pre_attr->value);
++ }
++
++#ifdef XIM_COMPLETE
+ else if (match (XNAreaNeeded, pre_attr))
+ ic->pre_attr.area_needed = *(XRectangle *)pre_attr->value;
+- else if (match (XNSpotLocation, pre_attr)) {
+- ic->pre_attr.spot_location.x = (*(XPoint *)pre_attr->value).x;
+- ic->pre_attr.spot_location.y = (*(XPoint *)pre_attr->value).y;
+- }
+ else if (match (XNColormap, pre_attr))
+ ic->pre_attr.cmap = *(Colormap *)pre_attr->value;
+ else if (match (XNStdColormap, pre_attr))
+@@ -417,23 +417,17 @@
+ ic->pre_attr.background = *(CARD32 *)pre_attr->value;
+ else if (match (XNBackgroundPixmap, pre_attr))
+ ic->pre_attr.bg_pixmap = *(Pixmap *)pre_attr->value;
+- else if (match (XNFontSet, pre_attr)) {
+- if (ic->pre_attr.base_font != NULL) {
+- if (match (ic->pre_attr.base_font, pre_attr))
+- continue;
+- XFree(ic->pre_attr.base_font);
+- }
+- ic->pre_attr.base_font = strdup(pre_attr->value);
+- }
+ else if (match (XNLineSpace, pre_attr))
+ ic->pre_attr.line_space = *(CARD32 *)pre_attr->value;
+ else if (match (XNCursor, pre_attr))
+ ic->pre_attr.cursor = *(Cursor *)pre_attr->value;
+ else
+ perr(XCINMSG_WARNING,
+- "ic_set: unknown IC pre_attr: %s\n", ic_attr->name);
++ "ic_set: unknown IC pre_attr: %s\n", pre_attr->name);
++#endif
+ }
+-
++
++#ifdef XIM_COMPLETE
+ for (i=0; i < (int)(call_data->status_attr_num); i++, sts_attr++) {
+ if (match (XNArea, sts_attr))
+ ic->sts_attr.area = *(XRectangle *)sts_attr->value;
+@@ -464,8 +458,9 @@
+ ic->sts_attr.cursor = *(Cursor *)sts_attr->value;
+ else
+ perr(XCINMSG_WARNING,
+- "ic_set: unknown IC sts_attr: %s\n", ic_attr->name);
++ "ic_set: unknown IC sts_attr: %s\n", sts_attr->name);
+ }
++#endif
+ }
+
+ /*---------------------------------------------------------------------------
+@@ -519,22 +514,24 @@
+
+ if (ic == ref_ic)
+ ic->exec_time = current_time;
+- else if (ic->focus_win && ic->focus_win == ref_ic->focus_win)
++ else if (ic->ic_rec.focus_win &&
++ ic->ic_rec.focus_win == ref_ic->ic_rec.focus_win)
+ delete = 1;
+ else if (current_time - ic->exec_time > IC_IDLE_TIME &&
+- ic->client_win != 0) {
++ ic->ic_rec.client_win != 0) {
+ DebugLog("Check IC: id=%d, window=0x%x, exec_time=%d.\n",
+ ic->id, (unsigned int)ic->client_win, (int)ic->exec_time);
+ ic->exec_time = current_time;
+- XGetGeometry(xccore->gui.display, ic->client_win,
++ XGetGeometry(xccore->gui.display, ic->ic_rec.client_win,
+ &root, &x, &y, &width, &height, &bw, &depth);
+ XSync(xccore->gui.display, False);
+ }
+
+ if (delete) {
+ DebugLog("Delete IC: id=%d, window=0x%x, exec_time=%d.\n",
+- ic->id, (unsigned int)ic->client_win, (int)ic->exec_time);
+- delete_IC(ic, last, !(xccore->xcin_mode & XCIN_SINGLE_IMC));
++ ic->id, (unsigned int)ic->ic_rec.client_win,
++ (int)ic->exec_time);
++ delete_IC(ic, last, xccore);
+ ic = (last) ? last->next : ic_list;
+ }
+ else {