Windows Window Starts Tiny

windows

#1

After going to test an open source application on windows for the first time, I came a cross a strange error with my program. When a window is drawn, it initially starts off tiny! I’ve tested this with windows scaling turned off and on and I still have the problem.

After moving the edge of the window to resize it, the component returns to the normal size and becomes constrained by the constrainer. The code below is the code I am using to draw the window. The problem does not seem to occur If I use my setFixedAspectRatio variable. Any ideas on what could be causing the problem? This problem doesn’t occur on mac perculiarly

auto mousePosition = Desktop::getInstance().getMousePosition();    
auto windowHeight = Desktop::getInstance().getDisplays().getDisplayContaining (mousePosition).userArea.getHeight();
auto windowWidth = Desktop::getInstance().getDisplays().getDisplayContaining (mousePosition).userArea.getWidth();

if (setFixedAspectRatio == true)
{
	DBG ("Resizeable: " + (String)minWidth + " x " + (String)minHeight);
    boundsConstrainer = new (ComponentBoundsConstrainer);
    auto aspectRatio = (double)minWidth / (double)minHeight;
    boundsConstrainer->setFixedAspectRatio (aspectRatio);
    boundsConstrainer->setMinimumSize (minWidth, minHeight);
    boundsConstrainer->setMaximumSize (maxWidth, maxHeight);
    boundsConstrainer->setMinimumOnscreenAmounts (maxHeight, maxWidth, maxHeight, maxWidth);
    setConstrainer (boundsConstrainer);
}
else
{
	DBG ("Fixed: " + (String)minWidth + " x " + (String)minHeight);
    setResizeLimits (minWidth, minHeight, maxWidth, maxHeight);
}

Initial size:

After clicking the border to resize:


#2

Well, what size do you set the window to be when you create it?


#3

It’s starts off at * 0.3 the width and height. Putting some break points in, the minWidth and minHeight appears to be set to about 500x300 on my 1440x900 screen when it start


#4

Well, I’d suggest just breakpointing in the Component class to catch each time its size is changed, and spot the culprit that’s calling it.