2014-08-14 12:43:57 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
2020-08-02 22:10:35 +00:00
|
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
2014-08-14 12:43:57 +00:00
|
|
|
|
2020-08-02 22:10:35 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
2014-08-14 12:43:57 +00:00
|
|
|
*********************************************************************/
|
|
|
|
#ifndef KWIN_LIBINPUT_CONTEXT_H
|
|
|
|
#define KWIN_LIBINPUT_CONTEXT_H
|
|
|
|
|
|
|
|
#include <libinput.h>
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2015-04-08 08:25:51 +00:00
|
|
|
class Udev;
|
2014-08-14 12:43:57 +00:00
|
|
|
|
2015-04-08 08:25:51 +00:00
|
|
|
namespace LibInput
|
2014-08-14 12:43:57 +00:00
|
|
|
{
|
|
|
|
|
2015-04-08 08:25:51 +00:00
|
|
|
class Event;
|
2014-08-14 12:43:57 +00:00
|
|
|
|
|
|
|
class Context
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Context(const Udev &udev);
|
|
|
|
~Context();
|
|
|
|
bool assignSeat(const char *seat);
|
|
|
|
bool isValid() const {
|
|
|
|
return m_libinput != nullptr;
|
|
|
|
}
|
2015-03-31 07:16:16 +00:00
|
|
|
bool isSuspended() const {
|
|
|
|
return m_suspended;
|
|
|
|
}
|
2014-08-14 12:43:57 +00:00
|
|
|
|
|
|
|
int fileDescriptor();
|
|
|
|
void dispatch();
|
2014-08-15 10:51:31 +00:00
|
|
|
void suspend();
|
|
|
|
void resume();
|
2014-08-14 12:43:57 +00:00
|
|
|
|
|
|
|
operator libinput*() {
|
|
|
|
return m_libinput;
|
|
|
|
}
|
|
|
|
operator libinput*() const {
|
|
|
|
return m_libinput;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the next event, if there is no new event @c null is returned.
|
|
|
|
* The caller takes ownership of the returned pointer.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2014-08-14 12:43:57 +00:00
|
|
|
Event *event();
|
|
|
|
|
|
|
|
static int openRestrictedCallback(const char *path, int flags, void *user_data);
|
|
|
|
static void closeRestrictedCallBack(int fd, void *user_data);
|
|
|
|
static const struct libinput_interface s_interface;
|
|
|
|
|
|
|
|
private:
|
|
|
|
int openRestricted(const char *path, int flags);
|
|
|
|
void closeRestricted(int fd);
|
|
|
|
struct libinput *m_libinput;
|
2014-08-15 10:51:31 +00:00
|
|
|
bool m_suspended;
|
2014-08-14 12:43:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|