Use non-rotated physical size of an output when required
1. In wl_output and kde_output_device_v2 protocols. This should fix dpi calculation in KScreen::Generator::bestScaleForOutput() when panel_orientation is set to rotate a screen by 90 or 270 degrees. 2. When comparing with physical size of libinput device. 3. In calculations with mode sizes which are not rotated. This change makes Output::physicalSize() return the raw physical size, which is used in most of cases. It should be rotated manually if needed.
This commit is contained in:
parent
8bfb0b1ff7
commit
64ce247104
3 changed files with 7 additions and 7 deletions
|
@ -181,7 +181,7 @@ QRectF Output::fractionalGeometry() const
|
|||
|
||||
QSize Output::physicalSize() const
|
||||
{
|
||||
return orientateSize(m_information.physicalSize);
|
||||
return m_information.physicalSize;
|
||||
}
|
||||
|
||||
int Output::refreshRate() const
|
||||
|
|
|
@ -172,7 +172,7 @@ public:
|
|||
qreal scale() const;
|
||||
|
||||
/**
|
||||
* Returns the physical size of this output, in millimeters.
|
||||
* Returns the non-rotated physical size of this output, in millimeters.
|
||||
*
|
||||
* Default implementation returns an invalid QSize.
|
||||
*/
|
||||
|
@ -230,6 +230,7 @@ public:
|
|||
};
|
||||
Q_ENUM(Transform)
|
||||
Transform transform() const;
|
||||
QSize orientateSize(const QSize &size) const;
|
||||
|
||||
void applyChanges(const OutputConfiguration &config);
|
||||
|
||||
|
@ -355,8 +356,6 @@ protected:
|
|||
void setInformation(const Information &information);
|
||||
void setState(const State &state);
|
||||
|
||||
QSize orientateSize(const QSize &size) const;
|
||||
|
||||
EffectScreenImpl *m_effectScreen = nullptr;
|
||||
State m_state;
|
||||
Information m_information;
|
||||
|
|
|
@ -1019,7 +1019,7 @@ public:
|
|||
}
|
||||
m_lastTouchDownTime = time;
|
||||
auto output = workspace()->outputAt(pos);
|
||||
auto physicalSize = output->physicalSize();
|
||||
auto physicalSize = output->orientateSize(output->physicalSize());
|
||||
if (!physicalSize.isValid()) {
|
||||
physicalSize = QSize(190, 100);
|
||||
}
|
||||
|
@ -1053,8 +1053,9 @@ public:
|
|||
return true;
|
||||
}
|
||||
auto output = workspace()->outputAt(pos);
|
||||
const float xfactor = output->physicalSize().width() / (float)output->geometry().width();
|
||||
const float yfactor = output->physicalSize().height() / (float)output->geometry().height();
|
||||
const auto physicalSize = output->orientateSize(output->physicalSize());
|
||||
const float xfactor = physicalSize.width() / (float)output->geometry().width();
|
||||
const float yfactor = physicalSize.height() / (float)output->geometry().height();
|
||||
|
||||
auto &point = m_touchPoints[id];
|
||||
const QPointF dist = pos - point;
|
||||
|
|
Loading…
Reference in a new issue