Make GNOME Shell able to exit cleanly
This is the mutter side of gnome-shell!1759
While adding the hooks for GNOME Shell to hook into, it also avoids segfaulting and causing memory corruption when terminating.
WIP because it contains the headless backend branch.
Edited by Jonas Ådahl