MythTV  master
mythscreensaverwayland.cpp
Go to the documentation of this file.
1 // MythTV
2 #include "mythlogging.h"
3 #include "mythmainwindow.h"
7 
8 #define LOC QString("ScreenSaverWayland: ")
9 
11  : MythScreenSaver(Parent),
12  m_window(MainWindow)
13 {
15 }
16 
18 {
19  if (m_inhibitor)
21  if (m_manager)
23  delete m_device;
24 }
25 
34 {
35  if (!m_device)
37 
39  return;
40 
41  if (!m_manager)
42  {
43  // We're looking for just the inhibit manager interface
45 
46  // Search for it
47  wl_registry* registry = wl_display_get_registry(m_device->m_display);
48  wl_registry_add_listener(registry, &MythWaylandExtras::s_registryListener, &m_registry);
49  wl_display_roundtrip(m_device->m_display);
50 
51  // Did we find it
52  m_manager = static_cast<zwp_idle_inhibit_manager_v1*>(m_registry.at(&zwp_idle_inhibit_manager_v1_interface));
53  }
54 
55  if (m_manager)
56  LOG(VB_GENERAL, LOG_INFO, LOC + "Ready");
57  else
58  LOG(VB_GENERAL, LOG_WARNING, LOC + "Setup failed (no compositor support?)");
59 }
60 
62 {
63  if (m_inhibitor || !m_manager)
64  return;
66  LOG(VB_GENERAL, LOG_INFO, LOC + "Screensaver inhibited");
67 }
68 
70 {
71  if (m_inhibitor)
73  m_inhibitor = nullptr;
74  LOG(VB_GENERAL, LOG_INFO, LOC + "Uninhibited screensaver");
75 }
76 
78 {
79  Restore();
80 }
81 
83 {
84  return false;
85 }
MythScreenSaverWayland::~MythScreenSaverWayland
~MythScreenSaverWayland() override
Definition: mythscreensaverwayland.cpp:17
LOC
#define LOC
Definition: mythscreensaverwayland.cpp:8
MythWaylandDevice::m_surface
wl_surface * m_surface
Definition: mythwaylandextras.h:36
MythMainWindow::SignalWindowReady
void SignalWindowReady()
MythScreenSaverWayland::Asleep
bool Asleep() override
Definition: mythscreensaverwayland.cpp:82
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythScreenSaver
Base Class for screensavers.
Definition: mythscreensaver.h:14
mythlogging.h
MythWaylandDevice
A simple wrapper to retrieve the major Wayland objects from the Qt Wayland native interface.
Definition: mythwaylandextras.h:27
MythScreenSaverWayland::m_registry
MythWaylandRegistry m_registry
Definition: mythscreensaverwayland.h:29
MythScreenSaverWayland::m_manager
zwp_idle_inhibit_manager_v1 * m_manager
Definition: mythscreensaverwayland.h:31
mythscreensaverwayland.h
MythWaylandExtras::s_registryListener
static const struct wl_registry_listener s_registryListener
Definition: mythwaylandextras.h:24
MythScreenSaverWayland::m_window
MythMainWindow * m_window
Definition: mythscreensaverwayland.h:28
zwp_idle_inhibit_manager_v1_create_inhibitor
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)
Definition: idle_inhibit_unstable_v1.h:174
idle_inhibit_unstable_v1.c
MythScreenSaverWayland::Restore
void Restore() override
Definition: mythscreensaverwayland.cpp:69
MythScreenSaverWayland::m_inhibitor
zwp_idle_inhibitor_v1 * m_inhibitor
Definition: mythscreensaverwayland.h:32
MythScreenSaverWayland::Disable
void Disable() override
Definition: mythscreensaverwayland.cpp:61
idle_inhibit_unstable_v1.h
MythScreenSaverWayland::m_device
MythWaylandDevice * m_device
Definition: mythscreensaverwayland.h:30
MythScreenSaverWayland::MythScreenSaverWayland
MythScreenSaverWayland(QObject *Parent, MythMainWindow *MainWindow)
Definition: mythscreensaverwayland.cpp:10
MythWaylandDevice::m_display
wl_display * m_display
Definition: mythwaylandextras.h:34
zwp_idle_inhibit_manager_v1_destroy
static void zwp_idle_inhibit_manager_v1_destroy(struct zwp_idle_inhibit_manager_v1 *zwp_idle_inhibit_manager_v1)
Definition: idle_inhibit_unstable_v1.h:160
zwp_idle_inhibitor_v1_destroy
static void zwp_idle_inhibitor_v1_destroy(struct zwp_idle_inhibitor_v1 *zwp_idle_inhibitor_v1)
Definition: idle_inhibit_unstable_v1.h:218
mythmainwindow.h
MythScreenSaverWayland::Reset
void Reset() override
Definition: mythscreensaverwayland.cpp:77
MythMainWindow
Definition: mythmainwindow.h:35
zwp_idle_inhibit_manager_v1_interface
const struct wl_interface zwp_idle_inhibit_manager_v1_interface
Definition: idle_inhibit_unstable_v1.c:49
MythScreenSaverWayland::WindowReady
void WindowReady()
Signalled when MythMainWindow has completed initialisation.
Definition: mythscreensaverwayland.cpp:33