                      Release 5 Public Patch #25
                           MIT X Consortium

To apply this patch:

cd to the top of the source tree (to the directory containing the "mit"
and "contrib" subdirectories) and do:
        patch -p -s < ThisFile
Patch will work silently unless an error occurs.
If you want to watch patch do its thing, leave out the "-s" argument to patch.


Finally, to rebuild after applying this patch, cd to the "mit" subdirectory
and do:
        make -k >& make.log


Brief notes on what this patch fixes:
Xt: fix-24 omitted patches to Display.c which caused problems with timeouts
Xt: inappropriate response to XtCWQueryOnly by Shell Geometry Manager
Xt: Shell's set_values method ignores the _XtShellPositionValid bit
Xt: Shell::get_values_hook doesn't test if realized
Xt: XtTranslateCoords doesn't test if realized
Xt: Shell GeometryManager does not deal with XtCWQueryOnly
Xt: incremental selection owner, nonincremental receiver, format != 8
Xt: XtVaTypedArg transformation to ArgList fails for some resources

Prereq: public-patch-24

*** /tmp/da02096	Tue May 25 15:29:26 1993
--- mit/bug-report	Tue May 25 15:29:05 1993
***************
*** 2,8 ****
  Subject: [area]: [synopsis]   [replace with actual area and short description]
  
  VERSION:
!     R5, public-patch-24
      [MIT public patches will edit this line to indicate the patch level]
  
  CLIENT MACHINE and OPERATING SYSTEM:
--- 2,8 ----
  Subject: [area]: [synopsis]   [replace with actual area and short description]
  
  VERSION:
!     R5, public-patch-25
      [MIT public patches will edit this line to indicate the patch level]
  
  CLIENT MACHINE and OPERATING SYSTEM:
*** /tmp/da01915	Tue May 25 14:50:12 1993
--- mit/lib/Xt/Display.c	Tue May 25 14:50:11 1993
***************
*** 1,4 ****
! /* $XConsortium: Display.c,v 1.86 92/11/23 15:32:29 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Display.c,v 1.89 93/03/15 15:27:35 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 315,320 ****
--- 315,321 ----
  	FD_ZERO(&app->fds.rmask);
  	FD_ZERO(&app->fds.wmask);
  	FD_ZERO(&app->fds.emask);
+ 	app->input_max = 0;
  	_XtHeapInit(&app->heap);
  	app->fallback_resources = NULL;
  	_XtPopupInitialize(app);
***************
*** 453,459 ****
  {
          register XtPerDisplay xtpd;
  	register PerDisplayTablePtr pd, opd;
! 	XrmDatabase def_db, db;
  	int i;
  	
  #ifdef lint
--- 454,460 ----
  {
          register XtPerDisplay xtpd;
  	register PerDisplayTablePtr pd, opd;
! 	XrmDatabase db;
  	int i;
  	
  #ifdef lint
***************
*** 503,516 ****
  	    XtFree((char*)xtpd->pdi.trace);
  	    _XtHeapFree(&xtpd->heap);
  	    _XtFreeWWTable(xtpd);
! 	    def_db = XrmGetDatabase(dpy);
  	    for (i = ScreenCount(dpy); --i >= 0; ) {
  		db = xtpd->per_screen_db[i];
! 		if (db && db != def_db)
  		    XrmDestroyDatabase(db);
  	    }
  	    XtFree((char *)xtpd->per_screen_db);
! 	    XrmDestroyDatabase(def_db);
  	    if (xtpd->cmd_db)
  		XrmDestroyDatabase(xtpd->cmd_db);
  	    if (xtpd->server_db)
--- 504,518 ----
  	    XtFree((char*)xtpd->pdi.trace);
  	    _XtHeapFree(&xtpd->heap);
  	    _XtFreeWWTable(xtpd);
! 	    xtpd->per_screen_db[DefaultScreen(dpy)] = (XrmDatabase)NULL;
  	    for (i = ScreenCount(dpy); --i >= 0; ) {
  		db = xtpd->per_screen_db[i];
! 		if (db)
  		    XrmDestroyDatabase(db);
  	    }
  	    XtFree((char *)xtpd->per_screen_db);
! 	    if (db = XrmGetDatabase(dpy))
! 		XrmDestroyDatabase(db);
  	    if (xtpd->cmd_db)
  		XrmDestroyDatabase(xtpd->cmd_db);
  	    if (xtpd->server_db)
*** /tmp/da01937	Tue May 25 14:50:14 1993
--- mit/lib/Xt/Resources.c	Tue May 25 14:50:13 1993
***************
*** 1,4 ****
! /* $XConsortium: Resources.c,v 1.107 91/06/13 19:03:09 converse Exp $ */
  
  /*LINTLIBRARY*/
  
--- 1,4 ----
! /* $XConsortium: Resources.c,v 1.108 93/05/21 13:57:29 converse Exp $ */
  
  /*LINTLIBRARY*/
  
***************
*** 656,662 ****
  		converted = _XtConvert(widget, from_type, &from_val,
  				       xrm_type, &to_val, cache_ptr);
  		if (converted) {
- 		    char *vp;
  
  		    /* Copy the converted value back into the typed argument.
  		     * normally the data should be <= sizeof(XtArgVal) and
--- 656,661 ----
***************
*** 674,686 ****
  		     */
  
  		    if(rx->xrm_size > sizeof(XtArgVal)) {
! 			arg->value = (XtArgVal)(vp = XtMalloc(rx->xrm_size));
  			arg->size = -(arg->size);
  		    } else { /* will fit - copy directly into value field */
! 			vp = (char *)&arg->value;
  		    }
! 
! 		    XtBCopy((char *)(base - rx->xrm_offset - 1), vp, rx->xrm_size);
  
  		} else {
  		   /* Conversion failed. Get default value. */
--- 673,685 ----
  		     */
  
  		    if(rx->xrm_size > sizeof(XtArgVal)) {
! 			arg->value = (XtArgVal) XtMalloc(rx->xrm_size);
  			arg->size = -(arg->size);
  		    } else { /* will fit - copy directly into value field */
! 			arg->value = (XtArgVal) NULL;
  		    }
! 		    _XtCopyToArg((char *)(base - rx->xrm_offset - 1),
! 				 &arg->value, rx->xrm_size);
  
  		} else {
  		   /* Conversion failed. Get default value. */
*** /tmp/da01959	Tue May 25 14:50:17 1993
--- mit/lib/Xt/Selection.c	Tue May 25 14:50:16 1993
***************
*** 1,4 ****
! /* $XConsortium: Selection.c,v 1.78 93/05/13 11:09:15 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Selection.c,v 1.79 93/05/24 17:50:21 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 1070,1076 ****
      XtRemoveTimeOut(info->timeout); 
  #endif 
      if (length == 0) {
!        unsigned long u_offset = info->offset;
         (*info->callback)(widget, *info->req_closure, &ctx->selection, 
  			  &info->type, 
  			  (info->offset == 0 ? value : info->value), 
--- 1070,1076 ----
      XtRemoveTimeOut(info->timeout); 
  #endif 
      if (length == 0) {
!        unsigned long u_offset = NUMELEM(info->offset, info->format);
         (*info->callback)(widget, *info->req_closure, &ctx->selection, 
  			  &info->type, 
  			  (info->offset == 0 ? value : info->value), 
*** /tmp/da01981	Tue May 25 14:50:20 1993
--- mit/lib/Xt/Shell.c	Tue May 25 14:50:19 1993
***************
*** 1,4 ****
! /* $XConsortium: Shell.c,v 1.129 92/09/15 13:54:28 converse Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
--- 1,4 ----
! /* $XConsortium: Shell.c,v 1.134 93/05/25 10:38:24 kaleb Exp $ */
  
  /***********************************************************
  Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
***************
*** 1575,1582 ****
  	if (request->request_mode & (CWX | CWY))
  	    return(XtGeometryNo);
  
! 	/* %%% worry about XtCWQueryOnly */
! 	my_request.request_mode = 0;
  	if (request->request_mode & CWWidth) {
  	    my_request.width = request->width;
  	    my_request.request_mode |= CWWidth;
--- 1575,1581 ----
  	if (request->request_mode & (CWX | CWY))
  	    return(XtGeometryNo);
  
! 	my_request.request_mode = (request->request_mode & XtCWQueryOnly);
  	if (request->request_mode & CWWidth) {
  	    my_request.width = request->width;
  	    my_request.request_mode |= CWWidth;
***************
*** 1600,1609 ****
  	     * only one of the two) is now the correct child size
  	     */
  	    
! 	    wid->core.width = shell->core.width;
! 	    wid->core.height = shell->core.height;
! 	    if (request->request_mode & CWBorderWidth) {
! 		wid->core.x = wid->core.y = -request->border_width;
  	    }
  	    return XtGeometryYes;
  	} else return XtGeometryNo;
--- 1599,1610 ----
  	     * only one of the two) is now the correct child size
  	     */
  	    
! 	    if (!(request->request_mode & XtCWQueryOnly)) {
! 		wid->core.width = shell->core.width;
! 		wid->core.height = shell->core.height;
! 		if (request->request_mode & CWBorderWidth) {
! 		    wid->core.x = wid->core.y = -request->border_width;
! 		}
  	    }
  	    return XtGeometryYes;
  	} else return XtGeometryNo;
***************
*** 1882,1889 ****
  /* ARGSUSED */
  static Boolean SetValues(old, ref, new, args, num_args)
  	Widget old, ref, new;
! 	ArgList args;		/* unused */
! 	Cardinal *num_args;	/* unused */
  {
  	ShellWidget nw = (ShellWidget) new;
  	ShellWidget ow = (ShellWidget) old;
--- 1883,1890 ----
  /* ARGSUSED */
  static Boolean SetValues(old, ref, new, args, num_args)
  	Widget old, ref, new;
! 	ArgList args;
! 	Cardinal *num_args;
  {
  	ShellWidget nw = (ShellWidget) new;
  	ShellWidget ow = (ShellWidget) old;
***************
*** 1890,1895 ****
--- 1891,1899 ----
  	Mask mask = 0;
  	XSetWindowAttributes attr;
  
+ 	if (!XtIsRealized(new))
+ 	    return False;
+ 
  	if (ow->shell.save_under != nw->shell.save_under) {
  	    mask = CWSaveUnder;
  	    attr.save_under = nw->shell.save_under;
***************
*** 1900,1910 ****
  	    attr.override_redirect = nw->shell.override_redirect;
  	}
  
! 	if (mask && XtIsRealized(new)) {
  	    XChangeWindowAttributes(XtDisplay(new),XtWindow(new), mask, &attr);
  	    if ((mask & CWOverrideRedirect) && !nw->shell.override_redirect)
  		_popup_set_prop(nw);
  	}
  	return FALSE;
  }
  
--- 1904,1927 ----
  	    attr.override_redirect = nw->shell.override_redirect;
  	}
  
! 	if (mask) {
  	    XChangeWindowAttributes(XtDisplay(new),XtWindow(new), mask, &attr);
  	    if ((mask & CWOverrideRedirect) && !nw->shell.override_redirect)
  		_popup_set_prop(nw);
  	}
+ 
+ 	if (! (ow->shell.client_specified & _XtShellPositionValid)) {
+ 	    Cardinal n;
+ 	    void _XtShellGetCoordinates();
+ 
+ 	    for (n = *num_args; n; n--, args++) {
+ 		if (strcmp(XtNx, args->name) == 0) {
+ 		    _XtShellGetCoordinates(ow, &ow->core.x, &ow->core.y);
+ 		} else if (strcmp(XtNy, args->name) == 0) {
+ 		    _XtShellGetCoordinates(ow, &ow->core.x, &ow->core.y);
+ 		}
+ 	    }
+ 	}
  	return FALSE;
  }
  
***************
*** 2125,2131 ****
      Position* y;
  {
      ShellWidget w = (ShellWidget)widget;
!     if (!(w->shell.client_specified & _XtShellPositionValid)) {
  	int tmpx, tmpy;
  	Window tmpchild;
  	(void) XTranslateCoordinates(XtDisplay(w), XtWindow(w), 
--- 2142,2149 ----
      Position* y;
  {
      ShellWidget w = (ShellWidget)widget;
!     if (XtIsRealized(widget) && 
! 	!(w->shell.client_specified & _XtShellPositionValid)) {
  	int tmpx, tmpy;
  	Window tmpchild;
  	(void) XTranslateCoordinates(XtDisplay(w), XtWindow(w), 
***************
*** 2150,2167 ****
      extern void _XtCopyToArg();
  
      /* x and y resource values may be invalid after a shell resize */
!     if (! (w->shell.client_specified & _XtShellPositionValid)) {
  	Cardinal	n;
  	Position	x, y;
  
  	for (n = *num_args; n; n--, args++) {
  	    if (strcmp(XtNx, args->name) == 0) {
! 		 if (! (w->shell.client_specified & _XtShellPositionValid))
! 		     _XtShellGetCoordinates(widget, &x, &y);
  		_XtCopyToArg((char *) &x, &args->value, sizeof(Position));
  	    } else if (strcmp(XtNy, args->name) == 0) {
! 		 if (! (w->shell.client_specified & _XtShellPositionValid))
! 		     _XtShellGetCoordinates(widget, &x, &y);
  		_XtCopyToArg((char *) &y, &args->value, sizeof(Position));
  	    }
  	}
--- 2168,2184 ----
      extern void _XtCopyToArg();
  
      /* x and y resource values may be invalid after a shell resize */
!     if (XtIsRealized(widget) &&
! 	!(w->shell.client_specified & _XtShellPositionValid)) {
  	Cardinal	n;
  	Position	x, y;
  
  	for (n = *num_args; n; n--, args++) {
  	    if (strcmp(XtNx, args->name) == 0) {
! 		_XtShellGetCoordinates(widget, &x, &y);
  		_XtCopyToArg((char *) &x, &args->value, sizeof(Position));
  	    } else if (strcmp(XtNy, args->name) == 0) {
! 		_XtShellGetCoordinates(widget, &x, &y);
  		_XtCopyToArg((char *) &y, &args->value, sizeof(Position));
  	    }
  	}
