po@cs.utexas.edu (Po Ling Cheung) (12/16/88)
I posted an article earlier about problems with XtNbitmap but
got no response.
Here is another version of my program that doesn't work.
The error message and stack frames are also shown below.
I have no idea what's wrong with it.
Would someone please test run the program and see if it displays
the xlogo ? If not? Why not?
--------------------------------------------------------------------------------
#include <X11/Intrinsic.h>
#include <X11/Label.h>
#include <X11/bitmaps/xlogo16>
void main(argc, argv)
int argc;
char **argv;
{
Widget toplevel, xlogo;
Arg args[10];
toplevel = XtInitialize( NULL, "DEmo", NULL, 0, &argc, argv);
xlogo = XtCreateManagedWidget("xlogo", labelWidgetClass, toplevel, NULL, 0);
XtSetArg(args[0], XtNbitmap, XCreateBitmapFromData (XtDisplay(xlogo),
XtWindow(xlogo), xlogo16_bits, xlogo16_width, xlogo16_height));
XtSetValues(xlogo, args, 1);
XtRealizeWidget(toplevel);
XtMainLoop();
}
--------------------------------------------------------------------------------
/* Run-time error
X Protocol error: BadDrawable, invalid Pixmap or Window parameter
Major opcode of failed request: 53 (X_CreatePixmap)
Minor opcode of failed request: 0
Resource id in failed request: 0x0
Serial number of failed request: 14
Current serial number in output stream: 18
*/
/* debugger info
(dbx) where
exit(0x1) at 0x25871
_XDefaultError(0x3e804, 0x7fffd9a8) at 0x1b394
_XError(0x3e804, 0x7fffda24) at 0x1b126
_XReply(0x3e804, 0x7fffda24, 0x0, 0x1) at 0x1aa33
XGetGeometry(0x3e804, 0x600006, 0x7fffdaa0, 0x7fffda9c, 0x7fffda98, 0x7fffda94,
0x7fffda90, 0x7fffda8c, 0x7fffda88) at 0x1466c
SetTextWidthAndHeight(0x3f304) at 0x156
Label.SetValues(0x7fffde48, 0x7fffdc54, 0x3f304) at 0x7cd
CallSetValues(0x25d80, 0x7fffde48, 0x7fffdc54, 0x3f304, 0x7fffe06c, 0x1) at 0x8c
ca
XtSetValues(0x3f304, 0x7fffe06c, 0x1) at 0x8f62
main(argc = 1, argv = 0x7fffe0ec, 0x7fffe0f4), line 17 in "xlogo2.c"
*/
Thank you!
Po (po@cs.utexas.edu)
rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (12/20/88)
xlogo = XtCreateManagedWidget("xlogo", labelWidgetClass, toplevel, NULL,0); XtSetArg(args[0], XtNbitmap, XCreateBitmapFromData (XtDisplay(xlogo), XtWindow(xlogo), xlogo16_bits, xlogo16_width, xlogo16_height)); The problem is that XtWindow(xlogo) returns 0, not a valid window id. X widget doesn't get a window until it's realized. The simplest thing is to instead use the root window of the screen.