multi-screen: ability to wait for configured ouput on display reset events

The new screen selection ability is great, however I encountered several issues with my hardware.

I have media center PC connected to Onkyo 706 Reciever -> Pioneer Plasma TV.

The media center has two Nvidia cards. The first one is older onboard video (GeForce 9400 mGPU) connected to a small LCD display on the case (1024x768). I also have a separate NVidia PCIe card (GT 610), which is connected to receiver and TV.

My X is configured as separate screens. Previously I used export DISPLAY trick to load XBMC on the second X screen, which is my receiver and TV. 

Now it is possible from inside XBMC, but with following issues:
- If I switch off the TV and receiver, XBMC automatically switches back to the small LCD display and saves settings.
- If I switch off TV, or switch on TV the receiver seems to switch HDMI port internally, which causes display reset event and once again XBMC reconfigures and saves small LCD screen as default.
- If both TV and receiver are on, and XBMC is off and receiver is set on a different input (for example PS3), when XBMC switches on and CEC adapter asks receiver to switch to XBMC input, in about 25% of cases this causes a device reset event, and XBMC switches to LCD screen.

I managed to solve the saving of different display by using advancedsettings.xml override. However this only partly solves the problem, as XBMC still switches to LCD until restart.

I attempted to solve this by adding two additional advancedsettings.xml options.

monitorwaitsec - number of seconds to wait for output configured, before trying to switch to a default screen. If set to 0 - will wait indefinitely.
monitorwaitexit - if timeout above passed and configured output was not found, exit XBMC instead of trying to find default screen. This is useful when you have XBMC restarter script in a loop.

I haven't really developed in C++ or for XBMC, so I am not sure how good this fix is. I tried all different combinations and it seems to work, solving all my problems above. Let me know if you want to pull this, or may be you want me to change something?