Ubuntu Unity: "Display::userArea" Incorrect


#1

Hi Jules,

The following code does not size an application’s window to the maximum possible user area correctly since the Unity “Launcher” and title bar are not being taken into account.

const juce::Desktop::Displays::Display& mainDisplay = juce::Desktop::getInstance().getDisplays().getMainDisplay();
myWindow.setBounds (mainDisplay.userArea);

JuceDemo example:
[attachment=0]Application Ain’t Sized Correctly.png[/attachment]


#2

And obviously, here’s the problem: the total area and the user area are set to the same dimensions! (Also, Xinerama there or not, the issue is the same)

        if (xineramaIsActive != nullptr
            && xineramaQueryScreens != nullptr
            && xineramaIsActive (display))
        {
            int numMonitors = 0;

            if (XineramaScreenInfo* const screens = xineramaQueryScreens (display, &numMonitors))
            {
                for (int index = 0; index < numMonitors; ++index)
                {
                    for (int j = numMonitors; --j >= 0;)
                    {
                        if (screens[j].screen_number == index)
                        {
                            Display d;
                            d.userArea = d.totalArea = Rectangle<int> (screens[j].x_org,
                                                                       screens[j].y_org,
                                                                       screens[j].width,
                                                                       screens[j].height);

#3

Would totally help on this one, but I have no idea where to find documentation or example code on getting the necessary screen information via this Xinerama/X11/Xlib business. (Don’t mind me, I’m just new at this Linux stuff…)

Edit: Found some xlib docs… but nothing on the “Unity Launcher”. I guess it goes by a different name entirely? Or has no relation.

Edit: Or such thing does not exist.

Edit: Attempted looking into this again, seems there is absolutely no code related. X11 is complete crap.