[comp.windows.x] Icon bitmap for

krish@orca.WV.TEK.COM (Shelley Gallaher) (05/12/89)

	I have modified (X11) xterm to display bitmap for icons.  You have to
	change only main.c file.  

	The syntax is similar to X10 xterm, except that instead of 
	"-ib", I have used "-xb" (xterm bitmap).

	"xterm -iconic -xb bitmap_filename"  would invoke xterm as an icon
	using specified file as icon bitmap.  Note that bitmap_filename should
	include the path also.

	Good bye labels, hello bitmap icons.

-- Suresh

--------------------------------------------------------------------------------
Suresh Krishnamurthy			Net: krish@gray.WV.TEK.COM
Hinditron International Inc,		ARPA: krish%gray.WV.TEK.COM@RELAY.CS.NET
(Work) (503)-685-2973			UUCP: gray.WV.TEK.COM!krish@uunet.UU.NET
--------------------------------------------------------------------------------

	Here are the diffs for main.c in R3.


----------------------  beginning of main.c (R3) diff -------------------------
246a247,248
 #define	MAKE_ICON		/* I think this should be defined in Makefile */
 
251a254,256
 #ifdef  MAKE_ICON
     char *iconfile;
 #endif  MAKE_ICON
276a282,285
 #ifdef  MAKE_ICON
     {"iconFile", "IconFile", XtRString, sizeof(char *),
         offset(iconfile), XtRString, (caddr_t) NULL},
 #endif  MAKE_ICON
340a350,352
 #ifdef  MAKE_ICON
 {"-xb",         "*iconFile",    XrmoptionSepArg,        (caddr_t) NULL},
 #endif  MAKE_ICON
1085a1098,1100
 #ifdef  MAKE_ICON
         Pixmap  xtermPixmap;
 #endif  MAKE_ICON
1245c1260,1262
 
---
 #ifdef  MAKE_ICON
         MakeCuteIcon( resource.iconfile );	/* Set icon pixmap */
 #endif  MAKE_ICON
2275a2293,2325
 
 #ifdef  MAKE_ICON
 
 MakeCuteIcon( icon_filename )
 	char    *icon_filename;
 {
 	int     junk;
 	Pixmap  xtermPixmap;
 	XWMHints  wmhints, *hints;
 
 	if (!strlen(icon_filename))             /* if no icon file specified */
 		return;
 
 	XReadBitmapFile( XtDisplay(XtParent(term)),
 		XtWindow(XtParent(term)), icon_filename,
 		&junk, &junk, &xtermPixmap, &junk, &junk );
 /*
  *	Get WMHints and save initial_state and position, otherwise 
  *	iconic option and icon position may not work properly.
  */
 	hints = XGetWMHints( XtDisplay(XtParent(term)),
 			     XtWindow(XtParent(term)) );
 	wmhints.flags = InputHint | StateHint | IconPixmapHint | IconPositionHint;
 	wmhints.initial_state = hints->initial_state; /* take care of iconic */
 	wmhints.input = hints->input;
 	wmhints.icon_pixmap = xtermPixmap;
 	wmhints.icon_x = hints->icon_x;         /* restore icon position */
 	wmhints.icon_y = hints->icon_y;
 	XSetWMHints( XtDisplay(XtParent(term)),
 		     XtWindow(XtParent(term)), &wmhints);
 }
 #endif  MAKE_ICON
 
----------------------  end of main.c (R3) diff -------------------------