Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!pt.cs.cmu.edu!cs.cmu.edu!moore From: moore@cs.cmu.edu (Dale Moore) Newsgroups: comp.windows.x Subject: XtSetKeyboardFocus Keywords: XtSetKeyboardFocus, X11R4-beta Message-ID: <7898@pt.cs.cmu.edu> Date: 8 Feb 90 20:34:11 GMT Organization: Carnegie-Mellon University, CS/RI Lines: 84 I'm not real familiar with the protocol on this particular newsgroup, so please be patient with me if I do something anti-social. I suspect I've found a problem with XtSetKeyboardFocus. Under certain situations it is possible to cause a protocol error by calling this routine. If the subtree widget is not yet realized, we end up passing 0 as the window to the XQueryPointer routine, which of course doesn't work. This bug appears to be present in the X11-R4beta release. Below is a program that should cause the error. Am I halucinating? Or is it really a bug? Does anyone care? Does anyone want a fix? Does anyone have a fix? ---------------- #include #include #include #include #include char dialog_string[100]; static void button_callback (w, client_addr, client_data) Widget w; XtPointer client_addr; XtPointer client_data; { Widget dialog; Arg args[10]; Cardinal num; num = 0; XtSetArg (args[num], XtNlabel, "dialog"); num++; XtSetArg (args[num], XtNvalue, dialog_string); num++; /* This program will have an error when this widget is created */ dialog = XtCreateWidget ( "dialog", dialogWidgetClass, XtParent (w), args, num); XtRealizeWidget (dialog); XtMapWidget (dialog); } main(argc, argv) int argc; char *argv[]; { XtAppContext app_context; Widget top; Widget box; Widget button; top = XtAppInitialize ( &app_context, /* app_context */ "foo", /* class */ NULL, /* options */ 0, /* num_options */ &argc, /* argc */ argv, /* argv */ NULL, /* fallback resources */ NULL, /* args */ 0); /* num_args */ box = XtCreateManagedWidget ("box", boxWidgetClass, top, NULL, 0); button = XtCreateManagedWidget ("go", commandWidgetClass, box, NULL, 0); XtAddCallback (button, XtNcallback, button_callback, 0); XtRealizeWidget (top); XtAppMainLoop (app_context); }