summaryrefslogtreecommitdiff
path: root/src/client/qwaylandfractionalscale.cpp
blob: 324a0b7299e70a731014092a14b81b890bcaac81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (C) 2022 David Edmundson <davidedmundson@kde.org>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include "qwaylandfractionalscale_p.h"

QT_BEGIN_NAMESPACE

namespace QtWaylandClient {

QWaylandFractionalScale::QWaylandFractionalScale(struct ::wp_fractional_scale_v1 *object)
    : QtWayland::wp_fractional_scale_v1(object)
{}


QWaylandFractionalScale::~QWaylandFractionalScale()
{
    destroy();
}

qreal QWaylandFractionalScale::preferredScale() const
{
    return mPreferredScale;
}

void QWaylandFractionalScale::wp_fractional_scale_v1_preferred_scale(uint scale)
{
    qreal preferredScale = scale / 120.0; // hardcoded denominator determined in the spec
    if (preferredScale != mPreferredScale) {
        mPreferredScale = preferredScale;
        Q_EMIT preferredScaleChanged();
    }
}

}

QT_END_NAMESPACE