$NetBSD: patch-ab,v 1.2 2015/04/23 09:17:48 abs Exp $ Remember to always ungrab on exit --- x.c.orig 2006-06-14 05:34:41.000000000 +0200 +++ x.c @@ -173,6 +173,14 @@ int warn_about_hotkey(Display *dpy, XErr */ static Bool mouseOnScreen; +static void atexit_ungrab(void) { + if (grabbed) { + fprintf(stderr, "%s: exit while grabbed, ungrabbing input devices\n", + programName); + ungrabit(-1, -1, DefaultRootWindow(dpy)); + } +} + /* * CreateXWindow. */ @@ -534,6 +542,7 @@ Bool CreateXWindow(void) dumpcoord(&origo2); fprintf(stderr,"offset=%d, %d\n",x_offset,y_offset); */ + atexit(atexit_ungrab); return True; }