Bug: getWindowStateAsString() and setUsingNativeTitleBar()

I use getWindowStateAsString() to save the window position, and when the app starts up again I use restoreWindowStateFromString().

This works great when I use the JUCE titlebars.

However, if my code uses setUsingNativeTitleBar() before the window is shown, the size is correct but the position drifts down and to the right.

Looking at the XML I’m writing with ApplicationProperties.getUserSettings()->setValue(…), the window drifts exactly 1 pixel to the right, and 25 pixels down every time the application is restarted. Here are the results of 3 open-close iterations where I did not move the window at all on the screen:

I’m using JUCE 2.0.38-g0353100 on Ubuntu 12.10.

Nothing like that happens for me with the introjucer or other apps that use those methods, so I don’t think you can blame those methods… Could be that on linux the window positions are coming back inconsistently?

Had the same here.

When calling setContentOwned() within your main DocumentWindow, use "false' for the second parameter.

So, this should work:

    setContentOwned (mainComponent = new MainComponent(), false);
    restoreWindowStateFromString (propertyFile->getValue (getName()));