libqt5-qtbase/Fix-physical-DPI-and-size-for-rotated-screens-on-X11.patch
Dominique Leuenberger 7169baff88 Accepting request 286573 from KDE:Qt5
- Added patches from upstream:
  Fix-Meta-shortcuts-on-XCB.patch (qtbug#43572),
  Fix-detection-of-GCC5.patch,
  Fix-physical-DPI-and-size-for-rotated-screens-on-X11.patch
  (qtbug#43688), Fix-typo-in-Qt5CoreMacroscmake.patch,
  Make-sure-theres-a-scene-before-using-it.patch (qtbug#44509),
  Multi-screen-DPI-support-for-X11.patch (qtbug#43713),
  QSystemTrayIcon-handle-submenus-correctly.patch,
  Update-mouse-buttons-from-MotionNotify-events.patch
  (qtbug#32609, qtbug#35065, qtbug#43776, qtbug#44166, qtbug#44231),
  X11-devicePixelRatio-screen-mapping-fix.patch (qtbug#43713) and
  xcb-Dont-return-0-from-QXcbKeyboard-possibleKeys.patch
  (qtcreatorbug#9589)

OBS-URL: https://build.opensuse.org/request/show/286573
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=37
2015-02-20 11:43:00 +00:00

86 lines
3.8 KiB
Diff

From: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Date: Wed, 07 Jan 2015 14:19:07 +0000
Subject: Fix physical DPI and size for rotated screens on X11
X-Git-Url: http://quickgit.kde.org/?p=qt%2Fqtbase.git&a=commitdiff&h=e6699afbee77b853773579d29d78a1ade2a4ab2c
---
Fix physical DPI and size for rotated screens on X11
Rotated screens would use the unrotated physical geometry, causing the
calculated physical DPI to be completely wrong.
In RandR, the output does not rotate, so the physical size is always for the
unrotated display. The transformation is done on the crtc.
http://www.x.org/releases/X11R7.6/doc/randrproto/randrproto.txt
Task-number: QTBUG-43688
Change-Id: Ifde192fcc99a37d0bfd6d57b4cdeac124a054ca3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
---
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -53,7 +53,7 @@
, m_screen(scr)
, m_crtc(output ? output->crtc : 0)
, m_outputName(outputName)
- , m_sizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize())
+ , m_outputSizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize())
, m_virtualSize(scr->width_in_pixels, scr->height_in_pixels)
, m_virtualSizeMillimeters(scr->width_in_millimeters, scr->height_in_millimeters)
, m_orientation(Qt::PrimaryOrientation)
@@ -71,6 +71,7 @@
updateGeometry(output ? output->timestamp : 0);
updateRefreshRate();
+
const int dpr = int(devicePixelRatio());
// On VNC, it can be that physical size is unknown while
// virtual size is known (probably back-calculated from DPI and resolution)
@@ -93,6 +94,7 @@
qDebug(" virtual height.: %lf", m_virtualSizeMillimeters.height());
qDebug(" virtual geom...: %d x %d", m_virtualSize.width(), m_virtualSize.height());
qDebug(" avail virt geom: %d x %d +%d +%d", m_availableGeometry.width(), m_availableGeometry.height(), m_availableGeometry.x(), m_availableGeometry.y());
+ qDebug(" orientation....: %d", m_orientation);
qDebug(" pixel ratio....: %d", m_devicePixelRatio);
qDebug(" depth..........: %d", screen()->root_depth);
qDebug(" white pixel....: %x", screen()->white_pixel);
@@ -413,6 +415,24 @@
if (crtc) {
xGeometry = QRect(crtc->x, crtc->y, crtc->width, crtc->height);
xAvailableGeometry = xGeometry;
+ switch (crtc->rotation) {
+ case XCB_RANDR_ROTATION_ROTATE_0: // xrandr --rotate normal
+ m_orientation = Qt::LandscapeOrientation;
+ m_sizeMillimeters = m_outputSizeMillimeters;
+ break;
+ case XCB_RANDR_ROTATION_ROTATE_90: // xrandr --rotate left
+ m_orientation = Qt::PortraitOrientation;
+ m_sizeMillimeters = m_outputSizeMillimeters.transposed();
+ break;
+ case XCB_RANDR_ROTATION_ROTATE_180: // xrandr --rotate inverted
+ m_orientation = Qt::InvertedLandscapeOrientation;
+ m_sizeMillimeters = m_outputSizeMillimeters;
+ break;
+ case XCB_RANDR_ROTATION_ROTATE_270: // xrandr --rotate right
+ m_orientation = Qt::InvertedPortraitOrientation;
+ m_sizeMillimeters = m_outputSizeMillimeters.transposed();
+ break;
+ }
free(crtc);
}
}
--- a/src/plugins/platforms/xcb/qxcbscreen.h
+++ b/src/plugins/platforms/xcb/qxcbscreen.h
@@ -111,6 +111,7 @@
xcb_screen_t *m_screen;
xcb_randr_crtc_t m_crtc;
QString m_outputName;
+ QSizeF m_outputSizeMillimeters;
QSizeF m_sizeMillimeters;
QRect m_geometry;
QRect m_availableGeometry;