home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume18 / X11R5-fix12 / part02 < prev    next >
Encoding:
Text File  |  1992-07-20  |  50.5 KB  |  1,736 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!gatech!europa.asd.contel.com!darwin.sura.net!mips!msi!dcmartin
  3. From: rws@EXPO.LCS.MIT.EDU (Bob Scheifler)
  4. Subject: v18i038: X11R5 public fix #12, Part02/05
  5. Message-ID: <1992Jul20.155550.2576@msi.com>
  6. Originator: dcmartin@fascet
  7. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  8. Organization: Molecular Simulations, Inc.
  9. References: <csx-18i037-X11R5-fix12@uunet.UU.NET>
  10. Date: Mon, 20 Jul 1992 15:55:50 GMT
  11. Approved: dcmartin@msi.com
  12. Lines: 1722
  13.  
  14. Submitted-by: rws@EXPO.LCS.MIT.EDU (Bob Scheifler)
  15. Posting-number: Volume 18, Issue 38
  16. Archive-name: X11R5-fix12/part02
  17.  
  18. #!/bin/sh
  19. # this is part.02 (part 2 of a multipart archive)
  20. # do not concatenate these parts, unpack them in order with /bin/sh
  21. # file fix-12 continued
  22. #
  23. if test ! -r _shar_seq_.tmp; then
  24.     echo 'Please unpack part 1 first!'
  25.     exit 1
  26. fi
  27. (read Scheck
  28.  if test "$Scheck" != 2; then
  29.     echo Please unpack part "$Scheck" next!
  30.     exit 1
  31.  else
  32.     exit 0
  33.  fi
  34. ) < _shar_seq_.tmp || exit 1
  35. if test ! -f _shar_wnt_.tmp; then
  36.     echo 'x - still skipping fix-12'
  37. else
  38. echo 'x - continuing file fix-12'
  39. sed 's/^X//' << 'SHAR_EOF' >> 'fix-12' &&
  40. !         if (current_xic)
  41. !             _XUnregisterFilter (ic->core.im->core.display,
  42. !                         ic->core.focus_window,
  43. !                         _Ximp_XimFilter_Keypress,
  44. !                         (XPointer)current_xic);
  45. X          _XRegisterFilterByType (ic->core.im->core.display,
  46. X                      ic->core.focus_window,
  47. X                      KeyPress, KeyPress,
  48. X                      _Ximp_XimFilter_Keypress,
  49. X                      (XPointer)ic);
  50. !         current_xic = ic;
  51. X      }
  52. X      return;
  53. X  }
  54. --- 170,183 ----
  55. X  _Ximp_SetFocus(ic)
  56. X      Ximp_XIC    ic;
  57. X  {
  58. !      _Ximp_IM_SendMessage(ic, XIMP_SETFOCUS, NULL, NULL, NULL);
  59. !     if(!(ic->ximp_icpart->filter_mode & 0x1)) {
  60. X          _XRegisterFilterByType (ic->core.im->core.display,
  61. X                      ic->core.focus_window,
  62. X                      KeyPress, KeyPress,
  63. X                      _Ximp_XimFilter_Keypress,
  64. X                      (XPointer)ic);
  65. !         ic->ximp_icpart->filter_mode |= 0x1;
  66. X      }
  67. X      return;
  68. X  }
  69. ***************
  70. *** 200,214 ****
  71. X  _Ximp_UnSetFocus(ic)
  72. X      Ximp_XIC    ic;
  73. X  {
  74. !     if(ic->ximp_icpart->icid) {
  75. !         _Ximp_IM_SendMessage(ic, XIMP_UNSETFOCUS, NULL, NULL, NULL);
  76. !         if (current_xic) {
  77. !             _XUnregisterFilter (ic->core.im->core.display,
  78. !                     ic->core.focus_window,
  79. !                     _Ximp_XimFilter_Keypress,
  80. !                     (XPointer)current_xic);
  81. !             current_xic = 0;
  82. !         }
  83. X      }
  84. X      return;
  85. X  }
  86. --- 186,198 ----
  87. X  _Ximp_UnSetFocus(ic)
  88. X      Ximp_XIC    ic;
  89. X  {
  90. !     _Ximp_IM_SendMessage(ic, XIMP_UNSETFOCUS, NULL, NULL, NULL);
  91. !     if(ic->ximp_icpart->filter_mode & 0x1) {
  92. !         _XUnregisterFilter (ic->core.im->core.display,
  93. !                 ic->core.focus_window,
  94. !                 _Ximp_XimFilter_Keypress,
  95. !                 (XPointer)ic);
  96. !         ic->ximp_icpart->filter_mode &= ~(0x1);
  97. X      }
  98. X      return;
  99. X  }
  100. ***************
  101. *** 237,249 ****
  102. X              ((Ximp_XIM)ic->core.im)->ximp_impart->focus_win_id,
  103. X              XA_WINDOW, 32, PropModeReplace,
  104. X              (unsigned char *)&ic->core.focus_window, 1);
  105. !     _XUnregisterFilter(ic->core.im->core.display,
  106. !                ic->core.focus_window,
  107. !                _Ximp_XimFilter_Client, (XPointer)NULL);
  108. X      _XRegisterFilterByType(ic->core.im->core.display,
  109. X                     ic->core.focus_window,
  110. X                     ClientMessage, ClientMessage,
  111. X                     _Ximp_XimFilter_Client, NULL);
  112. X      return;
  113. X  }
  114. X  
  115. --- 221,250 ----
  116. X              ((Ximp_XIM)ic->core.im)->ximp_impart->focus_win_id,
  117. X              XA_WINDOW, 32, PropModeReplace,
  118. X              (unsigned char *)&ic->core.focus_window, 1);
  119. !     if(ic->ximp_icpart->filter_mode & 0x2) {
  120. !         _XUnregisterFilter(ic->core.im->core.display,
  121. !                    ic->ximp_icpart->back_focus_win,
  122. !                    _Ximp_XimFilter_Client, (XPointer)NULL);
  123. !     }
  124. X      _XRegisterFilterByType(ic->core.im->core.display,
  125. X                     ic->core.focus_window,
  126. X                     ClientMessage, ClientMessage,
  127. X                     _Ximp_XimFilter_Client, NULL);
  128. +     ic->ximp_icpart->filter_mode |= 0x2;
  129. +     if(ic->ximp_icpart->filter_mode & 0x1) {
  130. +         _XUnregisterFilter (ic->core.im->core.display,
  131. +                 ic->ximp_icpart->back_focus_win,
  132. +                 _Ximp_XimFilter_Keypress,
  133. +                 (XPointer)ic);
  134. +     }
  135. +     _XRegisterFilterByType (ic->core.im->core.display,
  136. +                 ic->core.focus_window,
  137. +                 KeyPress, KeyPress,
  138. +                 _Ximp_XimFilter_Keypress,
  139. +                 (XPointer)ic);
  140. +     ic->ximp_icpart->filter_mode |= 0x1;
  141. X      return;
  142. X  }
  143. X  
  144. ***************
  145. *** 297,303 ****
  146. X  _Ximp_SetPreeditFont(ic)
  147. X      Ximp_XIC         ic;
  148. X  {
  149. -     Ximp_PreeditPropRec    *preedit_atr;
  150. X      Atom            actual_type;
  151. X      int            actual_format;
  152. X      unsigned long        nitems, bytes_after;
  153. --- 298,303 ----
  154. ***************
  155. *** 320,326 ****
  156. X              XA_STRING, 8, PropModeReplace,
  157. X              (unsigned char *)(ic->ximp_icpart->preedit_font),
  158. X              strlen(ic->ximp_icpart->preedit_font));
  159. -         XFree(ic->ximp_icpart->preedit_font);
  160. X          }
  161. X      return;
  162. X  }
  163. --- 320,325 ----
  164. ***************
  165. *** 396,402 ****
  166. X              XA_STRING, 8, PropModeReplace,
  167. X              (unsigned char *)(ic->ximp_icpart->status_font),
  168. X              strlen(ic->ximp_icpart->status_font));
  169. -         XFree(ic->ximp_icpart->status_font);
  170. X          }
  171. X      return;
  172. X  }
  173. --- 395,400 ----
  174. ***************
  175. *** 422,427 ****
  176. --- 420,428 ----
  177. X  {
  178. X      XEvent        Message;
  179. X      
  180. +     if((request != XIMP_CREATE) && !(ic->ximp_icpart->icid))
  181. +         return;
  182. X      /* ClientMessage Send */
  183. X      Message.xclient.type         = ClientMessage;
  184. X      Message.xclient.display      = ic->core.im->core.display;
  185. *** /tmp/d16921    Sun May  3 18:44:53 1992
  186. --- mit/lib/X/Ximp/XimpIM.c    Sun May  3 18:44:51 1992
  187. ***************
  188. *** 1,7 ****
  189. ! /* $XConsortium: XimpIM.c,v 1.5 91/11/17 15:36:42 rws Exp $ */
  190. X  /******************************************************************
  191. X  
  192. !               Copyright 1991, by FUJITSU LIMITED
  193. X  
  194. X  Permission to use, copy, modify, distribute, and sell this software
  195. X  and its documentation for any purpose is hereby granted without fee,
  196. --- 1,8 ----
  197. ! /* $XConsortium: XimpIM.c,v 1.6 92/04/14 13:29:18 rws Exp $ */
  198. X  /******************************************************************
  199. X  
  200. !               Copyright 1991, 1992 by FUJITSU LIMITED
  201. !               Copyright 1991, 1992 by Sony Corporaion
  202. X  
  203. X  Permission to use, copy, modify, distribute, and sell this software
  204. X  and its documentation for any purpose is hereby granted without fee,
  205. ***************
  206. *** 8,29 ****
  207. X  provided that the above copyright notice appear in all copies and
  208. X  that both that copyright notice and this permission notice appear
  209. X  in supporting documentation, and that the name of FUJITSU LIMITED
  210. ! not be used in advertising or publicity pertaining to distribution
  211. ! of the software without specific, written prior permission.
  212. ! FUJITSU LIMITED makes no representations about the suitability of
  213. ! this software for any purpose.  It is provided "as is" without
  214. ! express or implied warranty.
  215. X  
  216. ! FUJITSU LIMITED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  217. ! INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
  218. ! IN NO EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT
  219. ! OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
  220. ! OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  221. ! OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  222. ! OR PERFORMANCE OF THIS SOFTWARE.
  223. X  
  224. X    Author: Takashi Fujiwara     FUJITSU LIMITED 
  225. !                                fujiwara@a80.tech.yk.fujitsu.co.jp
  226. X  
  227. X  ******************************************************************/
  228. X  
  229. --- 9,32 ----
  230. X  provided that the above copyright notice appear in all copies and
  231. X  that both that copyright notice and this permission notice appear
  232. X  in supporting documentation, and that the name of FUJITSU LIMITED
  233. ! and Sony Corporation not be used in advertising or publicity
  234. ! pertaining to distribution of the software without specific,
  235. ! written prior permission.
  236. ! FUJITSU LIMITED and Sony Corporation make no representations about
  237. ! the suitability of this software for any purpose.  It is provided
  238. ! "as is" without express or implied warranty.
  239. X  
  240. ! FUJITSU LIMITED AND SONY CORPORATION DISCLAIM ALL WARRANTIES WITH
  241. ! REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
  242. ! MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED AND
  243. ! SONY CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
  244. ! DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
  245. ! OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  246. ! TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  247. ! PERFORMANCE OF THIS SOFTWARE.
  248. X  
  249. X    Author: Takashi Fujiwara     FUJITSU LIMITED 
  250. !       Makoto Wakamatsu     Sony Corporaion
  251. X  
  252. X  ******************************************************************/
  253. X  
  254. ***************
  255. *** 47,52 ****
  256. --- 50,57 ----
  257. X  extern Bool         _Ximp_GetIMExtension();
  258. X  static Bool          _Ximp_GetStyle();
  259. X  
  260. + extern Bool         _Ximp_XimFilter_Destroy();
  261. X  Ximp_XIM         *Ximp_Xim_List = (Ximp_XIM *)NULL;
  262. X  int             Ximp_Xim_count = 0;
  263. X  static    Atom          Protocol_ID;
  264. ***************
  265. *** 56,62 ****
  266. X                  _Ximp_CreateIC,     /* create_ic */
  267. X                  };
  268. X  
  269. ! static char    *Strstr( src, dest )
  270. X  register char    *src, *dest;
  271. X  {
  272. X      register    len;
  273. --- 61,67 ----
  274. X                  _Ximp_CreateIC,     /* create_ic */
  275. X                  };
  276. X  
  277. ! char    *_Ximp_Strstr( src, dest )
  278. X  register char    *src, *dest;
  279. X  {
  280. X      register    len;
  281. ***************
  282. *** 103,108 ****
  283. --- 108,114 ----
  284. X      ximp_impart->connectserver  = 0;
  285. X      ximp_impart->inputserver    = 1;
  286. X      ximp_impart->use_wchar      = False;
  287. +     ximp_impart->process_start_keys = NULL;
  288. X      im->ximp_impart = ximp_impart;
  289. X  
  290. X          if(_Ximp_OpenIM_Resource(im) == True)
  291. ***************
  292. *** 146,151 ****
  293. --- 152,161 ----
  294. X      for(ic = im->core.ic_chain; ic; ic = ic->core.next)
  295. X          XDestroyIC(ic);
  296. X      ximp_impart = (XIMXimpRec *)im->ximp_impart;
  297. +     if( ximp_impart->process_start_keys ) {
  298. +         XFree( ximp_impart->process_start_keys->keys_list );
  299. +         XFree( ximp_impart->process_start_keys );
  300. +     }
  301. X      if(ximp_impart->connectserver) {
  302. X          for(i=0; i < Ximp_Xim_count; i++) {
  303. X              if(Ximp_Xim_List[i] == im) {
  304. ***************
  305. *** 218,224 ****
  306. X   
  307. X           (void)strcpy(IMname, _XIMP_BASE);
  308. X           (void)strcat(IMname, LCname);
  309. !          mod = Strstr(lcd->core.modifiers, MODIFIER);
  310. X           if (mod) {
  311. X               (void)strcat(IMname, "@");
  312. X               mod += strlen(MODIFIER);
  313. --- 228,234 ----
  314. X   
  315. X           (void)strcpy(IMname, _XIMP_BASE);
  316. X           (void)strcat(IMname, LCname);
  317. !          mod = _Ximp_Strstr(lcd->core.modifiers, MODIFIER);
  318. X           if (mod) {
  319. X               (void)strcat(IMname, "@");
  320. X               mod += strlen(MODIFIER);
  321. ***************
  322. *** 357,363 ****
  323. X          _Ximp_SetupFree(version, imstyle, keylist, server_name, server_vl, vendor_name, NULL);
  324. X          return(False);
  325. X      }
  326. !     if((ext_list = (Atom *)Xmalloc((sizeof(Atom) * nitems + 1))) == NULL) {
  327. X          _Ximp_SetupFree(version, imstyle, keylist, server_name, server_vl, vendor_name, NULL);
  328. X          return(False);
  329. X      }
  330. --- 367,373 ----
  331. X          _Ximp_SetupFree(version, imstyle, keylist, server_name, server_vl, vendor_name, NULL);
  332. X          return(False);
  333. X      }
  334. !     if((ext_list = (Atom *)Xmalloc((sizeof(Atom) * (nitems + 1)))) == NULL) {
  335. X          _Ximp_SetupFree(version, imstyle, keylist, server_name, server_vl, vendor_name, NULL);
  336. X          return(False);
  337. X      }
  338. ***************
  339. *** 413,418 ****
  340. --- 423,434 ----
  341. X      }
  342. X  
  343. X      _Ximp_SetupExtension(im);
  344. +     _XRegisterFilterByType(im->core.display, fe_window_id,
  345. +                    DestroyNotify, DestroyNotify,
  346. +                    _Ximp_XimFilter_Destroy, NULL);
  347. +     XSelectInput(im->core.display, fe_window_id, StructureNotifyMask);
  348. X      im->ximp_impart->connectserver  = 1;
  349. X      return(True);
  350. X  }
  351. ***************
  352. *** 475,488 ****
  353. X      int        i;
  354. X  
  355. X      if(!(im->ximp_impart->connectserver)) {
  356. !         (*((long *)(p_style))) = (long)NULL;
  357. X          return(False);
  358. X      }
  359. X      p = im->ximp_impart->im_styles;
  360. !     *p_style = (XIMStyles *)Xmalloc(sizeof(XIMStyles));
  361. X      (*p_style)->count_styles = p->count_styles;
  362. !     (*p_style)->supported_styles = (XIMStyle *)
  363. !         Xmalloc(p->count_styles * sizeof(XIMStyle));
  364. X      for(i=0; i < (int)p->count_styles; i++) {
  365. X          (*p_style)->supported_styles[i] = p->supported_styles[i];
  366. X      }
  367. --- 491,505 ----
  368. X      int        i;
  369. X  
  370. X      if(!(im->ximp_impart->connectserver)) {
  371. !         *p_style = (XIMStyles *)NULL;
  372. X          return(False);
  373. X      }
  374. X      p = im->ximp_impart->im_styles;
  375. !     if((*p_style = (XIMStyles *)Xmalloc(sizeof(XIMStyles)
  376. !                 + p->count_styles * sizeof(XIMStyle))) == NULL)
  377. !         return(False);
  378. X      (*p_style)->count_styles = p->count_styles;
  379. !     (*p_style)->supported_styles = (XIMStyle *)(*p_style + sizeof(XIMStyles));
  380. X      for(i=0; i < (int)p->count_styles; i++) {
  381. X          (*p_style)->supported_styles[i] = p->supported_styles[i];
  382. X      }
  383. *** /tmp/d16943    Sun May  3 18:45:06 1992
  384. --- mit/lib/X/Ximp/XimpLCd.c    Sun May  3 18:45:03 1992
  385. ***************
  386. *** 1,7 ****
  387. ! /* $XConsortium: XimpLCd.c,v 1.3 91/07/09 17:36:35 rws Exp $ */
  388. X  /*
  389. !  * Copyright 1990, 1991 by TOSHIBA Corp.
  390. !  * Copyright 1990, 1991 by SORD Computer Corp.
  391. X   *
  392. X   * Permission to use, copy, modify, distribute, and sell this software and its
  393. X   * documentation for any purpose is hereby granted without fee, provided that
  394. --- 1,7 ----
  395. ! /* $XConsortium: XimpLCd.c,v 1.5 92/04/22 11:53:17 rws Exp $ */
  396. X  /*
  397. !  * Copyright 1990, 1991, 1992 by TOSHIBA Corp.
  398. !  * Copyright 1990, 1991, 1992 by SORD Computer Corp.
  399. X   *
  400. X   * Permission to use, copy, modify, distribute, and sell this software and its
  401. X   * documentation for any purpose is hereby granted without fee, provided that
  402. ***************
  403. *** 28,34 ****
  404. X  
  405. X  /******************************************************************
  406. X  
  407. !               Copyright 1991, by FUJITSU LIMITED
  408. X  
  409. X  Permission to use, copy, modify, distribute, and sell this software
  410. X  and its documentation for any purpose is hereby granted without fee,
  411. --- 28,34 ----
  412. X  
  413. X  /******************************************************************
  414. X  
  415. !               Copyright 1991, 1992 by FUJITSU LIMITED
  416. X  
  417. X  Permission to use, copy, modify, distribute, and sell this software
  418. X  and its documentation for any purpose is hereby granted without fee,
  419. ***************
  420. *** 222,230 ****
  421. --- 222,238 ----
  422. X      char        *name;
  423. X      {
  424. X      XLCd     xlcd;
  425. + #if !defined(X_NOT_STDC_ENV) && !defined(X_LOCALE)
  426. +     char siname[256];
  427. +     char *_XlcMapOSLocaleName();
  428. X  
  429. +     _XlcMapOSLocaleName(name, siname);
  430. +     if(!(xlcd = (XLCd) _Ximp_init_locale(siname)))
  431. +         return((XLCd)NULL);
  432. + #else
  433. X      if(!(xlcd = (XLCd) _Ximp_init_locale(name)))
  434. X          return((XLCd)NULL);
  435. + #endif
  436. X  
  437. X      xlcd->methods       = &lcd_methods;
  438. X      xlcd->core.name     = Xmalloc(strlen(name) + 1);
  439. *** /tmp/d16965    Sun May  3 18:45:18 1992
  440. --- mit/lib/X/Ximp/XimpLkup.c    Sun May  3 18:45:15 1992
  441. ***************
  442. *** 1,9 ****
  443. ! /* $XConsortium: XimpLkup.c,v 1.6 92/03/03 11:03:23 rws Exp $ */
  444. X  /******************************************************************
  445. X  
  446. !               Copyright 1991, by Sony Corporation
  447. !               Copyright 1991, by FUJITSU LIMITED
  448. !               Copyright 1991, by Fuji Xerox Co.,Ltd.
  449. X  
  450. X  Permission to use, copy, modify, distribute, and sell this software
  451. X  and its documentation for any purpose is hereby granted without fee,
  452. --- 1,9 ----
  453. ! /* $XConsortium: XimpLkup.c,v 1.7 92/04/14 13:29:28 rws Exp $ */
  454. X  /******************************************************************
  455. X  
  456. !               Copyright 1991, 1992 by Sony Corporation
  457. !               Copyright 1991, 1992 by FUJITSU LIMITED
  458. !               Copyright 1991, 1992 by Fuji Xerox Co.,Ltd.
  459. X  
  460. X  Permission to use, copy, modify, distribute, and sell this software
  461. X  and its documentation for any purpose is hereby granted without fee,
  462. ***************
  463. *** 26,34 ****
  464. X  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  465. X  OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  466. X  
  467. !   Author: Masaki Takeuchi,     Sony Corporation
  468. !           Takashi Fujiwara,    FUJITSU LIMITED 
  469. !           Kazunori Nishihara,  Fuji Xerox Co.,Ltd.
  470. X  
  471. X  ******************************************************************/
  472. X  
  473. --- 26,35 ----
  474. X  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  475. X  OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  476. X  
  477. !   Author: Masaki Takeuchi      Sony Corporation
  478. !           Takashi Fujiwara     FUJITSU LIMITED 
  479. !           Kazunori Nishihara   Fuji Xerox Co.,Ltd.
  480. !           Makoto Wakamatsu     Sony Corporation
  481. X  
  482. X  ******************************************************************/
  483. X  
  484. ***************
  485. *** 69,84 ****
  486. X  extern void        _Ximp_ProcExtension();
  487. X  
  488. X  static void        _Ximp_CallCallback();
  489. ! static void        _Ximp_ProcError();
  490. X  
  491. - #if NeedFunctionPrototypes
  492. - static Bool
  493. - _Ximp_ResetPredicate(
  494. -     Display *d,
  495. -     XEvent *ev,
  496. -     XPointer parg);
  497. - #endif
  498. X  typedef struct {
  499. X      Atom type;
  500. X      ICID icid;
  501. --- 70,77 ----
  502. X  extern void        _Ximp_ProcExtension();
  503. X  
  504. X  static void        _Ximp_CallCallback();
  505. ! extern void        _Ximp_ProcError();
  506. X  
  507. X  typedef struct {
  508. X      Atom type;
  509. X      ICID icid;
  510. ***************
  511. *** 86,97 ****
  512. X  } XimpResetPredArgRec, *XimpResetPredArg;
  513. X  
  514. X  static Bool
  515. ! _Ximp_ResetPredicate(d, ev, parg)
  516. X  Display *d;
  517. X  XEvent *ev;
  518. ! XPointer parg;
  519. X  {
  520. !     XimpResetPredArg arg = (XimpResetPredArg)parg;
  521. X      if (ev->type == ClientMessage) {
  522. X          if (ev->xclient.message_type == arg->type) {
  523. X              if ((ev->xclient.format == 32) &&
  524. --- 79,98 ----
  525. X  } XimpResetPredArgRec, *XimpResetPredArg;
  526. X  
  527. X  static Bool
  528. ! #if NeedFunctionPrototypes
  529. ! _Ximp_ResetPredicate(
  530. !     Display *d,
  531. !     XEvent *ev,
  532. !     XPointer arg0)
  533. ! #else
  534. ! _Ximp_ResetPredicate(d, ev, arg0)
  535. X  Display *d;
  536. X  XEvent *ev;
  537. ! XPointer arg0;
  538. ! #endif
  539. X  {
  540. !     XimpResetPredArg arg = (XimpResetPredArg) arg0 ;
  541. X      if (ev->type == ClientMessage) {
  542. X          if (ev->xclient.message_type == arg->type) {
  543. X              if ((ev->xclient.format == 32) &&
  544. ***************
  545. *** 232,240 ****
  546. X  #define LookupMessage    3
  547. X  
  548. X  static int        _xim_lookup_sign;
  549. ! static unsigned int    _xim_backup_keycode;
  550. ! static unsigned int    _xim_backup_state;
  551. ! static unsigned char    *_xim_prop_return;
  552. X  static unsigned long    _xim_string_length;
  553. X  static int        _xim_message_len;
  554. X  static unsigned char    _xim_message_buf[24];
  555. --- 233,239 ----
  556. X  #define LookupMessage    3
  557. X  
  558. X  static int        _xim_lookup_sign;
  559. ! static unsigned char    *_xim_prop_return = (unsigned char *) NULL;
  560. X  static unsigned long    _xim_string_length;
  561. X  static int        _xim_message_len;
  562. X  static unsigned char    _xim_message_buf[24];
  563. ***************
  564. *** 250,342 ****
  565. X  {
  566. X      XComposeStatus     comp_status;
  567. X      int         ret = 0, len;
  568. X  
  569. X      if(ev->type == KeyPress && ev->keycode == 0) { /* Filter function */
  570. !         if (_xim_lookup_sign == LookupKeypress) {
  571. !             ev->state   = _xim_backup_state;
  572. !             ev->keycode = _xim_backup_keycode;
  573. !             ret = _Ximp_LookupMBText(ic, ev, buffer, bytes, keysym, &comp_status);
  574. !             ev->send_event = False ;
  575. !             if(ret > 0) {
  576. !                 if(keysym && *keysym != NoSymbol) {
  577. !                     if(status) *status = XLookupBoth;
  578. !                      }
  579. !                 else {
  580. !                     if(status) *status = XLookupChars;
  581. !                     }
  582. !                 }
  583. !             else {
  584. !                 if(keysym && *keysym != NoSymbol) {
  585. !                     if(status) *status = XLookupKeySym;
  586. !                     }
  587. !                 else {
  588. !                     if(status) *status = XLookupNone;
  589. !                     }
  590. !                 }
  591. !             return(ret);
  592. X              }
  593. !         else if(_xim_lookup_sign == LookupProperty) {
  594. !             if (_Ximp_cttombs(ic->core.im->core.lcd,
  595. !                       _xim_prop_return,
  596. !                       _xim_string_length,
  597. !                       buffer, &bytes, NULL) < 0) 
  598. !                 ret = 0;
  599. !             else
  600. !                 ret = bytes;
  601. !             XFree((XPointer)_xim_prop_return);
  602. X              }
  603. !         else if (_xim_lookup_sign == LookupMessage) {
  604. !             if (_Ximp_cttombs(ic->core.im->core.lcd,
  605. !                       _xim_message_buf,
  606. !                       _xim_message_len,
  607. !                       buffer, &bytes, NULL) < 0) 
  608. !                 ret = 0;
  609. !             else
  610. !                 ret = bytes;
  611. !             }
  612. !         if(status)*status = (ret > 0) ? XLookupChars : XLookupNone;
  613. !         return(ret);
  614. X          }
  615. X      else if(ev->type == KeyPress) {
  616. !         if(ic->core.client_window == (Window)NULL) {
  617. X              if(status) *status = XLookupNone;
  618. X              return(0);
  619. !             }
  620. !         if (ic->ximp_icpart->input_mode) {/* ON : input_mode */
  621. !             _Ximp_IM_SendMessage(ic, XIMP_KEYPRESS,
  622. !                          (long)ev->keycode,
  623. !                          (long)ev->state, NULL);
  624. !             if(status) *status = XLookupNone;
  625. !             return(0);
  626. !             }
  627. X          ret = _Ximp_LookupMBText(ic, ev, buffer, bytes, keysym, &comp_status);
  628. -         if(ret >= 0) {
  629. -             if(_Ximp_StartXIMP(ic, ev, keysym ? *keysym : 0)) {
  630. -                 if(status) *status = XLookupNone;
  631. -                     return(0);
  632. -                 }
  633. -             }
  634. X          if(ret > 0) {
  635. X              if(keysym && *keysym != NoSymbol) {
  636. X                  if(status) *status = XLookupBoth;
  637. !                 }
  638. !              else {
  639. X                  if(status) *status = XLookupChars;
  640. -                 }
  641. X              }
  642. X          else {
  643. X              if(keysym && *keysym != NoSymbol) {
  644. X                  if(status) *status = XLookupKeySym;
  645. !                 }
  646. !              else {
  647. X                  if(status) *status = XLookupNone;
  648. -                 }
  649. X              }
  650. !          }
  651. X      else {
  652. !         if (status)
  653. !             *status = XLookupNone;
  654. !             }
  655. X      return(ret);
  656. X  }
  657. X  
  658. --- 249,314 ----
  659. X  {
  660. X      XComposeStatus     comp_status;
  661. X      int         ret = 0, len;
  662. +     Ximp_XLCd     lcd;
  663. +     unsigned char    *s;
  664. +     int         str_len;
  665. X  
  666. X      if(ev->type == KeyPress && ev->keycode == 0) { /* Filter function */
  667. !         if ((_xim_lookup_sign == LookupProperty) ||
  668. !             (_xim_lookup_sign == LookupMessage)) {
  669. !             if (_xim_lookup_sign == LookupMessage) {
  670. !                 s = _xim_message_buf;
  671. !                 str_len = _xim_message_len;
  672. !             } else {
  673. !                 s = _xim_prop_return;
  674. !                 str_len = _xim_string_length;
  675. X              }
  676. !             lcd = (Ximp_XLCd)ic->core.im->core.lcd;
  677. !             len = _Ximp_ct_mbslen(lcd, s, str_len, NULL);
  678. !             if (len > bytes) {
  679. !                 ret = len;
  680. !                 if(status) *status = XBufferOverflow;
  681. !             } else if (_Ximp_cttombs(lcd, s, str_len,
  682. !                            buffer, &bytes, NULL) <=  0) {
  683. !                 ret = 0;
  684. !                 if(status) *status = XLookupNone;
  685. !             } else {
  686. !                 ret = bytes;
  687. !                 if(status) *status = XLookupChars;
  688. X              }
  689. !             return(ret);
  690. !         } else {
  691. !             if(status) *status = XLookupNone;
  692. !             return(0);
  693. X          }
  694. +     }
  695. X      else if(ev->type == KeyPress) {
  696. !         if(!(ic->ximp_icpart->value_mask & XIMP_CLIENT_WIN)) {
  697. X              if(status) *status = XLookupNone;
  698. X              return(0);
  699. !         }
  700. !         ic->ximp_icpart->putback_key_event = False;
  701. X          ret = _Ximp_LookupMBText(ic, ev, buffer, bytes, keysym, &comp_status);
  702. X          if(ret > 0) {
  703. X              if(keysym && *keysym != NoSymbol) {
  704. X                  if(status) *status = XLookupBoth;
  705. !             }
  706. !             else {
  707. X                  if(status) *status = XLookupChars;
  708. X              }
  709. +         }
  710. X          else {
  711. X              if(keysym && *keysym != NoSymbol) {
  712. X                  if(status) *status = XLookupKeySym;
  713. !             }
  714. !             else {
  715. X                  if(status) *status = XLookupNone;
  716. X              }
  717. !         }
  718. !      }
  719. X      else {
  720. !         if (status) *status = XLookupNone;
  721. !         }
  722. X      return(ret);
  723. X  }
  724. X  
  725. ***************
  726. *** 352,440 ****
  727. X      XComposeStatus     comp_status;
  728. X      int         ret, len;
  729. X      char         look[128];
  730. X  
  731. X      if(ev->type == KeyPress && ev->keycode == 0) { /* Filter function */
  732. !         if (_xim_lookup_sign == LookupKeypress) {
  733. !             ev->state   = _xim_backup_state;
  734. !             ev->keycode = _xim_backup_keycode;
  735. !             ret = _Ximp_LookupWCText(ic, ev, buffer, wlen, keysym, &comp_status);
  736. !             ev->send_event = False ;
  737. !             if(ret > 0) {
  738. !                 if(keysym && *keysym != NoSymbol) {
  739. !                     if(status) *status = XLookupBoth;
  740. !                      }
  741. !                 else {
  742. !                     if(status) *status = XLookupChars;
  743. !                     }
  744. !                 }
  745. !             else {
  746. !                 if(keysym && *keysym != NoSymbol) {
  747. !                     if(status) *status = XLookupKeySym;
  748. !                     }
  749. !                 else {
  750. !                     if(status) *status = XLookupNone;
  751. !                     }
  752. !                 }
  753. !             return(ret);
  754. X              }
  755. !         else if(_xim_lookup_sign == LookupProperty) {
  756. !             len = wlen;
  757. !             if (_Ximp_cttowcs(ic->core.im->core.lcd,
  758. !                               _xim_prop_return,
  759. !                               _xim_string_length,
  760. !                               buffer, &len, NULL) < 0)
  761. !                 ret = 0;
  762. !             else
  763. X                  ret = len;
  764. !             XFree((XPointer)_xim_prop_return);
  765. !             }
  766. !         else if (_xim_lookup_sign == LookupMessage) {
  767. !             len = wlen;
  768. !             if (_Ximp_cttowcs(ic->core.im->core.lcd,
  769. !                               _xim_message_buf,
  770. !                               _xim_message_len,
  771. !                               buffer, &len, NULL) < 0)
  772. X                  ret = 0;
  773. !             else
  774. !                 ret = len;
  775. X              }
  776. !         if(status)*status = (ret > 0) ? XLookupChars : XLookupNone;
  777. !         return(ret);
  778. !         }
  779. !     else {
  780. !         if(ic->core.client_window == (Window)NULL) {
  781. X              if(status) *status = XLookupNone;
  782. X              return(0);
  783. !             }
  784. !         if (ic->ximp_icpart->input_mode) {/* ON : input_mode */
  785. !             _Ximp_IM_SendMessage(ic, XIMP_KEYPRESS,
  786. !                          (long)ev->keycode,
  787. !                          (long)ev->state, NULL);
  788. X              if(status) *status = XLookupNone;
  789. X              return(0);
  790. X              }
  791. X          ret = _Ximp_LookupWCText(ic, ev, buffer, wlen, keysym, &comp_status);
  792. !         if(ret >= 0) {
  793. !             if(_Ximp_StartXIMP(ic, ev, keysym ? *keysym : 0)) {
  794. !                 if(status) *status = XLookupNone;
  795. !                     return(0);
  796. !                 }
  797. X              if(keysym && *keysym != NoSymbol) {
  798. X                  if(status) *status = XLookupBoth;
  799. !                 }
  800. X               else {
  801. X                  if(status) *status = XLookupChars;
  802. -                 }
  803. X              }
  804. X          else {
  805. X              if(keysym && *keysym != NoSymbol) {
  806. X                  if(status) *status = XLookupKeySym;
  807. !                 }
  808. X               else {
  809. X                  if(status) *status = XLookupNone;
  810. -                 }
  811. X              }
  812. !          }
  813. X      return(ret);
  814. X  }
  815. X  
  816. --- 324,389 ----
  817. X      XComposeStatus     comp_status;
  818. X      int         ret, len;
  819. X      char         look[128];
  820. +     Ximp_XLCd     lcd;
  821. +     unsigned char    *s;
  822. +     int         str_len;
  823. X  
  824. X      if(ev->type == KeyPress && ev->keycode == 0) { /* Filter function */
  825. !         if ((_xim_lookup_sign == LookupProperty) ||
  826. !             (_xim_lookup_sign == LookupMessage)) {
  827. !             if (_xim_lookup_sign == LookupMessage) {
  828. !                 s = _xim_message_buf;
  829. !                 str_len = _xim_message_len;
  830. !             } else {
  831. !                 s = _xim_prop_return;
  832. !                 str_len = _xim_string_length;
  833. X              }
  834. !             lcd = (Ximp_XLCd)ic->core.im->core.lcd;
  835. !             len = _Ximp_ct_wcslen(lcd, s, str_len, NULL);
  836. !             if (len > wlen) {
  837. X                  ret = len;
  838. !                 if(status) *status = XBufferOverflow;
  839. !             } else if (_Ximp_cttowcs(lcd, s, str_len,
  840. !                          buffer, &wlen, NULL) <=  0) {
  841. X                  ret = 0;
  842. !                 if(status) *status = XLookupNone;
  843. !             } else {
  844. !                 ret = wlen;
  845. !                 if(status) *status = XLookupChars;
  846. X              }
  847. !             return(ret);
  848. !         } else {
  849. X              if(status) *status = XLookupNone;
  850. X              return(0);
  851. !         }
  852. !     }
  853. !     else if(ev->type == KeyPress) {
  854. !         if(!(ic->ximp_icpart->value_mask & XIMP_CLIENT_WIN)) {
  855. X              if(status) *status = XLookupNone;
  856. X              return(0);
  857. X              }
  858. +         ic->ximp_icpart->putback_key_event = False;
  859. X          ret = _Ximp_LookupWCText(ic, ev, buffer, wlen, keysym, &comp_status);
  860. !         if(ret > 0) {
  861. X              if(keysym && *keysym != NoSymbol) {
  862. X                  if(status) *status = XLookupBoth;
  863. !             }
  864. X               else {
  865. X                  if(status) *status = XLookupChars;
  866. X              }
  867. +         }
  868. X          else {
  869. X              if(keysym && *keysym != NoSymbol) {
  870. X                  if(status) *status = XLookupKeySym;
  871. !             }
  872. X               else {
  873. X                  if(status) *status = XLookupNone;
  874. X              }
  875. !         }
  876. !      }
  877. !     else {
  878. !         if (status) *status = XLookupNone;
  879. !         }
  880. X      return(ret);
  881. X  }
  882. X  
  883. ***************
  884. *** 476,499 ****
  885. X      XEvent             Message;
  886. X      extern Bool        _Ximp_Setup ();
  887. X  
  888. !     if(ic->ximp_icpart->input_mode) /* ON : input_mode */
  889. !         return(False);
  890. X  
  891. X      if(!(((Ximp_XIM)ic->core.im)->ximp_impart->connectserver)) {
  892. !         if(keysym && keysym ==
  893. !           (((Ximp_XIM)ic->core.im)->ximp_impart->def_startkeysym)) {
  894. !             if(_Ximp_Setup (ic->core.im) == False)
  895. !                 isEventPassedToIMS = 1;
  896. !             else
  897. !                 isEventPassedToIMS = 0;
  898. X          }
  899. !         else
  900. !             isEventPassedToIMS = 1;
  901. !     }
  902. !     else {    
  903. X          list = ((Ximp_XIM)ic->core.im)->ximp_impart->im_keyslist;
  904. X          for(i = 0, isEventPassedToIMS = 1; i < (int)list->count_keys; i++) {
  905. !             if(   (keysym && keysym == list->keys_list[i].keysym)
  906. X                 && ((ev->state & list->keys_list[i].modifier_mask)
  907. X                     == list->keys_list[i].modifier ) ) {
  908. X                  isEventPassedToIMS = 0;
  909. --- 425,456 ----
  910. X      XEvent             Message;
  911. X      extern Bool        _Ximp_Setup ();
  912. X  
  913. !     if (ic->ximp_icpart->input_mode) { /* ON : input_mode */
  914. !         if (!ic->ximp_icpart->putback_key_event && ev->keycode != 0) {
  915. !             _Ximp_IM_SendMessage( ic, XIMP_KEYPRESS,
  916. !                          (long)ev->keycode,
  917. !                          (long)ev->state, NULL );
  918. !             return (True);
  919. !         }
  920. !         return (False);
  921. !     }
  922. X  
  923. X      if(!(((Ximp_XIM)ic->core.im)->ximp_impart->connectserver)) {
  924. !         if( (list = ((Ximp_XIM)ic->core.im)->ximp_impart->process_start_keys) == NULL )
  925. !             return(False);
  926. !         for(i = 0, isEventPassedToIMS = 1; i < (int)list->count_keys; i++) {
  927. !             if( (keysym && keysym == list->keys_list[i].keysym)
  928. !                && ((ev->state & list->keys_list[i].modifier_mask)
  929. !                    == list->keys_list[i].modifier ) ) {
  930. !                 isEventPassedToIMS = (_Ximp_Setup( ic->core.im ) == False);
  931. !                 break;
  932. !                 }
  933. !             }
  934. X          }
  935. !     else {
  936. X          list = ((Ximp_XIM)ic->core.im)->ximp_impart->im_keyslist;
  937. X          for(i = 0, isEventPassedToIMS = 1; i < (int)list->count_keys; i++) {
  938. !             if( (keysym && keysym == list->keys_list[i].keysym)
  939. X                 && ((ev->state & list->keys_list[i].modifier_mask)
  940. X                     == list->keys_list[i].modifier ) ) {
  941. X                  isEventPassedToIMS = 0;
  942. ***************
  943. *** 500,521 ****
  944. X                  break;
  945. X                  }
  946. X              }
  947. !     }
  948. X      if(isEventPassedToIMS) return(False);
  949. X  
  950. X      if(ic->ximp_icpart->icid == NULL)
  951. !         if(!(_Ximp_SetOpenXIMP(ic))) return(False);
  952. !     _XRegisterFilterByType(ic->core.im->core.display,
  953. !                    ic->core.client_window,
  954. !                    ClientMessage, ClientMessage,
  955. !                    _Ximp_XimFilter_Client, NULL);
  956. !     _XRegisterFilterByType(ic->core.im->core.display,
  957. !                    ((Ximp_XIM)ic->core.im)->ximp_impart->fe_window,
  958. !                    DestroyNotify, DestroyNotify,
  959. !                    _Ximp_XimFilter_Destroy, NULL);
  960. !     XSelectInput (ic->core.im->core.display,
  961. !             ((Ximp_XIM)ic->core.im)->ximp_impart->fe_window,
  962. !             StructureNotifyMask);
  963. X  
  964. X      if (_Ximp_FocusInput (ic->core.focus_window, &dummy_mask))
  965. X          ic->ximp_icpart->back_mask = dummy_mask;
  966. --- 457,467 ----
  967. X                  break;
  968. X                  }
  969. X              }
  970. !         }
  971. X      if(isEventPassedToIMS) return(False);
  972. X  
  973. X      if(ic->ximp_icpart->icid == NULL)
  974. !         if(!(_Ximp_SetOpenXIMP(ic, XIMP_START_IC))) return(False);
  975. X  
  976. X      if (_Ximp_FocusInput (ic->core.focus_window, &dummy_mask))
  977. X          ic->ximp_icpart->back_mask = dummy_mask;
  978. ***************
  979. *** 532,556 ****
  980. X          XSelectInput(d, ic->core.focus_window, dummy_mask);
  981. X      }
  982. X      ic->ximp_icpart->input_mode = 1;
  983. X      _Ximp_IM_SendMessage(ic, XIMP_BEGIN, NULL, NULL, NULL);
  984. X      XFlush(ic->core.im->core.display);
  985. X      return(True);
  986. X  }
  987. X  
  988. X  Bool
  989. ! _Ximp_SetOpenXIMP(ic)
  990. X      Ximp_XIC    ic;
  991. X  {
  992. X      unsigned long     mask;
  993. X      XEvent         event;
  994. X  
  995. !     if(ic->core.client_window == (Window)NULL)
  996. !         return(False);
  997. X  
  998. X      if(!(ic->ximp_icpart->proto_mask & XIMP_FOCUS_WIN_MASK)) {
  999. -         ic->ximp_icpart->proto_mask |= XIMP_FOCUS_WIN_MASK;
  1000. X          ic->core.focus_window = ic->core.client_window;
  1001. !         }
  1002. X      
  1003. X      /* Property Data Set */
  1004. X      XChangeProperty(ic->core.im->core.display, ic->core.client_window,
  1005. --- 478,545 ----
  1006. X          XSelectInput(d, ic->core.focus_window, dummy_mask);
  1007. X      }
  1008. X      ic->ximp_icpart->input_mode = 1;
  1009. +     _Ximp_IM_SendMessage(ic, XIMP_MOVE,
  1010. +         ic->ximp_icpart->preedit_attr.SpotLocation.x,
  1011. +         ic->ximp_icpart->preedit_attr.SpotLocation.y,
  1012. +         NULL);
  1013. X      _Ximp_IM_SendMessage(ic, XIMP_BEGIN, NULL, NULL, NULL);
  1014. X      XFlush(ic->core.im->core.display);
  1015. X      return(True);
  1016. X  }
  1017. X  
  1018. + typedef struct {
  1019. +     Atom type;
  1020. +     Window owner;
  1021. + } XimpCreatePredArgRec, *XimpCreatePredArg;
  1022. + static Bool
  1023. + _Ximp_CreatePredicate(d, ev, arg0)
  1024. + Display *d;
  1025. + XEvent *ev;
  1026. + XPointer arg0;
  1027. + {
  1028. +     XimpCreatePredArg arg = (XimpCreatePredArg) arg0;
  1029. +     if (ev->type == ClientMessage) {
  1030. +         if (ev->xclient.message_type == arg->type) {
  1031. +             if (ev->xclient.format == 32) {
  1032. +                 switch (ev->xclient.data.l[0]) {
  1033. +                 case XIMP_CREATE_RETURN:
  1034. +                 case XIMP_ERROR:
  1035. +                     return(True);
  1036. +                 }
  1037. +             }
  1038. +         }
  1039. +     } else if (ev->type == DestroyNotify) {
  1040. +         if (ev->xdestroywindow.window == arg->owner) {
  1041. +             return(True);
  1042. +         }
  1043. +     }
  1044. +     return(False);
  1045. + }
  1046. X  Bool
  1047. ! _Ximp_SetOpenXIMP(ic, mode)
  1048. X      Ximp_XIC    ic;
  1049. +     int        mode;
  1050. X  {
  1051. X      unsigned long     mask;
  1052. X      XEvent         event;
  1053. +     XimpCreatePredArgRec Arg;
  1054. X  
  1055. !     if(mode == XIMP_CREATE_IC) {  /* XCretaeIC() */
  1056. !         if(!(ic->ximp_icpart->value_mask & XIMP_CLIENT_WIN)) {
  1057. !             ic->core.client_window = XCreateSimpleWindow(
  1058. !                 ic->core.im->core.display,
  1059. !                 DefaultRootWindow(ic->core.im->core.display),
  1060. !                 0, 0, 1, 1, 1, 0, 0);
  1061. !         }
  1062. !     }
  1063. X  
  1064. X      if(!(ic->ximp_icpart->proto_mask & XIMP_FOCUS_WIN_MASK)) {
  1065. X          ic->core.focus_window = ic->core.client_window;
  1066. !     }
  1067. X      
  1068. X      /* Property Data Set */
  1069. X      XChangeProperty(ic->core.im->core.display, ic->core.client_window,
  1070. ***************
  1071. *** 560,567 ****
  1072. X      XFlush(ic->core.im->core.display);
  1073. X  
  1074. X      mask = ic->ximp_icpart->proto_mask;
  1075. !     if(mask & XIMP_PROP_FOCUS)
  1076. !         _Ximp_SetFocusWindow(ic);
  1077. X      if(!(   (ic->core.input_style & XIMPreeditCallbacks)
  1078. X           || (ic->core.input_style & XIMPreeditNone) ) ) { 
  1079. X          if(mask & XIMP_PROP_PREEDIT)
  1080. --- 549,556 ----
  1081. X      XFlush(ic->core.im->core.display);
  1082. X  
  1083. X      mask = ic->ximp_icpart->proto_mask;
  1084. !     _Ximp_SetFocusWindow(ic);
  1085. !     mask |= XIMP_FOCUS_WIN_MASK;
  1086. X      if(!(   (ic->core.input_style & XIMPreeditCallbacks)
  1087. X           || (ic->core.input_style & XIMPreeditNone) ) ) { 
  1088. X          if(mask & XIMP_PROP_PREEDIT)
  1089. ***************
  1090. *** 590,623 ****
  1091. X      signal(SIGALRM, _time_out);
  1092. X      alarm(XIMP_TIME_OUT);
  1093. X  #endif /* XIMP_SIGNAL */
  1094. X      while(_time_flag != 1) {
  1095. !         if( (XCheckTypedEvent(ic->core.im->core.display, ClientMessage, &event)) == False) {
  1096. X  #ifdef XIMP_SIGNAL
  1097. X              sleep(1);
  1098. X  #endif /* XIMP_SIGNAL */
  1099. X              continue;
  1100. X              }
  1101. !         if(event.xclient.message_type != ((Ximp_XIM)ic->core.im)->ximp_impart->improtocol_id) {
  1102. !             XPutBackEvent(ic->core.im->core.display, &event);
  1103. !             continue;
  1104. !             }
  1105. !         else if(event.xclient.data.l[0] != XIMP_CREATE_RETURN) {
  1106. X  #ifdef XIMP_SIGNAL
  1107. X              alarm(0);
  1108. X  #endif /* XIMP_SIGNAL */
  1109. !             _Ximp_ProcError (ic->core.im->core.display, NULL, &event);
  1110. X              _time_flag = 0;
  1111. !             /* return(False); */
  1112. !             continue;
  1113. X              }
  1114. !         else { /* XIMP_CRETAE_RETURN   Event */
  1115. X  #ifdef XIMP_SIGNAL
  1116. X              alarm(0);
  1117. X  #endif /* XIMP_SIGNAL */
  1118. !             ic->ximp_icpart->icid = (ICID)event.xclient.data.l[1];
  1119. !             _Ximp_A_CreateExtension(ic);
  1120. X              _time_flag = 0;
  1121. !             return(True);
  1122. X              }
  1123. X          }
  1124. X      _time_flag = 0;
  1125. --- 579,611 ----
  1126. X      signal(SIGALRM, _time_out);
  1127. X      alarm(XIMP_TIME_OUT);
  1128. X  #endif /* XIMP_SIGNAL */
  1129. +     Arg.type = ((Ximp_XIM)ic->core.im)->ximp_impart->improtocol_id;
  1130. +     Arg.owner = ((Ximp_XIM)ic->core.im)->ximp_impart->fe_window;
  1131. X      while(_time_flag != 1) {
  1132. !         if( (XCheckIfEvent(ic->core.im->core.display, &event, _Ximp_CreatePredicate, (XPointer)&Arg)) == False) {
  1133. X  #ifdef XIMP_SIGNAL
  1134. X              sleep(1);
  1135. X  #endif /* XIMP_SIGNAL */
  1136. X              continue;
  1137. X              }
  1138. !         if(event.type == ClientMessage &&
  1139. !            event.xclient.data.l[0] == XIMP_CREATE_RETURN) {
  1140. X  #ifdef XIMP_SIGNAL
  1141. X              alarm(0);
  1142. X  #endif /* XIMP_SIGNAL */
  1143. !             ic->ximp_icpart->icid = (ICID)event.xclient.data.l[1];
  1144. !             _Ximp_A_CreateExtension(ic);
  1145. X              _time_flag = 0;
  1146. !             return(True);
  1147. X              }
  1148. !         else {
  1149. X  #ifdef XIMP_SIGNAL
  1150. X              alarm(0);
  1151. X  #endif /* XIMP_SIGNAL */
  1152. !             _Ximp_ProcError (ic->core.im->core.display, NULL, &event);
  1153. X              _time_flag = 0;
  1154. !             /* return(False); */
  1155. !             continue;
  1156. X              }
  1157. X          }
  1158. X      _time_flag = 0;
  1159. ***************
  1160. *** 635,651 ****
  1161. X  }
  1162. X  
  1163. X  void
  1164. ! _Ximp_ProcKeypress (d, w, ev)
  1165. X      Display            *d;
  1166. X      Window            w;
  1167. X      XClientMessageEvent    *ev;
  1168. X  {
  1169. !     ICID    icid;
  1170. X  
  1171. X      icid = ev->data.l[1];
  1172. !     _xim_backup_keycode = ev->data.l[2];
  1173. !     _xim_backup_state = ev->data.l[3];
  1174. !     _xim_lookup_sign = LookupKeypress;
  1175. X  }
  1176. X  
  1177. X  static void
  1178. --- 623,657 ----
  1179. X  }
  1180. X  
  1181. X  void
  1182. ! _Ximp_ProcKeypress (d, w, ev, kev)
  1183. X      Display            *d;
  1184. X      Window            w;
  1185. X      XClientMessageEvent    *ev;
  1186. +     XKeyEvent        *kev;
  1187. X  {
  1188. !     ICID            icid;
  1189. !     Ximp_XIC         ic;
  1190. X  
  1191. X      icid = ev->data.l[1];
  1192. !     kev->type = KeyPress;
  1193. !     kev->serial = ev->serial;
  1194. !     kev->send_event = False;
  1195. !     kev->display = ev->display;
  1196. !     kev->window = ev->window;
  1197. !     kev->root = DefaultRootWindow(ev->display);
  1198. !     kev->subwindow = (Window)NULL;
  1199. !     kev->time = 0L;
  1200. !     kev->x = 0;
  1201. !     kev->y = 0;
  1202. !     kev->x_root = 0;
  1203. !     kev->y_root = 0;
  1204. !     kev->keycode = ev->data.l[2];
  1205. !     kev->state = ev->data.l[3];
  1206. !     kev->same_screen = True;
  1207. !     ic = _Ximp_LookupXIC(icid);
  1208. !     if(ic->ximp_icpart->input_mode) { /* ON : input_mode */
  1209. !         ic->ximp_icpart->putback_key_event = True;
  1210. !     }
  1211. X  }
  1212. X  
  1213. X  static void
  1214. ***************
  1215. *** 724,729 ****
  1216. --- 730,738 ----
  1217. X      int            actual_format_return;
  1218. X      unsigned long        nitems_return;
  1219. X  
  1220. +     if (_xim_prop_return) {
  1221. +         XFree((XPointer)(_xim_prop_return));
  1222. +     }
  1223. X      icid      = ev->data.l[1];
  1224. X      read_prop = ev->data.l[2];
  1225. X      ic   = _Ximp_LookupXIC(icid);
  1226. ***************
  1227. *** 741,747 ****
  1228. X      _xim_lookup_sign = LookupProperty;
  1229. X  }
  1230. X  
  1231. ! static void
  1232. X  _Ximp_ProcError (d, w, ev)
  1233. X      Display            *d;
  1234. X      Window            w;
  1235. --- 750,756 ----
  1236. X      _xim_lookup_sign = LookupProperty;
  1237. X  }
  1238. X  
  1239. ! void
  1240. X  _Ximp_ProcError (d, w, ev)
  1241. X      Display            *d;
  1242. X      Window            w;
  1243. ***************
  1244. *** 850,864 ****
  1245. X      XClientMessageEvent    *ev;
  1246. X      XPointer        *client_data;
  1247. X  {
  1248. X      if (ev->message_type != _Ximp_Protocol_id ())
  1249. X          return (False);
  1250. X      if (ev->format == 32) {
  1251. X          switch (ev->data.l[0]) {
  1252. X          case XIMP_KEYPRESS:
  1253. !             _Ximp_ProcKeypress (d, w, ev);
  1254. !             _Ximp_MakeKeypress (d, w, ev);
  1255. !             ev->send_event = False ;
  1256. !             XPutBackEvent(d, (XEvent *)ev);
  1257. X              break ;
  1258. X          case XIMP_CREATE_RETURN:
  1259. X              _Ximp_ProcCreateReturn (d, w, ev);
  1260. --- 859,873 ----
  1261. X      XClientMessageEvent    *ev;
  1262. X      XPointer        *client_data;
  1263. X  {
  1264. +     XKeyEvent kev;
  1265. X      if (ev->message_type != _Ximp_Protocol_id ())
  1266. X          return (False);
  1267. X      if (ev->format == 32) {
  1268. X          switch (ev->data.l[0]) {
  1269. X          case XIMP_KEYPRESS:
  1270. !             _Ximp_ProcKeypress (d, w, ev, &kev);
  1271. !             XPutBackEvent(d, (XEvent *)&kev);
  1272. X              break ;
  1273. X          case XIMP_CREATE_RETURN:
  1274. X              _Ximp_ProcCreateReturn (d, w, ev);
  1275. ***************
  1276. *** 920,929 ****
  1277. X      long            dummy_mask;
  1278. X  
  1279. X      for(i=0; i < Ximp_Xim_count; i++) {
  1280. !         if(Ximp_Xim_List[i]->ximp_impart->fe_window == w)
  1281. X              ximp_impart = Ximp_Xim_List[i]->ximp_impart;
  1282. X          else
  1283. X              continue;
  1284. X          _Ximp_SetupFreeExtension(Ximp_Xim_List[i]);
  1285. X          _Ximp_SetupFree(ximp_impart->im_proto_vl,
  1286. X              ximp_impart->im_styles,
  1287. --- 929,940 ----
  1288. X      long            dummy_mask;
  1289. X  
  1290. X      for(i=0; i < Ximp_Xim_count; i++) {
  1291. !         if(Ximp_Xim_List[i] != NULL  &&
  1292. !            Ximp_Xim_List[i]->ximp_impart->fe_window == w)
  1293. X              ximp_impart = Ximp_Xim_List[i]->ximp_impart;
  1294. X          else
  1295. X              continue;
  1296. +         _XUnregisterFilter(d, w, _Ximp_XimFilter_Destroy, (XPointer)NULL);
  1297. X          _Ximp_SetupFreeExtension(Ximp_Xim_List[i]);
  1298. X          _Ximp_SetupFree(ximp_impart->im_proto_vl,
  1299. X              ximp_impart->im_styles,
  1300. ***************
  1301. *** 933,940 ****
  1302. --- 944,956 ----
  1303. X              ximp_impart->im_vendor_name,
  1304. X              ximp_impart->im_ext_list);
  1305. X          ximp_impart->connectserver = 0;
  1306. +         ximp_impart->fe_window = (Window)NULL;
  1307. X          for(ic = Ximp_Xim_List[i]->core.ic_chain; ic; ic = ic->core.next) {
  1308. X              ((Ximp_XIC)ic)->ximp_icpart->icid = NULL;
  1309. +             _XUnregisterFilter(d,
  1310. +                        ic->core.focus_window,
  1311. +                        _Ximp_XimFilter_Client,
  1312. +                        NULL);
  1313. X              if(((Ximp_XIC)ic)->ximp_icpart->input_mode) {/* ON : input_mode */
  1314. X                  dummy_mask = ((Ximp_XIC)ic)->ximp_icpart->back_mask;
  1315. X                  XSelectInput(ic->core.im->core.display,
  1316. ***************
  1317. *** 948,965 ****
  1318. X  }
  1319. X  
  1320. X  Bool
  1321. ! _Ximp_Keypress (d, w, ev, ic)
  1322. !     Display            *d;
  1323. !     Window            w;
  1324. !     XKeyEvent        *ev;
  1325. !     Ximp_XIC        ic;
  1326. X  {
  1327. ! #define BUFFLIM        32
  1328. !     KeySym        ks;
  1329. !     char        buff[BUFFLIM];
  1330. X  
  1331. !     XLookupString (ev, buff, BUFFLIM, &ks, NULL);
  1332. !     return _Ximp_StartXIMP (ic, ev, ks);
  1333. X  }
  1334. X  
  1335. X  /*
  1336. --- 964,981 ----
  1337. X  }
  1338. X  
  1339. X  Bool
  1340. ! _Ximp_XimFilter_Keypress (d, w, ev, client_data)
  1341. !     Display        *d;
  1342. !     Window        w;
  1343. !     XEvent        *ev;
  1344. !     XPointer    client_data;
  1345. X  {
  1346. ! #define    BUFFLIM        32
  1347. !     KeySym        ks;
  1348. !     char        buff[BUFFLIM];
  1349. X  
  1350. !     XLookupString( (XKeyEvent *)ev, buff, BUFFLIM, &ks, NULL );
  1351. !     return( _Ximp_StartXIMP( (Ximp_XIC)client_data, ev, ks ) );
  1352. X  }
  1353. X  
  1354. X  /*
  1355. *** /tmp/d16987    Sun May  3 18:45:31 1992
  1356. --- mit/lib/X/Ximp/XimpMCT.c    Sun May  3 18:45:28 1992
  1357. ***************
  1358. *** 1,7 ****
  1359. ! /* $XConsortium: XimpMCT.c,v 1.4 91/10/07 17:50:08 rws Exp $ */
  1360. X  /*
  1361. !  * Copyright 1990, 1991 by TOSHIBA Corp.
  1362. !  * Copyright 1990, 1991 by SORD Computer Corp.
  1363. X   *
  1364. X   * Permission to use, copy, modify, distribute, and sell this software and its
  1365. X   * documentation for any purpose is hereby granted without fee, provided that
  1366. --- 1,7 ----
  1367. ! /* $XConsortium: XimpMCT.c,v 1.5 92/04/14 13:29:33 rws Exp $ */
  1368. X  /*
  1369. !  * Copyright 1990, 1991, 1992 by TOSHIBA Corp.
  1370. !  * Copyright 1990, 1991, 1992 by SORD Computer Corp.
  1371. X   *
  1372. X   * Permission to use, copy, modify, distribute, and sell this software and its
  1373. X   * documentation for any purpose is hereby granted without fee, provided that
  1374. ***************
  1375. *** 28,34 ****
  1376. X  
  1377. X  /******************************************************************
  1378. X  
  1379. !               Copyright 1991, by FUJITSU LIMITED
  1380. X  
  1381. X  Permission to use, copy, modify, distribute, and sell this software
  1382. X  and its documentation for any purpose is hereby granted without fee,
  1383. --- 28,34 ----
  1384. X  
  1385. X  /******************************************************************
  1386. X  
  1387. !               Copyright 1991, 1992 by FUJITSU LIMITED
  1388. X  
  1389. X  Permission to use, copy, modify, distribute, and sell this software
  1390. X  and its documentation for any purpose is hereby granted without fee,
  1391. ***************
  1392. *** 227,232 ****
  1393. --- 227,306 ----
  1394. X      if (mbstr_len)
  1395. X      *mbstr_len = bufptr - mbstr;
  1396. X      ret = ctptr - ctext;
  1397. + error:
  1398. +     (*lcd->ximp_lcpart->methods->cnv_end)(lcd);
  1399. +     return ret;
  1400. + }
  1401. + int
  1402. + _Ximp_ct_mbslen(lcd, ctext, ctext_len, unconv_num)
  1403. +     Ximp_XLCd lcd;
  1404. +     unsigned char *ctext;
  1405. +     int ctext_len;
  1406. +     int *unconv_num;
  1407. + {
  1408. +     unsigned char ch, *ctptr = ctext;
  1409. +     unsigned char *tmpptr;
  1410. +     unsigned char msb_mask;
  1411. +     unsigned char buf[BUFSIZE];
  1412. +     int GL_codeset, GR_codeset, codeset_number;
  1413. +     int tmp_len, skip_size;
  1414. +     int ret = 0;
  1415. +     int (*cstombs)();
  1416. +     if (unconv_num)
  1417. +     *unconv_num = 0;
  1418. +     
  1419. +     cstombs = lcd->ximp_lcpart->methods->cstombs;
  1420. +     GL_codeset = _get_codeset_number(lcd, ISO8859_1, GL);
  1421. +     GR_codeset = _get_codeset_number(lcd, ISO8859_1, GR);
  1422. +     (*lcd->ximp_lcpart->methods->cnv_start)(lcd);
  1423. +     while (ctext_len > 0) {
  1424. +     ch = *ctptr;
  1425. +     if (ch == 0x1b) {
  1426. +         tmp_len = _check_ESC_sequence(lcd, ctptr, ctext_len, 
  1427. +                       &GL_codeset, &GR_codeset);
  1428. +     } else if (ch == 0x9b) {
  1429. +         tmp_len =_check_CSI_sequence(lcd, ctptr, ctext_len);
  1430. +     } else {
  1431. +         tmpptr = ctptr;
  1432. +         msb_mask = ch & 0x80;
  1433. +         for ( ; ctext_len; tmpptr++, ctext_len--) {
  1434. +         ch = *tmpptr;
  1435. +         if (msb_mask != (ch & 0x80) || ch == '\033' || ch == 0x9b)
  1436. +             break;
  1437. +             if ((ch < 0x20 && ch != '\n' && ch != '\t') ||
  1438. +             (ch >= 0x80 && ch < 0xa0)) {
  1439. +             ret = -1;
  1440. +             goto error;
  1441. +         }
  1442. +         }
  1443. +         codeset_number = msb_mask ? GR_codeset : GL_codeset;
  1444. +         if (codeset_number > -1) {
  1445. +         tmp_len = BUFSIZE;
  1446. +         skip_size = (*cstombs)(lcd, ctptr, tmpptr - ctptr,
  1447. +                        buf, &tmp_len, codeset_number);
  1448. +         if (skip_size < 0) {
  1449. +             ret - -1;
  1450. +             goto error;
  1451. +         }
  1452. +         ret += tmp_len;
  1453. +         } else if (unconv_num)
  1454. +         *unconv_num += tmpptr - ctptr;
  1455. +         ctptr = tmpptr;
  1456. +         continue;
  1457. +     }
  1458. +     if (tmp_len < 0) {
  1459. +         ret = -1;
  1460. +         goto error;
  1461. +     }
  1462. +     ctptr += tmp_len;
  1463. +     ctext_len -= tmp_len;
  1464. +     }
  1465. X  error:
  1466. X      (*lcd->ximp_lcpart->methods->cnv_end)(lcd);
  1467. X  
  1468. *** /tmp/d17009    Sun May  3 18:45:43 1992
  1469. --- mit/lib/X/Ximp/XimpMDrS.c    Sun May  3 18:45:40 1992
  1470. ***************
  1471. *** 1,7 ****
  1472. ! /* $XConsortium: XimpMDrS.c,v 1.2 91/07/09 17:22:03 rws Exp $ */
  1473. X  /*
  1474. !  * Copyright 1990, 1991 by TOSHIBA Corp.
  1475. !  * Copyright 1990, 1991 by SORD Computer Corp.
  1476. X   *
  1477. X   * Permission to use, copy, modify, distribute, and sell this software and its
  1478. X   * documentation for any purpose is hereby granted without fee, provided that
  1479. --- 1,7 ----
  1480. ! /* $XConsortium: XimpMDrS.c,v 1.3 92/04/14 13:29:36 rws Exp $ */
  1481. X  /*
  1482. !  * Copyright 1990, 1991, 1992 by TOSHIBA Corp.
  1483. !  * Copyright 1990, 1991, 1992 by SORD Computer Corp.
  1484. X   *
  1485. X   * Permission to use, copy, modify, distribute, and sell this software and its
  1486. X   * documentation for any purpose is hereby granted without fee, provided that
  1487. ***************
  1488. *** 29,35 ****
  1489. X  
  1490. X  /******************************************************************
  1491. X  
  1492. !               Copyright 1991, by FUJITSU LIMITED
  1493. X  
  1494. X  Permission to use, copy, modify, distribute, and sell this software
  1495. X  and its documentation for any purpose is hereby granted without fee,
  1496. --- 29,35 ----
  1497. X  
  1498. X  /******************************************************************
  1499. X  
  1500. !               Copyright 1991, 1992 by FUJITSU LIMITED
  1501. X  
  1502. X  Permission to use, copy, modify, distribute, and sell this software
  1503. X  and its documentation for any purpose is hereby granted without fee,
  1504. *** /tmp/d17031    Sun May  3 18:45:55 1992
  1505. --- mit/lib/X/Ximp/XimpMEsc.c    Sun May  3 18:45:52 1992
  1506. ***************
  1507. *** 1,7 ****
  1508. ! /* $XConsortium: XimpMEsc.c,v 1.2 91/07/09 17:22:05 rws Exp $ */
  1509. X  /*
  1510. !  * Copyright 1990, 1991 by TOSHIBA Corp.
  1511. !  * Copyright 1990, 1991 by SORD Computer Corp.
  1512. X   *
  1513. X   * Permission to use, copy, modify, distribute, and sell this software and its
  1514. X   * documentation for any purpose is hereby granted without fee, provided that
  1515. --- 1,7 ----
  1516. ! /* $XConsortium: XimpMEsc.c,v 1.3 92/04/14 13:29:38 rws Exp $ */
  1517. X  /*
  1518. !  * Copyright 1990, 1991, 1992 by TOSHIBA Corp.
  1519. !  * Copyright 1990, 1991, 1992 by SORD Computer Corp.
  1520. X   *
  1521. X   * Permission to use, copy, modify, distribute, and sell this software and its
  1522. X   * documentation for any purpose is hereby granted without fee, provided that
  1523. ***************
  1524. *** 29,35 ****
  1525. X  
  1526. X  /******************************************************************
  1527. X  
  1528. !               Copyright 1991, by FUJITSU LIMITED
  1529. X  
  1530. X  Permission to use, copy, modify, distribute, and sell this software
  1531. X  and its documentation for any purpose is hereby granted without fee,
  1532. --- 29,35 ----
  1533. X  
  1534. X  /******************************************************************
  1535. X  
  1536. !               Copyright 1991, 1992 by FUJITSU LIMITED
  1537. X  
  1538. X  Permission to use, copy, modify, distribute, and sell this software
  1539. X  and its documentation for any purpose is hereby granted without fee,
  1540. *** /tmp/d17053    Sun May  3 18:46:06 1992
  1541. --- mit/lib/X/Ximp/XimpMExt.c    Sun May  3 18:46:04 1992
  1542. ***************
  1543. *** 1,7 ****
  1544. ! /* $XConsortium: XimpMExt.c,v 1.2 91/07/09 17:22:07 rws Exp $ */
  1545. X  /*
  1546. !  * Copyright 1990, 1991 by TOSHIBA Corp.
  1547. !  * Copyright 1990, 1991 by SORD Computer Corp.
  1548. X   *
  1549. X   * Permission to use, copy, modify, distribute, and sell this software and its
  1550. X   * documentation for any purpose is hereby granted without fee, provided that
  1551. --- 1,7 ----
  1552. ! /* $XConsortium: XimpMExt.c,v 1.3 92/04/14 13:29:40 rws Exp $ */
  1553. X  /*
  1554. !  * Copyright 1990, 1991, 1992 by TOSHIBA Corp.
  1555. !  * Copyright 1990, 1991, 1992 by SORD Computer Corp.
  1556. X   *
  1557. X   * Permission to use, copy, modify, distribute, and sell this software and its
  1558. X   * documentation for any purpose is hereby granted without fee, provided that
  1559. ***************
  1560. *** 29,35 ****
  1561. X  
  1562. X  /******************************************************************
  1563. X  
  1564. !               Copyright 1991, by FUJITSU LIMITED
  1565. X  
  1566. X  Permission to use, copy, modify, distribute, and sell this software
  1567. X  and its documentation for any purpose is hereby granted without fee,
  1568. --- 29,35 ----
  1569. X  
  1570. X  /******************************************************************
  1571. X  
  1572. !               Copyright 1991, 1992 by FUJITSU LIMITED
  1573. X  
  1574. X  Permission to use, copy, modify, distribute, and sell this software
  1575. X  and its documentation for any purpose is hereby granted without fee,
  1576. *** /tmp/d17075    Sun May  3 18:46:18 1992
  1577. --- mit/lib/X/Ximp/XimpWCT.c    Sun May  3 18:46:15 1992
  1578. ***************
  1579. *** 1,7 ****
  1580. ! /* $XConsortium: XimpWCT.c,v 1.4 91/10/07 17:50:48 rws Exp $ */
  1581. X  /*
  1582. !  * Copyright 1990, 1991 by TOSHIBA Corp.
  1583. !  * Copyright 1990, 1991 by SORD Computer Corp.
  1584. X   *
  1585. X   * Permission to use, copy, modify, distribute, and sell this software and its
  1586. X   * documentation for any purpose is hereby granted without fee, provided that
  1587. --- 1,7 ----
  1588. ! /* $XConsortium: XimpWCT.c,v 1.5 92/04/14 13:30:14 rws Exp $ */
  1589. X  /*
  1590. !  * Copyright 1990, 1991, 1992 by TOSHIBA Corp.
  1591. !  * Copyright 1990, 1991, 1992 by SORD Computer Corp.
  1592. X   *
  1593. X   * Permission to use, copy, modify, distribute, and sell this software and its
  1594. X   * documentation for any purpose is hereby granted without fee, provided that
  1595. ***************
  1596. *** 28,34 ****
  1597. X  
  1598. X  /******************************************************************
  1599. X  
  1600. !               Copyright 1991, by FUJITSU LIMITED
  1601. X  
  1602. X  Permission to use, copy, modify, distribute, and sell this software
  1603. X  and its documentation for any purpose is hereby granted without fee,
  1604. --- 28,34 ----
  1605. X  
  1606. X  /******************************************************************
  1607. X  
  1608. !               Copyright 1991, 1992 by FUJITSU LIMITED
  1609. X  
  1610. X  Permission to use, copy, modify, distribute, and sell this software
  1611. X  and its documentation for any purpose is hereby granted without fee,
  1612. ***************
  1613. *** 227,232 ****
  1614. --- 227,306 ----
  1615. X      if (wcstr_len)
  1616. X      *wcstr_len = bufptr - wcstr;
  1617. X      ret = ctptr - ctext;
  1618. + error:
  1619. +     (*lcd->ximp_lcpart->methods->cnv_end)(lcd);
  1620. +     return ret;
  1621. + }
  1622. + int
  1623. + _Ximp_ct_wcslen(lcd, ctext, ctext_len, unconv_num)
  1624. +     Ximp_XLCd lcd;
  1625. +     unsigned char *ctext;
  1626. +     int ctext_len;
  1627. +     int *unconv_num;
  1628. + {
  1629. +     unsigned char ch, *ctptr = ctext;
  1630. +     unsigned char *tmpptr;
  1631. +     unsigned char msb_mask;
  1632. +     wchar_t buf[BUFSIZE];
  1633. +     int GL_codeset, GR_codeset, codeset_number;
  1634. +     int tmp_len, skip_size;
  1635. +     int ret = 0;
  1636. +     int (*cstowcs)();
  1637. +     if (unconv_num)
  1638. +     *unconv_num = 0;
  1639. +     
  1640. +     cstowcs = lcd->ximp_lcpart->methods->cstowcs;
  1641. +     GL_codeset = _get_codeset_number(lcd, ISO8859_1, GL);
  1642. +     GR_codeset = _get_codeset_number(lcd, ISO8859_1, GR);
  1643. +     (*lcd->ximp_lcpart->methods->cnv_start)(lcd);
  1644. +     while (ctext_len > 0) {
  1645. +     ch = *ctptr;
  1646. +     if (ch == 0x1b) {
  1647. +         tmp_len = _check_ESC_sequence(lcd, ctptr, ctext_len, 
  1648. +                       &GL_codeset, &GR_codeset);
  1649. +     } else if (ch == 0x9b) {
  1650. +         tmp_len =_check_CSI_sequence(lcd, ctptr, ctext_len);
  1651. +     } else {
  1652. +         tmpptr = ctptr;
  1653. +         msb_mask = ch & 0x80;
  1654. +         for ( ; ctext_len; tmpptr++, ctext_len--) {
  1655. +         ch = *tmpptr;
  1656. +         if (msb_mask != (ch & 0x80) || ch == '\033' || ch == 0x9b)
  1657. +             break;
  1658. +             if ((ch < 0x20 && ch != '\n' && ch != '\t') ||
  1659. +             (ch >= 0x80 && ch < 0xa0)) {
  1660. +             ret = -1;
  1661. +             goto error;
  1662. +         }
  1663. +         }
  1664. +         codeset_number = msb_mask ? GR_codeset : GL_codeset;
  1665. +         if (codeset_number > -1) {
  1666. +         tmp_len = BUFSIZE;
  1667. +         skip_size = (*cstowcs)(lcd, ctptr, tmpptr - ctptr,
  1668. +                        buf, &tmp_len, codeset_number);
  1669. +         if (skip_size < 0) {
  1670. +             ret = -1;
  1671. +             goto error;
  1672. +         }
  1673. +         ret += tmp_len;
  1674. +         } else if (unconv_num)
  1675. +         *unconv_num += tmpptr - ctptr;
  1676. +         ctptr = tmpptr;
  1677. +         continue;
  1678. +     }
  1679. +     if (tmp_len < 0) {
  1680. +         ret = -1;
  1681. +         goto error;
  1682. +     }
  1683. +     ctptr += tmp_len;
  1684. +     ctext_len -= tmp_len;
  1685. +     }
  1686. X  error:
  1687. X      (*lcd->ximp_lcpart->methods->cnv_end)(lcd);
  1688. X  
  1689. *** /tmp/d17097    Sun May  3 18:46:30 1992
  1690. --- mit/lib/X/Ximp/XimpWDrS.c    Sun May  3 18:46:27 1992
  1691. ***************
  1692. *** 1,7 ****
  1693. ! /* $XConsortium: XimpWDrS.c,v 1.2 91/07/09 17:22:11 rws Exp $ */
  1694. X  /*
  1695. !  * Copyright 1990, 1991 by TOSHIBA Corp.
  1696. !  * Copyright 1990, 1991 by SORD Computer Corp.
  1697. X   *
  1698. X   * Permission to use, copy, modify, distribute, and sell this software and its
  1699. SHAR_EOF
  1700. true || echo 'restore of fix-12 failed'
  1701. fi
  1702. echo 'End of  part 2'
  1703. echo 'File fix-12 is continued in part 3'
  1704. echo 3 > _shar_seq_.tmp
  1705. exit 0
  1706. -- 
  1707. ---
  1708. Senior Systems Scientist        mail: dcmartin@msi.com
  1709. Molecular Simulations, Inc.        uucp: uunet!dcmartin
  1710. 796 North Pastoria Avenue        at&t: 408/522-9236
  1711.