Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!snorkelwacker!bloom-beacon!NAC.NO!rune.johansen%odin.re.nta.uninett From: rune.johansen%odin.re.nta.uninett@NAC.NO (Rune Henning Johansen) Newsgroups: comp.windows.x Subject: Re: Please show me some applications by "XPM" utility. Message-ID: <1840*rune.johansen@odin.re.nta.uninett> Date: 9 Aug 90 07:33:15 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 67 > From: urushima@secom.co.jp (Kenji Urushima) > Newsgroups: comp.windows.x > So, I'm trying to make a application program which > shows XPM file on display, but this doesn't work. > > Something wrong with this program ? Try the version below! - Rune. --------------- cut here ------------ xshowpixmap.c ------------------------- #include #include #include #include #include "xpm.h" void main(argc, argv) int argc; char **argv; { Widget toplevel, w; Arg args[10]; Display *display; Window root; int screen; Pixmap iconPixmap; unsigned int iconWidth, iconHeight; toplevel = XtInitialize(NULL, "Bitmap", NULL, 0, &argc, argv); if( argc != 2) { (void)fprintf(stderr, "Usage: %s bitmap_file\n", argv[0]); exit(1); } display = XtDisplay(toplevel); screen = DefaultScreen(display); root = RootWindow(display, screen); if (XReadPixmapFile(display,root, XDefaultColormap(display,screen), argv[1], &iconWidth, &iconHeight, XDefaultDepth(display,screen), &iconPixmap)) { (void)fprintf(stderr, "%s: unable to read Pixmap... [ %s ]\n", argv[0], argv[1]); exit(1); } XtSetArg( args[0], XtNbackgroundPixmap, iconPixmap ); XtSetArg( args[1], XtNwidth, iconWidth ); XtSetArg( args[2], XtNheight, iconHeight ); (void)XtCreateManagedWidget(argv[0], widgetClass, toplevel, args, 3); XtRealizeWidget(toplevel); XtMainLoop(); }