How to get notification when monitor disconnected?

Hi folks, I have an app that has multiple windows, one of which can be set to fullscreen on a secondary monitor. Is there a way I can get notified when the monitor is disconnected, so that I can automatically reposition the window?

On Windows you would check for WM_DEVICECHANGED but JUCE doesn’t do that (except for audio device notifications). Unless there is some other piece of code I don’t know about.

It could be added fairly easily, not sure about OSX or Linux.

RE:

Ok, thanks. I was just wondering if there was already a Juce way to do it. I’d also need to do it for OSX.

Maybe JUCE has support for this already.

If you look at juce::Desktop there is a way to enumerate the display areas. I would set a breakpoint in Desktop::refresh() and see if it gets triggered when a display device is unplugged.

It looks like Component::parentSizeChanged is called when the component is a top level window and the screen size has changed. So that works. Thanks.