Child window behaviour for desktop windows possible?


#1

Hello :slight_smile:

I’d like to make some desktop windows behave like childs of another desktop window and can’t seem to find a solution.

for example:

i have 3 windows on the desktop
main, child1, child2

what i would like to achive is that if i click on the ‘main’ window, it will also bring ‘child1+2’ to the front of all other windows on the desktop and always keep ‘child1+2’ in front of the main window.

when i minimize the ‘main’ window, ‘child1+2’ should also be minimized.

The z-order of the ‘child’ windows should stay the same unless i click on a ‘child’ directly.

so in the end i need the same behaviour as if i would add the 2 childs to the main window component, but keep them as windows on the desktop.

is this possible?
so far i could only find the alwaysOnTop() function, which is not what i need.
using toFront() and toBack() would involve a lot of gain/lostFocus() checking and seems a bit complicated.

any help welcome! :wink:
comboy


#2

I’ve been trying to do similar to this for handling plugin windows. I “hacked” the TopLevelWindow timerCallback and setWindowActive so that activeWindowStatusChanged isn’t called until all windows have had their active state changed. This way activeWindowStatusChanged in your child windows can check to see if the main window is active or not. The child windows are set to be always on top and are changed to be otherwise when none of the apps windows are active. Or something like that. I was just about to ask this question and have also just begun testing this method so I can’t say it’s perfect, but it seems helpful to have windows states updated first. Jules would you be interested in making a proper change to allow this? Or maybe I’m missing something and doing it wrong!

EDIT: this is the portion of timerCallback in TopLevelWindow, setWindowActive no longer calls activeWindowStatusChanged. It’s just a hack to test it out.

            for (int i = windows.size(); --i >= 0;)
            {
                TopLevelWindow* const tlw = windows.getUnchecked (i);
                tlw->setWindowActive (isWindowActive (tlw));

                i = jmin (i, windows.size() - 1);
            }
			
            for (int i = windows.size(); --i >= 0;)
            {
                TopLevelWindow* const tlw = windows.getUnchecked (i);
                tlw->activeWindowStatusChanged();
                i = jmin (i, windows.size() - 1);
            }

#3

hmmm, okay.
thanks for the tip, at least it’s better than my current experiment using the gain + lostFocus() functions :wink:

I hoped I’m just overseeing something since with the windows API this behaviour is just a windows style flag to set.
not sure about osx and linux though and i like to stay cross platform.

comboy