summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformwindow_qpa.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2012-01-13 10:31:11 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-24 15:38:48 +0100
commitb39df8bf92a530783144dbcf5cae939742ff2d23 (patch)
tree0560985d33f59a48693acadbdfbb59b328131499 /src/gui/kernel/qplatformwindow_qpa.cpp
parentb0a0403daf81e82ea732aa91ec92cf94553a7935 (diff)
Made window orientation API more flexible.
Previously we only had QWindow::setOrientation() which was a hint about the orientation the window's contents were rendered in. However, it's necessary to separate between the orientation corresponding to the window buffer layout and orientation of the contents. A game for example might typically want to use a landscape buffer even on a portrait device. Thus, we replace QWindow::orientation() with QWindow::reportContentOrientationChange() and QWindow::requestWindowOrientation(). Change-Id: I1f07362192daf36c45519cb05b43ac352f1945b5 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/kernel/qplatformwindow_qpa.cpp')
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp
index 463267869c..b9506e7999 100644
--- a/src/gui/kernel/qplatformwindow_qpa.cpp
+++ b/src/gui/kernel/qplatformwindow_qpa.cpp
@@ -239,19 +239,44 @@ void QPlatformWindow::requestActivateWindow()
}
/*!
- Set the orientation of the platform window's contents.
+ Handle changes to the orientation of the platform window's contents.
This is a hint to the window manager in case it needs to display
additional content like popups, dialogs, status bars, or similar
in relation to the window.
- \sa QWindow::setOrientation()
+ \sa QWindow::reportContentOrientationChange()
*/
-void QPlatformWindow::setOrientation(Qt::ScreenOrientation orientation)
+void QPlatformWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
{
Q_UNUSED(orientation);
}
+/*!
+ Request a different orientation of the platform window.
+
+ This tells the window manager how the window wants to be rotated in order
+ to be displayed, and how input events should be translated.
+
+ As an example, a portrait compositor might rotate the window by 90 degrees,
+ if the window is in landscape. It will also rotate input coordinates from
+ portrait to landscape such that top right in portrait gets mapped to top
+ left in landscape.
+
+ If the implementation doesn't support the requested orientation it should
+ signal this by returning an actual supported orientation.
+
+ If the implementation doesn't support rotating the window at all it should
+ return Qt::PrimaryOrientation, this is also the default value.
+
+ \sa QWindow::requestWindowOrientation()
+*/
+Qt::ScreenOrientation QPlatformWindow::requestWindowOrientation(Qt::ScreenOrientation orientation)
+{
+ Q_UNUSED(orientation);
+ return Qt::PrimaryOrientation;
+}
+
bool QPlatformWindow::setKeyboardGrabEnabled(bool grab)
{
Q_UNUSED(grab);