TopLevelWindow visibility/active issue


I'm showing/hidding some top windows and under some circonstances the window does not get activated back as it should, and the top bar buttons are disabled.
When that happens, the problem is that TopLevelWindowManager::currentActive still points to the topLevelWindow while the isCurrentlyActive flag of the topLevelWindow is false.
Thus a workaround is to add a condition to the test in checkFocus :

if (active != currentActive || (active != nullptr && ! active->isActiveWindow()))

But maybe it make more sense to add something like that to TopLevelWindow::visibilityChanged() :

    if (isShowing())
        isCurrentlyActive = TopLevelWindowManager::getInstance()->addWindow (this);
        TopLevelWindowManager::getInstance()->removeWindow (this);

does that make sense to you?


Ok, thanks. I think the list of top-level windows needs to still contain the ones that are hidden, but I'll get something sorted out for this..


..actually, I'm confused by this - it would make no sense to do your first suggestion, because the whole purpose of that function is to set the variable that isActiveWindow() returns.

If the problem is caused by visibility, would it be enough to add a check like this:

        if (currentActive != nullptr && ! currentActive->isShowing())
            currentActive = nullptr;

        if (active != currentActive)



thanks for the commit jules, and really sorry I did not answer before.

Everything seems fine now!