[comp.windows.x] more uwm patches

jkh@VIOLET.BERKELEY.EDU (Jordan K. Hubbard) (12/15/87)

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# uwm.new.patch1 uwm.new.patch2

echo x - uwm.new.patch1
sed 's/^	//' > "uwm.new.patch1" << '//E*O*F uwm.new.patch1//'
	Date: Mon, 14 Dec 87 14:02 PST
	From: Jordan Hubbard <jkh@violet.berkeley.edu>
	Subject: uwm.new patch #1, portability fix.
	
	DESCRIPTION:
	        FocusChange included time.h conditionally to avoid some
		name conflict braindeath on suns. The problem also exists
		on IBM's, so we look after them too. Note that this patch
		is for the uwm that's currently in beta test. It's not
		an "official" MIT patch, don't apply it to your stock uwm!
	FIX:
	
	*** uwm.new/FocusChange.c	Mon Dec 14 17:17:50 1987
	--- uwm.new/FocusChange.c.new	Mon Dec 14 17:17:11 1987
	***************
	*** 12,18 ****
	  #include "uwm.h"
	  #include "grey.b"
	  
	! #ifdef sun
	  #include <sys/time.h>
	  #else
	  #include <time.h>
	--- 12,18 ----
	  #include "uwm.h"
	  #include "grey.b"
	  
	! #if defined(sun) || defined(ibm032)
	  #include <sys/time.h>
	  #else
	  #include <time.h>
//E*O*F uwm.new.patch1//

echo x - uwm.new.patch2
sed 's/^	//' > "uwm.new.patch2" << '//E*O*F uwm.new.patch2//'
	Date: Mon, 14 Dec 87 14:02 PST
	From: Jordan Hubbard <jkh@violet.berkeley.edu>
	Subject: uwm.new patch #2. Fixes some problems with TitleBold text.
	
	DESCRIPTION:
		Text not centered properly if titlefont and titlebold are radically
		different fonts. This isn't the best possible fix, but it looks
		a lot better. Note that this patch is for the uwm that's currently
		in beta test. It's not an "official" MIT patch, don't apply
		it to your stock uwm.
	FIX:
	
	*** uwm.new/TitleBar.c	Mon Dec 14 17:17:51 1987
	--- uwm.new/TitleBar.c.new	Mon Dec 14 17:17:18 1987
	***************
	*** 42,53 ****
	  			  TFontBoldName);
	  	}
	  	if (!Fheight) {
	! 	     Fheight = TFontInfo->max_bounds.ascent + TFontInfo->max_bounds.descent
	! 		  + (Pad * 2);
	  	     if (TFontBoldInfo) {
	  		  int foo;
	  
	! 		  foo = TFontBoldInfo->max_bounds.ascent + TFontBoldInfo->max_bounds.descent + (Pad * 2);
	  		  if (foo > Fheight)
	  		       Fheight = foo;
	  	     }
	--- 42,54 ----
	  			  TFontBoldName);
	  	}
	  	if (!Fheight) {
	! 	     Fheight = TFontInfo->max_bounds.ascent +
	! 		TFontInfo->max_bounds.descent + (Pad * 2);
	  	     if (TFontBoldInfo) {
	  		  int foo;
	  
	! 		  foo = TFontBoldInfo->max_bounds.ascent +
	! 			TFontBoldInfo->max_bounds.descent + (Pad * 2);
	  		  if (foo > Fheight)
	  		       Fheight = foo;
	  	     }
	***************
	*** 218,228 ****
	--- 219,231 ----
	  	XWindowAttributes xwa;
	  	Window junk, chld;
	  	Bool reversed;
	+ 	XFontStruct *f_info;
	  
	  	XGetWindowAttributes(dpy, t_data->title, &xwa);
	  	XQueryPointer(dpy, t_data->parent, &junk, &chld, &ijunk, &ijunk,
	  	  &ijunk, &ijunk, &ijunk);
	  	reversed = (chld == t_data->subwin);
	+ 	f_info = (reversed ? TFontBoldInfo : TFontInfo);
	  	if (!gc) {
	  		XGCValues gcv;
	  
	***************
	*** 231,237 ****
	  		gcv.background = MTextBackground;
	  		gc = XCreateGC(dpy, t_data->title, (GCFont | GCForeground |
	  						    GCBackground), &gcv);
	! 		/* Now create the gc for reverse video text (if we have no bold font) */
	  		if (TFontBoldInfo == NULL) {
	  			gcv.foreground = MTextBackground;
	  			gcv.background = MTextForground;
	--- 234,243 ----
	  		gcv.background = MTextBackground;
	  		gc = XCreateGC(dpy, t_data->title, (GCFont | GCForeground |
	  						    GCBackground), &gcv);
	! 		/*
	! 		 * Now create the gc for reverse video text (if we have
	! 		 * no bold font)
	! 		 */
	  		if (TFontBoldInfo == NULL) {
	  			gcv.foreground = MTextBackground;
	  			gcv.background = MTextForground;
	***************
	*** 244,252 ****
	  							     GCBackground), &gcv);
	  		}
	  	}
	! 	x = (xwa.width - XTextWidth(TFontInfo, t_data->name,
	  	  strlen(t_data->name))) / 2;
	! 	y = TFontInfo->max_bounds.ascent + Pad;
	  	XClearWindow(dpy, t_data->title);
	  	  XDrawImageString(dpy, t_data->title, (reversed ? rgc : gc), x, y,
	  			   t_data->name, strlen(t_data->name));
	--- 250,259 ----
	  							     GCBackground), &gcv);
	  		}
	  	}
	! 	x = (xwa.width - XTextWidth(f_info, t_data->name,
	  	  strlen(t_data->name))) / 2;
	! 	y = ((f_info->max_bounds.ascent + f_info->max_bounds.descent +
	! 	  xwa.height - 1) / 2) - (Pad * 2);
	  	XClearWindow(dpy, t_data->title);
	  	  XDrawImageString(dpy, t_data->title, (reversed ? rgc : gc), x, y,
	  			   t_data->name, strlen(t_data->name));
//E*O*F uwm.new.patch2//

exit 0