home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume18 / x11fix16 / part02 < prev    next >
Encoding:
Text File  |  1992-08-02  |  50.4 KB  |  1,786 lines

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