This is in preparation for adding signals. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2416>
Adds a _free() function since the display is reopened multiple times and cleaned up in between. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2416>
Add tests cases for the tests described in https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1550.