GCC Code Coverage Report


Directory: ./
File: server/idle_inhibit_v1.cpp
Date: 2024-01-22 17:25:27
Exec Total Coverage
Lines: 29 29 100.0%
Branches: 6 12 50.0%

Line Branch Exec Source
1 /****************************************************************************
2 Copyright 2020 Faveraux Adrien <ad1rie3@hotmail.fr>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) version 3, or any
8 later version accepted by the membership of KDE e.V. (or its
9 successor approved by the membership of KDE e.V.), which shall
10 act as a proxy defined in Section 6 of version 3 of the license.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 ****************************************************************************/
20 #include "idle_inhibit_v1_p.h"
21
22 namespace Wrapland::Server
23 {
24
25 const struct zwp_idle_inhibit_manager_v1_interface IdleInhibitManagerV1::Private::s_interface = {
26 resourceDestroyCallback,
27 cb<createInhibitorCallback>,
28 };
29
30 52 IdleInhibitManagerV1::Private::Private(Display* display, IdleInhibitManagerV1* q_ptr)
31 104 : Wayland::Global<IdleInhibitManagerV1>(q_ptr,
32 52 display,
33 &zwp_idle_inhibit_manager_v1_interface,
34 &s_interface)
35 52 {
36
1/2
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
52 create();
37 52 }
38
39 3 void IdleInhibitManagerV1::Private::createInhibitorCallback(IdleInhibitManagerV1Bind* bind,
40 uint32_t id,
41 wl_resource* wlSurface)
42 {
43 3 auto surface = Wayland::Resource<Surface>::get_handle(wlSurface);
44
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 auto inhibitor = new IdleInhibitor(bind->client->handle, bind->version, id);
45
46 3 surface->d_ptr->installIdleInhibitor(inhibitor);
47 3 }
48
49 52 IdleInhibitManagerV1::IdleInhibitManagerV1(Display* display)
50
2/4
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 52 times.
52 : d_ptr(new Private(display, this))
51
52 52 {
53 52 }
54
55 104 IdleInhibitManagerV1::~IdleInhibitManagerV1() = default;
56
57 const struct zwp_idle_inhibitor_v1_interface IdleInhibitor::Private::s_interface
58 = {destroyCallback};
59
60 3 IdleInhibitor::Private::Private(Client* client, uint32_t version, uint32_t id, IdleInhibitor* q_ptr)
61 6 : Wayland::Resource<IdleInhibitor>(client,
62 3 version,
63 3 id,
64 &zwp_idle_inhibitor_v1_interface,
65 &s_interface,
66 3 q_ptr)
67 3 {
68 3 }
69
70 6 IdleInhibitor::Private::~Private() = default;
71
72 3 IdleInhibitor::IdleInhibitor(Client* client, uint32_t version, uint32_t id)
73
2/4
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
3 : d_ptr(new Private(client, version, id, this))
74 3 {
75 3 }
76 6 IdleInhibitor::~IdleInhibitor() = default;
77 }
78