I am using "xev" to monitor a program running under X. I use:...
xev -id 0xNNNNNNNN -event mouse -event keyboard
It all works fine, except for one thing. If the window (program)
exits, the xev process continues running. I would like for xev to
exit if/when the program/window it is monitoring goes away.
So, first, I'd like to know if there is some easy way to make this
work. I.e., to make "xev" exit when the window goes away.
Failing that, I'd like to know what to put as the "event mask" to make
it catch the "DestroyNotify" event.
Failing that, I'd like to know what to put as the "event mask" to make
it catch the "DestroyNotify" event.
It looks like "-event structure" (or, if that doesn't work, then try
"-event substructure") would catch DestroyNotify events when
the window is destroyed, but I haven't tried it.
Failing that, I'd like to know what to put as the "event mask" to make
it catch the "DestroyNotify" event.
It looks like "-event structure" (or, if that doesn't work, then try >>"-event substructure") would catch DestroyNotify events when
the window is destroyed, but I haven't tried it.
Thank you! It looks like either one (structure or substructure) works,
with the later (substructure) preferable, since it generates less noise (extraneous events) while still delivering the DestroyNotify event.
So, that's good. Thanks again.
So now I just have to change my program so that xev exits (i.e, is killed) when it sees the DestroyNotify event.
P.S. How did you figure this out (if other than by trial and error)?
"man xev" lists the event masks, but gives no info as to what they actually mean.
gazelle@shell.xmission.com (Kenny McCormack) writes:
P.S. How did you figure this out (if other than by trial and error)?
"man xev" lists the event masks, but gives no info as to what they
actually mean.
I'll add that:
* I've written X11 code, so verifying before I posted the reply didn't
take long, but I took your question to mean how can one figure that
out; and
* the last sentence in the paragraph describing -event in the xev man
page could use a bunch of commas and a period. :-/ :)
-WBE
Initially, by looking at X.h and Xproto.h for clues, which didn't help
much, and then by what used to be called "apropos":
# man -k DestroyNotify
XDestroyWindowEvent(3) - DestroyNotify event structure
# man XDestroyWindowEvent
P.S. How did you figure this out (if other than by trial and error)?
"man xev" lists the event masks, but gives no info as to what they
actually mean.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 349 |
Nodes: | 16 (0 / 16) |
Uptime: | 141:36:34 |
Calls: | 7,613 |
Calls today: | 1 |
Files: | 12,789 |
Messages: | 5,684,402 |