MythTV master
mythscreensaverwayland.cpp
Go to the documentation of this file.
1// MythTV
3#include "mythmainwindow.h"
6// NOLINTNEXTLINE(bugprone-suspicious-include)
8
9#define LOC QString("ScreenSaverWayland: ")
10
12 : MythScreenSaver(Parent),
13 m_window(MainWindow)
14{
16}
17
19{
20 if (m_inhibitor)
22 if (m_manager)
24 delete m_device;
25}
26
35{
36 if (!m_device)
38
40 return;
41
42 if (!m_manager)
43 {
44 // We're looking for just the inhibit manager interface
46
47 // Search for it
48 wl_registry* registry = wl_display_get_registry(m_device->m_display);
49 wl_registry_add_listener(registry, &MythWaylandExtras::kRegistryListener, &m_registry);
50 wl_display_roundtrip(m_device->m_display);
51
52 // Did we find it
53 m_manager = static_cast<zwp_idle_inhibit_manager_v1*>(m_registry.at(&zwp_idle_inhibit_manager_v1_interface));
54 }
55
56 if (m_manager)
57 LOG(VB_GENERAL, LOG_INFO, LOC + "Ready");
58 else
59 LOG(VB_GENERAL, LOG_WARNING, LOC + "Setup failed (no compositor support?)");
60}
61
63{
64 if (m_inhibitor || !m_manager)
65 return;
67 LOG(VB_GENERAL, LOG_INFO, LOC + "Screensaver inhibited");
68}
69
71{
72 if (m_inhibitor)
74 m_inhibitor = nullptr;
75 LOG(VB_GENERAL, LOG_INFO, LOC + "Uninhibited screensaver");
76}
77
79{
80 Restore();
81}
82
84{
85 return false;
86}
void SignalWindowReady()
zwp_idle_inhibit_manager_v1 * m_manager
zwp_idle_inhibitor_v1 * m_inhibitor
MythWaylandDevice * m_device
void WindowReady()
Signalled when MythMainWindow has completed initialisation.
MythScreenSaverWayland(QObject *Parent, MythMainWindow *MainWindow)
MythWaylandRegistry m_registry
Base Class for screensavers.
A simple wrapper to retrieve the major Wayland objects from the Qt Wayland native interface.
wl_display * m_display
wl_surface * m_surface
static struct zwp_idle_inhibitor_v1 * zwp_idle_inhibit_manager_v1_create_inhibitor(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1, struct wl_surface *surface)
Create a new inhibitor object associated with the given surface.
static void zwp_idle_inhibit_manager_v1_destroy(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1)
Destroy the inhibit manager.
static void zwp_idle_inhibitor_v1_destroy(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1)
Remove the inhibitor effect from the associated wl_surface.
const struct wl_interface zwp_idle_inhibit_manager_v1_interface
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
#define LOC
static const struct wl_registry_listener kRegistryListener