debian/changelog | 8 +++ debian/patches/05_xprop_spy_exit_on_destroy.diff | 50 +++++++++++++++++++++++ debian/patches/series | 1 3 files changed, 59 insertions(+)
New commits: commit 604903e460af8e7c1ebc40d4e7e04f9b45341f63 Author: Ben Hutchings <b...@decadent.org.uk> Date: Sun Jan 4 12:27:25 2009 +0100 Make xprop -spy exit cleanly when target window is destroyed diff --git a/debian/changelog b/debian/changelog index 0703da6..bd0bd32 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +x11-utils (7.3+2+nmu1) unstable; urgency=low + + * Non-maintainer upload. + * Make xprop -spy exit cleanly when target window is destroyed + (closes: #508126) + + -- Ben Hutchings <b...@decadent.org.uk> Sat, 03 Jan 2009 22:22:40 +0000 + x11-utils (7.3+2) unstable; urgency=low * Relax Replaces on xutils and xbase-clients to allow further updates. diff --git a/debian/patches/05_xprop_spy_exit_on_destroy.diff b/debian/patches/05_xprop_spy_exit_on_destroy.diff new file mode 100644 index 0000000..69a2721 --- /dev/null +++ b/debian/patches/05_xprop_spy_exit_on_destroy.diff @@ -0,0 +1,50 @@ +This patch by Ben Hutchings <b...@decadent.org.uk>. + +xprop -spy should exit cleanly when the target window is destroyed. +The current behaviour is that it sometimes dies with a BadWindow error +and sometimes hangs around after the target has been destroyed. + +We fix this by listening for destroy events but also catching +BadWindow errors (and BadMatch, which may sometimes be received +instead of BadWindow). We print a new-line before exiting from the +error handler, since we may have generated partial output for a +property change. + +--- x11-utils.orig/xprop/xprop.c ++++ x11-utils/xprop/xprop.c +@@ -1596,6 +1596,19 @@ + + static int spy = 0; + ++static int (*old_error_handler)(Display *dpy, XErrorEvent *ev); ++ ++static int spy_error_handler(Display *dpy, XErrorEvent *ev) ++{ ++ if (ev->error_code == BadWindow || ev->error_code == BadMatch) { ++ /* Window was destroyed */ ++ puts(""); ++ exit(0); ++ } ++ ++ return old_error_handler(dpy, ev); ++} ++ + int + main (int argc, char **argv) + { +@@ -1738,9 +1750,14 @@ + XEvent event; + const char *format, *dformat; + +- XSelectInput(dpy, target_win, PropertyChangeMask); ++ XSelectInput(dpy, target_win, PropertyChangeMask | StructureNotifyMask); ++ old_error_handler = XSetErrorHandler(spy_error_handler); + for (;;) { + XNextEvent(dpy, &event); ++ if (event.type == DestroyNotify) ++ break; ++ if (event.type != PropertyNotify) ++ continue; + format = dformat = NULL; + if (props) { + int i; diff --git a/debian/patches/series b/debian/patches/series index c8dec57..24a51a9 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ 02_xev_flush_standard_output.diff 04_xlsfonts_do_not_spew_usage_on_connection_error.diff -p0 +05_xprop_spy_exit_on_destroy.diff -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org