[comp.windows.x] Novice needs help

gsh7w@astsun9.astro.Virginia.EDU (Greg S. Hennessy) (08/26/90)

I have been working with a program which is basically to display an
image created by another program. When I iconify the first program, a
few seconds later it dies with:

X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  42 (X_SetInputFocus)
  Minor opcode of failed request:  0
  Resource id in failed request:  0xe00002
  Serial number of failed request:  59
  Current serial number in output stream:  60

I have the source, but I am a novice with X-windows. Can anyone give
me some advice as to what may be going wrong? Or at least a hint to
which FM I should read?

Sincerely
--
-Greg Hennessy, University of Virginia
 USPS Mail:     Astronomy Department, Charlottesville, VA 22903-2475 USA
 Internet:      gsh7w@virginia.edu  
 UUCP:		...!uunet!virginia!gsh7w

mouse@LARRY.MCRCIM.MCGILL.EDU (08/26/90)

> I have been working with a program which is basically to display an
> image created by another program.  When I iconify the first program,
> a few seconds later it dies with:

> X Error of failed request:  BadMatch (invalid parameter attributes)
>   Major opcode of failed request:  42 (X_SetInputFocus)
>   Minor opcode of failed request:  0
>   Resource id in failed request:  0xe00002
>   Serial number of failed request:  59
>   Current serial number in output stream:  60

> I have the source, but I am a novice with X-windows.  Can anyone give
> me some advice as to what may be going wrong?  Or at least a hint to
> which FM I should read?

I would guess that the program does not realize it has been iconified
and is trying to grab the keyboard focus and set it to one of its
windows - but the window in question is not viewable because it or one
of its ancestors has been unmapped by the window manager as part of the
iconification process.  Check with xlswins before doing the iconify and
see if the "Resource id in failed request" isn't one of the program's
windows.

Also, does it by any chance die as soon as you move the mouse onto
something related to it (like its icon, or its slot in twm's icon
manager)?  It may be getting an EnterNotify or FocusIn event and
misunderstanding (and mishandling) it.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

klee@wsl.dec.com (Ken Lee) (08/29/90)

In article <1990Aug25.215821.25317@murdoch.acc.Virginia.EDU>,
gsh7w@astsun9.astro.Virginia.EDU (Greg S. Hennessy) writes:
|> X Error of failed request:  BadMatch (invalid parameter attributes)
|>   Major opcode of failed request:  42 (X_SetInputFocus)
|>   Minor opcode of failed request:  0
|>   Resource id in failed request:  0xe00002
|>   Serial number of failed request:  59
|>   Current serial number in output stream:  60
|> 
|> I have the source, but I am a novice with X-windows. Can anyone give
|> me some advice as to what may be going wrong? Or at least a hint to
|> which FM I should read?


The simplest way to debug an X protocol error like this is to:

1.  look in the appendix of the Xlib manual to see which Xlib functions
generate this protocol request

2.  read the description of those functions in the Xlib manual

In this case, only XSetInputFocus generates the SetInputFocus request.
The Xlib manual says that a BadMatch error happens if the window ID in
the XSetInputFocus call is not viewable.

If you want to get fancier about error handling, see the chapter in the
Xlib manual on errors.  You may want to include an error handler in
your program or debug it by enabling synchronization.

Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee