xscreenshot

screen capture tool (mirror)
git clone git://git.2f30.org/xscreenshot
Log | Files | Refs | README | LICENSE

commit 540d4dc0fb64b33d5f8050cc80affe513c37199e
parent 1cf03c53b280d3fe21dac843504dd54e9b64e4b6
Author: sin <sin@2f30.org>
Date:   Mon, 28 Jul 2014 12:46:00 +0100

Ungrab X as quickly as possible and close display

Avoids deadlock when trying to output to stdout but the terminal
can't process any events because of the grabbed X.

Diffstat:
Mxscreenshot.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xscreenshot.c b/xscreenshot.c @@ -119,15 +119,14 @@ main(int argc, char *argv[]) XGrabServer(dpy); XGetWindowAttributes(dpy, win, &attr); - img = XGetImage(dpy, win, 0, 0, attr.width, attr.height, 0xffffffff, ZPixmap); + XUngrabServer(dpy); + XCloseDisplay(dpy); if(!img) die("Can't XGetImage"); pngstdout(img); XDestroyImage(img); - XUngrabServer(dpy); - XCloseDisplay(dpy); return EXIT_SUCCESS; }