getMainDisplay().userArea not returning correct dimensions


#1

The following java code reports a height of 720:

        Display display = getWindowManager().getDefaultDisplay();
        Point size = new Point();
        display.getSize(size);
        int width = size.x;
        int height = size.y;
        showNativeMessage(Integer.toString(height));

Yet my main component, which is set to fullscreen reports a height of 266 using the following code:

        Rectangle<int> rect(Desktop::getInstance().getDisplays().getMainDisplay().userArea);
        cUtils::showMessage(rect.getHeight());

This worked before I updated to Juce4. I was on a 3.1n branch. Anyone else noticing this?

 


#2

In order to rule out an error on my part I created a blank project from scratch with the Introjucer. Same problem as before. Here's the reported screen size from the Java activity:

And here is the reported screen size from Desktop::getInstance().getDisplays().getMainDisplay()

Here is the sample project. I'm running Android 4.3 and the latest tip.

https://copy.com/ao6UArbtpeWpA1pF

 


#3

On a high-DPI display, those numbers could be correct. It's not a count of physical pixels, it can be scaled.


#4

Thanks Jules. I can adjust accordingly.