1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-04 22:33:27 +00:00
freebsd-ports/chinese/xcin25/files/patch-af
Vanilla I. Shu 7a0a491c10 Upgrade to latest version
PR:		ports/16940
Submitted by:	maintainer
2000-02-27 11:54:37 +00:00

368 lines
12 KiB
Plaintext

--- 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
/*
* 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 @@
/* 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;
--- 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 @@
return;
if (state) {
- if (! win->winmap) {
+ if (win->winmap == (ubyte_t)0) {
XMapWindow(gui->display, win->window);
win->winmap = (byte_t)1;
}
}
else {
- if (win->winmap) {
+ if (win->winmap == (ubyte_t)1) {
XUnmapWindow(gui->display, win->window);
win->winmap = (byte_t)0;
}
}
}
-void
-gui_greq_winmap_change(gui_t *gui, greq_win_t *greqw, int state)
-{
- winlist_t *w;
- int i;
-
- for (i=0; i<greqw->n_greq; i++) {
- w = (winlist_t *)(greqw->win[i]);
- gui_winmap_change(gui, w, state);
- }
-}
-
void
gui_greq_win_destroy(greq_win_t *greqw)
{
@@ -229,22 +217,6 @@
}
void
-gui_overspot_winmap_change(gui_t *gui, int imid, int state)
-{
- winlist_t *w = xccore->win;
-
- while (w) {
- if (w->imid == imid && w->wid == WID_OVERSPOT) {
- gui_winmap_change(gui, w, state);
- if (state == 1)
- XRaiseWindow(gui->display, w->window);
- break;
- }
- w = w->next;
- }
-}
-
-void
gui_overspot_destroy(int imid)
{
winlist_t *w = xccore->win;
@@ -351,6 +323,20 @@
return win;
}
+static void
+gui_greq_windraw(gui_t *gui, greq_win_t *greqw, int state)
+{
+ winlist_t *w;
+ int i;
+
+ for (i=0; i<greqw->n_greq; i++) {
+ w = (winlist_t *)(greqw->win[i]);
+ gui_winmap_change(gui, w, state);
+ if (state)
+ w->win_draw_func(&(xccore->gui), w);
+ }
+}
+
static void
update_gui_request(void)
{
@@ -360,6 +346,13 @@
greq_win_t gw_handling;
int i, j;
+ 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 && imc->gwin.n_greq == 0)
return;
@@ -384,14 +377,11 @@
gw_handling.win[gw_handling.n_greq] = imc->gwin.win[i];
(gw_handling.n_greq) ++;
- 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->win_end->next = win;
- xccore->win_end = win;
- }
+ if (! search_winlist(xccore->win,
+ WID_GUIREQ, imc->id, greqd->reqid) &&
+ (win=gui_request_init(imc, greqd))) {
+ xccore->win_end->next = win;
+ xccore->win_end = win;
}
}
greqd = greqd->next;
@@ -407,15 +397,13 @@
}
memcpy(&(imc->gwin), &(gw_handling), sizeof(greq_win_t));
- if ((xccore->xcin_mode & XCIN_SINGLE_IMC)) {
+// 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->ic->imc->inp_state & IM_XIMFOCUS))
+ gui_greq_windraw(&(xccore->gui), &(imc->gwin), 0);
else
- gui_greq_winmap_change(&(xccore->gui), &(imc->gwin), 1);
- }
+ gui_greq_windraw(&(xccore->gui), &(imc->gwin), 1);
+// }
}
/*--------------------------------------------------------------------------*/
@@ -425,16 +413,17 @@
update_gui_overspot(void)
{
winlist_t *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->imc->pre_attr = &(ic->pre_attr);
+ ic->imc->sts_attr = &(ic->sts_attr);
win = gui_overspot_init(&(xccore->gui), xccore->main_win, ic->imc);
xccore->win_end->next = win;
xccore->win_end = 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->display, win->window, &(gui->wm_del_win), 1);
/* Setup GC */
- 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->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->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->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->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->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->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);
+ XRaiseWindow(gui->display, win->window);
overspot_win_location(gui, win, imc);
gui_winmap_change(gui, win, 1);
overspot_win_draw(gui, win, imc);
@@ -225,18 +224,21 @@
XSelectInput(gui->display, win->window, (ExposureMask|StructureNotifyMask));
/* Setup GC */
- 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->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->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->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->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/xim.c.orig Wed Feb 23 09:47:57 2000
+++ src/xim.c Thu Feb 24 01:55:36 2000
@@ -165,12 +165,11 @@
if (imc->icid != ic->id)
return;
- xccore->ic = ic;
if ((imc->inp_state & IM_CINPUT)) {
imc->inp_state |= IM_XIMFOCUS;
xccore->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;
}
@@ -460,6 +459,7 @@
ic->imc->icid = ic->id;
call_switch_in(ic);
ic->ic_state |= IC_FOCUS;
+ xccore->ic = ic;
if ((ic->ic_state & IC_NEWIC)) {
if ((xccore->xcin_mode & XCIN_RUN_IM_FOCUS) ||
@@ -484,23 +484,8 @@
ic->imc->sts_attr = &(ic->sts_attr);
}
}
- else {
-/*
- * For XCIN_SINGLE_IMC off, we should change the GUI-request windows' mapping
- * state everytime when changing the IC focus, since the focus status in this
- * mode is definite, and each IC is completely independent to the others, so
- * we should handle them independently.
- *
- * But for XCIN_SINGLE_IMC mode, the focus state of IMC might be ambiguous,
- * as described on the above, so we will change the GUI-request windows'
- * mapping state after all the focus status are determined, i.e., in the
- * update_gui_request() in gui.c. This way can also improve the graphical
- * performance.
- */
- 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);
- }
+ else
+ xccore->gui.winchange |= WIN_CHANGE_FOCUS;
return True;
}
@@ -517,12 +502,10 @@
return False;
call_switch_out(ic);
+ 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->xcin_mode & XCIN_SINGLE_IMC))
+ xccore->gui.winchange |= WIN_CHANGE_FOCUS;
return True;
}
@@ -962,12 +945,15 @@
{
IMSyncXlibStruct pass_data;
- 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->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->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 & 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.
+
+
xcin-2.5.2-pre2: 2000/02/23
------------------------------
1. Register a WM protocol into testprog such that it can be terminated by WM.