1// Copyright (C) 2022 David Edmundson <davidedmundson@kde.org>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qwaylandfractionalscale_p.h"
5
6QT_BEGIN_NAMESPACE
7
8namespace QtWaylandClient {
9
10QWaylandFractionalScale::QWaylandFractionalScale(struct ::wp_fractional_scale_v1 *object)
11 : QtWayland::wp_fractional_scale_v1(object)
12{}
13
14
15QWaylandFractionalScale::~QWaylandFractionalScale()
16{
17 destroy();
18}
19
20void QWaylandFractionalScale::wp_fractional_scale_v1_preferred_scale(uint scale)
21{
22 qreal preferredScale = scale / 120.0; // hardcoded denominator determined in the spec
23 if (preferredScale != mPreferredScale) {
24 mPreferredScale = preferredScale;
25 Q_EMIT preferredScaleChanged(preferredScale);
26 }
27}
28
29}
30
31QT_END_NAMESPACE
32

source code of qtwayland/src/client/qwaylandfractionalscale.cpp