diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2012-07-25 12:02:23 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-25 14:50:35 +0200 |
commit | 06e8682cb7c29d15a2c49fbc442a1a4509876abb (patch) | |
tree | bf4d4bafbb703c3ed50c2fcf4059d53ec1929ff4 /src/plugins/platforms/kms | |
parent | 8cbd591c2b719bdee7f895ffff0104cdf88e27ac (diff) |
Disable tty keyboard in kms
Set QT_KMS_TTYKBD=1 to prevent this and keep vt switching, ctrl-c,
input appearing on the tty, etc. working.
Change-Id: I0071685205ae9e02536dcb71f6fef6495c48f8fb
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/plugins/platforms/kms')
-rw-r--r-- | src/plugins/platforms/kms/kms.pro | 6 | ||||
-rw-r--r-- | src/plugins/platforms/kms/qkmsintegration.cpp | 3 | ||||
-rw-r--r-- | src/plugins/platforms/kms/qkmsintegration.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/kms/qkmsvthandler.cpp | 77 | ||||
-rw-r--r-- | src/plugins/platforms/kms/qkmsvthandler.h | 64 |
5 files changed, 150 insertions, 2 deletions
diff --git a/src/plugins/platforms/kms/kms.pro b/src/plugins/platforms/kms/kms.pro index 4a50569aa7..2e8af5ba9d 100644 --- a/src/plugins/platforms/kms/kms.pro +++ b/src/plugins/platforms/kms/kms.pro @@ -21,7 +21,8 @@ SOURCES = main.cpp \ qkmsnativeinterface.cpp \ qkmsudevlistener.cpp \ qkmsudevhandler.cpp \ - qkmsudevdrmhandler.cpp + qkmsudevdrmhandler.cpp \ + qkmsvthandler.cpp HEADERS = qkmsintegration.h \ qkmsscreen.h \ qkmscontext.h \ @@ -32,7 +33,8 @@ HEADERS = qkmsintegration.h \ qkmsnativeinterface.h \ qkmsudevlistener.h \ qkmsudevhandler.h \ - qkmsudevdrmhandler.h + qkmsudevdrmhandler.h \ + qkmsvthandler.h target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/kms/qkmsintegration.cpp b/src/plugins/platforms/kms/qkmsintegration.cpp index c1e1f0d576..5e8c28effe 100644 --- a/src/plugins/platforms/kms/qkmsintegration.cpp +++ b/src/plugins/platforms/kms/qkmsintegration.cpp @@ -48,6 +48,7 @@ #include "qkmsnativeinterface.h" #include "qkmsudevlistener.h" #include "qkmsudevdrmhandler.h" +#include "qkmsvthandler.h" #include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> #include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h> @@ -66,6 +67,7 @@ QKmsIntegration::QKmsIntegration() { QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher); setenv("EGL_PLATFORM", "drm",1); + m_vtHandler = new QKmsVTHandler; m_drmHandler = new QKmsUdevDRMHandler(this); m_udevListener->addHandler(m_drmHandler); } @@ -80,6 +82,7 @@ QKmsIntegration::~QKmsIntegration() } delete m_fontDatabase; delete m_udevListener; + delete m_vtHandler; } QObject *QKmsIntegration::createDevice(const char *path) diff --git a/src/plugins/platforms/kms/qkmsintegration.h b/src/plugins/platforms/kms/qkmsintegration.h index 93b3084e9b..034fd1090f 100644 --- a/src/plugins/platforms/kms/qkmsintegration.h +++ b/src/plugins/platforms/kms/qkmsintegration.h @@ -51,6 +51,7 @@ class QKmsScreen; class QKmsDevice; class QKmsUdevListener; class QKmsUdevDRMHandler; +class QKmsVTHandler; class QKmsIntegration : public QPlatformIntegration { @@ -82,6 +83,7 @@ private: QPlatformNativeInterface *m_nativeInterface; QKmsUdevListener *m_udevListener; QKmsUdevDRMHandler *m_drmHandler; + QKmsVTHandler *m_vtHandler; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/kms/qkmsvthandler.cpp b/src/plugins/platforms/kms/qkmsvthandler.cpp new file mode 100644 index 0000000000..88ca4bfeed --- /dev/null +++ b/src/plugins/platforms/kms/qkmsvthandler.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qkmsvthandler.h> +#include <sys/ioctl.h> +#include <linux/vt.h> +#include <linux/kd.h> +#include <QDebug> + +#ifdef K_OFF +#define KBD_OFF_MODE K_OFF +#else +#define KBD_OFF_MODE K_RAW +#endif + +QT_BEGIN_NAMESPACE + +QKmsVTHandler::QKmsVTHandler(QObject *parent) + : QObject(parent), m_tty(-1) +{ + if (!isatty(0)) + return; + + m_tty = 0; + + ioctl(m_tty, KDGKBMODE, &m_oldKbdMode); + if (!qgetenv("QT_KMS_TTYKBD").toInt()) + ioctl(m_tty, KDSKBMODE, KBD_OFF_MODE); +} + +QKmsVTHandler::~QKmsVTHandler() +{ + if (m_tty == -1) + return; + + ioctl(m_tty, KDSKBMODE, m_oldKbdMode); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/kms/qkmsvthandler.h b/src/plugins/platforms/kms/qkmsvthandler.h new file mode 100644 index 0000000000..311ea2432a --- /dev/null +++ b/src/plugins/platforms/kms/qkmsvthandler.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKMSVTHANDLER_H +#define QKMSVTHANDLER_H + +#include <QObject> + +QT_BEGIN_NAMESPACE + +class QKmsVTHandler : public QObject +{ + Q_OBJECT + +public: + QKmsVTHandler(QObject *parent = 0); + ~QKmsVTHandler(); + +private: + int m_tty; + int m_oldKbdMode; +}; + +QT_END_NAMESPACE + +#endif |