jdiff -rc contrib.patch1/lib/Xaw/MultiText.c contrib/lib/Xaw/MultiText.c
*** contrib.patch1/lib/Xaw/MultiText.c	Wed Dec 25 17:03:34 1991
--- contrib/lib/Xaw/MultiText.c	Thu Nov 14 14:41:17 1991
***************
*** 1,5 ****
  /*
!  * $Id: MultiText.c,v 1.1 1991/10/29 06:47:13 proj Exp $
   */
  /* $XConsortium: MultiText.c,v 1.44 91/07/12 11:27:23 converse Exp $ */
  
--- 1,5 ----
  /*
!  * $Id: MultiText.c,v 1.2 1991/11/14 05:41:16 proj Exp $
   */
  /* $XConsortium: MultiText.c,v 1.44 91/07/12 11:27:23 converse Exp $ */
  
***************
*** 187,192 ****
--- 187,195 ----
  Destroy(w)
  Widget w;
  {
+ #if defined(IM)
+     XawImUnregister(w);
+ #endif  /* defnied(IM) */
      if (w == XtParent(((MultiWidget)w)->text.source))
  	XtDestroyWidget( ((MultiWidget)w)->text.source );
  
jdiff -rc contrib.patch1/lib/Xaw/Text.c contrib/lib/Xaw/Text.c
*** contrib.patch1/lib/Xaw/Text.c	Wed Dec 25 17:03:43 1991
--- contrib/lib/Xaw/Text.c	Wed Nov 20 10:53:31 1991
***************
*** 1,5 ****
  /*
!  * $Id: Text.c,v 1.1 1991/10/29 06:47:55 proj Exp $
   */
  /* $XConsortium: Text.c,v 1.182 91/07/24 22:56:47 converse Exp $ */
  
--- 1,5 ----
  /*
!  * $Id: Text.c,v 1.2 1991/11/20 01:53:19 proj Exp $
   */
  /* $XConsortium: Text.c,v 1.182 91/07/24 22:56:47 converse Exp $ */
  
***************
*** 1520,1526 ****
  		XTextProperty textprop;
  		if (XwcTextListToTextProperty(d, (wchar_t **)value, 1,
  					      XCompoundTextStyle, &textprop)
! 			!=  Success) {
  		    XtFree(*value);
  		    return False;
  		}
--- 1520,1526 ----
  		XTextProperty textprop;
  		if (XwcTextListToTextProperty(d, (wchar_t **)value, 1,
  					      XCompoundTextStyle, &textprop)
! 			<  Success) {
  		    XtFree(*value);
  		    return False;
  		}
***************
*** 1544,1556 ****
  	    textprop.nitems = strlen(*value);
  	    textprop.format = 8;
  	    if (XwcTextPropertyToTextList(d, &textprop, (wchar_t ***)&wlist, &count)
! 			!= Success) {
  		XtFree(*value);
  		return False;
  	    }
  	    XtFree(*value);
  	    if (XwcTextListToTextProperty(d, (wchar_t **)wlist, 1,
! 					  XStringStyle, &textprop) != Success) {
  		XwcFreeStringList(wlist);
  		return False;
  	    }
--- 1544,1556 ----
  	    textprop.nitems = strlen(*value);
  	    textprop.format = 8;
  	    if (XwcTextPropertyToTextList(d, &textprop, (wchar_t ***)&wlist, &count)
! 			< Success) {
  		XtFree(*value);
  		return False;
  	    }
  	    XtFree(*value);
  	    if (XwcTextListToTextProperty(d, (wchar_t **)wlist, 1,
! 					  XStringStyle, &textprop) < Success) {
  		XwcFreeStringList(wlist);
  		return False;
  	    }
***************
*** 1749,1755 ****
  	XTextProperty textprop;
  	if (XwcTextListToTextProperty(XtDisplay((Widget)ctx),
  			(wchar_t **)(&(salt->contents)), 1, XCompoundTextStyle,
! 			&textprop) !=  Success) {
  	    XtFree(salt->contents);
  	    salt->length = 0;
  	    return;
--- 1749,1755 ----
  	XTextProperty textprop;
  	if (XwcTextListToTextProperty(XtDisplay((Widget)ctx),
  			(wchar_t **)(&(salt->contents)), 1, XCompoundTextStyle,
! 			&textprop) <  Success) {
  	    XtFree(salt->contents);
  	    salt->length = 0;
  	    return;
***************
*** 1830,1836 ****
  	    */
  	    XTextProperty textprop;
  	    if (XwcTextListToTextProperty(XtDisplay(w), (wchar_t **)&ptr, 1,
! 		    XStringStyle, &textprop) !=  Success) {
  		XtFree((char *)ptr);
  		return;
  	    }
--- 1830,1836 ----
  	    */
  	    XTextProperty textprop;
  	    if (XwcTextListToTextProperty(XtDisplay(w), (wchar_t **)&ptr, 1,
! 		    XStringStyle, &textprop) <  Success) {
  		XtFree((char *)ptr);
  		return;
  	    }
jdiff -rc contrib.patch1/lib/Xaw/TextAction.c contrib/lib/Xaw/TextAction.c
*** contrib.patch1/lib/Xaw/TextAction.c	Wed Dec 25 17:03:47 1991
--- contrib/lib/Xaw/TextAction.c	Wed Nov 20 10:53:13 1991
***************
*** 1,5 ****
  /*
!  * $Id: TextAction.c,v 1.2 1991/10/29 07:38:25 proj Exp $
   */
  /* $XConsortium: TextAction.c,v 1.43 91/07/23 12:23:54 rws Exp $ */
  
--- 1,5 ----
  /*
!  * $Id: TextAction.c,v 1.3 1991/11/20 01:53:05 proj Exp $
   */
  /* $XConsortium: TextAction.c,v 1.43 91/07/23 12:23:54 rws Exp $ */
  
***************
*** 175,181 ****
        textprop.nitems = strlen(value);
        textprop.format = 8;
        if (XwcTextPropertyToTextList(d, &textprop, (wchar_t ***)&wlist, &count)
! 		!=  Success) {
  	 return;
        }	
        XFree(value);	/* the selection value should be freed with XFree */
--- 175,181 ----
        textprop.nitems = strlen(value);
        textprop.format = 8;
        if (XwcTextPropertyToTextList(d, &textprop, (wchar_t ***)&wlist, &count)
! 		<  Success) {
  	 return;
        }	
        XFree(value);	/* the selection value should be freed with XFree */
***************
*** 640,646 ****
  		XTextProperty textprop;
  		if (XwcTextListToTextProperty(d, (wchar_t **)value, 1,
  					      XCompoundTextStyle, &textprop)
! 			!=  Success) {
  		    XtFree(*value);
  		    return False;
  		}
--- 640,646 ----
  		XTextProperty textprop;
  		if (XwcTextListToTextProperty(d, (wchar_t **)value, 1,
  					      XCompoundTextStyle, &textprop)
! 			<  Success) {
  		    XtFree(*value);
  		    return False;
  		}
***************
*** 664,676 ****
  	    textprop.nitems = strlen(*value);
  	    textprop.format = 8;
  	    if (XwcTextPropertyToTextList(d, &textprop, (wchar_t ***)&wlist, &count)
! 			!= Success) {
  		XtFree(*value);
  		return False;
  	    }
  	    XtFree(*value);
  	    if (XwcTextListToTextProperty(d, (wchar_t **)wlist, 1,
! 					  XStringStyle, &textprop) != Success) {
  		XwcFreeStringList(wlist);
  		return False;
  	    }
--- 664,676 ----
  	    textprop.nitems = strlen(*value);
  	    textprop.format = 8;
  	    if (XwcTextPropertyToTextList(d, &textprop, (wchar_t ***)&wlist, &count)
! 			< Success) {
  		XtFree(*value);
  		return False;
  	    }
  	    XtFree(*value);
  	    if (XwcTextListToTextProperty(d, (wchar_t **)wlist, 1,
! 					  XStringStyle, &textprop) < Success) {
  		XwcFreeStringList(wlist);
  		return False;
  	    }
***************
*** 813,819 ****
  	XTextProperty textprop;
  	if (XwcTextListToTextProperty(XtDisplay((Widget)ctx),
  			(wchar_t **)(&(salt->contents)), 1, XCompoundTextStyle,
! 			&textprop) !=  Success) {
  	    XtFree(salt->contents);
  	    salt->length = 0;
  	    return;
--- 813,819 ----
  	XTextProperty textprop;
  	if (XwcTextListToTextProperty(XtDisplay((Widget)ctx),
  			(wchar_t **)(&(salt->contents)), 1, XCompoundTextStyle,
! 			&textprop) <  Success) {
  	    XtFree(salt->contents);
  	    salt->length = 0;
  	    return;
jdiff -rc contrib.patch1/lib/Xaw/TextSrc.c contrib/lib/Xaw/TextSrc.c
*** contrib.patch1/lib/Xaw/TextSrc.c	Wed Dec 25 17:03:55 1991
--- contrib/lib/Xaw/TextSrc.c	Wed Nov 20 10:52:58 1991
***************
*** 1,5 ****
  /*
!  * $Id: TextSrc.c,v 1.1 1991/10/29 06:48:17 proj Exp $
   */
  /* $XConsortium: TextSrc.c,v 1.11 91/02/20 17:58:08 converse Exp $ */
  
--- 1,5 ----
  /*
!  * $Id: TextSrc.c,v 1.2 1991/11/20 01:52:55 proj Exp $
   */
  /* $XConsortium: TextSrc.c,v 1.11 91/02/20 17:58:08 converse Exp $ */
  
***************
*** 630,636 ****
    else {
        XTextProperty textprop;
        if (XwcTextListToTextProperty(d, (wchar_t **)&wstr, 1,
! 		  XTextStyle, &textprop) !=  Success) {
  	  XtErrorMsg("convertError", "multiSourceCreate", "XawError",
                   "Non-character code(s) in buffer.", NULL, NULL);
        }
--- 630,636 ----
    else {
        XTextProperty textprop;
        if (XwcTextListToTextProperty(d, (wchar_t **)&wstr, 1,
! 		  XTextStyle, &textprop) <  Success) {
  	  XtErrorMsg("convertError", "multiSourceCreate", "XawError",
                   "Non-character code(s) in buffer.", NULL, NULL);
        }
***************
*** 679,685 ****
      strncpy(buf, str, *len);
      *(buf + *len) = '\0';
      if (XmbTextListToTextProperty(d, &buf, 1, XTextStyle, &textprop)
! 			!= Success) {
  	XtErrorMsg("convertError", "multiSourceCreate", "XawError",
  		 "Non-character code(s) in source.", NULL, NULL);
  	XtFree(buf);
--- 679,685 ----
      strncpy(buf, str, *len);
      *(buf + *len) = '\0';
      if (XmbTextListToTextProperty(d, &buf, 1, XTextStyle, &textprop)
! 			< Success) {
  	XtErrorMsg("convertError", "multiSourceCreate", "XawError",
  		 "Non-character code(s) in source.", NULL, NULL);
  	XtFree(buf);
***************
*** 688,694 ****
      }
      XtFree(buf);
      if (XwcTextPropertyToTextList(d, &textprop,
! 			(wchar_t ***)&wlist, &count) != Success) {
  	XtErrorMsg("convertError", "multiSourceCreate", "XawError",
  		 "Non-character code(s) in source.", NULL, NULL);
  	*len = 0;
--- 688,694 ----
      }
      XtFree(buf);
      if (XwcTextPropertyToTextList(d, &textprop,
! 			(wchar_t ***)&wlist, &count) < Success) {
  	XtErrorMsg("convertError", "multiSourceCreate", "XawError",
  		 "Non-character code(s) in source.", NULL, NULL);
  	*len = 0;
jdiff -rc contrib.patch1/lib/Xaw/Vendor.c contrib/lib/Xaw/Vendor.c
*** contrib.patch1/lib/Xaw/Vendor.c	Wed Dec 25 17:04:13 1991
--- contrib/lib/Xaw/Vendor.c	Wed Nov 20 10:52:53 1991
***************
*** 1,5 ****
  /*
!  * $Id: Vendor.c,v 1.1 1991/10/29 06:48:40 proj Exp $
   */
  /* $XConsortium: Vendor.c,v 1.21 91/07/30 15:29:56 rws Exp $ */
  
--- 1,5 ----
  /*
!  * $Id: Vendor.c,v 1.2 1991/11/20 01:52:49 proj Exp $
   */
  /* $XConsortium: Vendor.c,v 1.21 91/07/30 15:29:56 rws Exp $ */
  
***************
*** 216,222 ****
      prop.format = 8;
      prop.nitems = fromVal->size;
  
!     if(XmbTextPropertyToTextList(dpy, &prop, &list, &count) != Success) {
  	XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
  	"converter", "XmbTextPropertyToTextList", "XawError",
  	"conversion from CT to MB failed.", NULL, 0);
--- 216,222 ----
      prop.format = 8;
      prop.nitems = fromVal->size;
  
!     if(XmbTextPropertyToTextList(dpy, &prop, &list, &count) < Success) {
  	XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
  	"converter", "XmbTextPropertyToTextList", "XawError",
  	"conversion from CT to MB failed.", NULL, 0);
jdiff -rc contrib.patch1/lib/Xaw/XawIm.c contrib/lib/Xaw/XawIm.c
*** contrib.patch1/lib/Xaw/XawIm.c	Wed Dec 25 17:04:19 1991
--- contrib/lib/Xaw/XawIm.c	Fri Dec 13 17:42:32 1991
***************
*** 1,5 ****
  /*
!  * $Id: XawIm.c,v 1.2 1991/10/29 07:45:34 proj Exp $
   */
  
  /*
--- 1,5 ----
  /*
!  * $Id: XawIm.c,v 1.7 1991/12/13 08:42:26 proj Exp $
   */
  
  /*
***************
*** 237,242 ****
--- 237,285 ----
  	XCloseIM(ve->im.xim);
  }
  
+ static void _ImDestroyIC(w, ve)
+     Widget	w;
+     XawVendorShellExtPart	*ve;
+ {
+     XawIcTableList	p;
+ 
+     if ((ve->im.xim == NULL) || ((p = _ImGetIcTable(w, ve)) == NULL) ||
+ 	(p->xic == NULL)) return;
+     XDestroyIC(p->xic);
+     if (p->input_style & XIMPreeditPosition) {
+ 	XtRemoveEventHandler(w, (EventMask)StructureNotifyMask, FALSE,
+ 			  (XtEventHandler)_ImConfigureCB, (Opaque)NULL);
+     }
+ }
+ 
+ static Dimension _ImSetVendorShellHeight(ve, height)
+     XawVendorShellExtPart	*ve;
+     Dimension	height;
+ {
+     Arg			args[2];
+     Cardinal		i = 0;
+ 
+    if (ve->im.area_height < height || height == 0) {
+        XtSetArg(args[i], XtNheight,
+ 		(ve->parent->core.height + height - ve->im.area_height));
+        XtSetValues(ve->parent, args, 1);
+        ve->im.area_height = height;
+    }
+    return(ve->im.area_height);
+ }
+ 
+ static Boolean _ImIsCreatedIC(w, ve)
+     Widget	w;
+     XawVendorShellExtPart	*ve;
+ {
+     XawIcTableList	p;
+ 
+     if (ve->im.xim == NULL) return(FALSE);
+     if ((p = _ImGetIcTable(w, ve)) == NULL) return(FALSE);
+     if (p->xic == NULL) return(FALSE);
+     return(TRUE);
+ }
+     
  static int _ImIOErrorHandler(error_im)
  XIM error_im;
  {
***************
*** 243,250 ****
      VendorShellWidget	vw;
      XawIcTableList	p;
      XawVendorShellExtPart	*ve;
!     extern void XawVendorShellExtResize(), _ImDestroyIC();
!     extern Dimension _ImSetVendorShellHeight();
  
      if ((vw = (VendorShellWidget)_ImGetErrCnxt(error_im)) == NULL
  	|| (ve = _ImGetExtPart(vw)) == NULL) return(0);
--- 286,292 ----
      VendorShellWidget	vw;
      XawIcTableList	p;
      XawVendorShellExtPart	*ve;
!     extern void XawVendorShellExtResize();
  
      if ((vw = (VendorShellWidget)_ImGetErrCnxt(error_im)) == NULL
  	|| (ve = _ImGetExtPart(vw)) == NULL) return(0);
***************
*** 281,287 ****
      XawVendorShellExtPart	*ve;
  {
      char	*p, modifiers[32];
-     Arg		args[2];
  
      if (!strcmp(setlocale(LC_ALL, NULL), "C")) return;
      if ((p = XSetLocaleModifiers(NULL)) == NULL || *p == '\0') {
--- 323,328 ----
***************
*** 306,345 ****
      XawIcTableList		p;
      XVaNestedList		pe_attr, st_attr;
      XRectangle			pe_area, st_area;
  
      for (p = ve->ic.ic_table; p; p = p->next) {
  	if (p->xic == NULL) continue;
  	st_area.width = 0;
  	if (p->input_style & XIMStatusArea) {
! 	    st_attr = XVaCreateNestedList(0, XNArea, &st_area, NULL);
  	    XGetICValues(p->xic, XNStatusAttributes, st_attr, NULL);
  	    if (p->xic == NULL) {
- 		XtFree(st_attr);
  		return;
  	    }
  	    st_area.y = vw->core.height - ve->im.area_height;
  	    XSetICValues(p->xic, XNStatusAttributes, st_attr, NULL);
! 	    XtFree(st_attr);
  	}
- 	if (p->xic == NULL) {
- 	    XtFree(st_attr);
- 	    return;
- 	}
  	if (p->input_style & XIMPreeditArea) {
! 	    pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL);
  	    XGetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL);
  	    if (p->xic == NULL) {
- 		XtFree(pe_attr);
  		return;
  	    }
  	    pe_area.x = st_area.width;
  	    pe_area.y = vw->core.height - ve->im.area_height;
  	    pe_area.width = vw->core.width;
  	    if (p->input_style & XIMStatusArea) {
  		pe_area.width -= st_area.width;
  	    }
  	    XSetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL);
! 	    XtFree(pe_attr);
  	}
      }
  }
--- 347,394 ----
      XawIcTableList		p;
      XVaNestedList		pe_attr, st_attr;
      XRectangle			pe_area, st_area;
+     XRectangle			*get_pe_area = NULL, *get_st_area = NULL;
  
      for (p = ve->ic.ic_table; p; p = p->next) {
  	if (p->xic == NULL) continue;
  	st_area.width = 0;
  	if (p->input_style & XIMStatusArea) {
! 	    st_attr = XVaCreateNestedList(0, XNArea, &get_st_area, NULL);
  	    XGetICValues(p->xic, XNStatusAttributes, st_attr, NULL);
+ 	    XFree(st_attr);
  	    if (p->xic == NULL) {
  		return;
  	    }
+ 	    st_area.x = 0;
  	    st_area.y = vw->core.height - ve->im.area_height;
+ 	    st_area.width = get_st_area->width;
+ 	    st_area.height = get_st_area->height;
+ 	    XFree(get_st_area);
+ 	    st_attr = XVaCreateNestedList(0, XNArea, &st_area, NULL);
  	    XSetICValues(p->xic, XNStatusAttributes, st_attr, NULL);
! 	    XFree(st_attr);
! 	    if (p->xic == NULL) {
! 		return;
! 	    }
  	}
  	if (p->input_style & XIMPreeditArea) {
! 	    pe_attr = XVaCreateNestedList(0, XNArea, &get_pe_area, NULL);
  	    XGetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL);
+ 	    XFree(pe_attr);
  	    if (p->xic == NULL) {
  		return;
  	    }
  	    pe_area.x = st_area.width;
  	    pe_area.y = vw->core.height - ve->im.area_height;
  	    pe_area.width = vw->core.width;
+ 	    pe_area.height = get_pe_area->height;
  	    if (p->input_style & XIMStatusArea) {
  		pe_area.width -= st_area.width;
  	    }
+ 	    XFree(get_pe_area);
+ 	    pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL);
  	    XSetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL);
! 	    XFree(pe_attr);
  	}
      }
  }
***************
*** 370,375 ****
--- 419,426 ----
      table->bg_pixmap = 0;
      table->cursor_position = 0xffff;
      table->line_spacing = 0;
+     table->ic_focused = FALSE;
+     table->openic_error = FALSE;
      table->next = ve->ic.ic_table;
      ve->ic.ic_table = table;
  }
***************
*** 390,423 ****
      return;
  }
  
- static Dimension _ImSetVendorShellHeight(ve, height)
-     XawVendorShellExtPart	*ve;
-     Dimension	height;
- {
-     Arg			args[2];
-     Cardinal		i = 0;
- 
-    if (ve->im.area_height < height || height == 0) {
-        XtSetArg(args[i], XtNheight,
- 		(ve->parent->core.height + height - ve->im.area_height));
-        XtSetValues(ve->parent, args, 1);
-        ve->im.area_height = height;
-    }
-    return(ve->im.area_height);
- }
- 
- static Boolean _ImIsCreatedIC(w, ve)
-     Widget	w;
-     XawVendorShellExtPart	*ve;
- {
-     XawIcTableList	p;
- 
-     if (ve->im.xim == NULL) return(FALSE);
-     if ((p = _ImGetIcTable(w, ve)) == NULL) return(FALSE);
-     if (p->xic == NULL) return(FALSE);
-     return(TRUE);
- }
-     
  static void _ImCreateIC(w, ve)
      Widget	w;
      XawVendorShellExtPart	*ve;
--- 441,446 ----
***************
*** 424,430 ****
  {
      XawIcTableList	p;
      XPoint		position;
!     XRectangle		pe_area, st_area, pe_area_needed, st_area_needed;
      XVaNestedList	pe_attr = NULL, st_attr = NULL;
      XPointer		ic_a[20], pe_a[20], st_a[20];
      Dimension		height = 0;
--- 447,454 ----
  {
      XawIcTableList	p;
      XPoint		position;
!     XRectangle		pe_area, st_area;
!     XRectangle		*pe_area_needed = NULL, *st_area_needed = NULL;
      XVaNestedList	pe_attr = NULL, st_attr = NULL;
      XPointer		ic_a[20], pe_a[20], st_a[20];
      Dimension		height = 0;
***************
*** 434,440 ****
      int			i;
  
      if (!XtIsRealized(w)) return;
!     if ((p = _ImGetIcTable(w, ve)) == NULL) return;
  
      XFlush(XtDisplay(w));
      if (XGetIMValues(ve->im.xim, XNQueryInputStyle, &xim_styles, NULL)
--- 458,465 ----
      int			i;
  
      if (!XtIsRealized(w)) return;
!     if (((ve->im.xim == NULL) || (p = _ImGetIcTable(w, ve)) == NULL) ||
! 	p->xic || (p->openic_error != FALSE)) return;
  
      XFlush(XtDisplay(w));
      if (XGetIMValues(ve->im.xim, XNQueryInputStyle, &xim_styles, NULL)
***************
*** 555,561 ****
      if (pe_attr) XtFree(pe_attr);
      if (st_attr) XtFree(st_attr);
  
!     if (p->xic == NULL) return;
  
      pe_attr = st_attr = NULL;
      ic_cnt = pe_cnt = st_cnt = 0;
--- 580,589 ----
      if (pe_attr) XtFree(pe_attr);
      if (st_attr) XtFree(st_attr);
  
!     if (p->xic == NULL) {
! 	p->openic_error = True;
! 	return;
!     }
  
      pe_attr = st_attr = NULL;
      ic_cnt = pe_cnt = st_cnt = 0;
***************
*** 577,591 ****
  	if (pe_attr) XtFree(pe_attr);
  	if (st_attr) XtFree(st_attr);
  	if (p->xic == NULL) {
  	    return;
  	}
  	pe_attr = st_attr = NULL;
  	ic_cnt = pe_cnt = st_cnt = 0;
  	if (p->input_style & XIMStatusArea) {
! 	    st_area.height = st_area_needed.height;
  	    if (p->input_style & XIMPreeditArea) {
! 		st_area.width = st_area_needed.width;
  	    }
  	    st_attr = XVaCreateNestedList(0, XNArea, &st_area, NULL);
  	    _ImSetVaArg(&ic_a[ic_cnt], XNStatusAttributes); ic_cnt++;
  	    _ImSetVaArg(&ic_a[ic_cnt], st_attr); ic_cnt++;
--- 605,621 ----
  	if (pe_attr) XtFree(pe_attr);
  	if (st_attr) XtFree(st_attr);
  	if (p->xic == NULL) {
+ 	    p->openic_error = True;
  	    return;
  	}
  	pe_attr = st_attr = NULL;
  	ic_cnt = pe_cnt = st_cnt = 0;
  	if (p->input_style & XIMStatusArea) {
! 	    st_area.height = st_area_needed->height;
  	    if (p->input_style & XIMPreeditArea) {
! 		st_area.width = st_area_needed->width;
  	    }
+ 	    XFree(st_area_needed);
  	    st_attr = XVaCreateNestedList(0, XNArea, &st_area, NULL);
  	    _ImSetVaArg(&ic_a[ic_cnt], XNStatusAttributes); ic_cnt++;
  	    _ImSetVaArg(&ic_a[ic_cnt], st_attr); ic_cnt++;
***************
*** 595,601 ****
  		pe_area.x = st_area.width;
  		pe_area.width -= st_area.width;
  	    }
! 	    pe_area.height = pe_area_needed.height;
  	    pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL);
  	    _ImSetVaArg(&ic_a[ic_cnt], XNPreeditAttributes); ic_cnt++;
  	    _ImSetVaArg(&ic_a[ic_cnt], pe_attr); ic_cnt++;
--- 625,632 ----
  		pe_area.x = st_area.width;
  		pe_area.width -= st_area.width;
  	    }
! 	    pe_area.height = pe_area_needed->height;
! 	    XFree(pe_area_needed);
  	    pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL);
  	    _ImSetVaArg(&ic_a[ic_cnt], XNPreeditAttributes); ic_cnt++;
  	    _ImSetVaArg(&ic_a[ic_cnt], pe_attr); ic_cnt++;
***************
*** 605,610 ****
--- 636,642 ----
  	if (pe_attr) XtFree(pe_attr);
  	if (st_attr) XtFree(st_attr);
  	if (p->xic == NULL) {
+ 	    p->openic_error = True;
  	    return;
  	}
      }
***************
*** 627,633 ****
      int			ic_cnt = 0, pe_cnt = 0, st_cnt = 0;
      int			height;
  
!     if ((p = _ImGetIcTable(w, ve)) == NULL) return;
  
      XFlush(XtDisplay(w));
      if (!(p->flg & (CIFontSet | CIFg | CIBg |
--- 659,666 ----
      int			ic_cnt = 0, pe_cnt = 0, st_cnt = 0;
      int			height;
  
!     if ((ve->im.xim == NULL) || ((p = _ImGetIcTable(w, ve)) == NULL) ||
! 	(p->xic == NULL)) return;
  
      XFlush(XtDisplay(w));
      if (!(p->flg & (CIFontSet | CIFg | CIBg |
***************
*** 721,727 ****
  {
      XawIcTableList	p;
  
!     if ((p = _ImGetIcTable(w, ve)) == NULL) return;
  
      if (p->flg & CIICFocus && p->ic_focused == FALSE) {
  	p->ic_focused = TRUE;
--- 754,761 ----
  {
      XawIcTableList	p;
  
!     if ((ve->im.xim == NULL) || ((p = _ImGetIcTable(w, ve)) == NULL) ||
! 	(p->xic == NULL)) return;
  
      if (p->flg & CIICFocus && p->ic_focused == FALSE) {
  	p->ic_focused = TRUE;
***************
*** 736,742 ****
  {
      XawIcTableList	p;
  
!     if ((p = _ImGetIcTable(w, ve)) == NULL) return;
  
      if (p->ic_focused == TRUE) {
  	XUnsetICFocus(p->xic);
--- 770,777 ----
  {
      XawIcTableList	p;
  
!     if ((ve->im.xim == NULL) || ((p = _ImGetIcTable(w, ve)) == NULL) ||
! 	(p->xic == NULL)) return;
  
      if (p->ic_focused == TRUE) {
  	XUnsetICFocus(p->xic);
***************
*** 812,831 ****
      p->setted_flg |= p->flg;
  }
  
- static void _ImDestroyIC(w, ve)
-     Widget	w;
-     XawVendorShellExtPart	*ve;
- {
-     XawIcTableList	p;
- 
-     if ((ve->im.xim == NULL) || (p = _ImGetIcTable(w, ve)) == NULL) return;
-     XDestroyIC(p->xic);
-     if (p->input_style & XIMPreeditPosition) {
- 	XtRemoveEventHandler(w, (EventMask)StructureNotifyMask, FALSE,
- 			  (XtEventHandler)_ImConfigureCB, (Opaque)NULL);
-     }
- }
- 
  static void _ImSetFocusValues(inwidg, args, num_args, focus)
      Widget	inwidg;
      ArgList	args;
--- 847,852 ----
***************
*** 926,931 ****
--- 947,957 ----
      if (_ImNoRegistered(ve))
  	{
  	    _ImCloseIM(ve);
+ 	    ve->im.xim = NULL;
+ 	    /*
+ 	     * resize vendor shell to core size
+ 	    */
+ 	    _ImSetVendorShellHeight(ve, 0);
  	}
  }
  
***************
*** 936,942 ****
  
      if (ve->im.xim == NULL) return;
      for (p = ve->ic.ic_table; p; p = p->next) {
! 	_ImCreateIC(p->widget, ve);
      }
      for (p = ve->ic.ic_table; p; p = p->next) {
  	_ImSetICFocus(p->widget, ve);
--- 962,969 ----
  
      if (ve->im.xim == NULL) return;
      for (p = ve->ic.ic_table; p; p = p->next) {
! 	if (p->xic == NULL)
! 	    _ImCreateIC(p->widget, ve);
      }
      for (p = ve->ic.ic_table; p; p = p->next) {
  	_ImSetICFocus(p->widget, ve);
***************
*** 950,962 ****
  
      if (ve->im.xim == NULL) {
  	_ImOpenIM(ve);
-     } else {
- 	return;
      }
      if (ve->im.xim == NULL) return;
  
      for (p = ve->ic.ic_table; p; p = p->next) {
  	p->flg = p->setted_flg;
      }
      _ImAllCreateIC(ve);
  }
--- 977,988 ----
  
      if (ve->im.xim == NULL) {
  	_ImOpenIM(ve);
      }
      if (ve->im.xim == NULL) return;
  
      for (p = ve->ic.ic_table; p; p = p->next) {
  	p->flg = p->setted_flg;
+ 	p->openic_error = FALSE;
      }
      _ImAllCreateIC(ve);
  }
jdiff -rc contrib.patch1/lib/Xaw/XawImP.h contrib/lib/Xaw/XawImP.h
*** contrib.patch1/lib/Xaw/XawImP.h	Wed Dec 25 17:04:21 1991
--- contrib/lib/Xaw/XawImP.h	Tue Nov 26 09:43:34 1991
***************
*** 1,5 ****
  /*
!  * $Id: XawImP.h,v 1.1 1991/10/29 06:48:50 proj Exp $
   */
  
  /*
--- 1,5 ----
  /*
!  * $Id: XawImP.h,v 1.2 1991/11/26 00:43:32 proj Exp $
   */
  
  /*
***************
*** 70,75 ****
--- 70,76 ----
      Pixmap		bg_pixmap;
      XawTextPosition	cursor_position;
      Dimension		line_spacing;
+     Boolean		openic_error;
      struct _XawIcTablePart *next;
  } XawIcTablePart, *XawIcTableList;