juce_areThereAnyAlwaysOnTopWindows not implemented


#1

Hi Jules,

The function juce_areThereAnyAlwaysOnTopWindows() always return false on Linux. As a consequence, any AlertWindow opened when there is an AlwaysOnTop window displayed, appears behind it, which is a bit annoying.

Here is a very basic patch to implement juce_areThereAnyAlwaysOnTopWindows:

[code]@@ -794,6 +794,8 @@
return CustomMouseCursorInfo (ImageFileFormat::loadFrom (dragHandData, dragHandDataSize), 8, 7).create();
}

+Array<ComponentPeer*> alwaysOnTopPeerList;
+
//==============================================================================
class LinuxComponentPeer : public ComponentPeer
{
@@ -823,6 +825,8 @@
deleteIconPixmaps();
destroyWindow();
windowH = 0;
+

  •    alwaysOnTopPeerList.removeAllInstancesOf(this);
    

    }

    // (this callback is hooked up in the messaging code)
    @@ -1147,8 +1151,10 @@
    XWindowAttributes attr;
    XGetWindowAttributes (display, windowH, &attr);

  •        if (component.isAlwaysOnTop())
    
  •        if (component.isAlwaysOnTop()) {
               XRaiseWindow (display, windowH);
    
  •            alwaysOnTopPeerList.addIfNotAlreadyThere(this);
    
  •        }
    
           XSync (display, False);
       }
    

@@ -2150,8 +2156,10 @@
if ((styleFlags & windowAppearsOnTaskbar) == 0)
netHints [numHints++] = Atoms::getIfExists ("_NET_WM_STATE_SKIP_TASKBAR");

  •    if (component.isAlwaysOnTop())
    
  •    if (component.isAlwaysOnTop()) {
           netHints [numHints++] = Atoms::getIfExists ("_NET_WM_STATE_ABOVE");
    
  •        alwaysOnTopPeerList.addIfNotAlreadyThere(this);
    
  •    }
    
       if (numHints > 0)
           xchangeProperty (windowH, Atoms::get().WindowState, XA_ATOM, 32, &netHints, numHints);
    

@@ -3155,7 +3163,8 @@
//==============================================================================
bool juce_areThereAnyAlwaysOnTopWindows()
{

  • return false; // XXX should be implemented
  • return alwaysOnTopPeerList.size() != 0;
    }

//==============================================================================
[/code]


#2

Thanks. I don’t think there’s any need for an array: just a simple counter would do the trick, but I’ll add that in a sec…


#3

Has this been added now? I have a similar problems with FileCHooser dialogues, they always appear behind any AlwaysOnTop components.


#4

Yes, I added it.