summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2016-07-28 11:59:06 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2016-08-01 15:29:38 +0000
commitc4b4eba188d2fc0273aaa38533e19dcbd4cfc7be (patch)
treebe5d7b72874a17bded380b8da9535de01be2edc4 /src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
parent97c00e66c8ce3fff0f3bb748d3f3c290b30dd296 (diff)
eglfs: Add support for raster content rotation
Running QWidget or other raster window-based apps with QT_QPA_EGLFS_ROTATION=180 will now flip the screen as expected. In addition, 90 and -90 are supported too. These will affect the reported screen geometry as well. The OpenGL mouse cursor is repositioned and rotated accordingly. For true OpenGL content the rotation is ignored. Hardware mouse cursors (DRM) ignore it as well for the time being. [ChangeLog][Platform Specific Changes] QWidget-based applications running on the eglfs platform plugin can now request 180 or 90 degrees rotated output by setting the QT_QPA_EGLFS_ROTATION environment variable. Task-number: QTBUG-39959 Change-Id: I3570b515d0233c6c6a0e813899b935ee222eab62 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/plugins/platforms/eglfs/api/qeglfsscreen.cpp')
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
index d636a783ec..47ef2f64e7 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
@@ -65,6 +65,31 @@ QEglFSScreen::~QEglFSScreen()
QRect QEglFSScreen::geometry() const
{
+ QRect r = geometryForSurface();
+
+ static int rotation = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION");
+ switch (rotation) {
+ case 0:
+ case 180:
+ case -180:
+ break;
+ case 90:
+ case -90: {
+ int h = r.height();
+ r.setHeight(r.width());
+ r.setWidth(h);
+ break;
+ }
+ default:
+ qWarning("Invalid rotation %d specified in QT_QPA_EGLFS_ROTATION", rotation);
+ break;
+ }
+
+ return r;
+}
+
+QRect QEglFSScreen::geometryForSurface() const
+{
return QRect(QPoint(0, 0), qt_egl_device_integration()->screenSize());
}