26static void libinputLogHandler(
libinput *
libinput, libinput_log_priority priority,
const char *
format, va_list args)
29 if (std::vsnprintf(buf, 1023,
format, args) <= 0) {
33 case LIBINPUT_LOG_PRIORITY_DEBUG:
34 qCDebug(KWIN_LIBINPUT) <<
"Libinput:" << buf;
36 case LIBINPUT_LOG_PRIORITY_INFO:
37 qCInfo(KWIN_LIBINPUT) <<
"Libinput:" << buf;
39 case LIBINPUT_LOG_PRIORITY_ERROR:
41 qCCritical(KWIN_LIBINPUT) <<
"Libinput:" << buf;
50 , m_udev(std::move(udev))
89const struct libinput_interface
Context::s_interface = {
90 Context::openRestrictedCallback,
91 Context::closeRestrictedCallBack,
96 return ((
Context *)user_data)->openRestricted(path, flags);
101 ((
Context *)user_data)->closeRestricted(fd);
104int Context::openRestricted(
const char *path,
int flags)
112 int fl = fcntl(fd, F_GETFL);
113 auto errorHandling = [fd,
this]() {
122 if (flags & O_NONBLOCK) {
126 if (fcntl(fd, F_SETFL, fl) < 0) {
131 fl = fcntl(fd, F_GETFD);
137 if (!(flags & O_CLOEXEC)) {
141 if (fcntl(fd, F_SETFD, fl) < 0) {
148void Context::closeRestricted(
int fd)
virtual int openRestricted(const QString &fileName)=0
virtual QString seat() const =0
virtual void closeRestricted(int fileDescriptor)=0
Context(Session *session, std::unique_ptr< Udev > &&udev)
static int openRestrictedCallback(const char *path, int flags, void *user_data)
Session * session() const
std::unique_ptr< Event > event()
static void closeRestrictedCallBack(int fd, void *user_data)