File indexing completed on 2024-05-19 05:32:35

0001 /*
0002     SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 #pragma once
0007 
0008 #include "kwin_export.h"
0009 
0010 #include <QObject>
0011 
0012 struct wl_resource;
0013 
0014 namespace KWin
0015 {
0016 class Display;
0017 class IdleInterfacePrivate;
0018 
0019 /**
0020  * @brief Global representing the org_kde_kwin_idle interface.
0021  *
0022  * The IdleInterface allows to register callbacks which are invoked if there has
0023  * not been any user activity (no input) for a specified time span on a seat.
0024  *
0025  * A client can bind an idle timeout for a SeatInterface and through that register
0026  * an idle timeout. The complete interaction is handled internally, thus the API
0027  * user only needs to create the IdleInterface in order to provide this feature.
0028  *
0029  * This interface is useful for clients as it allows them to perform power management,
0030  * chat applications might want to set to away after no user input for some time, etc.
0031  *
0032  * Of course this exposes the global input usage to all clients. Normally clients don't
0033  * know whether the input devices are used, only if their surfaces have focus. With this
0034  * interface it is possible to notice that there are input events. A server should consider
0035  * this to decide whether it wants to provide this feature!
0036  */
0037 class KWIN_EXPORT IdleInterface : public QObject
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     explicit IdleInterface(Display *display, QObject *parent = nullptr);
0043     ~IdleInterface() override;
0044 
0045 private:
0046     std::unique_ptr<IdleInterfacePrivate> d;
0047 };
0048 
0049 }