This is the second patch for kinput2 version 2.0, a Japanese input server contributed to X11R6. To apply this patch, you should do: % cd % cd contrib/programs/kinput2 % patch -p < thisfile Changes: + Configuration for Wnn conversion system is more flexible than it was (although it might be more complicated). With the Wnn version 4.2, you no longer need Wnn source to compile kinput2. + X I/O error handler is introduced, so the appropriate cleanup tasks such as saving dictionaries are performed even when kinput2 exits due to XIO error. + Kinput2 respects the specification of conversion start keys in the Canna configuration file. + Some bugs in XIM and XLC protocol handling are fixed. + Geometry negotiation in XIM protocol is much improved. + Display of underlined characters using small fonts (with its decent less than 2) is fixed. etc. Makoto Ishisone Software Research Associates, Inc. ishisone@sra.co.jp diff -N -a -r -c ../ki2v2f1/Kinput2.conf ./Kinput2.conf *** ../ki2v2f1/Kinput2.conf Wed Oct 5 10:18:12 1994 --- ./Kinput2.conf Thu Sep 26 18:22:36 1996 *************** *** 24,52 **** /* * If you define UseWnn, set following 3 variables: * ! * WNNSRC: Wnn source directory * WNNLIB: Wnn client-side library * CCDEF_DIR: directory where character conversion rule * definition files are to be installed */ CCDEF_DIR = $(LIBDIR)/ccdef /* * If you have installed Wnn.. ! * Even if you have installed Wnn header files, kinput2 still needs ! * "config.h" which is not installed, so you have to set WNNSRC ! * anyway. */ XCOMM use installed library - XCOMM WNNSRC = $(R5SRC)/contrib/im/Xsi/Wnn XCOMM WNNLIB = -lwnn /* * Or, use library in the source tree.. */ XCOMM use library in the source tree ! WNNSRC = $(R5SRC)/contrib/im/Xsi/Wnn WNNLIB = $(WNNSRC)/jlib/libwnn.a --- 24,61 ---- /* * If you define UseWnn, set following 3 variables: * ! * WNNINCDIR: Wnn include file directory * WNNLIB: Wnn client-side library * CCDEF_DIR: directory where character conversion rule * definition files are to be installed + * + * You may need to define WnnLibDir if Wnn configuration files + * are not installed in /usr/local/lib/wnn (the default). */ + /* #define WnnLibDir /some/peculiar/directory/wnn */ CCDEF_DIR = $(LIBDIR)/ccdef /* * If you have installed Wnn.. ! * ! * First check the directory where Wnn header files has been installed. ! * If "config.h" is not there, you must specify the include directory ! * in the Wnn source tree. */ + XCOMM use installed header files (if config.h is there) + XCOMM WNNINCDIR = /usr/X11R6/include/wnn + XCOMM or header files in the source tree + XCOMM WNNINCDIR = $(CONTRIBSRC)/programs/Xsi/Wnn/include XCOMM use installed library XCOMM WNNLIB = -lwnn /* * Or, use library in the source tree.. */ XCOMM use library in the source tree ! WNNSRC = $(CONTRIBSRC)/programs/Xsi/Wnn ! WNNINCDIR = $(WNNSRC)/include WNNLIB = $(WNNSRC)/jlib/libwnn.a diff -N -a -r -c ../ki2v2f1/cmd/kinput2.c ./cmd/kinput2.c *** ../ki2v2f1/cmd/kinput2.c Wed Oct 5 10:18:15 1994 --- ./cmd/kinput2.c Thu Sep 26 18:22:41 1996 *************** *** 21,27 **** */ #ifndef lint ! static char *rcsid = "$Id: kinput2.c,v 1.36 1994/09/01 05:08:32 ishisone Exp $"; #endif #include --- 21,27 ---- */ #ifndef lint ! static char *rcsid = "$Id: kinput2.c,v 1.38 1995/05/17 09:08:40 ishisone Exp $"; #endif #include *************** *** 32,37 **** --- 32,38 ---- #include "patchlevel.h" #include "AsyncErr.h" #include "MyDispatch.h" + #include "IOECall.h" #include "ConvMgr.h" #include "KIProto.h" #include "XimpProto.h" *************** *** 163,168 **** --- 164,170 ---- Widget manager, protocol; int i; WidgetClass inputobjclass, displayobjclass; + Widget inputobj; toplevel = XtAppInitialize(&apc, "Kinput2", options, XtNumber(options), *************** *** 186,191 **** --- 188,196 ---- /* initialize asynchronous error handler */ XAEInit(); + /* initialize I/O error callback handler */ + XIOEInit(); + XtGetApplicationResources(toplevel, &appres, app_resources, XtNumber(app_resources), NULL, 0); *************** *** 218,223 **** --- 223,240 ---- #endif inputobjclass = getInputObjClass(); + + inputobj = XtCreateWidget("inputObj", inputobjclass, + toplevel, 0, 0); + XtRealizeWidget(inputobj); + ICRegisterTriggerKeys(inputobj); + /* + Destroying the `inputobj' is postponed until all the widgets + are realized in order to prevent duplicate initialization of + input object, that is, to prevent making connection twice to + input conversion server. + */ + displayobjclass = jpWcharDisplayObjectClass; manager = XtVaCreateManagedWidget("convmanager", *************** *** 293,298 **** --- 310,317 ---- DefaultErrorHandler = XAESetErrorHandler(IgnoreBadWindow); XtRealizeWidget(toplevel); + + XtDestroyWidget(inputobj); /* Don't move this before XtRealizeWidget() */ for (;;) { XEvent event; diff -N -a -r -c ../ki2v2f1/doc/ccdef ./doc/ccdef *** ../ki2v2f1/doc/ccdef Wed Oct 5 10:18:16 1994 --- ./doc/ccdef Thu Sep 26 18:22:42 1996 *************** *** 632,638 **** カスタマイズの最後の例として、emacs を使う時に便利な変更を紹介します。 ご存知のように、emacs はコントロールキーを駆使して編集を行ないます。リソー ! スsendBackKeyPress が True になっていれば、未確定の文字列がない状態ではほ とんどのコントロールキーは(そのキーが変換ファンクションに割り当てられてい ても) そのままアプリケーションに渡されますので、かな漢字変換ができる入力モー ドのまま emacs にコマンドを与えることができます。しかし中には '^Xo' などの --- 632,638 ---- カスタマイズの最後の例として、emacs を使う時に便利な変更を紹介します。 ご存知のように、emacs はコントロールキーを駆使して編集を行ないます。リソー ! スsendbackKeyPress が True になっていれば、未確定の文字列がない状態ではほ とんどのコントロールキーは(そのキーが変換ファンクションに割り当てられてい ても) そのままアプリケーションに渡されますので、かな漢字変換ができる入力モー ドのまま emacs にコマンドを与えることができます。しかし中には '^Xo' などの diff -N -a -r -c ../ki2v2f1/include/IMProtoP.h ./include/IMProtoP.h *** ../ki2v2f1/include/IMProtoP.h Wed Oct 5 10:18:25 1994 --- ./include/IMProtoP.h Thu Sep 26 18:22:58 1996 *************** *** 1,4 **** ! /* $Id: IMProtoP.h,v 1.5 1994/05/31 07:55:06 ishisone Rel $ */ /* * Copyright (c) 1994 Software Research Associates, Inc. * --- 1,4 ---- ! /* $Id: IMProtoP.h,v 1.6 1995/05/17 09:15:02 ishisone Exp $ */ /* * Copyright (c) 1994 Software Research Associates, Inc. * *************** *** 23,28 **** --- 23,29 ---- #include "im.h" #include "FontBank.h" #include "ConvCtrl.h" + #include "IOECall.h" typedef struct { int dummy; *************** *** 79,84 **** --- 80,86 ---- FontBank font_bank; XFontStruct **default_fonts; int num_default_fonts; + XIOEHandle ioe_handle; /* atoms */ Atom xim_xconnect; /* "_XIM_XCONNECT" */ diff -N -a -r -c ../ki2v2f1/include/IOECall.h ./include/IOECall.h *** ../ki2v2f1/include/IOECall.h Thu Jan 1 09:00:00 1970 --- ./include/IOECall.h Thu Sep 26 18:23:05 1996 *************** *** 0 **** --- 1,50 ---- + /* $Id: IOECall.h,v 1.1 1994/11/22 01:13:01 ishisone Exp $ */ + /* + * Copyright (C) 1994 Software Research Associates, Inc. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Software Research Associates not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. Software Research + * Associates makes no representations about the suitability of this software + * for any purpose. It is provided "as is" without express or implied + * warranty. + * + * Author: Makoto Ishisone, Software Research Associates, Inc., Japan + */ + + #ifndef _IOECall_h + #define _IOECall_h + + /* + * X I/O error callback handler + */ + + /* + * XIOEHandle -- an opaque type used as a 'handle' in this library + */ + typedef struct ioe_cb_desc_ *XIOEHandle; + + extern void XIOEInit( + #if NeedFunctionPrototypes + void + #endif + ); + + extern XIOEHandle XIOESet( + #if NeedFunctionPrototypes + void (*)(), + XPointer + #endif + ); + + extern void XIOEUnset( + #if NeedFunctionPrototypes + XIOEHandle handle + #endif + ); + + #endif /* _IOECall_h */ diff -N -a -r -c ../ki2v2f1/include/InputConv.h ./include/InputConv.h *** ../ki2v2f1/include/InputConv.h Wed Oct 5 10:18:21 1994 --- ./include/InputConv.h Thu Sep 26 18:22:50 1996 *************** *** 1,4 **** ! /* $Id: InputConv.h,v 1.16 1994/07/05 07:49:01 ishisone Exp $ */ /* * Copyright (c) 1990 Software Research Associates, Inc. * --- 1,4 ---- ! /* $Id: InputConv.h,v 1.17 1995/05/17 09:13:13 ishisone Exp $ */ /* * Copyright (c) 1990 Software Research Associates, Inc. * *************** *** 120,125 **** --- 120,135 ---- } ICAuxControlArg; /* + * GetTriggerKeys に使われる keys のための構造体 + */ + + typedef struct { + KeySym keysym; + long modifiers; + long modifiermask; + } ICTriggerKey; + + /* * パブリックインターフェイスファンクション */ *************** *** 311,316 **** --- 321,350 ---- Cardinal * /* n */, Cardinal * /* ns */, Cardinal * /* nc */ + #endif + ); + + /* + * int ICRegisterTriggerKeys(Widget object) + * 指定されたオブジェクトの日本語入力開始キーを取り出し、 + * クラス変数に格納する。 + */ + extern int ICRegisterTriggerKeys( + #if NeedFunctionPrototypes + Widget /* object */ + #endif + ); + + /* + * int ICGetTriggerKeysOfInputObjectClass(WidgetClass objectclass, + * ICTriggerKey *keys_return) + * 指定された入力オブジェクトクラスに登録されている日本語 + * 入力開始キーを取り出す。 + */ + extern int ICGetTriggerKeysOfInputObjectClass( + #if NeedFunctionPrototypes + WidgetClass /* objectclass */, + ICTriggerKey ** /* keys_return */ #endif ); diff -N -a -r -c ../ki2v2f1/include/InputConvP.h ./include/InputConvP.h *** ../ki2v2f1/include/InputConvP.h Wed Oct 5 10:18:21 1994 --- ./include/InputConvP.h Thu Sep 26 18:22:50 1996 *************** *** 1,4 **** ! /* $Id: InputConvP.h,v 1.12 1991/09/26 00:35:29 ishisone Rel $ */ /* * Copyright (c) 1990 Software Research Associates, Inc. * --- 1,4 ---- ! /* $Id: InputConvP.h,v 1.13 1995/05/17 09:13:13 ishisone Exp $ */ /* * Copyright (c) 1990 Software Research Associates, Inc. * *************** *** 35,40 **** --- 35,43 ---- int (*ClearConversion)(); ICString *(*GetAuxSegments)(); Boolean SupportMultipleObjects; + int (*GetTriggerKeys)(); + int num_trigger_keys; + ICTriggerKey *trigger_keys; /* private state */ Boolean NoMoreObjects; } InputConvClassPart; *************** *** 73,77 **** --- 76,81 ---- #define XtInheritGetConvertedString (int(*)())_XtInherit #define XtInheritClearConversion (int(*)())_XtInherit #define XtInheritGetAuxSegments (ICString*(*)())_XtInherit + #define XtInheritGetTriggerKeys (int(*)())_XtInherit #endif diff -N -a -r -c ../ki2v2f1/lib/Canna.c ./lib/Canna.c *** ../ki2v2f1/lib/Canna.c Wed Oct 5 10:18:45 1994 --- ./lib/Canna.c Thu Sep 26 18:23:34 1996 *************** *** 47,53 **** */ #ifndef lint ! static char *rcsid = "$Id: Canna.c,v 1.47 1994/09/21 04:58:05 kon Exp $"; #endif #include --- 47,53 ---- */ #ifndef lint ! static char *rcsid = "$Id: Canna.c,v 1.52 1996/09/02 10:19:10 kon Exp $"; #endif #include *************** *** 59,64 **** --- 59,65 ---- #include #endif #include "CannaP.h" + #include "DebugPrint.h" #define _WCHAR_T /* この定義は jrkanji.h で wcKanjiStatus などを定義するため */ #define wchar_t wchar *************** *** 91,96 **** --- 92,98 ---- static int ConvertedString(); static int ClearConversion(); static void displayPreEdit(); + static int GetTriggerKeys(); static initializeCannaConnection(); static toJapaneseMode(); *************** *** 102,108 **** static ibufInitialize(), freeIBuf(); #ifdef KC_SETLISTCALLBACK ! static void listfunc(); static void openSelection(); #define SELECTION_SET 0 /* SelectionStart をしても良いと言う情報を設定する */ #define SELECTION_DO 1 /* 実際に SelectionStart を開始する */ --- 104,116 ---- static ibufInitialize(), freeIBuf(); #ifdef KC_SETLISTCALLBACK ! #ifdef CANNA_LIST_Convert ! #define CANNA_LISTFUNCTYPE int ! #else ! #define CANNA_LISTFUNCTYPE void ! #endif ! static CANNA_LISTFUNCTYPE listfunc(); ! static void openSelection(); #define SELECTION_SET 0 /* SelectionStart をしても良いと言う情報を設定する */ #define SELECTION_DO 1 /* 実際に SelectionStart を開始する */ *************** *** 160,165 **** --- 168,176 ---- /* ClearConversion */ ClearConversion, /* GetAuxSegments */ GetAuxSegments, /* SupportMultipleObjects */ True, + /* GetTriggerKeys */ GetTriggerKeys, + /* num_trigger_keys */ 0, + /* trigger_keys */ NULL, /* NoMoreObjects */ False, }, { /* canna fields */ *************** *** 186,191 **** --- 197,203 ---- static void ClassInitialize() { + TRACE(("CannaObjectClass initialized\n")); /* 何もしない */ } *************** *** 247,253 **** } /* 要らない場合は無視する */ ! if (nbytes == 0) return 0; /* ベルを鳴らすディスプレイの設定 */ --- 259,265 ---- } /* 要らない場合は無視する */ ! if (nbytes == 0) return 1; /* ベルを鳴らすディスプレイの設定 */ *************** *** 641,646 **** --- 653,660 ---- #endif /* KC_SETINITFILENAME */ wcKanjiControl((int)obj, KC_INITIALIZE, (char *)&warn); + TRACE(("Canna initialized\n")); + if (warn) { char **p; *************** *** 1459,1465 **** * cur_item : 〃 カレントアイテム番号を格納するアドレスが入る */ ! static void listfunc(obj, func, items, nitems, cur_item) CannaObject obj; int func; --- 1473,1479 ---- * cur_item : 〃 カレントアイテム番号を格納するアドレスが入る */ ! static CANNA_LISTFUNCTYPE listfunc(obj, func, items, nitems, cur_item) CannaObject obj; int func; *************** *** 1489,1494 **** --- 1503,1511 ---- querySelection(obj); break; #endif + #ifdef CANNA_LIST_Convert + case CANNA_LIST_Convert: + #endif case CANNA_LIST_Forward: moveSelection(obj, ICMoveRight); break; *************** *** 1508,1513 **** --- 1525,1533 ---- moveSelection(obj, ICMoveRightMost); break; } + #ifdef CANNA_LIST_Convert + return 1; + #endif } static void *************** *** 1562,1564 **** --- 1582,1716 ---- } } #endif /* KC_SETLISTCALLBACK */ + + struct _keymap { + unsigned char cannakey; + KeySym keysym; + long modifier; + } cannakeymap[] = { + {(unsigned char)'\b', XK_BackSpace, 0}, + {(unsigned char)'\t', XK_Tab, 0}, + {(unsigned char)'\n', XK_Linefeed, 0}, + {(unsigned char)'\013', XK_Clear, 0}, + {(unsigned char)'\r', XK_Return, 0}, + {(unsigned char)'\023', XK_Pause, 0}, + {(unsigned char)'\024', XK_Scroll_Lock, 0}, + {(unsigned char)'\e', XK_Escape, 0}, + {(unsigned char)CANNA_KEY_Nfer, XK_Muhenkan, 0}, + {(unsigned char)CANNA_KEY_Xfer, XK_Kanji, 0}, + {(unsigned char)CANNA_KEY_Up, XK_Up, 0}, + {(unsigned char)CANNA_KEY_Left, XK_Left, 0}, + {(unsigned char)CANNA_KEY_Right, XK_Right, 0}, + {(unsigned char)CANNA_KEY_Down, XK_Down, 0}, + {(unsigned char)CANNA_KEY_Insert, XK_Insert, 0}, + {(unsigned char)CANNA_KEY_Rollup, XK_Prior, 0}, + {(unsigned char)CANNA_KEY_Rolldown, XK_Next, 0}, + {(unsigned char)CANNA_KEY_Home, XK_Home, 0}, + {(unsigned char)CANNA_KEY_Help, XK_Help, 0}, + {(unsigned char)CANNA_KEY_KP_Key, XK_KP_Space, 0}, /* ? */ + {(unsigned char)CANNA_KEY_Shift_Nfer, XK_Muhenkan, ShiftMask}, + {(unsigned char)CANNA_KEY_Shift_Xfer, XK_Kanji, ShiftMask}, + {(unsigned char)CANNA_KEY_Shift_Up, XK_Up, ShiftMask}, + {(unsigned char)CANNA_KEY_Shift_Left, XK_Left, ShiftMask}, + {(unsigned char)CANNA_KEY_Shift_Right, XK_Right, ShiftMask}, + {(unsigned char)CANNA_KEY_Shift_Down, XK_Down, ShiftMask}, + {(unsigned char)CANNA_KEY_Cntrl_Nfer, XK_Muhenkan, ControlMask}, + {(unsigned char)CANNA_KEY_Cntrl_Xfer, XK_Kanji, ControlMask}, + {(unsigned char)CANNA_KEY_Cntrl_Up, XK_Up, ControlMask}, + {(unsigned char)CANNA_KEY_Cntrl_Left, XK_Left, ControlMask}, + {(unsigned char)CANNA_KEY_Cntrl_Right, XK_Right, ControlMask}, + {(unsigned char)CANNA_KEY_Cntrl_Down, XK_Down, ControlMask}, + {(unsigned char)CANNA_KEY_F1, XK_F1, 0}, + {(unsigned char)CANNA_KEY_F2, XK_F2, 0}, + {(unsigned char)CANNA_KEY_F3, XK_F3, 0}, + {(unsigned char)CANNA_KEY_F4, XK_F4, 0}, + {(unsigned char)CANNA_KEY_F5, XK_F5, 0}, + {(unsigned char)CANNA_KEY_F6, XK_F6, 0}, + {(unsigned char)CANNA_KEY_F7, XK_F7, 0}, + {(unsigned char)CANNA_KEY_F8, XK_F8, 0}, + {(unsigned char)CANNA_KEY_F9, XK_F9, 0}, + {(unsigned char)CANNA_KEY_F10, XK_F10, 0}, + {(unsigned char)CANNA_KEY_PF1, XK_KP_F1, 0}, + {(unsigned char)CANNA_KEY_PF2, XK_KP_F2, 0}, + {(unsigned char)CANNA_KEY_PF3, XK_KP_F3, 0}, + {(unsigned char)CANNA_KEY_PF4, XK_KP_F4, 0}, + {(unsigned char)CANNA_KEY_PF5, XK_F15, 0}, + {(unsigned char)CANNA_KEY_PF6, XK_F16, 0}, + {(unsigned char)CANNA_KEY_PF7, XK_F17, 0}, + {(unsigned char)CANNA_KEY_PF8, XK_F18, 0}, + {(unsigned char)CANNA_KEY_PF9, XK_F19, 0}, + {(unsigned char)CANNA_KEY_PF10, XK_F20, 0}, + }; + + #define NCANNAKEYMAP (sizeof(cannakeymap) / sizeof(struct _keymap)) + + /* ARGSUSED */ + static int + GetTriggerKeys(w, keys_return) + Widget w; + ICTriggerKey **keys_return; + { + CannaObject obj = (CannaObject)w; + ICTriggerKey *keys; + unsigned char c, mkeys[256], *p, *ekeys; /* enough */ + int n; + struct _keymap *pk, *ek; + + n = wcKanjiControl((int)obj, KC_MODEKEYS, (char *)mkeys); + + *keys_return = keys = + (ICTriggerKey *)XtMalloc(2 * n * sizeof(ICTriggerKey)); + /* 「2 *」の意味: + 一つのコードに2つの X のキーが存在していたりする事がある。 + (例) C-h → Ctlh, Backspace */ + + if (keys) { + for (p = mkeys, ekeys = p + n ; p < ekeys ; p++, keys++) { + c = *p; + if (c == (unsigned char)0) { + keys->keysym = XK_space; + keys->modifiers = keys->modifiermask = ControlMask; + keys++; + keys->keysym = XK_at; + keys->modifiers = keys->modifiermask = ControlMask; + } + else if (c < ' ') { + keys->keysym = XK_quoteleft + c; + keys->modifiers = keys->modifiermask = ControlMask; + for (pk = cannakeymap, ek = cannakeymap + NCANNAKEYMAP ; + pk < ek ; pk++) { + if (c == pk->cannakey) { + keys++; + keys->keysym = pk->keysym; + keys->modifiers = keys->modifiermask = pk->modifier; + } + } + } + else if (c <= '~') { + keys->keysym = XK_space + (c - (unsigned char)' '); + keys->modifiers = keys->modifiermask = 0; + } + else if (c == 0x7f) { + keys->keysym = XK_Delete; + keys->modifiers = keys->modifiermask = 0; + } + else if ((unsigned char)0xa1 <= c && c <= (unsigned char)0xdf) { + keys->keysym = XK_kana_fullstop + (c - (unsigned char)0xa1); + keys->modifiers = keys->modifiermask = pk->modifier; + } + else { + keys--; + for (pk = cannakeymap, ek = cannakeymap + NCANNAKEYMAP ; + pk < ek ; pk++) { + if (c == pk->cannakey) { + keys++; + keys->keysym = pk->keysym; + keys->modifiers = keys->modifiermask = pk->modifier; + } + } + } + } + return n; + } + return 0; + } diff -N -a -r -c ../ki2v2f1/lib/CcWnn.c ./lib/CcWnn.c *** ../ki2v2f1/lib/CcWnn.c Wed Oct 5 10:18:44 1994 --- ./lib/CcWnn.c Thu Sep 26 18:23:30 1996 *************** *** 1,5 **** #ifndef lint ! static char *rcsid = "$Id: CcWnn.c,v 1.35 1993/09/07 07:24:54 ishisone Rel $"; #endif /* * Copyright (c) 1990 Software Research Associates, Inc. --- 1,5 ---- #ifndef lint ! static char *rcsid = "$Id: CcWnn.c,v 1.39 1996/09/02 09:08:20 ishisone Exp $"; #endif /* * Copyright (c) 1990 Software Research Associates, Inc. *************** *** 26,31 **** --- 26,32 ---- #endif #include "CcWnnP.h" #include + #include "IOECall.h" static XtResource resources[] = { #define offset(field) XtOffset(CcWnnObject, ccWnn.field) *************** *** 118,123 **** --- 119,127 ---- /* ClearConversion */ ClearConversion, /* GetAuxSegments */ GetAuxSegments, /* SupportMultipleObjects */ True, + /* GetTriggerKeys */ XtInheritGetTriggerKeys, + /* num_trigger_keys */ 0, + /* trigger_keys */ NULL, /* NoMoreObjects */ False, }, { /* ccWnn fields */ *************** *** 308,318 **** --- 312,326 ---- static void saveData(); static void restoreData(); + static void ioeCallback(); + static void ClassInitialize() { /* symbollist を設定 */ NumSymbols = buildSymbolList(&SymbolList); + /* I/O error コールバック関数の設定 */ + XIOESet(ioeCallback, (XPointer)NULL); } static int *************** *** 1383,1412 **** { jcConvBuf *jcbuf = JCBUF(obj); - obj->ccWnn.fixperformed = True; - normalState(obj); - if (jcFix(jcbuf) < 0) { - beep(obj); - return; - } ccContextClear(CCBUF(obj)); ! /* 辞書セーブの処理 */ ! obj->ccWnn.fixcount++; ! if (obj->ccWnn.saveinterval > 0 && ! obj->ccWnn.fixcount >= obj->ccWnn.saveinterval) { ! jcSaveDic(jcbuf); ! obj->ccWnn.fixcount = 0; ! } ! /* 確定の処理 */ ! XtCallCallbackList((Widget)obj, obj->inputConv.fixcallback, ! (XtPointer)NULL); /* ??? */ /* バッファをクリアする */ jcClear(jcbuf); - HINT(obj) = True; } static void --- 1391,1424 ---- { jcConvBuf *jcbuf = JCBUF(obj); normalState(obj); ccContextClear(CCBUF(obj)); ! if (jcbuf->nClause > 0) { ! obj->ccWnn.fixperformed = True; ! ! if (jcFix(jcbuf) < 0) { ! beep(obj); ! return; ! } ! ! /* 辞書セーブの処理 */ ! obj->ccWnn.fixcount++; ! if (obj->ccWnn.saveinterval > 0 && ! obj->ccWnn.fixcount >= obj->ccWnn.saveinterval) { ! jcSaveDic(jcbuf); ! obj->ccWnn.fixcount = 0; ! } ! ! /* 確定の処理 */ ! XtCallCallbackList((Widget)obj, obj->inputConv.fixcallback, ! (XtPointer)NULL); /* ??? */ ! HINT(obj) = True; ! } /* バッファをクリアする */ jcClear(jcbuf); } static void *************** *** 2062,2065 **** --- 2074,2096 ---- obj->ccWnn.pendingdata = NULL; obj->ccWnn.textchanged = True; + } + + /* ARGSUSED */ + static void + ioeCallback(dummy) + XPointer dummy; + { + ObjRec *objp = ObjList; + + /* + * I/O Error callback function. + * Does minimum cleanup -- i.e. saving dictionaries. + */ + while (objp != NULL) { + if (objp->obj->ccWnn.jcbuf != NULL) { + jcSaveDic(objp->obj->ccWnn.jcbuf); + } + objp = objp->next; + } } diff -N -a -r -c ../ki2v2f1/lib/IMProto.c ./lib/IMProto.c *** ../ki2v2f1/lib/IMProto.c Wed Oct 5 10:18:46 1994 --- ./lib/IMProto.c Thu Sep 26 18:23:36 1996 *************** *** 1,5 **** #ifndef lint ! static char *rcsid = "$Id: IMProto.c,v 1.16 1994/09/22 08:12:58 ishisone Exp $"; #endif /*- * Copyright (c) 1991, 1994 Software Research Associates, Inc. --- 1,5 ---- #ifndef lint ! static char *rcsid = "$Id: IMProto.c,v 1.18 1995/05/17 09:17:08 ishisone Exp $"; #endif /*- * Copyright (c) 1991, 1994 Software Research Associates, Inc. *************** *** 39,44 **** --- 39,45 ---- #include #include "IMProtoP.h" #include "ParseKey.h" + #include "InputConv.h" #include "im.h" *************** *** 145,150 **** --- 146,152 ---- static void setTransport _Pt_((Widget w)); static int makeConverter _Pt_((Widget w)); static void getTriggerKeys _Pt_((Widget w)); + static void ioeCallback _Pt_((XPointer cldata)); /* *************** *** 312,317 **** --- 314,320 ---- ipw->imp.unix_sock, (XtPointer)XtInputReadMask, acceptUnixService, (XtPointer)ipw); + ipw->imp.ioe_handle = XIOESet(ioeCallback, (XPointer)ipw); } #endif /* IM_UNIX_TRANSPORT */ *************** *** 369,374 **** --- 372,378 ---- (void)close(ipw->imp.tcp_sock); } if (ipw->imp.unix_sock >= 0) { + XIOEUnset(ipw->imp.ioe_handle); (void)unlink(ipw->imp.unix_path); XtRemoveInput(ipw->imp.unix_id); (void)close(ipw->imp.unix_sock); *************** *** 933,939 **** char *key_str; IMTriggerKey keys[100]; int num_keys; ! int c; TRACE(("IMProtocolWidget:getTriggerKeys()\n")); --- 937,944 ---- char *key_str; IMTriggerKey keys[100]; int num_keys; ! int c, n; ! ICTriggerKey *ckeys, *ekeys; TRACE(("IMProtocolWidget:getTriggerKeys()\n")); *************** *** 962,967 **** --- 967,984 ---- } } while (c != '\0' && num_keys < 100); } + + n = ICGetTriggerKeysOfInputObjectClass(ipw->imp.input_object_class, + &ckeys); + for (ekeys = ckeys + n ; + ckeys < ekeys && num_keys < (sizeof(keys) / sizeof(IMTriggerKey)) ; + ckeys++) { + keys[num_keys].keysym = ckeys->keysym; + keys[num_keys].modifiers = ckeys->modifiers; + keys[num_keys].check_modifiers = ckeys->modifiermask; + num_keys++; + } + TRACE(("\tnumber of trigger keys: %d\n", num_keys)); ipw->imp.num_trigger_keys = num_keys; *************** *** 973,977 **** --- 990,1006 ---- bcopy((char *)keys, (char *)ipw->imp.trigger_keys, size); } else { ipw->imp.trigger_keys = NULL; + } + } + + /*- ioeCallback: callback procedure for X I/O error -*/ + static void + ioeCallback(cldata) + XPointer cldata; + { + IMProtocolWidget ipw = (IMProtocolWidget)cldata; + + if (ipw->imp.unix_sock >= 0 && ipw->imp.unix_path != NULL) { + (void)unlink(ipw->imp.unix_path); } } diff -N -a -r -c ../ki2v2f1/lib/Imakefile ./lib/Imakefile *** ../ki2v2f1/lib/Imakefile Wed Oct 5 10:18:42 1994 --- ./lib/Imakefile Thu Sep 26 18:23:27 1996 *************** *** 12,22 **** UTILSRCS = cachedatom.c cachedfont.c ctext.c dispatch.c \ fontset.c wstring.c xtwstr.c xwstr.c \ ! asyncerr.c fontbank.c parsekey.c UTILOBJS = cachedatom.o cachedfont.o ctext.o dispatch.o \ fontset.o wstring.o xtwstr.o xwstr.o \ ! asyncerr.o fontbank.o parsekey.o #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' #define IHaveSubdirs --- 12,22 ---- UTILSRCS = cachedatom.c cachedfont.c ctext.c dispatch.c \ fontset.c wstring.c xtwstr.c xwstr.c \ ! asyncerr.c fontbank.c parsekey.c ioecall.c UTILOBJS = cachedatom.o cachedfont.o ctext.o dispatch.o \ fontset.o wstring.o xtwstr.o xwstr.o \ ! asyncerr.o fontbank.o parsekey.o ioecall.o #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' #define IHaveSubdirs *************** *** 25,31 **** #ifdef UseWnn WNNSRCS = CcWnn.c cconv.c jclib.c jilib.c WNNOBJS = CcWnn.o cconv.o jclib.o jilib.o ! WNNINCS = -I$(WNNSRC)/include #endif #ifdef UseCanna CANNASRCS = Canna.c --- 25,34 ---- #ifdef UseWnn WNNSRCS = CcWnn.c cconv.c jclib.c jilib.c WNNOBJS = CcWnn.o cconv.o jclib.o jilib.o ! WNNINCS = -I$(WNNINCDIR) ! #ifdef WnnLibDir ! WNNDEFS = -DLIBDIR=WnnLibDir ! #endif #endif #ifdef UseCanna CANNASRCS = Canna.c *************** *** 49,55 **** DEFINES = -DCCDEFPATH=\"$(CCDEF_DIR)/\" \ -DSJ3DEFPATH=\"$(SJ3DEF_DIR)/\" \ ! $(TRANSPORTDEFS) NormalLibraryObjectRule() NormalLibraryTarget(Ki2,$(OBJS)) --- 52,58 ---- DEFINES = -DCCDEFPATH=\"$(CCDEF_DIR)/\" \ -DSJ3DEFPATH=\"$(SJ3DEF_DIR)/\" \ ! $(WNNDEFS) $(TRANSPORTDEFS) NormalLibraryObjectRule() NormalLibraryTarget(Ki2,$(OBJS)) diff -N -a -r -c ../ki2v2f1/lib/InputConv.c ./lib/InputConv.c *** ../ki2v2f1/lib/InputConv.c Wed Oct 5 10:18:44 1994 --- ./lib/InputConv.c Thu Sep 26 18:23:31 1996 *************** *** 1,5 **** #ifndef lint ! static char *rcsid = "$Id: InputConv.c,v 1.14 1991/09/26 00:35:59 ishisone Rel $"; #endif /* * Copyright (c) 1990 Software Research Associates, Inc. --- 1,5 ---- #ifndef lint ! static char *rcsid = "$Id: InputConv.c,v 1.15 1995/05/17 09:13:13 ishisone Exp $"; #endif /* * Copyright (c) 1990 Software Research Associates, Inc. *************** *** 56,61 **** --- 56,62 ---- static int ConvertedString(); static int Clear(); static ICString *GetAuxSegments(); + static int GetTriggerKeys(); InputConvClassRec inputConvClassRec = { { /* object fields */ *************** *** 105,110 **** --- 106,112 ---- /* ClearConversion */ Clear, /* GetSegments */ GetAuxSegments, /* SupportMultipleObjects */ False, + /* GetTriggerKeys */ GetTriggerKeys, /* NoMoreObjects */ False, } }; *************** *** 140,145 **** --- 142,149 ---- class->inputConv_class.ClearConversion = super->inputConv_class.ClearConversion; if (class->inputConv_class.GetAuxSegments == XtInheritGetAuxSegments) class->inputConv_class.GetAuxSegments = super->inputConv_class.GetAuxSegments; + if (class->inputConv_class.GetTriggerKeys == XtInheritGetTriggerKeys) + class->inputConv_class.GetTriggerKeys = super->inputConv_class.GetTriggerKeys; class->inputConv_class.NoMoreObjects = False; } *************** *** 303,308 **** --- 307,322 ---- } + /* ARGSUSED */ + static int + GetTriggerKeys(w, keys_return) + Widget w; + ICTriggerKey **keys_return; + { + return 0; + } + + /* * public functions */ *************** *** 448,451 **** --- 462,498 ---- XtCheckSubclass(w, inputConvObjectClass, "ICGetAuxSegments()"); return (*class->inputConv_class.GetAuxSegments)(w, n, ns, nc); + } + + /* + + Though the following procedure should be done during initialization + of object class, I will do the following separately from the + initialization procedure in order to prevent duplicate + initialization of input object, that is, to prevent making + connection twice to input conversion server. + + */ + + int + ICRegisterTriggerKeys(w) + Widget w; + { + InputConvObjectClass class = (InputConvObjectClass)w->core.widget_class; + + XtCheckSubclass(w, inputConvObjectClass, "ICRegisterTriggerKeys()"); + return class->inputConv_class.num_trigger_keys = + (*class->inputConv_class.GetTriggerKeys) + (w, &class->inputConv_class.trigger_keys); + } + + int + ICGetTriggerKeysOfInputObjectClass(cl, keys_return) + WidgetClass cl; + ICTriggerKey **keys_return; + { + InputConvObjectClass class = (InputConvObjectClass)cl; + + *keys_return = class->inputConv_class.trigger_keys; + return class->inputConv_class.num_trigger_keys; } diff -N -a -r -c ../ki2v2f1/lib/KIProto.c ./lib/KIProto.c *** ../ki2v2f1/lib/KIProto.c Wed Oct 5 10:18:47 1994 --- ./lib/KIProto.c Thu Sep 26 18:23:36 1996 *************** *** 1,5 **** #ifndef lint ! static char *rcsid = "$Id: KIProto.c,v 1.46 1994/06/02 05:00:05 ishisone Rel $"; #endif /*- * Copyright (c) 1991 Software Research Associates, Inc. --- 1,5 ---- #ifndef lint ! static char *rcsid = "$Id: KIProto.c,v 1.47 1995/05/17 09:15:55 ishisone Exp $"; #endif /*- * Copyright (c) 1991 Software Research Associates, Inc. *************** *** 1023,1030 **** if (client == NULL) { if ((client = findClient(kpw, (Window)data[1])) == NULL) { ! DPRINT(("\tcan't find the client rec. for the window ID\n")); ! return NULL; } } else { if (data[1] != client->reqwin) { --- 1023,1044 ---- if (client == NULL) { if ((client = findClient(kpw, (Window)data[1])) == NULL) { ! TRACE(("\tcreate new client rec. for the window ID\n")); ! /* check validity of the client window ID */ ! if (!isCorrectWindowID(kpw, (Window)data[1])) { ! DPRINT(("getXlcDataFromProperty(): client window doesn't exist\n")); ! return NULL; ! } ! client = newClient(kpw, (Window)data[1], None); ! client->protocol = xlc_protocol; ! client->style = overthespot_style; ! client->esm = ESMethodInputOnly; ! client->end_proc = xlcEnd; ! client->free_resources = xlcFreeResources; ! MyAddEventHandler(XtDisplay((Widget)kpw), client->reqwin, ! DestroyNotify, StructureNotifyMask, ! ClientDead, (XtPointer)client); ! initial = True; } } else { if (data[1] != client->reqwin) { *************** *** 1770,1776 **** --- 1784,1798 ---- } sendNegativeConversionNotify(kpw, reqwin, convatom); return; + } else if (ccp->protocol == xlc_protocol) { + if (prop == kpw->kinput.xlcOnTheSpotAtom) { + /* reread property before starting conversion */ + (void)getXlcDataFromProperty(kpw, ccp, False); + } } + + /* set convatom */ + if (ccp->selection == None) ccp->selection = convatom; if (attachConverter(ccp) == NULL) { sendNegativeConversionNotify(kpw, reqwin, convatom); diff -N -a -r -c ../ki2v2f1/lib/Sj3.c ./lib/Sj3.c *** ../ki2v2f1/lib/Sj3.c Wed Oct 5 10:18:48 1994 --- ./lib/Sj3.c Thu Sep 26 18:23:39 1996 *************** *** 141,146 **** --- 141,149 ---- /* ClearConversion */ ClearConversion, /* GetAuxSegments */ GetAuxSegments, /* SupportMultipleObjects */ True, + /* GetTriggerKeys */ XtInheritGetTriggerKeys, + /* num_trigger_keys */ 0, + /* trigger_keys */ NULL, /* NoMoreObjects */ False, }, { /* sj3 fields */ diff -N -a -r -c ../ki2v2f1/lib/WcharDisp.c ./lib/WcharDisp.c *** ../ki2v2f1/lib/WcharDisp.c Wed Oct 5 10:18:44 1994 --- ./lib/WcharDisp.c Thu Sep 26 18:23:32 1996 *************** *** 1,5 **** #ifndef lint ! static char *rcsid = "$Id: WcharDisp.c,v 1.22 1993/09/08 02:43:27 ishisone Rel $"; #endif /* * Copyright (c) 1990 Software Research Associates, Inc. --- 1,5 ---- #ifndef lint ! static char *rcsid = "$Id: WcharDisp.c,v 1.23 1994/10/27 08:29:05 ishisone Exp $"; #endif /* * Copyright (c) 1990 Software Research Associates, Inc. *************** *** 507,516 **** if (attr == UNDERLINED) { int uloffset = 1; ! if (obj->wcharDisplay.ascent >= obj->wcharDisplay.fontheight) { ! /* font descent is 0 -- not likely to happen */ ! uloffset = -1; } XDrawLine(dpy, win, obj->wcharDisplay.gc_normal, x, y + obj->wcharDisplay.ascent + uloffset, --- 507,517 ---- if (attr == UNDERLINED) { int uloffset = 1; + int descent = obj->wcharDisplay.fontheight - obj->wcharDisplay.ascent; ! if (descent <= 1) { ! /* font descent is 0 or 1 */ ! uloffset = descent - 1; } XDrawLine(dpy, win, obj->wcharDisplay.gc_normal, x, y + obj->wcharDisplay.ascent + uloffset, diff -N -a -r -c ../ki2v2f1/lib/XimpProto.c ./lib/XimpProto.c *** ../ki2v2f1/lib/XimpProto.c Wed Oct 5 10:18:47 1994 --- ./lib/XimpProto.c Thu Sep 26 18:23:37 1996 *************** *** 1,5 **** #ifndef lint ! static char *rcsid = "$Id: XimpProto.c,v 1.40 1994/06/03 06:35:29 ishisone Rel $"; #endif /*- * Copyright (c) 1991 Software Research Associates, Inc. --- 1,5 ---- #ifndef lint ! static char *rcsid = "$Id: XimpProto.c,v 1.41 1995/05/17 09:17:08 ishisone Exp $"; #endif /*- * Copyright (c) 1991 Software Research Associates, Inc. *************** *** 1068,1074 **** Display *dpy = XtDisplay((Widget)xpw); int nkeys = 0; String p, q; ! int c; if ((p = xpw->ximp.convkeys) != NULL) { TRACE(("setKeyProperty(%s)\n", p)); --- 1068,1075 ---- Display *dpy = XtDisplay((Widget)xpw); int nkeys = 0; String p, q; ! int c, n; ! ICTriggerKey *keys, *ekeys; if ((p = xpw->ximp.convkeys) != NULL) { TRACE(("setKeyProperty(%s)\n", p)); *************** *** 1088,1093 **** --- 1089,1103 ---- nkeys++; } } while (c != '\0'); + } + + n = ICGetTriggerKeysOfInputObjectClass(xpw->ximp.inputObjClass, &keys); + for (ekeys = keys + n ; + keys < ekeys && nkeys < (sizeof(data) / sizeof(long)) / 3 ; keys++) { + data[nkeys * 3] = keys->modifiers; + data[nkeys * 3 + 1] = keys->modifiermask; + data[nkeys * 3 + 2] = keys->keysym; + nkeys++; } XChangeProperty(dpy, XtWindow((Widget)xpw), xpw->ximp.ximpKeysAtom, diff -N -a -r -c ../ki2v2f1/lib/imlib/imattr.c ./lib/imlib/imattr.c *** ../ki2v2f1/lib/imlib/imattr.c Wed Oct 5 10:18:39 1994 --- ./lib/imlib/imattr.c Thu Sep 26 18:23:21 1996 *************** *** 1,5 **** #ifndef lint ! static char *rcsid = "$Id: imattr.c,v 1.8 1994/08/01 02:19:26 ishisone Exp $"; #endif /* * Copyright (c) 1994 Software Research Associates, Inc. --- 1,5 ---- #ifndef lint ! static char *rcsid = "$Id: imattr.c,v 1.10 1996/09/05 02:00:26 ishisone Exp $"; #endif /* * Copyright (c) 1994 Software Research Associates, Inc. *************** *** 130,136 **** static ICAttribute icAttributes[] = { { XNInputStyle, TYPE_CARD32, OP_C|OP_G, setInputStyle, getInputStyle }, ! { XNClientWindow, TYPE_WINDOW, OP_C|OP_G, setClientWindow, getClientWindow }, { XNFocusWindow, TYPE_WINDOW, OP_C|OP_S|OP_G, setFocusWindow, getFocusWindow }, --- 130,136 ---- static ICAttribute icAttributes[] = { { XNInputStyle, TYPE_CARD32, OP_C|OP_G, setInputStyle, getInputStyle }, ! { XNClientWindow, TYPE_WINDOW, OP_C|OP_S|OP_G, setClientWindow, getClientWindow }, { XNFocusWindow, TYPE_WINDOW, OP_C|OP_S|OP_G, setFocusWindow, getFocusWindow }, *************** *** 1316,1324 **** return -1; } ! if (!(ap->set_mask & ATTR_MASK_AREA_NEEDED)) { ! fillPSDefault(icp, nest, (unsigned long)ATTR_MASK_AREA_NEEDED); /* ??? */ ! } TRACE(("\tarea needed: %d, %d, %d, %d\n", ap->area_needed.x, ap->area_needed.y, --- 1316,1325 ---- return -1; } ! /* ! * Always call fillPSDefault to get appropriate AreaNeeded value. ! */ ! fillPSDefault(icp, nest, (unsigned long)ATTR_MASK_AREA_NEEDED); TRACE(("\tarea needed: %d, %d, %d, %d\n", ap->area_needed.x, ap->area_needed.y, *************** *** 1958,1964 **** IMPSAttributes *sattr = &icp->status_attr; IMWindowProfile *cpr = &icp->client_profile; int width, height; ! int max_width, max_height; int default_status_width; int font_height; --- 1959,1965 ---- IMPSAttributes *sattr = &icp->status_attr; IMWindowProfile *cpr = &icp->client_profile; int width, height; ! int min_width, min_height; int default_status_width; int font_height; *************** *** 1976,2003 **** */ fillPSDefault(icp, NEST_STATUS, (unsigned long)ATTR_MASK_LINESPACE); font_height = sattr->line_space + 2; ! max_width = max_height = 0; if (sattr->set_mask & ATTR_MASK_AREA_NEEDED) { ! max_width = sattr->area_needed.width; ! max_height = sattr->area_needed.height; ! TRACE(("\tstatus areaNeeded was: (%d,%d)\n", max_width, max_height)); } ! default_status_width = IMStatusWidth(icp->im->connection->proto_widget); ! if (default_status_width > 0) { ! width = default_status_width; ! } else { ! width = cpr->width / 5; /* wild guess */ ! if (width < font_height * 3) { ! width = font_height * 3; /* another wild guess */ } } - height = font_height; ! if (max_width > 0 && width > max_width) width = max_width; ! if (max_height > 0 && height > max_height) height = max_height; ! if (width < MIN_AREA_WIDTH) width = MIN_AREA_WIDTH; ! if (height < MIN_AREA_HEIGHT) height = MIN_AREA_HEIGHT; sattr->area_needed.x = 0; sattr->area_needed.y = cpr->height - height; --- 1977,2006 ---- */ fillPSDefault(icp, NEST_STATUS, (unsigned long)ATTR_MASK_LINESPACE); font_height = sattr->line_space + 2; ! width = height = 0; if (sattr->set_mask & ATTR_MASK_AREA_NEEDED) { ! width = sattr->area_needed.width; ! height = sattr->area_needed.height; ! TRACE(("\tstatus areaNeeded was: (%d,%d)\n", width, height)); } ! min_width = font_height * 3; ! min_height = font_height; ! if (min_width < MIN_AREA_WIDTH) min_width = MIN_AREA_WIDTH; ! if (min_height < MIN_AREA_HEIGHT) min_height = MIN_AREA_HEIGHT; ! ! if (width == 0) { ! default_status_width = ! IMStatusWidth(icp->im->connection->proto_widget); ! if (default_status_width > 0) { ! width = default_status_width; ! } else { ! width = cpr->width / 5; /* wild guess */ } } ! if (width < min_width) width = min_width; ! if (height < min_height) height = min_height; sattr->area_needed.x = 0; sattr->area_needed.y = cpr->height - height; *************** *** 2013,2033 **** fillPSDefault(icp, NEST_PREEDIT, (unsigned long)ATTR_MASK_LINESPACE); font_height = pattr->line_space + 2; ! max_width = max_height = 0; if (pattr->set_mask & ATTR_MASK_AREA_NEEDED) { ! max_width = pattr->area_needed.width; ! max_height = pattr->area_needed.height; TRACE(("\tpreedit areaNeeded was: (%d,%d)\n", ! max_width, max_height)); } ! width = cpr->width - sattr->area_needed.width; ! height = font_height; ! if (max_width > 0 && width > max_width) width = max_width; ! if (max_height > 0 && height > max_height) height = max_height; ! if (width < MIN_AREA_WIDTH) width = MIN_AREA_WIDTH; ! if (height < MIN_AREA_HEIGHT) height = MIN_AREA_HEIGHT; pattr->area_needed.x = sattr->area_needed.width; pattr->area_needed.y = cpr->height - height; --- 2016,2036 ---- fillPSDefault(icp, NEST_PREEDIT, (unsigned long)ATTR_MASK_LINESPACE); font_height = pattr->line_space + 2; ! width = height = 0; if (pattr->set_mask & ATTR_MASK_AREA_NEEDED) { ! width = pattr->area_needed.width; ! height = pattr->area_needed.height; TRACE(("\tpreedit areaNeeded was: (%d,%d)\n", ! width, height)); } ! min_width = (cpr->width - sattr->area_needed.width) / 2; ! min_height = font_height; ! if (min_width < MIN_AREA_WIDTH) min_width = MIN_AREA_WIDTH; ! if (min_height < MIN_AREA_HEIGHT) min_height = MIN_AREA_HEIGHT; ! if (width < min_width) width = min_width; ! if (height < min_height) height = min_height; pattr->area_needed.x = sattr->area_needed.width; pattr->area_needed.y = cpr->height - height; diff -N -a -r -c ../ki2v2f1/lib/imlib/imrequest.c ./lib/imlib/imrequest.c *** ../ki2v2f1/lib/imlib/imrequest.c Wed Oct 5 10:18:41 1994 --- ./lib/imlib/imrequest.c Thu Sep 26 18:23:25 1996 *************** *** 1,5 **** #ifndef lint ! static char *rcsid = "$Id: imrequest.c,v 1.9 1994/09/16 02:44:52 ishisone Exp $"; #endif /* * Copyright (c) 1994 Software Research Associates, Inc. --- 1,5 ---- #ifndef lint ! static char *rcsid = "$Id: imrequest.c,v 1.10 1996/04/24 09:12:11 ishisone Exp $"; #endif /* * Copyright (c) 1994 Software Research Associates, Inc. *************** *** 18,30 **** * Author: Makoto Ishisone, Software Research Associates, Inc., Japan */ - #include "im.h" - #include "imreq.h" - /* in order to include xEvent definition */ #define NEED_EVENTS #include /* * Request handle functions */ --- 18,30 ---- * Author: Makoto Ishisone, Software Research Associates, Inc., Japan */ /* in order to include xEvent definition */ #define NEED_EVENTS #include + #include "im.h" + #include "imreq.h" + /* * Request handle functions */ *************** *** 615,623 **** IMConnection *conn; IMRequest *req; { IMPutC8(conn, req->major); IMPutC8(conn, req->minor); ! IMPutC16(conn, (unsigned int)strlen(req->name)); IMPutPad(conn); } --- 615,627 ---- IMConnection *conn; IMRequest *req; { + int text_length; + + text_length = strlen(req->name); IMPutC8(conn, req->major); IMPutC8(conn, req->minor); ! IMPutC16(conn, (unsigned int)text_length); ! IMPutString(conn, req->name, text_length); IMPutPad(conn); } diff -N -a -r -c ../ki2v2f1/lib/ioecall.c ./lib/ioecall.c *** ../ki2v2f1/lib/ioecall.c Thu Jan 1 09:00:00 1970 --- ./lib/ioecall.c Thu Sep 26 18:23:43 1996 *************** *** 0 **** --- 1,108 ---- + #ifndef lint + static char *rcsid = "$Id: ioecall.c,v 1.1 1994/11/22 01:12:30 ishisone Exp $"; + #endif + /* + * Copyright (C) 1994 Software Research Associates, Inc. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Software Research Associates not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. Software Research + * Associates makes no representations about the suitability of this software + * for any purpose. It is provided "as is" without express or implied + * warranty. + * + * Author: Makoto Ishisone, Software Research Associates, Inc., Japan + */ + + /* + * X I/O error callback + */ + + #include + #include + #include "IOECall.h" + + typedef struct ioe_cb_desc_ { + void (*callback)(); + XPointer client_data; + struct ioe_cb_desc_ *next; + } CBDesc; + + static CBDesc *cb_list; + + static int (*original_handler)(); + + static int + XIOEHandler(dpy) + Display *dpy; + { + CBDesc *cb; + + cb = cb_list; + while (cb != NULL) { + (*cb->callback)(cb->client_data); + cb = cb->next; + } + return (*original_handler)(dpy); + } + + void + XIOEInit() + { + int (*oldhandler)() = XSetIOErrorHandler(XIOEHandler); + + if (oldhandler != XIOEHandler) original_handler = oldhandler; + } + + XIOEHandle + XIOESet(handler, client_data) + void (*handler)(); + XPointer client_data; + { + CBDesc *cb; + + cb = (CBDesc *)malloc(sizeof(CBDesc)); + if (cb == NULL) return NULL; + + cb->callback = handler; + cb->client_data = client_data; + cb->next = NULL; + + if (cb_list == NULL) { + cb_list = cb; + } else { + CBDesc *p = cb_list; + + while (p->next != NULL) p = p->next; + p->next = cb; + } + + return cb; + } + + void + XIOEUnset(handle) + XIOEHandle handle; + { + CBDesc *cb, *cb0; + + cb = cb_list; + cb0 = NULL; + + while (cb != NULL) { + if (cb == handle) { + if (cb0 == NULL) { + cb_list = cb->next; + } else { + cb0->next = cb->next; + } + (void)free((char *)cb); + return; + } + cb = cb->next; + } + } diff -N -a -r -c ../ki2v2f1/patchlevel.h ./patchlevel.h *** ../ki2v2f1/patchlevel.h Wed Oct 5 10:18:51 1994 --- ./patchlevel.h Thu Sep 26 18:23:45 1996 *************** *** 1,3 **** #define KINPUT2_VERSION "version 2.0" ! #define DATE "$Date: 1994/10/05 01:15:13 $" ! #define PATCHLEVEL 1 --- 1,3 ---- #define KINPUT2_VERSION "version 2.0" ! #define DATE "$Date: 1996/09/26 09:21:21 $" ! #define PATCHLEVEL 2