Move Udev into an own header and implementation
For a DRM backend we also need Udev, so don't bundle with libinput.icc-effect-5.14.5
parent
7c747e1591
commit
e6b076df9c
|
@ -435,6 +435,13 @@ if(HAVE_WAYLAND)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(UDEV_FOUND)
|
||||
set(kwin_KDEINIT_SRCS
|
||||
${kwin_KDEINIT_SRCS}
|
||||
udev.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(HAVE_INPUT)
|
||||
set(kwin_KDEINIT_SRCS
|
||||
${kwin_KDEINIT_SRCS}
|
||||
|
@ -551,8 +558,12 @@ if(HAVE_WAYLAND)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(UDEV_FOUND)
|
||||
set(kwinLibs ${kwinLibs} ${UDEV_LIBS})
|
||||
endif()
|
||||
|
||||
if(HAVE_INPUT)
|
||||
set(kwinLibs ${kwinLibs} Libinput::Libinput ${UDEV_LIBS})
|
||||
set(kwinLibs ${kwinLibs} Libinput::Libinput)
|
||||
endif()
|
||||
|
||||
add_library(kwin SHARED ${kwin_KDEINIT_SRCS})
|
||||
|
|
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "context.h"
|
||||
#include "events.h"
|
||||
#include "../logind.h"
|
||||
#include "../udev.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QSocketNotifier>
|
||||
|
|
|
@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "context.h"
|
||||
#include "events.h"
|
||||
#include "../logind.h"
|
||||
#include "../udev.h"
|
||||
|
||||
#include <libudev.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
@ -31,18 +31,6 @@ namespace KWin
|
|||
namespace LibInput
|
||||
{
|
||||
|
||||
Udev::Udev()
|
||||
: m_udev(udev_new())
|
||||
{
|
||||
}
|
||||
|
||||
Udev::~Udev()
|
||||
{
|
||||
if (m_udev) {
|
||||
udev_unref(m_udev);
|
||||
}
|
||||
}
|
||||
|
||||
Context::Context(const Udev &udev)
|
||||
: m_libinput(libinput_udev_create_context(&Context::s_interface, this, udev))
|
||||
, m_suspended(false)
|
||||
|
|
|
@ -22,34 +22,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <libinput.h>
|
||||
|
||||
struct udev;
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
class Udev;
|
||||
|
||||
namespace LibInput
|
||||
{
|
||||
|
||||
class Event;
|
||||
|
||||
class Udev
|
||||
{
|
||||
public:
|
||||
Udev();
|
||||
~Udev();
|
||||
|
||||
bool isValid() const {
|
||||
return m_udev != nullptr;
|
||||
}
|
||||
operator udev*() const {
|
||||
return m_udev;
|
||||
}
|
||||
operator udev*() {
|
||||
return m_udev;
|
||||
}
|
||||
private:
|
||||
struct udev *m_udev;
|
||||
};
|
||||
|
||||
class Context
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -25,6 +25,7 @@ if (HAVE_INPUT)
|
|||
${KWIN_SOURCE_DIR}/libinput/connection.cpp
|
||||
${KWIN_SOURCE_DIR}/libinput/events.cpp
|
||||
${KWIN_SOURCE_DIR}/logind.cpp
|
||||
${KWIN_SOURCE_DIR}/udev.cpp
|
||||
)
|
||||
add_executable(libinputtest ${libinputtest_SRCS})
|
||||
target_link_libraries(libinputtest Qt5::Core Qt5::DBus Libinput::Libinput ${UDEV_LIBS} KF5::WindowSystem)
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "udev.h"
|
||||
#include <libudev.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
Udev::Udev()
|
||||
: m_udev(udev_new())
|
||||
{
|
||||
}
|
||||
|
||||
Udev::~Udev()
|
||||
{
|
||||
if (m_udev) {
|
||||
udev_unref(m_udev);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#ifndef KWIN_UDEV_H
|
||||
#define KWIN_UDEV_H
|
||||
|
||||
struct udev;
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
class Udev
|
||||
{
|
||||
public:
|
||||
Udev();
|
||||
~Udev();
|
||||
|
||||
bool isValid() const {
|
||||
return m_udev != nullptr;
|
||||
}
|
||||
operator udev*() const {
|
||||
return m_udev;
|
||||
}
|
||||
operator udev*() {
|
||||
return m_udev;
|
||||
}
|
||||
private:
|
||||
struct udev *m_udev;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue