!11 修复 xcb 上高 dpi 时触控笔坐标异常
Merge pull request !11 from amphetamineWei/openkylin/yangtze-dev
This commit is contained in:
commit
94c3760749
|
@ -266,6 +266,13 @@ QPoint QPlatformWindow::mapToGlobal(const QPoint &pos) const
|
|||
return result;
|
||||
}
|
||||
|
||||
QPointF QPlatformWindow::mapFromGlobalF(const QPointF &pos) const
|
||||
{
|
||||
const QPoint posPt = pos.toPoint();
|
||||
const QPointF delta = pos - posPt;
|
||||
return mapFromGlobal(posPt) + delta;
|
||||
}
|
||||
|
||||
/*!
|
||||
Translates the global screen coordinate \a pos to window
|
||||
coordinates using native methods. This is required for embedded windows,
|
||||
|
|
|
@ -114,6 +114,7 @@ public:
|
|||
virtual bool isForeignWindow() const { return false; };
|
||||
virtual QPoint mapToGlobal(const QPoint &pos) const;
|
||||
virtual QPoint mapFromGlobal(const QPoint &pos) const;
|
||||
QPointF mapFromGlobalF(const QPointF &pos) const;
|
||||
|
||||
virtual void propagateSizeHints();
|
||||
|
||||
|
|
|
@ -1270,16 +1270,16 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD
|
|||
if (Q_LIKELY(useValuators)) {
|
||||
const qreal value = scaleOneValuator(normalizedValue, physicalScreenArea.x(), physicalScreenArea.width());
|
||||
global.setX(value);
|
||||
// mapFromGlobal is ok for nested/embedded windows, but works only with whole-number QPoint;
|
||||
// so map it first, then add back the sub-pixel position
|
||||
local.setX(window->mapFromGlobal(QPoint(int(value), 0)).x() + (value - int(value)));
|
||||
//! \note Fix QTBUG-77826
|
||||
local.setX(xcbWindow->mapFromGlobalF(global).x());
|
||||
}
|
||||
break;
|
||||
case QXcbAtom::AbsY:
|
||||
if (Q_LIKELY(useValuators)) {
|
||||
qreal value = scaleOneValuator(normalizedValue, physicalScreenArea.y(), physicalScreenArea.height());
|
||||
global.setY(value);
|
||||
local.setY(window->mapFromGlobal(QPoint(0, int(value))).y() + (value - int(value)));
|
||||
//! \note Fix QTBUG-77826
|
||||
local.setY(xcbWindow->mapFromGlobalF(global).y());
|
||||
}
|
||||
break;
|
||||
case QXcbAtom::AbsPressure:
|
||||
|
|
Loading…
Reference in New Issue