Search
SailfishOS Open Build Service
>
Projects
>
home:sbinner
:
qt481
>
qt
> qt-4.8.0-add-scaling-based-on-screen-size.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File qt-4.8.0-add-scaling-based-on-screen-size.patch of Package qt
From a9ca8c3aac9850875b44e2d78fbd7737a570e543 Mon Sep 17 00:00:00 2001 From: Robin Burchell <robin.burchell@collabora.com> Date: Sun, 13 Nov 2011 12:37:18 +0100 Subject: [PATCH] add scaling based on screen size Author: James Ketrenos <jketreno@linux.intel.com> Signed-off-by: James Ketrenos <jketreno@linux.intel.com> --- src/gui/kernel/qapplication_x11.cpp | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index ab3c190..2e1fe98 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -5080,6 +5080,12 @@ static Qt::MouseButtons translateXI2MouseButtons(XIButtonState *state) bool QETWidget::translateXI2Event(const XIEvent *xievent) { Q_D(QWidget); + static int width = 0; + static int height = 0; + if (width == 0 || height == 0) { + width = DisplayWidth(X11->display, 0); + height = DisplayHeight(X11->display, 0); + } if (xievent->evtype == XI_Motion) { XIDeviceEvent *motionevent = (XIDeviceEvent *) xievent; @@ -5227,6 +5233,7 @@ bool QETWidget::translateXI2Event(const XIEvent *xievent) touchPoints << QTouchEvent::TouchPoint(i); } qreal x, y, nx, ny, w = 0.0, h = 0.0, p = -1.0; + x = y = nx = ny = 0.0; int id; uint active = 0; for (int i = 0; i < X11->xideviceinfo->num_classes; ++i) { @@ -5269,7 +5276,10 @@ bool QETWidget::translateXI2Event(const XIEvent *xievent) newstate |= Qt::TouchPointPrimary; touchPoint.setState(newstate); - touchPoint.setScreenRect(QRectF(x - w/2, y - h/2, w, h)); + if (w != 0.0 && h != 0.0) + touchPoint.setScreenRect(QRectF((nx * width) - w/2, (ny * height) - h/2, w, h)); + else + touchPoint.setScreenPos(QPoint(nx * width, ny * height)); touchPoint.setNormalizedPos(QPointF(nx, ny)); touchPoint.setPressure(p); } -- 1.7.7.4