1 | // Copyright (C) 2018 The Qt Company Ltd. |
---|---|
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 "qwaylandxdgdecorationv1_p.h" |
5 | #include "qwaylandxdgshell_p.h" |
6 | |
7 | QT_BEGIN_NAMESPACE |
8 | |
9 | namespace QtWaylandClient { |
10 | |
11 | QWaylandXdgDecorationManagerV1::QWaylandXdgDecorationManagerV1(wl_registry *registry, uint32_t id, uint32_t availableVersion) |
12 | : QtWayland::zxdg_decoration_manager_v1(registry, id, qMin(availableVersion, 1u)) |
13 | { |
14 | } |
15 | |
16 | QWaylandXdgDecorationManagerV1::~QWaylandXdgDecorationManagerV1() |
17 | { |
18 | Q_ASSERT(isInitialized()); |
19 | destroy(); |
20 | } |
21 | |
22 | QWaylandXdgToplevelDecorationV1 *QWaylandXdgDecorationManagerV1::createToplevelDecoration(::xdg_toplevel *toplevel) |
23 | { |
24 | Q_ASSERT(toplevel); |
25 | return new QWaylandXdgToplevelDecorationV1(get_toplevel_decoration(toplevel)); |
26 | } |
27 | |
28 | QWaylandXdgToplevelDecorationV1::QWaylandXdgToplevelDecorationV1(::zxdg_toplevel_decoration_v1 *decoration) |
29 | : QtWayland::zxdg_toplevel_decoration_v1(decoration) |
30 | { |
31 | } |
32 | |
33 | QWaylandXdgToplevelDecorationV1::~QWaylandXdgToplevelDecorationV1() |
34 | { |
35 | Q_ASSERT(isInitialized()); |
36 | destroy(); |
37 | } |
38 | |
39 | void QWaylandXdgToplevelDecorationV1::requestMode(QtWayland::zxdg_toplevel_decoration_v1::mode mode) |
40 | { |
41 | // According to the spec the client is responsible for not requesting a mode repeatedly. |
42 | if (m_modeSet && m_requested == mode) |
43 | return; |
44 | |
45 | set_mode(mode); |
46 | m_requested = mode; |
47 | m_modeSet = true; |
48 | } |
49 | |
50 | void QWaylandXdgToplevelDecorationV1::unsetMode() |
51 | { |
52 | unset_mode(); |
53 | m_modeSet = false; |
54 | m_requested = mode_client_side; |
55 | } |
56 | |
57 | QWaylandXdgToplevelDecorationV1::mode QWaylandXdgToplevelDecorationV1::pending() const |
58 | { |
59 | return m_pending; |
60 | } |
61 | |
62 | bool QWaylandXdgToplevelDecorationV1::isConfigured() const |
63 | { |
64 | return m_configured; |
65 | } |
66 | |
67 | void QtWaylandClient::QWaylandXdgToplevelDecorationV1::zxdg_toplevel_decoration_v1_configure(uint32_t mode) |
68 | { |
69 | m_pending = zxdg_toplevel_decoration_v1::mode(mode); |
70 | m_configured = true; |
71 | } |
72 | |
73 | } |
74 | |
75 | QT_END_NAMESPACE |
76 |