kwin/libinput/context.h
Vlad Zahorodnii 1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
2020-08-07 19:57:56 +00:00

69 lines
1.4 KiB
C++

/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*********************************************************************/
#ifndef KWIN_LIBINPUT_CONTEXT_H
#define KWIN_LIBINPUT_CONTEXT_H
#include <libinput.h>
namespace KWin
{
class Udev;
namespace LibInput
{
class Event;
class Context
{
public:
Context(const Udev &udev);
~Context();
bool assignSeat(const char *seat);
bool isValid() const {
return m_libinput != nullptr;
}
bool isSuspended() const {
return m_suspended;
}
int fileDescriptor();
void dispatch();
void suspend();
void resume();
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.
*/
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;
bool m_suspended;
};
}
}
#endif