Title: | DECWINDOWS 26-JAN-89 to 29-NOV-90 |
Notice: | See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit |
Moderator: | STAR::VATNE |
Created: | Mon Oct 30 1989 |
Last Modified: | Mon Dec 31 1990 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 3726 |
Total number of notes: | 19516 |
My application (in response to a button on a pull-down menu) brings up a modal file-selection widget. When this is first created, it is read from the UID file, so this takes a few seconds. If during this time, I iconize my shell window, de-iconize it, and iconize it again, then when the file-selection widget appears, I see only the widget outline (no text) and I get an X-error signalled from the server: X error event received from server: BadMatch - parameter mismatch Failed request major op code 42 (S_SetInputFocus) Failed request minor op code 0 (if applicable) ResourceId 0x80004f in failed request (if applicable) Serial number of failed request 1207 Current serial number in output stream 1208 Any ideas as to what's wrong? Is this likely to be a bug in my program, or in the toolkit? John
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
1880.1 | ASTs disabled, too | ULTRA::WRAY | John Wray, Secure Systems Development | Mon Dec 11 1989 15:08 | 5 |
Also, when this condition is signalled (on VMS), user-mode ASTs are disabled. This means that my condition-handler has to be very carefully coded to avoid a deadlock. In particular, I can't do any Ada I/O in the condition-handler without locking up the program. | |||||
1880.2 | GOSOX::RYAN | DECwindows Mail | Tue Dec 12 1989 07:55 | 10 | |
Nothing to do with AST's - you can't set input focus to an iconified window. Your file-selection widget must be parented to your shell, and been iconified at the time it was mapped and the attempt was made to set focus to it. The best way to avoid this is to set focus in an event handler for the MapNotify event, but even that's no guarantee - you should also set up an X error handler which will ignore BadMatch errors on X_SetInputFocus. Mike | |||||
1880.3 | Call VtkSetErrorHandler before XtMainLoop and you're off | DECWIN::KLEIN | Tue Dec 12 1989 12:37 | 99 | |
/* vtkerrorhandler.c ***************************************************************************** * * * COPYRIGHT (c) 1989 BY * * DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS. * * ALL RIGHTS RESERVED. * * * * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * * ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE * * INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER * * COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY * * OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * * TRANSFERRED. * * * * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * * AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * * CORPORATION. * * * * DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * * SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. * * * ***************************************************************************** FACILITY: FileView ENVIRONMENT: DECwindows AUTHORS: Steve Klein This module contains the replacement XLib error handler for FileView. MODIFICATION HISTORY: 16-May-1989 (sjk) Remove call to lib$signal, since it adds no information. 15-May-1989 (sjk) Initial entry. */ #include "stdio.h" #include "decw$xlibmsg.h" #include "MrmAppl.h" #include "XProto.h" #define BUFSIZ 256 static void ErrorHandler(dpy, event) Display *dpy; XErrorEvent *event; { char bufA[BUFSIZ]; char msgA[BUFSIZ]; char numberA[32]; char *mtype = "XlibMessage"; /* Ignore soft errors. */ if ( /* Attempted to assign input focus to a window, but that window was * iconified at the time the server processed the request. */ ((event->error_code == BadMatch) && (event->request_code == X_SetInputFocus)) || /* Attempted to select for ButtonPress on the root window, but * another application already has selected for it. */ ((event->error_code == BadAccess) && (event->request_code == X_ChangeWindowAttributes))) return; XGetErrorText (dpy, event->error_code, bufA, BUFSIZ); XGetErrorDatabaseText (dpy, mtype, "XError", "X Error", msgA, BUFSIZ); fprintf (stderr, "%s: %s\n ", msgA, bufA); XGetErrorDatabaseText (dpy, mtype, "MajorCode", "Request Major code %d", msgA, BUFSIZ); fprintf (stderr, msgA, event->request_code); sprintf (numberA, "%d", event->request_code); XGetErrorDatabaseText (dpy, "XRequest", numberA, "", bufA, BUFSIZ); fprintf (stderr, " (%s)", bufA); fputs ("\n ", stderr); XGetErrorDatabaseText (dpy, mtype, "MinorCode", "Request Minor code", msgA, BUFSIZ); fprintf (stderr, msgA, event->minor_code); fputs ("\n ", stderr); XGetErrorDatabaseText (dpy, mtype, "ResourceID", "ResourceID 0x%x", msgA, BUFSIZ); fprintf (stderr, msgA, event->resourceid); fputs ("\n ", stderr); XGetErrorDatabaseText (dpy, mtype, "ErrorSerial", "Error Serial #%d", msgA, BUFSIZ); fprintf (stderr, msgA, event->serial); fputs ("\n ", stderr); XGetErrorDatabaseText (dpy, mtype, "CurrentSerial", "Current Serial #%d", msgA, BUFSIZ); fprintf (stderr, msgA, dpy->request); fputs ("\n", stderr); } void VtkSetErrorHandler() { XSetErrorHandler (ErrorHandler); } | |||||
1880.4 | ULTRA::WRAY | John Wray, Secure Systems Development | Tue Dec 12 1989 14:25 | 20 | |
Re .-1 > Nothing to do with AST's No, I wasn't suggesting that the problem had anything to do with ASTs. However, when the error is raised, user-mode ASTs are disabled, which seems like bad practice, since it makes writing a generic condition-handler for an application difficult. > The best way to > avoid this is to set focus in an event handler for the > MapNotify event, but even that's no guarantee - you should also > set up an X error handler which will ignore BadMatch errors > on X_SetInputFocus. If this is required, shouldn't the file-selection widget do it itself? After all, it's the widget (not my code) that is doing the SetInputFocus. Probably all modal widgets ought to be prepared for this possibility. John | |||||
1880.5 | GOSOX::RYAN | DECwindows Mail | Wed Dec 13 1989 08:45 | 4 | |
An X error handler is global to your application - you really don't want widgets taking it upon themselves to set up error handlers. Mike | |||||
1880.6 | ULTRA::WRAY | John Wray, Secure Systems Development | Wed Dec 13 1989 08:53 | 12 | |
> An X error handler is global to your application - you really don't > want widgets taking it upon themselves to set up error handlers. True. This is probably a deficiency in the toolkit itself, in that error-handling requirements typically aren't global to the application, so the toolkit ought to provide some local (either stack-based or widget-based) error-handling functionality. In this particular case, though, the preferred solution would be for the widget to avoid raising the error in the first place. Is it really that difficult for it to check whether it is iconized before it tries to SetFocus? | |||||
1880.7 | Can't check | DECWIN::KLEIN | Wed Dec 13 1989 13:16 | 13 | |
>> In this particular case, though, the preferred solution would be for >> the widget to avoid raising the error in the first place. Is it really >> that difficult for it to check whether it is iconized before it tries >> to SetFocus? Actually, it is impossible. Because of the asynchronous window manager activity, a check may say "Yes, you're mapped", and by the time the XSetFocus call is received by the server, the window manager has iconified the window. I don't see any way around using an error handler. -steve | |||||
1880.8 | Nothing is impossible in software! | SMURF::JJG | Jeff Glass | Wed Dec 27 1989 13:58 | 13 |
> Actually, it is impossible. Because of the asynchronous window manager > activity, a check may say "Yes, you're mapped", and by the time the > XSetFocus call is received by the server, the window manager has iconified > the window. The widget could grab the server, check whether it is mapped, and only if it is, set the input focus, and then ungrab the server. Voila--no async window manager activity. /jeff Whether it's a good idea for clients to go around grabbing the server is another question... |