Adding or removing a monitor in fullscreen mode on our 10.13.3 machine results in completely black screens. It is possible to recover by pressing "F8, down, Enter", so apparently vncviewer still runs.
The problem has been verified with ThinLinc client build 5702, as well as my manual vncviewer build of upstream TigerVNC (including patches for bug 7007).
I think it makes sense to try fixing bug 6116 and see if that improves things.
This problem only happens when using "Send system keys", ie keyboard grabbing. Also, in our lab, it only happens on the 10.13 machine; not on 10.6.
I've tried various methods to detect if a screen has been connected or disconnected, without success. The number of screens stays the same (CGGetActiveDisplayList). The window "level" is the same. No interesting events delivered, as far as I can tell.
Tested on 10.12.4:
The screen does not turn black. However, the client is not notified of the screen change (not even with patches; FL_SCREEN_CONFIGURATION_CHANGED is not generated). This means:
* If a second monitor is removed, the ThinLinc session will continue to think that there are two monitors.
* If a second monitor is added, macOS will not even start using it, until fullscreen mode is exited. (The monitor blinks in power save mode.)
(Apparently, when in fullscreen mode and using captured displays, everything is "locked". I even checked with "system_profiler SPDisplaysDataType": The output shows that the second monitor is online, even after pulling the connector. It is not until fullscreen mode is exited that the data is updated.)
We could explore using an alternative method of grabbing the keyboard. See bug 4660 for one such method.
*** Bug 7248 has been marked as a duplicate of this bug. ***