Disko comes with its own idea of window management, to keep it simple in aproach and to generate usage
constraints that seem feasible to us. This section deals with the different window types and
how they should be properly used. To follow this part, have a look at the
tutorials/04 folder.
Disko knows 3 types of Windows. RootWindow, MainWindow and PopupWindow. Each type is treated differently within disko. These window types have a fixed Z-order. The management and placement is automatically dealt whith whithin the window manager.

The window stack
The RootWindow ist the lowest type of window. Ontop of this window can reside a MainWindow. The PopupWindow can reside above a RootWindow and/or a MainWindow. There can be only one RootWindow and MainWindow be shown on the screen at the same time. If another RootWindow is to be shown, the current one is removed by the window manager. The same goes for the MainWindow type. Popup window do not displace each other, but the to have only a short lifetime, as they are removed automatically from the screen after a certain timeout is reached.
The RootWindow should be used for one of the applicaitons main functions. In a mediacenter application there are some functions that make very little sense to be used together. Watching TV and listening to some music at the same time would not go very well together. Using RootWindows Would at least ensure that you can't see both functions at the same time. The plaback though has to be "manually" stopped on window removal.
The MainWindow is used when a main function could be safely combined whith some extra functionality. Looking at the mediacenter application again, this could be reading the the weather report during a commercial while watching tv. You would expect, that this could be done while TV is running. The mainwindow would be placed above the "TV" - Rootwindow, and would be removed on the users demand, or when another "extra" function is called, like the stock market news.
The PopUpWindow is used when an information is presented to the user. That could be the notification that a new email arrived, or an alert that a specific TV-show or whatever occured. This information is only lived, as the PopUpWindow is. It will close on users demand, or when its defined timeout is reached.
To see this window management in action, You can have a look at Morphine.TV, which is a mediacenter applicaiton built ontop of disko.
Sub-Windows are windows that reside whithin other windows. The could be a part of a RootWindow as well as MainWindow. Even in PopUpWindows, allthough questionable, this window could be used. Subwindows offer a free placement whithout z-Order. The are best used when there is a need of replacing a widget on the screen by another one. An Example could be a playlist that is replaced by a visualization during music playback.

Subwindows
The window placement is normally definend in a dialog XML - file, but could be set at runtime as well. Each window must be individually shown by the program, to decide which window should be shown in case that they should be used at the same spot.
In this exampe we will load and show 3 windows. 2 of them are root windows, which will displace each other when they are shown.
As we do not use some of the other disko facilities mmsInit() is still to be used to just initialize the window manager.
mmsInit(MMSINIT_WINDOWMANAGER, argc, argv,"./diskorc.xml");
We are using 3 DialogManager objects to handle the different windows.
MMSDialogManager dm;
MMSDialogManager dm2;
MMSDialogManager dm3;
/* create a root window */
MMSWindow *window = dm.loadDialog("./root.xml");
MMSWindow *window2 = dm2.loadDialog("./main.xml");
MMSWindow *window3 = dm3.loadDialog("./root2.xml");
window->show();
sleep(2);
window2->show();
sleep(2);
window3->show();If everything went well, You will see a gray picture. After 2 seconds a window should fade in. Another 2 seconds later the gray picture should be replaced by a blue one.

The resulting window should look like this