When I set a (standalone) program to use a native titlebar (Win7) the window is sometimes positioned so that the upper left position of the window content is exactly in the upper-left-most position on the screen, thus hiding the titlebar outside of the screen/reach with no way of getting it back.
With a resizable window I can then resize the windows and Windows7 would magically move the window the tinyest amount for me to be able to drag the titlebar. Non-resizable windows: no such luck!
Of course, I’m just saying it’s a minimal example.
What I’m also saying is that perhaps setUsingNativeTitleBar( … ) should call getConstrainer()->checkComponentBounds(this), which solves the problem (consistently / for me).
In general, though, why does switching to a native title bar (for example, in the Juce Demo app) change the window position/size? It seems to me that these should be preserved exactly, even if the content component size has to be changed a little bit to accommodate a different window frame size. Or, it could work the other way – the content component size is preserved exactly, and the overall window size/position are changed a little bit. But either of those seem to better than making the native window’s client area be the same size as the entire Juce window.
I’m not sure if this is directly relevant but I wrote a simple wrapper that makes the JUCE ComponentBoundsConstrainer behave better when trying to specify sizes that are independent of the window frame thickness:
It’s not flipping back and forth that’s an issue for me. It’s that, when I do something like setTopLeftPosition(0,0) on a native window, the window frame goes off the screen. This seems strange to me. I would expect that saying setTopLeftPosition(0,0) on a native window would do the same thing as on a Juce window, which is that the top left corner of the window frame gets put at (0,0) – not the top left corner of the content component.
A non-native titlebar window has a 0 pixel thick window border, while a native titlebar window has a non-zero sized window border. You can observe this yourself by stepping through HWNDComponentPeer::updateBorderSize() (juce_win32_Windowing.cpp).
If you want to specify coordinates independent of the native or non-native condition of the titlebar then you need to add to your coordinates the thickness of the left and top sides of the border from the ComponentPeer, by calling:
Note that this is exactly what the code in my ComponentBoundsConstrainer class does.