Fractional scaling in DRM kscreen integration
Summary: The kwin code was written to treat scale as non integers, we just need to switch to the relevant float version of methods. Test Plan: Used kscreen-doctor to change this Konsole resized as appropriate Plasmashell was all broken, but that's expected until QScreen::size is based on the xdg-output virtual size Reviewers: #kwin, mart, graesslin, romangg Reviewed By: #kwin, mart, graesslin Subscribers: romangg, zzag, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13616
This commit is contained in:
parent
39186e1442
commit
7aedacd89e
1 changed files with 10 additions and 3 deletions
|
@ -53,6 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <xf86drmMode.h>
|
#include <xf86drmMode.h>
|
||||||
#include <libdrm/drm_mode.h>
|
#include <libdrm/drm_mode.h>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -817,10 +818,16 @@ void DrmOutput::setScale(qreal scale)
|
||||||
{
|
{
|
||||||
m_scale = scale;
|
m_scale = scale;
|
||||||
if (m_waylandOutput) {
|
if (m_waylandOutput) {
|
||||||
m_waylandOutput->setScale(scale);
|
// this is the scale that clients will ideally use for their buffers
|
||||||
|
// this has to be an int which is fine
|
||||||
|
|
||||||
|
// I don't know whether we want to round or ceil
|
||||||
|
// or maybe even set this to 3 when we're scaling to 1.5
|
||||||
|
// don't treat this like it's chosen deliberately
|
||||||
|
m_waylandOutput->setScale(std::ceil(scale));
|
||||||
}
|
}
|
||||||
if (m_waylandOutputDevice) {
|
if (m_waylandOutputDevice) {
|
||||||
m_waylandOutputDevice->setScale(scale);
|
m_waylandOutputDevice->setScaleF(scale);
|
||||||
}
|
}
|
||||||
if (m_xdgOutput) {
|
if (m_xdgOutput) {
|
||||||
m_xdgOutput->setLogicalSize(pixelSize() / m_scale);
|
m_xdgOutput->setLogicalSize(pixelSize() / m_scale);
|
||||||
|
@ -861,7 +868,7 @@ bool DrmOutput::commitChanges()
|
||||||
}
|
}
|
||||||
if (m_changeset->scaleChanged()) {
|
if (m_changeset->scaleChanged()) {
|
||||||
qCDebug(KWIN_DRM) << "Setting scale:" << m_changeset->scale();
|
qCDebug(KWIN_DRM) << "Setting scale:" << m_changeset->scale();
|
||||||
setScale(m_changeset->scale());
|
setScale(m_changeset->scaleF());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue