[comp.windows.x] Using a bitmap with the Athena Widget Label Class.

moss@brl.mil (Gary S. Moss (VLD/VMB) <moss>) (04/13/90)

Hi there.

I have run into a problem with the Athena Widgets in the Label Class,
specifically the Toggle, Command or Label widgets.  When I attempt
to either create a widget with a bitmap resource, or call XtSetValues
with an existing widget to set the bitmap resource, I get:

X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)
  Major opcode of failed request:  14 (X_GetGeometry)
  Minor opcode of failed request:  0
  Resource id in failed request:  0x40318
  Serial number of failed request:  13
  Current serial number in output stream:  13

I am using R4 on a Sun 3/80 running SunOS 4.0.3.
I have boiled things down to a simple test case, would someone please
take a look and tell me if I am doing anything obviously wrong, or if
this is a known bug; I am very new at this, but it seems straightforward
enough.

Thanks very much,
Gary Moss

moss@brl.mil
301 278-6651
/*----------------------------- bug.c ------------------------------------*/
#include <stdio.h>
#include <X11/Intrinsic.h>	/* MIT Athena Widget headers */
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <X11/Xaw/Toggle.h>

int
main( argc, argv )
int argc;
char *argv[];
	{	XtAppContext apcon;
		Cardinal n;
		Widget toplevel, toggle;
		Arg args[20]; /* An arg list for XtSetArg(), etc. */
		Display *display;
	XtToolkitInitialize();	/* initialize toolkit */
	apcon = XtCreateApplicationContext();
	display = XtOpenDisplay( apcon, "", "bug", "Bug",
			NULL, 0, &argc, argv );
	n = 0;
	XtSetArg( args[n], XtNiconName, "Presented Area" );
	n++;
	toplevel = XtAppCreateShell( "bug", "Bug",
			applicationShellWidgetClass,
			display, args, n );
	n = 0;
#ifndef WONTWORK
#define WONTWORK 1
#endif
#if WONTWORK
	XtSetArg( args[n], XtNbitmap, "./off.icon" );
	n++;
#endif
	toggle = XtCreateManagedWidget( "Toggle", toggleWidgetClass,
			toplevel, args, n );
	(void) fprintf( stderr, "Toggle widget created.\n" );
	XtRealizeWidget( toplevel );
	XtAppMainLoop( apcon );
	/*NOTREACHED*/
	}
/*-------------------------------- off.icon ------------------------------*/
#define off_width 32
#define off_height 32
static char off_bits[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0x07, 0x00, 0xc0, 0x55, 0x0d, 0x00, 0xc0, 0x00, 0x08, 0x00,
   0x40, 0xdd, 0x16, 0x00, 0xc0, 0xd4, 0x16, 0x00, 0x40, 0x5d, 0x22, 0x00,
   0xc0, 0x00, 0x20, 0x00, 0x40, 0xff, 0x7f, 0x00, 0xc0, 0x00, 0x40, 0x00,
   0x40, 0x01, 0x80, 0x00, 0x80, 0x02, 0x00, 0x01, 0x80, 0x05, 0x00, 0x02,
   0x80, 0x0a, 0x00, 0x04, 0x80, 0x15, 0x00, 0x08, 0x00, 0xab, 0xaa, 0x1a,
   0x00, 0x55, 0x55, 0x15, 0x00, 0xeb, 0xff, 0x1f, 0x00, 0xf5, 0xff, 0x0f,
   0x00, 0xea, 0xff, 0x0f, 0x00, 0xf6, 0xff, 0x07, 0x00, 0xfa, 0xff, 0x07,
   0x00, 0xf4, 0xff, 0x03, 0x00, 0xfc, 0xff, 0x03, 0x00, 0xf4, 0xff, 0x01,
   0x00, 0xfc, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xf8, 0x7f, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};