Add command line option to enable libinput support

kwin_wayland gains a new command line option to enable libinput support.
This is needed as logind blanks the VT when the session controller
releases the control. So a nested compositor can seriously affect the
primary session. Thus it needs a dedicated command line switch to
enable it.

By default libinput support is disabled for kwin_x11 and can be enabled
for kwin_wayland in case KWin is compiled with libinput support.
icc-effect-5.14.5
Martin Gräßlin 2014-08-15 14:03:52 +02:00
parent 6a032e78b7
commit 15a1a5b70f
4 changed files with 29 additions and 1 deletions

View File

@ -172,7 +172,7 @@ InputRedirection::InputRedirection(QObject *parent)
, m_shortcuts(new GlobalShortcutsManager(this))
{
#if HAVE_INPUT
if (kwinApp()->operationMode() != Application::OperationModeX11) {
if (Application::usesLibinput()) {
LogindIntegration *logind = LogindIntegration::self();
auto takeControl = [logind, this]() {
if (logind->hasSessionControl()) {
@ -199,6 +199,9 @@ InputRedirection::~InputRedirection()
void InputRedirection::setupLibInput()
{
#if HAVE_INPUT
if (!Application::usesLibinput()) {
return;
}
LibInput::Connection *conn = LibInput::Connection::create(this);
if (conn) {
// TODO: connect the motion notifiers

View File

@ -406,6 +406,18 @@ bool XcbEventFilter::nativeEventFilter(const QByteArray &eventType, void *messag
return Workspace::self()->workspaceEvent(static_cast<xcb_generic_event_t *>(message));
}
static bool s_useLibinput = false;
void Application::setUseLibinput(bool use)
{
s_useLibinput = use;
}
bool Application::usesLibinput()
{
return s_useLibinput;
}
} // namespace
#include "main.moc"

4
main.h
View File

@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MAIN_H
#include <kwinglobals.h>
#include <config-kwin.h>
#include <KSelectionWatcher>
#include <KSelectionOwner>
@ -113,6 +114,9 @@ public:
static void setupLocalizedString();
static void setupLoggingCategoryFilters();
static bool usesLibinput();
static void setUseLibinput(bool use);
protected:
Application(OperationMode mode, int &argc, char **argv);
virtual void performStartup() = 0;

View File

@ -238,10 +238,19 @@ KWIN_EXPORT int kdemain(int argc, char * argv[])
a.setupCommandLine(&parser);
parser.addOption(startXServerOption);
parser.addOption(x11DisplayOption);
#if HAVE_INPUT
QCommandLineOption libinputOption(QStringLiteral("libinput"),
i18n("Enable libinput support for input events processing. Note: never use in a nested session."));
parser.addOption(libinputOption);
#endif
parser.process(a);
a.processCommandLine(&parser);
#if HAVE_INPUT
KWin::Application::setUseLibinput(parser.isSet(libinputOption));
#endif
// perform sanity checks
// TODO: remove those two
if (a.platformName().toLower() != QStringLiteral("xcb")) {