Fix signal handling to avoid deadlocks

Signal handling is a delicate issue. As signals can appear anywhere throughout the life of a program, they may interrupt anything, even `malloc` or `pthread_mutex_lock`. Therefore a signal handler should not do too much as this may result in inconsistent state or deadlocks.

The latter is the case for issue #188, where a reply-sending of Xlib is interrupted and the signal handler asks again for a reply. This breaks assumptions in the Xlib-code.

In this pull-request, the standard Unix-way of handling signals is replaced by a wrapper provided by GLib. This feeds the signal event into the normal main-loop, thus mitigating the issues above. [Documentation](https://developer.gnome.org/glib/2.36/glib-UNIX-specific-utilities-and-integration.html)

**Drawbacks**: 
* Possible small delays in handling signals (the event is only noted in the next iteration of the mainloop)
* This requires the rather recent GLib-version 2.36

This fixes issue #188, and possible others too.