Add convenience macros for checking OS X and iOS platform SDK and target

Allows us to skip passing __MAC_NA and __IPHONE_NA when we don't care
about that platform.

Change-Id: Ie265beb457d057de06ae64970684d67e59062b1c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
iOS: Fix when and how we send geometry and expose events

Geometry changes may come from Qt itself, or spontaneously from the windowing
system. In both cases we deal with them through the layoutSubviews callback,
which we now ensure gets called after we set a new geometry on the UIView
frame, by using the setNeedsLayout message.

We take care to persist the requested geometry from Qt immediately in our
setGeometry() function, so that subsequent calls to QWindow::geometry()
will report back the requested geometry. Clients can however not rely
on this geometry until they've received a corresponding resize event,
which we trigger from layoutSubviews.

Since the new geometry reported in layoutSubviews may be different from
what the user requested, we ensure to pass on both the new and the "old"
geometry, so that Qt will send the appropriate resize and move events.

Instead of building expose events on top of the existing layout
mechanism provided by iOS, we hook into the more logical point,
which is the display-phase. Since a EAGL view normally doesn't
need to "display" anything this takes a few overrides on UIView.

Once we have the hooks we need, we can distinguish between a QWindow
backing needing layout, and needing displaying.

Finally, we flush both the resize and expose events, as that's what
iOS expects of us when asking us to layout or display. The result
is that Qt is able to synchronously resize subwindows and prepare
new GL rendering for the next frame.

Change-Id: I4c03e3db3fe886163284ba1a342699e217e88cbb
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
iOS: Take position of root viewcontroller into account for geometry changes

When setting the geometry on our UIView, or when reporting it back to Qt
in our layoutSubviews callback, we need to take into account that the
root viewcontroller may be not be positioned at 0,0 in the screen's
window. Even when using the wantsFullScreenLayout property of the view
controller this may be the case on iOS7 when the in-call status-bar is
visible.

Change-Id: I0ca706c1c9aff8ba4f3b4ccdf83dba713bd5c9c2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
iOS: Change show() to imply maximize, and showFullScreen() to hide status bar

Matches the Android behavior, and gives an easy and predictable way to
show true fullscreen windows that is similar to how one would do it on
a desktop platform.

We keep the statusbar visibility in sync with the window state of the
active window.

Change-Id: Ia4b99e03f83e19f9ef56cc99b9d477cc6da4c734
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
iOS: Use separate release pool for qt_ios_version()

QSysInfo::MacintoshVersion is initialized before the main thread's release
pool has been set up, so we have to wrap the UIKit usage in our own pool.

Change-Id: I80e2c068339e0251f38ecf55fcfb764594eb3ad7
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
iOS: Fix build against iOS 5 SDK and auto-rotation on iOS 5

Change-Id: I3acc2d3780a9440bedf48db3fed0046b06300b9e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
iOS: Allow QBackingStore::flush() without beginPaint()

The QBackingStore API doesn't require clients to precede flush() with a
beginPaint() call, but our backingstore is backed by a GL context, so
it's up to us to ensure it's current before swapping.

Change-Id: Ia6119bf0e835448b1fd383d933df6f88fa4f298a
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
iOS: Deliver resize events synchronously after setGeometry for QtWidgets

QWidget::show_sys() assumes synchronous geometry behavior by trying to
resize both the platform window and the backing store if the widget's
view of what the geometry is doesn't match the platform window's.

The problem with that is that it's the widget which is not up to date,
not the window, as the widget is not waiting for resize events before
applying any resize logic. Instead of trying to fix widgets, we throw
our hands in the air and give QtWidgets the synchronous behavior it
assumes from the platform.

Change-Id: I1b9241b9b13df661dc7f41c4cb8ecd02f5572256
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
iOS: Re-enable kEAGLDrawablePropertyRetainedBacking

Having it disabled caused issues with our backing-store implementation,
which assumes that the backing store is retained, but for us is backed
by a GL context.

Change-Id: I18d05e226c7cf949adcd3b71801ffd845fa6d83d
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>