Make a complete different thing:
Get the "JanFX" plugin which allows you to draw on panels. This way you could easily create windows with checkboxes and everything else. Then you have to write something like a little interpreter:
If you click somewhere a "message" is sent and the engine can decide what will happen next. For example the first thing you do is to check, which window was clicked. If it was an inactive one then make it active. Next step is to find out wether you clicked on a control element. Depending on those decisions you draw your "desktop" again. That saves a lot of panels and the problems which come with it.