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/qkmsvthandler.cpp | |
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/qkmsvthandler.cpp')
-rw-r--r-- | src/plugins/platforms/kms/qkmsvthandler.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
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 |