summaryrefslogtreecommitdiff
path: root/src/gui/embedded
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-07-24 11:45:33 +0200
committerJason Barron <jbarron@trolltech.com>2009-07-27 15:04:30 +0200
commit3643028959f0b38350e57e60ba4000435b75e592 (patch)
treec129e4dee11487abd437ab8ebd993ba261e06fa6 /src/gui/embedded
parentcf66c667a97c0079141eb3f2d9e997b7378ae792 (diff)
parentc36139c665e61866aff4bf8572890a735167a7d0 (diff)
downloadqt4-tools-3643028959f0b38350e57e60ba4000435b75e592.tar.gz
Merge commit 'qt/master-stable'
Conflicts: configure.exe qmake/Makefile.unix qmake/generators/makefile.cpp src/corelib/global/qglobal.h src/corelib/kernel/kernel.pri src/corelib/kernel/qcoreevent.cpp src/corelib/kernel/qsharedmemory_unix.cpp src/gui/graphicsview/qgraphicsscene.cpp src/gui/kernel/qaction.cpp src/gui/kernel/qaction.h src/gui/kernel/qaction_p.h src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication.h src/gui/kernel/qwidget.cpp src/gui/kernel/qwidget.h src/gui/kernel/qwidget_mac.mm src/gui/painting/qgraphicssystemfactory.cpp src/gui/styles/qwindowsstyle.cpp src/gui/text/qfontengine_qpf.cpp src/gui/widgets/qabstractscrollarea_p.h src/network/access/qnetworkaccessdebugpipebackend.cpp src/network/socket/qlocalsocket_unix.cpp src/network/socket/qnativesocketengine_p.h src/network/socket/qnativesocketengine_unix.cpp src/openvg/qpaintengine_vg.cpp tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp tests/auto/qcssparser/qcssparser.pro tests/auto/qdir/tst_qdir.cpp tests/auto/qfile/tst_qfile.cpp tests/auto/qobject/tst_qobject.cpp tests/auto/qpathclipper/qpathclipper.pro tests/auto/qprocess/tst_qprocess.cpp tests/auto/qsettings/tst_qsettings.cpp tests/auto/qsharedpointer/qsharedpointer.pro tests/auto/qsqlquerymodel/qsqlquerymodel.pro tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro tests/auto/qsqltablemodel/qsqltablemodel.pro tests/auto/qsqlthread/qsqlthread.pro tests/auto/qwidget/tst_qwidget.cpp
Diffstat (limited to 'src/gui/embedded')
-rw-r--r--src/gui/embedded/embedded.pri40
-rw-r--r--src/gui/embedded/qkbd_qws.cpp8
-rw-r--r--src/gui/embedded/qkbddriverfactory_qws.cpp24
-rw-r--r--src/gui/embedded/qkbdlinuxinput_qws.cpp14
-rw-r--r--src/gui/embedded/qkbdsl5000_qws.cpp365
-rw-r--r--src/gui/embedded/qkbdsl5000_qws.h92
-rw-r--r--src/gui/embedded/qkbdtty_qws.cpp18
-rw-r--r--src/gui/embedded/qkbdvfb_qws.cpp9
-rw-r--r--src/gui/embedded/qkbdvr41xx_qws.cpp185
-rw-r--r--src/gui/embedded/qkbdvr41xx_qws.h73
-rw-r--r--src/gui/embedded/qkbdyopy_qws.cpp209
-rw-r--r--src/gui/embedded/qkbdyopy_qws.h73
-rw-r--r--src/gui/embedded/qlock.cpp6
-rw-r--r--src/gui/embedded/qmousebus_qws.cpp238
-rw-r--r--src/gui/embedded/qmousedriverfactory_qws.cpp34
-rw-r--r--src/gui/embedded/qmouselinuxinput_qws.cpp205
-rw-r--r--src/gui/embedded/qmouselinuxinput_qws.h (renamed from src/gui/embedded/qmousebus_qws.h)30
-rw-r--r--src/gui/embedded/qmouselinuxtp_qws.cpp7
-rw-r--r--src/gui/embedded/qmousepc_qws.cpp39
-rw-r--r--src/gui/embedded/qmousevfb_qws.cpp9
-rw-r--r--src/gui/embedded/qmousevr41xx_qws.cpp250
-rw-r--r--src/gui/embedded/qmousevr41xx_qws.h80
-rw-r--r--src/gui/embedded/qmouseyopy_qws.cpp184
-rw-r--r--src/gui/embedded/qmouseyopy_qws.h80
-rw-r--r--src/gui/embedded/qscreenlinuxfb_qws.cpp20
-rw-r--r--src/gui/embedded/qscreenproxy_qws.cpp8
-rw-r--r--src/gui/embedded/qsoundqss_qws.cpp9
-rw-r--r--src/gui/embedded/qtransportauth_qws.cpp7
-rw-r--r--src/gui/embedded/qunixsocket.cpp18
29 files changed, 334 insertions, 2000 deletions
diff --git a/src/gui/embedded/embedded.pri b/src/gui/embedded/embedded.pri
index 4a9aa3f2f7..53a2512937 100644
--- a/src/gui/embedded/embedded.pri
+++ b/src/gui/embedded/embedded.pri
@@ -141,15 +141,7 @@ embedded {
!contains( kbd-drivers, qvfb ) {
kbd-drivers += qvfb
}
- }
-
- contains( kbd-drivers, sl5000 ) {
- HEADERS +=embedded/qkbdsl5000_qws.h
- SOURCES +=embedded/qkbdsl5000_qws.cpp
- !contains( kbd-drivers, tty ) {
- kbd-drivers += tty
- }
- }
+ }
contains( kbd-drivers, tty ) {
HEADERS +=embedded/qkbdtty_qws.h
@@ -166,16 +158,6 @@ embedded {
SOURCES +=embedded/qkbdum_qws.cpp
}
- contains( kbd-drivers, yopy ) {
- HEADERS +=embedded/qkbdyopy_qws.h
- SOURCES +=embedded/qkbdyopy_qws.cpp
- }
-
- contains( kbd-drivers, vr41xx ) {
- HEADERS +=embedded/qkbdvr41xx_qws.h
- SOURCES +=embedded/qkbdvr41xx_qws.cpp
- }
-
#
# Mouse drivers
#
@@ -189,29 +171,19 @@ embedded {
SOURCES +=embedded/qmousepc_qws.cpp
}
- contains( mouse-drivers, bus ) {
- HEADERS +=embedded/qmousebus_qws.h
- SOURCES +=embedded/qmousebus_qws.cpp
- }
-
contains( mouse-drivers, linuxtp ) {
HEADERS +=embedded/qmouselinuxtp_qws.h
SOURCES +=embedded/qmouselinuxtp_qws.cpp
}
- contains( mouse-drivers, vr41xx ) {
- HEADERS +=embedded/qmousevr41xx_qws.h
- SOURCES +=embedded/qmousevr41xx_qws.cpp
- }
-
- contains( mouse-drivers, yopy ) {
- HEADERS +=embedded/qmouseyopy_qws.h
- SOURCES +=embedded/qmouseyopy_qws.cpp
- }
-
contains( mouse-drivers, tslib ) {
LIBS += -lts
HEADERS +=embedded/qmousetslib_qws.h
SOURCES +=embedded/qmousetslib_qws.cpp
}
+
+ contains( mouse-drivers, linuxinput ) {
+ HEADERS +=embedded/qmouselinuxinput_qws.h
+ SOURCES +=embedded/qmouselinuxinput_qws.cpp
+ }
}
diff --git a/src/gui/embedded/qkbd_qws.cpp b/src/gui/embedded/qkbd_qws.cpp
index 7799339a38..756a398376 100644
--- a/src/gui/embedded/qkbd_qws.cpp
+++ b/src/gui/embedded/qkbd_qws.cpp
@@ -453,8 +453,9 @@ void QWSKeyboardHandler::endAutoRepeat()
Maps \a keycode according to a keymap and sends that key event to the
\l{Qt for Embedded Linux} server application.
- Please see the QWS_KEYBOARD documentation for a description on how to
- create and use keymap files.
+ Please see the \l{Qt for Embedded Linux Character Input} and the \l
+ {kmap2qmap} documentations for a description on how to create and use
+ keymap files.
The key event is identified by its \a keycode value and the \a isPress
and \a autoRepeat parameters.
@@ -475,9 +476,6 @@ void QWSKeyboardHandler::endAutoRepeat()
implementation needs to take care of a special action, like console
switching or LED handling.
- Standard Linux console keymaps can be found at the
- \l {http://lct.sourceforege.net}{LCT project}
-
If standard Linux console keymaps are used, \a keycode must be one of the
standardized values defined in \c /usr/include/linux/input.h
diff --git a/src/gui/embedded/qkbddriverfactory_qws.cpp b/src/gui/embedded/qkbddriverfactory_qws.cpp
index c599396847..b77eb72faa 100644
--- a/src/gui/embedded/qkbddriverfactory_qws.cpp
+++ b/src/gui/embedded/qkbddriverfactory_qws.cpp
@@ -47,10 +47,7 @@
#include "qkbdtty_qws.h"
#include "qkbdlinuxinput_qws.h"
#include "qkbdum_qws.h"
-#include "qkbdsl5000_qws.h"
#include "qkbdvfb_qws.h"
-#include "qkbdyopy_qws.h"
-#include "qkbdvr41xx_qws.h"
#include <stdlib.h>
#include "private/qfactoryloader_p.h"
#include "qkbddriverplugin_qws.h"
@@ -104,18 +101,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
QWSKeyboardHandler *QKbdDriverFactory::create(const QString& key, const QString& device)
{
QString driver = key.toLower();
-#ifndef QT_NO_QWS_KBD_SL5000
- if (driver == QLatin1String("sl5000") || driver.isEmpty())
- return new QWSSL5000KeyboardHandler(device);
-#endif
-#ifndef QT_NO_QWS_KBD_YOPY
- if (driver == QLatin1String("yopy") || driver.isEmpty())
- return new QWSYopyKeyboardHandler(device);
-#endif
-#ifndef QT_NO_QWS_KBD_VR41XX
- if (driver == QLatin1String("vr41xx") || driver.isEmpty())
- return new QWSVr41xxKeyboardHandler(device);
-#endif
#ifndef QT_NO_QWS_KEYBOARD
# ifndef QT_NO_QWS_KBD_TTY
if (driver == QLatin1String("tty") || driver.isEmpty())
@@ -158,15 +143,6 @@ QStringList QKbdDriverFactory::keys()
{
QStringList list;
-#ifndef QT_NO_QWS_KBD_SL5000
- list << QLatin1String("SL5000");
-#endif
-#ifndef QT_NO_QWS_KBD_YOPY
- list << QLatin1String("YOPY");
-#endif
-#ifndef QT_NO_QWS_KBD_VR41XX
- list << QLatin1String("VR41xx");
-#endif
#ifndef QT_NO_QWS_KBD_TTY
list << QLatin1String("TTY");
#endif
diff --git a/src/gui/embedded/qkbdlinuxinput_qws.cpp b/src/gui/embedded/qkbdlinuxinput_qws.cpp
index d5720f7d1b..6aa6633c13 100644
--- a/src/gui/embedded/qkbdlinuxinput_qws.cpp
+++ b/src/gui/embedded/qkbdlinuxinput_qws.cpp
@@ -47,6 +47,7 @@
#include <QStringList>
#include <qplatformdefs.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <errno.h>
#include <termios.h>
@@ -75,6 +76,7 @@ private:
int m_fd;
int m_tty_fd;
struct termios m_tty_attr;
+ int m_orig_kbmode;
};
QWSLinuxInputKeyboardHandler::QWSLinuxInputKeyboardHandler(const QString &device)
@@ -94,8 +96,7 @@ bool QWSLinuxInputKeyboardHandler::filterInputEvent(quint16 &, qint32 &)
}
QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h, const QString &device)
- : m_handler(h), m_fd(-1), m_tty_fd(-1)
-
+ : m_handler(h), m_fd(-1), m_tty_fd(-1), m_orig_kbmode(K_XLATE)
{
setObjectName(QLatin1String("LinuxInputSubsystem Keyboard Handler"));
@@ -134,7 +135,10 @@ QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h,
struct ::termios termdata;
tcgetattr(m_tty_fd, &termdata);
- // setting this tranlation mode is also needed in INPUT mode to prevent
+ // record the original mode so we can restore it again in the destructor.
+ ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode);
+
+ // setting this tranlation mode is even needed in INPUT mode to prevent
// the shell from also interpreting codes, if the process has a tty
// attached: e.g. Ctrl+C wouldn't copy, but kill the application.
::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW);
@@ -151,7 +155,7 @@ QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h,
tcsetattr(m_tty_fd, TCSANOW, &termdata);
}
} else {
- qWarning("Cannot open input device '%s': %s", qPrintable(dev), strerror(errno));
+ qWarning("Cannot open keyboard input device '%s': %s", qPrintable(dev), strerror(errno));
return;
}
}
@@ -159,7 +163,7 @@ QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h,
QWSLinuxInputKbPrivate::~QWSLinuxInputKbPrivate()
{
if (m_tty_fd >= 0) {
- ::ioctl(m_tty_fd, KDSKBMODE, K_XLATE);
+ ::ioctl(m_tty_fd, KDSKBMODE, m_orig_kbmode);
tcsetattr(m_tty_fd, TCSANOW, &m_tty_attr);
}
if (m_fd >= 0)
diff --git a/src/gui/embedded/qkbdsl5000_qws.cpp b/src/gui/embedded/qkbdsl5000_qws.cpp
deleted file mode 100644
index 36cb9030c9..0000000000
--- a/src/gui/embedded/qkbdsl5000_qws.cpp
+++ /dev/null
@@ -1,365 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.0, 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.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkbdsl5000_qws.h"
-
-#ifndef QT_NO_QWS_KBD_SL5000
-
-#include "qwindowsystem_qws.h"
-#include "qwsutils_qws.h"
-#include "qscreen_qws.h"
-
-#include "qapplication.h"
-#include "qnamespace.h"
-#include "qtimer.h"
-
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-
-#include <asm/sharp_char.h>
-
-#include <string.h>
-
-QT_BEGIN_NAMESPACE
-
-static const QWSKeyMap sl5000KeyMap[] = {
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 00
- { Qt::Key_A, 'a' , 'A' , 'A'-64 }, // 01
- { Qt::Key_B, 'b' , 'B' , 'B'-64 }, // 02
- { Qt::Key_C, 'c' , 'C' , 'C'-64 }, // 03
- { Qt::Key_D, 'd' , 'D' , 'D'-64 }, // 04
- { Qt::Key_E, 'e' , 'E' , 'E'-64 }, // 05
- { Qt::Key_F, 'f' , 'F' , 'F'-64 }, // 06
- { Qt::Key_G, 'g' , 'G' , 'G'-64 }, // 07
- { Qt::Key_H, 'h' , 'H' , 'H'-64 }, // 08
- { Qt::Key_I, 'i' , 'I' , 'I'-64 }, // 09
- { Qt::Key_J, 'j' , 'J' , 'J'-64 }, // 0a 10
- { Qt::Key_K, 'k' , 'K' , 'K'-64 }, // 0b
- { Qt::Key_L, 'l' , 'L' , 'L'-64 }, // 0c
- { Qt::Key_M, 'm' , 'M' , 'M'-64 }, // 0d
- { Qt::Key_N, 'n' , 'N' , 'N'-64 }, // 0e
- { Qt::Key_O, 'o' , 'O' , 'O'-64 }, // 0f
- { Qt::Key_P, 'p' , 'P' , 'P'-64 }, // 10
- { Qt::Key_Q, 'q' , 'Q' , 'Q'-64 }, // 11
- { Qt::Key_R, 'r' , 'R' , 'R'-64 }, // 12
- { Qt::Key_S, 's' , 'S' , 'S'-64 }, // 13
- { Qt::Key_T, 't' , 'T' , 'T'-64 }, // 14 20
- { Qt::Key_U, 'u' , 'U' , 'U'-64 }, // 15
- { Qt::Key_V, 'v' , 'V' , 'V'-64 }, // 16
- { Qt::Key_W, 'w' , 'W' , 'W'-64 }, // 17
- { Qt::Key_X, 'x' , 'X' , 'X'-64 }, // 18
- { Qt::Key_Y, 'y' , 'Y' , 'Y'-64 }, // 19
- { Qt::Key_Z, 'z' , 'Z' , 'Z'-64 }, // 1a
- { Qt::Key_Shift, 0xffff , 0xffff , 0xffff }, // 1b
- { Qt::Key_Return, 13 , 13 , 0xffff }, // 1c
- { Qt::Key_F11, 0xffff , 0xffff , 0xffff }, // 1d todo
- { Qt::Key_F22, 0xffff , 0xffff , 0xffff }, // 1e 30
- { Qt::Key_Backspace, 8 , 8 , 0xffff }, // 1f
- { Qt::Key_F31, 0xffff , 0xffff , 0xffff }, // 20
- { Qt::Key_F35, 0xffff , 0xffff , 0xffff }, // 21 light
- { Qt::Key_Escape, 0xffff , 0xffff , 0xffff }, // 22
-
- // Direction key code are for *UNROTATED* display.
- { Qt::Key_Up, 0xffff , 0xffff , 0xffff }, // 23
- { Qt::Key_Right, 0xffff , 0xffff , 0xffff }, // 24
- { Qt::Key_Left, 0xffff , 0xffff , 0xffff }, // 25
- { Qt::Key_Down, 0xffff , 0xffff , 0xffff }, // 26
-
- { Qt::Key_F33, 0xffff , 0xffff , 0xffff }, // 27 OK
- { Qt::Key_F12, 0xffff , 0xffff , 0xffff }, // 28 40 home
- { Qt::Key_1, '1' , 'q' , 'Q'-64 }, // 29
- { Qt::Key_2, '2' , 'w' , 'W'-64 }, // 2a
- { Qt::Key_3, '3' , 'e' , 'E'-64 }, // 2b
- { Qt::Key_4, '4' , 'r' , 'R'-64 }, // 2c
- { Qt::Key_5, '5' , 't' , 'T'-64 }, // 2d
- { Qt::Key_6, '6' , 'y' , 'Y'-64 }, // 2e
- { Qt::Key_7, '7' , 'u' , 'U'-64 }, // 2f
- { Qt::Key_8, '8' , 'i' , 'I'-64 }, // 30
- { Qt::Key_9, '9' , 'o' , 'O'-64 }, // 31
- { Qt::Key_0, '0' , 'p' , 'P'-64 }, // 32 50
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 33
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 34
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 35
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 36
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 37
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 38
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 39
- { Qt::Key_Minus, '-' , 'b' , 'B'-64 }, // 3a
- { Qt::Key_Plus, '+' , 'n' , 'N'-64 }, // 3b
- { Qt::Key_CapsLock, 0xffff , 0xffff , 0xffff }, // 3c 60
- { Qt::Key_At, '@' , 's' , 'S'-64 }, // 3d
- { Qt::Key_Question, '?' , '?' , 0xffff }, // 3e
- { Qt::Key_Comma, ',' , ',' , 0xffff }, // 3f
- { Qt::Key_Period, '.' , '.' , 0xffff }, // 40
- { Qt::Key_Tab, 9 , '\\' , 0xffff }, // 41
- { Qt::Key_X, 0xffff , 'x' , 'X'-64 }, // 42
- { Qt::Key_C, 0xffff , 'c' , 'C'-64 }, // 43
- { Qt::Key_V, 0xffff , 'v' , 'V'-64 }, // 44
- { Qt::Key_Slash, '/' , '/' , 0xffff }, // 45
- { Qt::Key_Apostrophe, '\'' , '\'' , 0xffff }, // 46 70
- { Qt::Key_Semicolon, ';' , ';' , 0xffff }, // 47
- { Qt::Key_QuoteDbl, '\"' , '\"' , 0xffff }, // 48
- { Qt::Key_Colon, ':' , ':' , 0xffff }, // 49
- { Qt::Key_NumberSign, '#' , 'd' , 'D'-64 }, // 4a
- { Qt::Key_Dollar, '$' , 'f' , 'F'-64 }, // 4b
- { Qt::Key_Percent, '%' , 'g' , 'G'-64 }, // 4c
- { Qt::Key_Underscore, '_' , 'h' , 'H'-64 }, // 4d
- { Qt::Key_Ampersand, '&' , 'j' , 'J'-64 }, // 4e
- { Qt::Key_Asterisk, '*' , 'k' , 'K'-64 }, // 4f
- { Qt::Key_ParenLeft, '(' , 'l' , 'L'-64 }, // 50 80
- { Qt::Key_Delete, '[' , '[' , '[' }, // 51
- { Qt::Key_Z, 0xffff , 'z' , 'Z'-64 }, // 52
- { Qt::Key_Equal, '=' , 'm' , 'M'-64 }, // 53
- { Qt::Key_ParenRight, ')' , ']' , ']' }, // 54
- { Qt::Key_AsciiTilde, '~' , '^' , '^' }, // 55
- { Qt::Key_Less, '<' , '{' , '{' }, // 56
- { Qt::Key_Greater, '>' , '}' , '}' }, // 57
- { Qt::Key_F9, 0xffff , 0xffff , 0xffff }, // 58 datebook
- { Qt::Key_F10, 0xffff , 0xffff , 0xffff }, // 59 address
- { Qt::Key_F13, 0xffff , 0xffff , 0xffff }, // 5a 90 email
- { Qt::Key_F30, ' ' , ' ' , 0xffff }, // 5b select
- { Qt::Key_Space, ' ' , '|' , '`' }, // 5c
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 5d
- { Qt::Key_Exclam, '!' , 'a' , 'A'-64 }, // 5e
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 5f
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 60
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 61
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 62
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 63
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 64
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 65
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 66
- { Qt::Key_Meta, 0xffff , 0xffff , 0xffff }, // 67
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 68
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 69
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 6a
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 6b
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 6c
- { Qt::Key_F34, 0xffff , 0xffff , 0xffff }, // 6d power
- { Qt::Key_F13, 0xffff , 0xffff , 0xffff }, // 6e mail long
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 6f
- { Qt::Key_NumLock, 0xffff , 0xffff , 0xffff }, // 70
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 71
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 72
- { 0x20ac, 0xffff , 0x20ac , 0x20ac }, // 73 Euro sign
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 74
- { Qt::Key_F32, 0xffff , 0xffff , 0xffff }, // 75 Sync
- { 0, 0xffff , 0xffff , 0xffff }
-};
-
-static const int keyMSize = sizeof(sl5000KeyMap)/sizeof(QWSKeyMap)-1;
-
-QWSSL5000KeyboardHandler::QWSSL5000KeyboardHandler(const QString &device)
- : QWSTtyKeyboardHandler(device)
-{
- shift = false;
- alt = false;
- ctrl = false;
- extended = 0;
- prevuni = 0;
- prevkey = 0;
- caps = false;
- meta = false;
- fn = false;
- numLock = false;
-
- sharp_kbdctl_modifstat st;
- int dev = ::open(device.isEmpty()?"/dev/sharp_kbdctl":device.toLocal8Bit().constData(), O_RDWR);
- if (dev >= 0) {
- memset(&st, 0, sizeof(st));
- st.which = 3;
- int ret = ioctl(dev, SHARP_KBDCTL_GETMODIFSTAT, (char*)&st);
- if(!ret)
- numLock = (bool)st.stat;
- ::close(dev);
- }
-}
-
-QWSSL5000KeyboardHandler::~QWSSL5000KeyboardHandler()
-{
-}
-
-const QWSKeyMap *QWSSL5000KeyboardHandler::keyMap() const
-{
- return sl5000KeyMap;
-}
-
-bool QWSSL5000KeyboardHandler::filterKeycode(char &code)
-{
- int keyCode = Qt::Key_unknown;
- bool release = false;
-
- if (code & 0x80) {
- release = true;
- code &= 0x7f;
- }
-
- if (fn && !meta && (code >= 0x42 && code <= 0x52)) {
- ushort unicode=0;
- int scan=0;
- if (code == 0x42) { unicode='X'-'@'; scan=Qt::Key_X; } // Cut
- else if (code == 0x43) { unicode='C'-'@'; scan=Qt::Key_C; } // Copy
- else if (code == 0x44) { unicode='V'-'@'; scan=Qt::Key_V; } // Paste
- else if (code == 0x52) { unicode='Z'-'@'; scan=Qt::Key_Z; } // Undo
- if (scan) {
- processKeyEvent(unicode, scan, Qt::ControlModifier, !release, false);
- return true;
- }
- }
-
- if (code < keyMSize) {
- keyCode = keyMap()[int(code)].key_code;
- }
-
- bool repeatable = true;
-
- if (release && (keyCode == Qt::Key_F34 || keyCode == Qt::Key_F35))
- return true; // no release for power and light keys
- if ((keyCode >= Qt::Key_F1 && keyCode <= Qt::Key_F35)
- || keyCode == Qt::Key_Escape || keyCode == Qt::Key_Home
- || keyCode == Qt::Key_Shift || keyCode == Qt::Key_Meta)
- repeatable = false;
-
- if (qt_screen->isTransformed()
- && keyCode >= Qt::Key_Left && keyCode <= Qt::Key_Down)
- {
- keyCode = transformDirKey(keyCode);
- }
-
- // Ctrl-Alt-Delete exits qws
- if (ctrl && alt && keyCode == Qt::Key_Delete) {
- qApp->quit();
- }
-
- if (keyCode == Qt::Key_F22) { /* Fn key */
- fn = !release;
- } else if (keyCode == Qt::Key_NumLock) {
- if (release)
- numLock = !numLock;
- } else if (keyCode == Qt::AltModifier) {
- alt = !release;
- } else if (keyCode == Qt::ControlModifier) {
- ctrl = !release;
- } else if (keyCode == Qt::ShiftModifier) {
- shift = !release;
- } else if (keyCode == Qt::MetaModifier) {
- meta = !release;
- } else if (keyCode == Qt::Key_CapsLock && release) {
- caps = !caps;
- }
- if (keyCode != Qt::Key_unknown) {
- bool bAlt = alt;
- bool bCtrl = ctrl;
- bool bShift = shift;
- int unicode = 0;
- if (code < keyMSize) {
- bool bCaps = caps ^ shift;
- if (fn) {
- if (shift) {
- bCaps = bShift = false;
- bCtrl = true;
- }
- if (meta) {
- bCaps = bShift = true;
- bAlt = true;
- }
- } else if (meta) {
- bCaps = bShift = true;
- }
- if (code > 40 && caps) {
- // fn-keys should only react to shift, not caps
- bCaps = bShift = shift;
- }
- if (numLock) {
- if (keyCode != Qt::Key_Space && keyCode != Qt::Key_Tab)
- bCaps = bShift = false;
- }
- if (keyCode == Qt::Key_Delete && (bAlt || bCtrl)) {
- keyCode = Qt::Key_BraceLeft;
- unicode = '[';
- bCaps = bShift = bAlt = bCtrl = false;
- } else if (keyCode == Qt::Key_F31 && bCtrl) {
- keyCode = Qt::Key_QuoteLeft;
- unicode = '`';
- } else if (bCtrl)
- unicode = keyMap()[int(code)].ctrl_unicode ? keyMap()[int(code)].ctrl_unicode : 0xffff;
- else if (bCaps)
- unicode = keyMap()[int(code)].shift_unicode ? keyMap()[int(code)].shift_unicode : 0xffff;
- else
- unicode = keyMap()[int(code)].unicode ? keyMap()[int(code)].unicode : 0xffff;
- }
-
- modifiers = 0;
- if (bAlt) modifiers |= Qt::AltModifier;
- if (bCtrl) modifiers |= Qt::ControlModifier;
- if (bShift) modifiers |= Qt::ShiftModifier;
-
- // looks wrong -- WWA
- bool repeat = false;
- if (prevuni == unicode && prevkey == keyCode && !release)
- repeat = true;
-
- processKeyEvent(unicode, keyCode, modifiers, !release, repeat);
-
- if (!release) {
- prevuni = unicode;
- prevkey = keyCode;
- } else {
- prevkey = prevuni = 0;
- }
- }
-
- if (repeatable && !release)
- beginAutoRepeat(prevuni, prevkey, modifiers);
- else
- endAutoRepeat();
-
- return true;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_KBD_SL5000
diff --git a/src/gui/embedded/qkbdsl5000_qws.h b/src/gui/embedded/qkbdsl5000_qws.h
deleted file mode 100644
index 42afbe153e..0000000000
--- a/src/gui/embedded/qkbdsl5000_qws.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.0, 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.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDSL5000_QWS_H
-#define QKBDSL5000_QWS_H
-
-#include <QtGui/qkbdtty_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_KBD_SL5000
-
-struct QWSKeyMap {
- uint key_code;
- ushort unicode;
- ushort shift_unicode;
- ushort ctrl_unicode;
-};
-
-
-class QWSSL5000KeyboardHandler : public QWSTtyKeyboardHandler
-{
-public:
- explicit QWSSL5000KeyboardHandler(const QString&);
- virtual ~QWSSL5000KeyboardHandler();
-
- bool filterKeycode(char &keycode);
- virtual const QWSKeyMap *keyMap() const;
-
-private:
- bool shift;
- bool alt;
- bool ctrl;
- bool caps;
- uint extended:2;
- Qt::KeyboardModifiers modifiers;
- int prevuni;
- int prevkey;
- bool meta;
- bool fn;
- bool numLock;
-};
-
-#endif // QT_NO_QWS_KBD_SL5000
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDSL5000_QWS_H
diff --git a/src/gui/embedded/qkbdtty_qws.cpp b/src/gui/embedded/qkbdtty_qws.cpp
index 33777eb91b..f107567775 100644
--- a/src/gui/embedded/qkbdtty_qws.cpp
+++ b/src/gui/embedded/qkbdtty_qws.cpp
@@ -47,6 +47,7 @@
#include <QStringList>
#include <qplatformdefs.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <errno.h>
#include <termios.h>
@@ -89,7 +90,7 @@ private:
struct termios m_tty_attr;
char m_last_keycode;
int m_vt_qws;
- int m_originalKbdMode;
+ int m_orig_kbmode;
};
@@ -110,7 +111,7 @@ bool QWSTtyKeyboardHandler::filterKeycode(char &)
}
QWSTtyKbPrivate::QWSTtyKbPrivate(QWSTtyKeyboardHandler *h, const QString &device)
- : m_handler(h), m_tty_fd(-1), m_last_keycode(0), m_vt_qws(0)
+ : m_handler(h), m_tty_fd(-1), m_last_keycode(0), m_vt_qws(0), m_orig_kbmode(K_XLATE)
{
setObjectName(QLatin1String("TTY Keyboard Handler"));
#ifndef QT_NO_QWS_SIGNALHANDLER
@@ -151,15 +152,15 @@ QWSTtyKbPrivate::QWSTtyKbPrivate(QWSTtyKeyboardHandler *h, const QString &device
tcgetattr(m_tty_fd, &termdata);
#if defined(Q_OS_LINUX)
- // record the original mode so we can restore it again in the constructor
- ::ioctl(m_tty_fd, KDGKBMODE, m_originalKbdMode);
+ // record the original mode so we can restore it again in the destructor.
+ ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode);
// PLEASE NOTE:
- // The tty keycode interface can only report keycodes 0x01 .. 0x7f
+ // the tty keycode interface can only report keycodes 0x01 .. 0x7f
// KEY_MAX is however defined to 0x1ff. In practice this is sufficient
// for a PC style keyboard though.
- // we don't support K_RAW anymore - if you need, you habe to add a
- // scan- to keycode converter.
+ // we don't support K_RAW anymore - if you need that, you have to add
+ // a scan- to keycode converter yourself.
::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW);
#endif
@@ -210,9 +211,10 @@ QWSTtyKbPrivate::~QWSTtyKbPrivate()
{
if (m_tty_fd >= 0) {
#if defined(Q_OS_LINUX)
- ::ioctl(m_tty_fd, KDSKBMODE, m_originalKbdMode);
+ ::ioctl(m_tty_fd, KDSKBMODE, m_orig_kbmode);
#endif
tcsetattr(m_tty_fd, TCSANOW, &m_tty_attr);
+ QT_CLOSE(m_tty_fd);
}
}
diff --git a/src/gui/embedded/qkbdvfb_qws.cpp b/src/gui/embedded/qkbdvfb_qws.cpp
index 082aac1d09..a44183ba44 100644
--- a/src/gui/embedded/qkbdvfb_qws.cpp
+++ b/src/gui/embedded/qkbdvfb_qws.cpp
@@ -55,6 +55,7 @@
#include <qwindowsystem_qws.h>
#include <qsocketnotifier.h>
#include <qapplication.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
QT_BEGIN_NAMESPACE
@@ -69,13 +70,13 @@ QVFbKeyboardHandler::QVFbKeyboardHandler(const QString &device)
kbdBufferLen = sizeof(QVFbKeyData) * 5;
kbdBuffer = new unsigned char [kbdBufferLen];
- if ((kbdFD = open(terminalName.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) {
+ if ((kbdFD = QT_OPEN(terminalName.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) {
qWarning("Cannot open %s (%s)", terminalName.toLatin1().constData(),
strerror(errno));
} else {
// Clear pending input
char buf[2];
- while (read(kbdFD, buf, 1) > 0) { }
+ while (QT_READ(kbdFD, buf, 1) > 0) { }
notifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this);
connect(notifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData()));
@@ -85,7 +86,7 @@ QVFbKeyboardHandler::QVFbKeyboardHandler(const QString &device)
QVFbKeyboardHandler::~QVFbKeyboardHandler()
{
if (kbdFD >= 0)
- close(kbdFD);
+ QT_CLOSE(kbdFD);
delete [] kbdBuffer;
}
@@ -94,7 +95,7 @@ void QVFbKeyboardHandler::readKeyboardData()
{
int n;
do {
- n = read(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx);
+ n = QT_READ(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx);
if (n > 0)
kbdIdx += n;
} while (n > 0);
diff --git a/src/gui/embedded/qkbdvr41xx_qws.cpp b/src/gui/embedded/qkbdvr41xx_qws.cpp
deleted file mode 100644
index 03c2a6718e..0000000000
--- a/src/gui/embedded/qkbdvr41xx_qws.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.0, 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.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkbdvr41xx_qws.h"
-
-#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_VR41XX)
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <termios.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <qsocketnotifier.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWSVr41xxKbPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSVr41xxKbPrivate(QWSVr41xxKeyboardHandler *h, const QString&);
- virtual ~QWSVr41xxKbPrivate();
-
- bool isOpen() { return buttonFD > 0; }
-
-private slots:
- void readKeyboardData();
-
-private:
- QString terminalName;
- int buttonFD;
- int kbdIdx;
- int kbdBufferLen;
- unsigned char *kbdBuffer;
- QSocketNotifier *notifier;
- QWSVr41xxKeyboardHandler *handler;
-};
-
-QWSVr41xxKeyboardHandler::QWSVr41xxKeyboardHandler(const QString &device)
-{
- d = new QWSVr41xxKbPrivate(this, device);
-}
-
-QWSVr41xxKeyboardHandler::~QWSVr41xxKeyboardHandler()
-{
- delete d;
-}
-
-QWSVr41xxKbPrivate::QWSVr41xxKbPrivate(QWSVr41xxKeyboardHandler *h, const QString &device) : handler(h)
-{
- terminalName = device;
- if (terminalName.isEmpty())
- terminalName = QLatin1String("/dev/buttons");
- buttonFD = -1;
- notifier = 0;
-
- buttonFD = open(terminalName.toLatin1().constData(), O_RDWR | O_NDELAY, 0);;
- if (buttonFD < 0) {
- qWarning("Cannot open %s\n", qPrintable(terminalName));
- return;
- }
-
- if (buttonFD >= 0) {
- notifier = new QSocketNotifier(buttonFD, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)),this,
- SLOT(readKeyboardData()));
- }
-
- kbdBufferLen = 80;
- kbdBuffer = new unsigned char [kbdBufferLen];
- kbdIdx = 0;
-}
-
-QWSVr41xxKbPrivate::~QWSVr41xxKbPrivate()
-{
- if (buttonFD > 0) {
- ::close(buttonFD);
- buttonFD = -1;
- }
- delete notifier;
- notifier = 0;
- delete [] kbdBuffer;
-}
-
-void QWSVr41xxKbPrivate::readKeyboardData()
-{
- int n = 0;
- do {
- n = read(buttonFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx);
- if (n > 0)
- kbdIdx += n;
- } while (n > 0);
-
- int idx = 0;
- while (kbdIdx - idx >= 2) {
- unsigned char *next = kbdBuffer + idx;
- unsigned short *code = (unsigned short *)next;
- int keycode = Qt::Key_unknown;
- switch ((*code) & 0x0fff) {
- case 0x7:
- keycode = Qt::Key_Up;
- break;
- case 0x9:
- keycode = Qt::Key_Right;
- break;
- case 0x8:
- keycode = Qt::Key_Down;
- break;
- case 0xa:
- keycode = Qt::Key_Left;
- break;
- case 0x3:
- keycode = Qt::Key_Up;
- break;
- case 0x4:
- keycode = Qt::Key_Down;
- break;
- case 0x1:
- keycode = Qt::Key_Return;
- break;
- case 0x2:
- keycode = Qt::Key_F4;
- break;
- default:
- qDebug("Unrecognised key sequence %d", *code);
- }
- if ((*code) & 0x8000)
- handler->processKeyEvent(0, keycode, 0, false, false);
- else
- handler->processKeyEvent(0, keycode, 0, true, false);
- idx += 2;
- }
-
- int surplus = kbdIdx - idx;
- for (int i = 0; i < surplus; i++)
- kbdBuffer[i] = kbdBuffer[idx+i];
- kbdIdx = surplus;
-}
-
-QT_END_NAMESPACE
-
-#include "qkbdvr41xx_qws.moc"
-
-#endif // QT_NO_QWS_KBD_VR41XX
diff --git a/src/gui/embedded/qkbdvr41xx_qws.h b/src/gui/embedded/qkbdvr41xx_qws.h
deleted file mode 100644
index 1a657b9249..0000000000
--- a/src/gui/embedded/qkbdvr41xx_qws.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.0, 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.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDVR41XX_QWS_H
-#define QKBDVR41XX_QWS_H
-
-#include <QtGui/qkbd_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_VR41XX)
-
-class QWSVr41xxKbPrivate;
-
-class QWSVr41xxKeyboardHandler : public QWSKeyboardHandler
-{
-public:
- explicit QWSVr41xxKeyboardHandler(const QString&);
- virtual ~QWSVr41xxKeyboardHandler();
-
-private:
- QWSVr41xxKbPrivate *d;
-};
-
-#endif // QT_NO_QWS_KBD_VR41XX
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDVR41XX_QWS_H
diff --git a/src/gui/embedded/qkbdyopy_qws.cpp b/src/gui/embedded/qkbdyopy_qws.cpp
deleted file mode 100644
index 5c9d28ddc6..0000000000
--- a/src/gui/embedded/qkbdyopy_qws.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.0, 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.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- * YOPY buttons driver
- * Contributed by Ron Victorelli (victorrj at icubed.com)
- */
-
-#include "qkbdyopy_qws.h"
-
-#ifndef QT_NO_QWS_KBD_YOPY
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <termios.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <linux/kd.h>
-#include <linux/fb.h>
-#include <linux/yopy_button.h>
-
-extern "C" {
- int getpgid(int);
-}
-
-#include <qwidget.h>
-#include <qsocketnotifier.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWSYopyKbPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSYopyKbPrivate(QWSYopyKeyboardHandler *h, const QString&);
- virtual ~QWSYopyKbPrivate();
-
- bool isOpen() { return buttonFD > 0; }
-
-private slots:
- void readKeyboardData();
-
-private:
- QString terminalName;
- int buttonFD;
- struct termios newT, oldT;
- QSocketNotifier *notifier;
- QWSYopyKeyboardHandler *handler;
-};
-
-QWSYopyKeyboardHandler::QWSYopyKeyboardHandler(const QString &device)
-{
- d = new QWSYopyKbPrivate(this, device);
-}
-
-QWSYopyKeyboardHandler::~QWSYopyKeyboardHandler()
-{
- delete d;
-}
-
-QWSYopyKbPrivate::QWSYopyKbPrivate(QWSYopyKeyboardHandler *h, const QString &device) : handler(h)
-{
- terminalName = device.isEmpty()?"/dev/tty1":device.toLatin1().constData();
- buttonFD = -1;
- notifier = 0;
-
- buttonFD = ::open(terminalName.toLatin1().constData(), O_RDWR | O_NDELAY, 0);
- if (buttonFD < 0) {
- qWarning("Cannot open %s\n", qPrintable(terminalName));
- return;
- } else {
-
- tcsetpgrp(buttonFD, getpgid(0));
-
- /* put tty into "straight through" mode.
- */
- if (tcgetattr(buttonFD, &oldT) < 0) {
- qFatal("Linux-kbd: tcgetattr failed");
- }
-
- newT = oldT;
- newT.c_lflag &= ~(ICANON | ECHO | ISIG);
- newT.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON);
- newT.c_iflag |= IGNBRK;
- newT.c_cc[VMIN] = 0;
- newT.c_cc[VTIME] = 0;
-
-
- if (tcsetattr(buttonFD, TCSANOW, &newT) < 0) {
- qFatal("Linux-kbd: TCSANOW tcsetattr failed");
- }
-
- if (ioctl(buttonFD, KDSKBMODE, K_MEDIUMRAW) < 0) {
- qFatal("Linux-kbd: KDSKBMODE tcsetattr failed");
- }
-
- notifier = new QSocketNotifier(buttonFD, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)),this,
- SLOT(readKeyboardData()));
- }
-}
-
-QWSYopyKbPrivate::~QWSYopyKbPrivate()
-{
- if (buttonFD > 0) {
- ::close(buttonFD);
- buttonFD = -1;
- }
-}
-
-void QWSYopyKbPrivate::readKeyboardData()
-{
- uchar buf[1];
- char c='1';
- int fd;
-
- int n=read(buttonFD,buf,1);
- if (n<0) {
- qDebug("Keyboard read error %s",strerror(errno));
- } else {
- uint code = buf[0]&YPBUTTON_CODE_MASK;
- bool press = !(buf[0]&0x80);
- // printf("Key=%d/%d/%d\n",buf[1],code,press);
- int k=(-1);
- switch(code) {
- case 39: k=Qt::Key_Up; break;
- case 44: k=Qt::Key_Down; break;
- case 41: k=Qt::Key_Left; break;
- case 42: k=Qt::Key_Right; break;
- case 56: k=Qt::Key_F1; break; //windows
- case 29: k=Qt::Key_F2; break; //cycle
- case 24: k=Qt::Key_F3; break; //record
- case 23: k=Qt::Key_F4; break; //mp3
- case 4: k=Qt::Key_F5; break; // PIMS
- case 1: k=Qt::Key_Escape; break; // Escape
- case 40: k=Qt::Key_Up; break; // prev
- case 45: k=Qt::Key_Down; break; // next
- case 35: if(!press) {
- fd = open("/proc/sys/pm/sleep",O_RDWR,0);
- if(fd >= 0) {
- write(fd,&c,sizeof(c));
- close(fd);
- //
- // Updates all widgets.
- //
- QWidgetList list = QApplication::allWidgets();
- for (int i = 0; i < list.size(); ++i) {
- QWidget *w = list.at(i);
- w->update();
- }
- }
- }
- break;
-
- default: k=(-1); break;
- }
-
- if (k >= 0) {
- handler->processKeyEvent(0, k, 0, press, false);
- }
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qkbdyopy_qws.moc"
-
-#endif // QT_NO_QWS_KBD_YOPY
diff --git a/src/gui/embedded/qkbdyopy_qws.h b/src/gui/embedded/qkbdyopy_qws.h
deleted file mode 100644
index b4e45bd46a..0000000000
--- a/src/gui/embedded/qkbdyopy_qws.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.0, 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.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDYOPY_QWS_H
-#define QKBDYOPY_QWS_H
-
-#include <QtGui/qkbd_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_KBD_YOPY
-
-class QWSYopyKbPrivate;
-
-class QWSYopyKeyboardHandler : public QWSKeyboardHandler
-{
-public:
- explicit QWSYopyKeyboardHandler(const QString&);
- virtual ~QWSYopyKeyboardHandler();
-
-private:
- QWSYopyKbPrivate *d;
-};
-
-#endif // QT_NO_QWS_KBD_YOPY
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDYOPY_QWS_H
diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp
index c23608fa86..305832cf5d 100644
--- a/src/gui/embedded/qlock.cpp
+++ b/src/gui/embedded/qlock.cpp
@@ -73,6 +73,8 @@ union semun {
#endif // QT_NO_QWS_MULTIPROCESS
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
+
#define MAX_LOCKS 200 // maximum simultaneous read locks
QT_BEGIN_NAMESPACE
@@ -134,7 +136,7 @@ QLock::QLock(const QString &filename, char id, bool create)
#ifdef Q_NO_SEMAPHORE
data->file = QString(filename+id).toLocal8Bit().constData();
for(int x = 0; x < 2; x++) {
- data->id = open(data->file, O_RDWR | (x ? O_CREAT : 0), S_IRWXU);
+ data->id = QT_OPEN(data->file, O_RDWR | (x ? O_CREAT : 0), S_IRWXU);
if(data->id != -1 || !create) {
data->owned = x;
break;
@@ -177,7 +179,7 @@ QLock::~QLock()
unlock();
#ifdef Q_NO_SEMAPHORE
if(isValid()) {
- close(data->id);
+ QT_CLOSE(data->id);
if(data->owned)
unlink(data->file);
}
diff --git a/src/gui/embedded/qmousebus_qws.cpp b/src/gui/embedded/qmousebus_qws.cpp
deleted file mode 100644
index a88ca5be3e..0000000000
--- a/src/gui/embedded/qmousebus_qws.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.0, 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.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmousebus_qws.h"
-
-#ifndef QT_NO_QWS_MOUSE_BUS
-
-#include "qwindowsystem_qws.h"
-#include "qsocketnotifier.h"
-
-#include "qapplication.h"
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-
-QT_BEGIN_NAMESPACE
-
-/*
- * bus mouse driver (a.k.a. Logitech busmouse)
- */
-
-class QWSBusMouseHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSBusMouseHandlerPrivate(QWSBusMouseHandler *h, const QString &driver, const QString &device);
- ~QWSBusMouseHandlerPrivate();
-
- void suspend();
- void resume();
-
-private slots:
- void readMouseData();
-
-protected:
- enum { mouseBufSize = 128 };
- QWSBusMouseHandler *handler;
- QSocketNotifier *mouseNotifier;
- int mouseFD;
- int mouseIdx;
- int obstate;
- uchar mouseBuf[mouseBufSize];
-};
-
-QWSBusMouseHandler::QWSBusMouseHandler(const QString &driver, const QString &device)
- : QWSMouseHandler(driver, device)
-{
- d = new QWSBusMouseHandlerPrivate(this, driver, device);
-}
-
-QWSBusMouseHandler::~QWSBusMouseHandler()
-{
- delete d;
-}
-
-void QWSBusMouseHandler::suspend()
-{
- d->suspend();
-}
-
-void QWSBusMouseHandler::resume()
-{
- d->resume();
-}
-
-
-QWSBusMouseHandlerPrivate::QWSBusMouseHandlerPrivate(QWSBusMouseHandler *h,
- const QString &, const QString &device)
- : handler(h)
-
-{
- QString mouseDev = device;
- if (mouseDev.isEmpty())
- mouseDev = QLatin1String("/dev/mouse");
- obstate = -1;
- mouseFD = -1;
- mouseFD = open(mouseDev.toLocal8Bit(), O_RDWR | O_NDELAY);
- if (mouseFD < 0)
- mouseFD = open(mouseDev.toLocal8Bit(), O_RDONLY | O_NDELAY);
- if (mouseFD < 0)
- qDebug("Cannot open %s (%s)", qPrintable(mouseDev), strerror(errno));
-
- // Clear pending input
- tcflush(mouseFD,TCIFLUSH);
- usleep(50000);
-
- char buf[100]; // busmouse driver will not read if bufsize < 3, YYD
- while (read(mouseFD, buf, 100) > 0) { } // eat unwanted replies
-
- mouseIdx = 0;
-
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
-}
-
-QWSBusMouseHandlerPrivate::~QWSBusMouseHandlerPrivate()
-{
- if (mouseFD >= 0) {
- tcflush(mouseFD,TCIFLUSH); // yyd.
- close(mouseFD);
- }
-}
-
-
-void QWSBusMouseHandlerPrivate::suspend()
-{
- mouseNotifier->setEnabled(false);
-}
-
-
-void QWSBusMouseHandlerPrivate::resume()
-{
- mouseIdx = 0;
- obstate = -1;
- mouseNotifier->setEnabled(true);
-}
-
-void QWSBusMouseHandlerPrivate::readMouseData()
-{
- int n;
- // It'll only read 3 bytes a time and return all other buffer zeroed, thus cause protocol errors
- for (;;) {
- if (mouseBufSize - mouseIdx < 3)
- break;
- n = read(mouseFD, mouseBuf+mouseIdx, 3);
- if (n != 3)
- break;
- mouseIdx += 3;
- }
-
- static const int accel_limit = 5;
- static const int accel = 2;
-
- int idx = 0;
- int bstate = 0;
- int dx = 0, dy = 0;
- bool sendEvent = false;
- int tdx = 0, tdy = 0;
-
- while (mouseIdx-idx >= 3) {
-#if 0 // debug
- qDebug("Got mouse data");
-#endif
- uchar *mb = mouseBuf+idx;
- bstate = 0;
- dx = 0;
- dy = 0;
- sendEvent = false;
- if (((mb[0] & 0x04)))
- bstate |= Qt::LeftButton;
- if (((mb[0] & 0x01)))
- bstate |= Qt::RightButton;
-
- dx=(signed char)mb[1];
- dy=(signed char)mb[2];
- sendEvent=true;
-
- if (sendEvent) {
- if (qAbs(dx) > accel_limit || qAbs(dy) > accel_limit) {
- dx *= accel;
- dy *= accel;
- }
- tdx += dx;
- tdy += dy;
- if (bstate != obstate) {
- QPoint pos = handler->pos() + QPoint(tdx,-tdy);
- handler->limitToScreen(pos);
- handler->mouseChanged(pos,bstate);
- sendEvent = false;
- tdx = 0;
- tdy = 0;
- obstate = bstate;
- }
- }
- idx += 3;
- }
- if (sendEvent) {
- QPoint pos = handler->pos() + QPoint(tdx,-tdy);
- handler->limitToScreen(pos);
- handler->mouseChanged(pos,bstate);
- }
-
- int surplus = mouseIdx - idx;
- for (int i = 0; i < surplus; i++)
- mouseBuf[i] = mouseBuf[idx+i];
- mouseIdx = surplus;
-}
-
-QT_END_NAMESPACE
-
-#include "qmousebus_qws.moc"
-
-#endif // QT_NO_QWS_MOUSE_BUS
diff --git a/src/gui/embedded/qmousedriverfactory_qws.cpp b/src/gui/embedded/qmousedriverfactory_qws.cpp
index 7e518186b2..46898aed87 100644
--- a/src/gui/embedded/qmousedriverfactory_qws.cpp
+++ b/src/gui/embedded/qmousedriverfactory_qws.cpp
@@ -43,10 +43,8 @@
#include "qapplication.h"
#include "qmousepc_qws.h"
-#include "qmousebus_qws.h"
-#include "qmousevr41xx_qws.h"
-#include "qmouseyopy_qws.h"
#include "qmouselinuxtp_qws.h"
+#include "qmouselinuxinput_qws.h"
#include "qmousevfb_qws.h"
#include "qmousetslib_qws.h"
#include <stdlib.h>
@@ -108,14 +106,6 @@ QWSMouseHandler *QMouseDriverFactory::create(const QString& key, const QString &
if (driver == QLatin1String("linuxtp") || driver.isEmpty())
return new QWSLinuxTPMouseHandler(key, device);
#endif
-#ifndef QT_NO_QWS_MOUSE_YOPY
- if (driver == QLatin1String("yopy") || driver.isEmpty())
- return new QWSYopyMouseHandler(key, device);
-#endif
-#ifndef QT_NO_QWS_MOUSE_VR41XX
- if (driver == QLatin1String("vr41xx") || driver.isEmpty())
- return new QWSVr41xxMouseHandler(key, device);
-#endif
#ifndef QT_NO_QWS_MOUSE_PC
if (driver == QLatin1String("auto")
|| driver == QLatin1String("intellimouse")
@@ -126,14 +116,16 @@ QWSMouseHandler *QMouseDriverFactory::create(const QString& key, const QString &
return new QWSPcMouseHandler(key, device);
}
#endif
-#ifndef QT_NO_QWS_MOUSE_BUS
- if (driver == QLatin1String("bus"))
- return new QWSBusMouseHandler(key, device);
-#endif
#ifndef QT_NO_QWS_MOUSE_TSLIB
if (driver == QLatin1String("tslib") || driver.isEmpty())
return new QWSTslibMouseHandler(key, device);
#endif
+# ifndef QT_NO_QWS_MOUSE_LINUXINPUT
+ if (driver == QLatin1String("linuxinput") || \
+ driver == QLatin1String("usb") || \
+ driver == QLatin1String("linuxis"))
+ return new QWSLinuxInputMouseHandler(device);
+# endif
#ifndef QT_NO_QWS_MOUSE_QVFB
if (driver == QLatin1String("qvfbmouse") || driver == QLatin1String("qvfb"))
return new QVFbMouseHandler(key, device);
@@ -160,12 +152,6 @@ QStringList QMouseDriverFactory::keys()
#ifndef QT_NO_QWS_MOUSE_LINUXTP
list << QLatin1String("LinuxTP");
#endif
-#ifndef QT_NO_QWS_MOUSE_YOPY
- list << QLatin1String("Yopy");
-#endif
-#ifndef QT_NO_QWS_MOUSE_VR41XX
- list << QLatin1String("VR41xx");
-#endif
#ifndef QT_NO_QWS_MOUSE_PC
list << QLatin1String("Auto")
<< QLatin1String("IntelliMouse")
@@ -173,12 +159,12 @@ QStringList QMouseDriverFactory::keys()
<< QLatin1String("MouseSystems")
<< QLatin1String("MouseMan");
#endif
-#ifndef QT_NO_QWS_MOUSE_BUS
- list << QLatin1String("Bus");
-#endif
#ifndef QT_NO_QWS_MOUSE_TSLIB
list << QLatin1String("Tslib");
#endif
+#ifndef QT_NO_QWS_MOUSE_LINUXINPUT
+ list << QLatin1String("LinuxInput");
+#endif
#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
#ifndef QT_NO_LIBRARY
diff --git a/src/gui/embedded/qmouselinuxinput_qws.cpp b/src/gui/embedded/qmouselinuxinput_qws.cpp
new file mode 100644
index 0000000000..6ea880771b
--- /dev/null
+++ b/src/gui/embedded/qmouselinuxinput_qws.cpp
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmouselinuxinput_qws.h"
+
+#include <QScreen>
+#include <QSocketNotifier>
+
+#include <qplatformdefs.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
+
+#include <errno.h>
+
+#include <linux/input.h>
+
+QT_BEGIN_NAMESPACE
+
+
+class QWSLinuxInputMousePrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QWSLinuxInputMousePrivate(QWSLinuxInputMouseHandler *, const QString &);
+ ~QWSLinuxInputMousePrivate();
+
+ void enable(bool on);
+
+private Q_SLOTS:
+ void readMouseData();
+
+private:
+ QWSLinuxInputMouseHandler *m_handler;
+ QSocketNotifier * m_notify;
+ int m_fd;
+ int m_x, m_y;
+ int m_buttons;
+};
+
+QWSLinuxInputMouseHandler::QWSLinuxInputMouseHandler(const QString &device)
+ : QWSCalibratedMouseHandler(device)
+{
+ d = new QWSLinuxInputMousePrivate(this, device);
+}
+
+QWSLinuxInputMouseHandler::~QWSLinuxInputMouseHandler()
+{
+ delete d;
+}
+
+void QWSLinuxInputMouseHandler::suspend()
+{
+ d->enable(false);
+}
+
+void QWSLinuxInputMouseHandler::resume()
+{
+ d->enable(true);
+}
+
+QWSLinuxInputMousePrivate::QWSLinuxInputMousePrivate(QWSLinuxInputMouseHandler *h, const QString &device)
+ : m_handler(h), m_notify(0), m_x(0), m_y(0), m_buttons(0)
+{
+ setObjectName(QLatin1String("LinuxInputSubsystem Mouse Handler"));
+
+ QString dev = QLatin1String("/dev/input/event0");
+ if (device.startsWith(QLatin1String("/dev/")))
+ dev = device;
+
+ m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
+ if (m_fd >= 0) {
+ m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
+ connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData()));
+ } else {
+ qWarning("Cannot open mouse input device '%s': %s", qPrintable(dev), strerror(errno));
+ return;
+ }
+}
+
+QWSLinuxInputMousePrivate::~QWSLinuxInputMousePrivate()
+{
+ if (m_fd >= 0)
+ QT_CLOSE(m_fd);
+}
+
+void QWSLinuxInputMousePrivate::enable(bool on)
+{
+ if (m_notify)
+ m_notify->setEnabled(on);
+}
+
+void QWSLinuxInputMousePrivate::readMouseData()
+{
+ if (!qt_screen)
+ return;
+
+ struct ::input_event buffer[32];
+ int n = 0;
+
+ forever {
+ n = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
+
+ if (n == 0) {
+ qWarning("Got EOF from the input device.");
+ return;
+ } else if (n < 0 && (errno != EINTR && errno != EAGAIN)) {
+ qWarning("Could not read from input device: %s", strerror(errno));
+ return;
+ } else if (n % sizeof(buffer[0]) == 0) {
+ break;
+ }
+ }
+
+ n /= sizeof(buffer[0]);
+
+ for (int i = 0; i < n; ++i) {
+ struct ::input_event *data = &buffer[i];
+
+ bool unknown = false;
+ if (data->type == EV_ABS) {
+ if (data->code == ABS_X) {
+ m_x = data->value;
+ } else if (data->code == ABS_Y) {
+ m_y = data->value;
+ } else {
+ unknown = true;
+ }
+ } else if (data->type == EV_REL) {
+ if (data->code == REL_X) {
+ m_x += data->value;
+ } else if (data->code == REL_Y) {
+ m_y += data->value;
+ } else {
+ unknown = true;
+ }
+ } else if (data->type == EV_KEY && data->code == BTN_TOUCH) {
+ m_buttons = data->value ? Qt::LeftButton : 0;
+ } else if (data->type == EV_KEY) {
+ int button = 0;
+ switch (data->code) {
+ case BTN_LEFT: button = Qt::LeftButton; break;
+ case BTN_MIDDLE: button = Qt::MidButton; break;
+ case BTN_RIGHT: button = Qt::RightButton; break;
+ }
+ if (data->value)
+ m_buttons |= button;
+ else
+ m_buttons &= ~button;
+ } else if (data->type == EV_SYN && data->code == SYN_REPORT) {
+ QPoint pos(m_x, m_y);
+ pos = m_handler->transform(pos);
+ m_handler->limitToScreen(pos);
+ m_handler->mouseChanged(pos, m_buttons);
+ } else if (data->type == EV_MSC && data->code == MSC_SCAN) {
+ // kernel encountered an unmapped key - just ignore it
+ continue;
+ } else {
+ unknown = true;
+ }
+ if (unknown) {
+ qWarning("unknown mouse event type=%x, code=%x, value=%x", data->type, data->code, data->value);
+ }
+ }
+}
+
+QT_END_NAMESPACE
+
+#include "qmouselinuxinput_qws.moc"
diff --git a/src/gui/embedded/qmousebus_qws.h b/src/gui/embedded/qmouselinuxinput_qws.h
index 407da9817b..25e351fa5c 100644
--- a/src/gui/embedded/qmousebus_qws.h
+++ b/src/gui/embedded/qmouselinuxinput_qws.h
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMOUSEBUS_QWS_H
-#define QMOUSEBUS_QWS_H
+#ifndef QMOUSELINUXINPUT_QWS_H
+#define QMOUSELINUXINPUT_QWS_H
-#include <QtGui/qmouse_qws.h>
+#include <QtGui/QWSCalibratedMouseHandler>
QT_BEGIN_HEADER
@@ -50,27 +50,29 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-#ifndef QT_NO_QWS_MOUSE_BUS
+#ifndef QT_NO_QWS_MOUSE_LINUXINPUT
-class QWSBusMouseHandlerPrivate;
+class QWSLinuxInputMousePrivate;
-class QWSBusMouseHandler : public QWSMouseHandler
+class QWSLinuxInputMouseHandler : public QWSCalibratedMouseHandler
{
public:
- explicit QWSBusMouseHandler(const QString & = QString(),
- const QString & = QString());
- ~QWSBusMouseHandler();
+ QWSLinuxInputMouseHandler(const QString &);
+ ~QWSLinuxInputMouseHandler();
void suspend();
void resume();
-protected:
- QWSBusMouseHandlerPrivate *d;
+
+private:
+ QWSLinuxInputMousePrivate *d;
+
+ friend class QWSLinuxInputMousePrivate;
};
-#endif // QT_NO_QWS_MOUSE_BUS
+#endif // QT_NO_QWS_MOUSE_LINUXINPUT
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMOUSEBUS_QWS_H
+#endif // QMOUSELINUXINPUT_QWS_H
diff --git a/src/gui/embedded/qmouselinuxtp_qws.cpp b/src/gui/embedded/qmouselinuxtp_qws.cpp
index 1b4d96e55d..e64407e078 100644
--- a/src/gui/embedded/qmouselinuxtp_qws.cpp
+++ b/src/gui/embedded/qmouselinuxtp_qws.cpp
@@ -47,6 +47,7 @@
#include "qtimer.h"
#include "qapplication.h"
#include "qscreen_qws.h"
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <unistd.h>
#include <stdlib.h>
@@ -190,7 +191,7 @@ QWSLinuxTPMouseHandlerPrivate::QWSLinuxTPMouseHandlerPrivate(QWSLinuxTPMouseHand
} else {
mousedev = device;
}
- if ((mouseFD = open(mousedev.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) {
+ if ((mouseFD = QT_OPEN(mousedev.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) {
qWarning("Cannot open %s (%s)", qPrintable(mousedev), strerror(errno));
return;
}
@@ -205,7 +206,7 @@ QWSLinuxTPMouseHandlerPrivate::QWSLinuxTPMouseHandlerPrivate(QWSLinuxTPMouseHand
QWSLinuxTPMouseHandlerPrivate::~QWSLinuxTPMouseHandlerPrivate()
{
if (mouseFD >= 0)
- close(mouseFD);
+ QT_CLOSE(mouseFD);
}
void QWSLinuxTPMouseHandlerPrivate::suspend()
@@ -233,7 +234,7 @@ void QWSLinuxTPMouseHandlerPrivate::readMouseData()
int n;
do {
- n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx);
+ n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx);
if (n > 0)
mouseIdx += n;
} while (n > 0 && mouseIdx < mouseBufSize);
diff --git a/src/gui/embedded/qmousepc_qws.cpp b/src/gui/embedded/qmousepc_qws.cpp
index a9f2bc8340..317bb8af04 100644
--- a/src/gui/embedded/qmousepc_qws.cpp
+++ b/src/gui/embedded/qmousepc_qws.cpp
@@ -55,6 +55,7 @@
#include "qfile.h"
#include "qtextstream.h"
#include "qstringlist.h"
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <unistd.h>
#include <stdlib.h>
@@ -107,7 +108,7 @@ public:
{
if (fd != f) {
f = fd;
- close(fd);
+ QT_CLOSE(fd);
}
}
@@ -170,7 +171,7 @@ public:
}
static const uchar initseq[] = { 243, 200, 243, 100, 243, 80 };
static const uchar query[] = { 0xf2 };
- if (write(fd, initseq, sizeof(initseq))!=sizeof(initseq)) {
+ if (QT_WRITE(fd, initseq, sizeof(initseq))!=sizeof(initseq)) {
badness = 100;
return;
}
@@ -180,12 +181,12 @@ public:
perror("QWSPcMouseSubHandler_intellimouse: post-init tcflush");
#endif
}
- if (write(fd, query, sizeof(query))!=sizeof(query)) {
+ if (QT_WRITE(fd, query, sizeof(query))!=sizeof(query)) {
badness = 100;
return;
}
usleep(10000);
- n = read(fd, reply, 20);
+ n = QT_READ(fd, reply, 20);
if (n > 0) {
goodness = 10;
switch (reply[n-1]) {
@@ -256,13 +257,13 @@ public:
perror("QWSPcMouseSubHandler_mouseman: initial tcflush");
#endif
}
- write(fd,"",1);
+ QT_WRITE(fd,"",1);
usleep(50000);
- write(fd,"@EeI!",5);
+ QT_WRITE(fd,"@EeI!",5);
usleep(10000);
static const char ibuf[] = { 246, 244 };
- write(fd,ibuf,1);
- write(fd,ibuf+1,1);
+ QT_WRITE(fd,ibuf,1);
+ QT_WRITE(fd,ibuf+1,1);
if (tcflush(fd,TCIOFLUSH) == -1) {
#ifdef QWS_MOUSE_DEBUG
perror("QWSPcMouseSubHandler_mouseman: tcflush");
@@ -271,7 +272,7 @@ public:
usleep(10000);
char buf[100];
- while (read(fd, buf, 100) > 0) { } // eat unwanted replies
+ while (QT_READ(fd, buf, 100) > 0) { } // eat unwanted replies
}
int tryData()
@@ -350,7 +351,7 @@ private:
for (int n = 0; n < 4; n++) {
setflags(CSTOPB | speed[n]);
- write(fd, "*q", 2);
+ QT_WRITE(fd, "*q", 2);
usleep(10000);
}
}
@@ -369,7 +370,7 @@ public:
{
setflags(B1200|CS8|CSTOPB);
// 60Hz
- if (write(fd, "R", 1)!=1) {
+ if (QT_WRITE(fd, "R", 1)!=1) {
badness = 100;
return;
}
@@ -418,7 +419,7 @@ public:
{
setflags(B1200|CS7);
// 60Hz
- if (write(fd, "R", 1)!=1) {
+ if (QT_WRITE(fd, "R", 1)!=1) {
badness = 100;
return;
}
@@ -648,25 +649,25 @@ void QWSPcMouseHandlerPrivate::openDevices()
if (drv == QLatin1String("intellimouse")) {
if (dev.isEmpty())
dev = "/dev/psaux";
- fd = open(dev, O_RDWR | O_NDELAY);
+ fd = QT_OPEN(dev, O_RDWR | O_NDELAY);
if (fd >= 0)
sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd);
} else if (drv == QLatin1String("microsoft")) {
if (dev.isEmpty())
dev = "/dev/ttyS0";
- fd = open(dev, O_RDWR | O_NDELAY);
+ fd = QT_OPEN(dev, O_RDWR | O_NDELAY);
if (fd >= 0)
sub[nsub++] = new QWSPcMouseSubHandler_ms(fd);
} else if (drv == QLatin1String("mousesystems")) {
if (dev.isEmpty())
dev = "/dev/ttyS0";
- fd = open(dev, O_RDWR | O_NDELAY);
+ fd = QT_OPEN(dev, O_RDWR | O_NDELAY);
if (fd >= 0)
sub[nsub++] = new QWSPcMouseSubHandler_mousesystems(fd);
} else if (drv == QLatin1String("mouseman")) {
if (dev.isEmpty())
dev = "/dev/psaux";
- fd = open(dev, O_RDWR | O_NDELAY);
+ fd = QT_OPEN(dev, O_RDWR | O_NDELAY);
if (fd >= 0)
sub[nsub++] = new QWSPcMouseSubHandler_mouseman(fd);
}
@@ -677,12 +678,12 @@ void QWSPcMouseHandlerPrivate::openDevices()
dev.constData(), strerror(errno));
} else {
// Try automatically
- fd = open("/dev/psaux", O_RDWR | O_NDELAY);
+ fd = QT_OPEN("/dev/psaux", O_RDWR | O_NDELAY);
if (fd >= 0) {
sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd);
notify(fd);
}
- fd = open("/dev/input/mice", O_RDWR | O_NDELAY);
+ fd = QT_OPEN("/dev/input/mice", O_RDWR | O_NDELAY);
if (fd >= 0) {
sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd);
notify(fd);
@@ -694,7 +695,7 @@ void QWSPcMouseHandlerPrivate::openDevices()
#if 0
const char fn[4][11] = { "/dev/ttyS0", "/dev/ttyS1", "/dev/ttyS2", "/dev/ttyS3" };
for (int ch = 0; ch < 4; ++ch) {
- fd = open(fn[ch], O_RDWR | O_NDELAY);
+ fd = QT_OPEN(fn[ch], O_RDWR | O_NDELAY);
if (fd >= 0) {
//sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd);
sub[nsub++] = new QWSPcMouseSubHandler_mousesystems(fd);
diff --git a/src/gui/embedded/qmousevfb_qws.cpp b/src/gui/embedded/qmousevfb_qws.cpp
index 17d051f7a6..dd553bc26b 100644
--- a/src/gui/embedded/qmousevfb_qws.cpp
+++ b/src/gui/embedded/qmousevfb_qws.cpp
@@ -54,6 +54,7 @@
#include <qsocketnotifier.h>
#include <qapplication.h>
#include <qtimer.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
QT_BEGIN_NAMESPACE
@@ -64,7 +65,7 @@ QVFbMouseHandler::QVFbMouseHandler(const QString &driver, const QString &device)
if (device.isEmpty())
mouseDev = QLatin1String("/dev/vmouse");
- mouseFD = open(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY);
+ mouseFD = QT_OPEN(mouseDev.toLatin1().constData(), O_RDWR | O_NDELAY);
if (mouseFD == -1) {
perror("QVFbMouseHandler::QVFbMouseHandler");
qWarning("QVFbMouseHander: Unable to open device %s",
@@ -74,7 +75,7 @@ QVFbMouseHandler::QVFbMouseHandler(const QString &driver, const QString &device)
// Clear pending input
char buf[2];
- while (read(mouseFD, buf, 1) > 0) { }
+ while (QT_READ(mouseFD, buf, 1) > 0) { }
mouseIdx = 0;
@@ -85,7 +86,7 @@ QVFbMouseHandler::QVFbMouseHandler(const QString &driver, const QString &device)
QVFbMouseHandler::~QVFbMouseHandler()
{
if (mouseFD >= 0)
- close(mouseFD);
+ QT_CLOSE(mouseFD);
}
void QVFbMouseHandler::resume()
@@ -102,7 +103,7 @@ void QVFbMouseHandler::readMouseData()
{
int n;
do {
- n = read(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx);
+ n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx);
if (n > 0)
mouseIdx += n;
} while (n > 0);
diff --git a/src/gui/embedded/qmousevr41xx_qws.cpp b/src/gui/embedded/qmousevr41xx_qws.cpp
deleted file mode 100644
index 8748055d5d..0000000000
--- a/src/gui/embedded/qmousevr41xx_qws.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.0, 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.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmousevr41xx_qws.h"
-
-#ifndef QT_NO_QWS_MOUSE_VR41XX
-#include "qwindowsystem_qws.h"
-#include "qsocketnotifier.h"
-#include "qtimer.h"
-#include "qapplication.h"
-#include "qscreen_qws.h"
-#include <qstringlist.h>
-#include <qvarlengtharray.h>
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-
-QT_BEGIN_NAMESPACE
-
-static const int defaultFilterSize = 3;
-
-class QWSVr41xxMouseHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSVr41xxMouseHandlerPrivate(QWSVr41xxMouseHandler *, const QString &, const QString &);
- ~QWSVr41xxMouseHandlerPrivate();
-
- void resume();
- void suspend();
-
-private slots:
- void sendRelease();
- void readMouseData();
-
-private:
- bool getSample();
- ushort currSample[6];
- uint currLength;
-
- int mouseFD;
- int mouseIdx;
- QTimer *rtimer;
- QSocketNotifier *mouseNotifier;
- QWSVr41xxMouseHandler *handler;
- QPoint lastPos;
- bool isPressed;
- int filterSize;
- int pressLimit;
-};
-
-QWSVr41xxMouseHandler::QWSVr41xxMouseHandler(const QString &drv, const QString &dev)
- : QWSCalibratedMouseHandler(drv, dev)
-{
- d = new QWSVr41xxMouseHandlerPrivate(this, drv, dev);
-}
-
-QWSVr41xxMouseHandler::~QWSVr41xxMouseHandler()
-{
- delete d;
-}
-
-void QWSVr41xxMouseHandler::resume()
-{
- d->resume();
-}
-
-void QWSVr41xxMouseHandler::suspend()
-{
- d->suspend();
-}
-
-QWSVr41xxMouseHandlerPrivate::QWSVr41xxMouseHandlerPrivate(QWSVr41xxMouseHandler *h, const QString &, const QString &device)
- : currLength(0), handler(h)
-{
- QStringList options = device.split(QLatin1String(":"));
- int index = -1;
-
- filterSize = defaultFilterSize;
- QRegExp filterRegExp(QLatin1String("filter=(\\d+)"));
- index = options.indexOf(filterRegExp);
- if (index != -1) {
- filterSize = qMax(1, filterRegExp.cap(1).toInt());
- options.removeAt(index);
- }
- handler->setFilterSize(filterSize);
-
- pressLimit = 750;
- QRegExp pressRegExp(QLatin1String("press=(\\d+)"));
- index = options.indexOf(pressRegExp);
- if (index != -1) {
- pressLimit = filterRegExp.cap(1).toInt();
- options.removeAt(index);
- }
-
- QString dev;
- if (options.isEmpty())
- dev = QLatin1String("/dev/vrtpanel");
- else
- dev = options.first();
-
- if ((mouseFD = open(dev.toLocal8Bit().constData(), O_RDONLY)) < 0) {
- qWarning("Cannot open %s (%s)", qPrintable(dev), strerror(errno));
- return;
- }
- sleep(1);
-
- if (fcntl(mouseFD, F_SETFL, O_NONBLOCK) < 0) {
- qWarning("Error initializing touch panel.");
- return;
- }
-
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
-
- rtimer = new QTimer(this);
- rtimer->setSingleShot(true);
- connect(rtimer, SIGNAL(timeout()), this, SLOT(sendRelease()));
- mouseIdx = 0;
-}
-
-QWSVr41xxMouseHandlerPrivate::~QWSVr41xxMouseHandlerPrivate()
-{
- if (mouseFD >= 0)
- close(mouseFD);
-}
-
-void QWSVr41xxMouseHandlerPrivate::suspend()
-{
- mouseNotifier->setEnabled(false);
-}
-
-
-void QWSVr41xxMouseHandlerPrivate::resume()
-{
- mouseIdx = 0;
- mouseNotifier->setEnabled(true);
-}
-
-void QWSVr41xxMouseHandlerPrivate::sendRelease()
-{
- handler->sendFiltered(lastPos, Qt::NoButton);
- isPressed = false;
-}
-
-bool QWSVr41xxMouseHandlerPrivate::getSample()
-{
- const int n = read(mouseFD,
- reinterpret_cast<uchar*>(currSample) + currLength,
- sizeof(currSample) - currLength);
-
- if (n > 0)
- currLength += n;
-
- if (currLength < sizeof(currSample))
- return false;
-
- currLength = 0;
- return true;
-}
-
-void QWSVr41xxMouseHandlerPrivate::readMouseData()
-{
- const int sampleLength = sizeof(currSample) / sizeof(ushort);
- QVarLengthArray<ushort, sampleLength * defaultFilterSize> samples(sampleLength * filterSize);
-
- // Only return last 'filterSize' samples
- int head = 0;
- int tail = 0;
- int nSamples = 0;
- while (getSample()) {
- if (!(currSample[0] & 0x8000) || (currSample[5] < pressLimit))
- continue;
-
- ushort *data = samples.data() + head * sampleLength;
- memcpy(data, currSample, sizeof(currSample));
- ++nSamples;
- head = (head + 1) % filterSize;
- if (nSamples >= filterSize)
- tail = (tail + 1) % filterSize;
- }
-
- if (nSamples == 0)
- return;
-
- // send mouse events
- while (tail != head || filterSize == 1) {
- const ushort *data = samples.data() + tail * sampleLength;
- lastPos = QPoint(data[3] - data[4], data[2] - data[1]);
- handler->sendFiltered(lastPos, Qt::LeftButton);
- isPressed = true;
- tail = (tail + 1) % filterSize;
- if (filterSize == 1)
- break;
- }
-
- if (isPressed)
- rtimer->start(50); // release unreliable
-}
-
-QT_END_NAMESPACE
-
-#include "qmousevr41xx_qws.moc"
-
-#endif //QT_NO_QWS_MOUSE_VR41
diff --git a/src/gui/embedded/qmousevr41xx_qws.h b/src/gui/embedded/qmousevr41xx_qws.h
deleted file mode 100644
index 46d07e0088..0000000000
--- a/src/gui/embedded/qmousevr41xx_qws.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.0, 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.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSEVR41XX_QWS_H
-#define QMOUSEVR41XX_QWS_H
-
-#include <QtGui/qmouse_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_MOUSE_VR41XX
-
-class QWSVr41xxMouseHandlerPrivate;
-
-class QWSVr41xxMouseHandler : public QWSCalibratedMouseHandler
-{
-public:
- explicit QWSVr41xxMouseHandler(const QString & = QString(),
- const QString & = QString());
- ~QWSVr41xxMouseHandler();
-
- void resume();
- void suspend();
-
-protected:
- QWSVr41xxMouseHandlerPrivate *d;
-
-private:
- friend class QWSVr41xxMouseHandlerPrivate;
-};
-
-#endif // QT_NO_QWS_MOUSE_VR41XX
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMOUSEVR41XX_QWS_H
diff --git a/src/gui/embedded/qmouseyopy_qws.cpp b/src/gui/embedded/qmouseyopy_qws.cpp
deleted file mode 100644
index 7b1141a384..0000000000
--- a/src/gui/embedded/qmouseyopy_qws.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.0, 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.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmouseyopy_qws.h"
-
-#ifndef QT_NO_QWS_MOUSE_YOPY
-#include "qwindowsystem_qws.h"
-#include "qsocketnotifier.h"
-#include "qapplication.h"
-#include "qscreen_qws.h"
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWSYopyMouseHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSYopyMouseHandlerPrivate(QWSYopyMouseHandler *h);
- ~QWSYopyMouseHandlerPrivate();
-
- void suspend();
- void resume();
-
-private slots:
- void readMouseData();
-
-private:
- int mouseFD;
- int prevstate;
- QSocketNotifier *mouseNotifier;
- QWSYopyMouseHandler *handler;
-};
-
-QWSYopyMouseHandler::QWSYopyMouseHandler(const QString &driver, const QString &device)
- : QWSMouseHandler(driver, device)
-{
- d = new QWSYopyMouseHandlerPrivate(this);
-}
-
-QWSYopyMouseHandler::~QWSYopyMouseHandler()
-{
- delete d;
-}
-
-void QWSYopyMouseHandler::resume()
-{
- d->resume();
-}
-
-void QWSYopyMouseHandler::suspend()
-{
- d->suspend();
-}
-
-QWSYopyMouseHandlerPrivate::QWSYopyMouseHandlerPrivate(QWSYopyMouseHandler *h)
- : handler(h)
-{
- if ((mouseFD = open("/dev/ts", O_RDONLY)) < 0) {
- qWarning("Cannot open /dev/ts (%s)", strerror(errno));
- return;
- } else {
- sleep(1);
- }
- prevstate=0;
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read,
- this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
-}
-
-QWSYopyMouseHandlerPrivate::~QWSYopyMouseHandlerPrivate()
-{
- if (mouseFD >= 0)
- close(mouseFD);
-}
-
-#define YOPY_XPOS(d) (d[1]&0x3FF)
-#define YOPY_YPOS(d) (d[2]&0x3FF)
-#define YOPY_PRES(d) (d[0]&0xFF)
-#define YOPY_STAT(d) (d[3]&0x01)
-
-struct YopyTPdata {
-
- unsigned char status;
- unsigned short xpos;
- unsigned short ypos;
-
-};
-
-void QWSYopyMouseHandlerPrivate::suspend()
-{
- mouseNotifier->setEnabled(false);
-}
-
-
-void QWSYopyMouseHandlerPrivate::resume()
-{
- prevstate = 0;
- mouseNotifier->setEnabled(true);
-}
-
-void QWSYopyMouseHandlerPrivate::readMouseData()
-{
- if(!qt_screen)
- return;
- YopyTPdata data;
-
- unsigned int yopDat[4];
-
- int ret;
-
- ret=read(mouseFD,&yopDat,sizeof(yopDat));
-
- if(ret) {
- data.status= (YOPY_PRES(yopDat)) ? 1 : 0;
- data.xpos=YOPY_XPOS(yopDat);
- data.ypos=YOPY_YPOS(yopDat);
- QPoint q;
- q.setX(data.xpos);
- q.setY(data.ypos);
- if (data.status && !prevstate) {
- handler->mouseChanged(q,Qt::LeftButton);
- } else if(!data.status && prevstate) {
- handler->mouseChanged(q,0);
- }
- prevstate = data.status;
- }
- if(ret<0) {
- qDebug("Error %s",strerror(errno));
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qmouseyopy_qws.moc"
-
-#endif //QT_NO_QWS_MOUSE_YOPY
diff --git a/src/gui/embedded/qmouseyopy_qws.h b/src/gui/embedded/qmouseyopy_qws.h
deleted file mode 100644
index 0d24a8f038..0000000000
--- a/src/gui/embedded/qmouseyopy_qws.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.0, 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.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSEYOPY_QWS_H
-#define QMOUSEYOPY_QWS_H
-
-#include <QtGui/qmouse_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_MOUSE_YOPY
-
-// YOPY touch panel support based on changes contributed by Ron Victorelli
-// (victorrj at icubed.com) to Custom TP driver.
-
-class QWSYopyMouseHandlerPrivate;
-
-class QWSYopyMouseHandler : public QWSMouseHandler
-{
-public:
- explicit QWSYopyMouseHandler(const QString & = QString(),
- const QString & = QString());
- ~QWSYopyMouseHandler();
-
- void resume();
- void suspend();
-
-protected:
- QWSYopyMouseHandlerPrivate *d;
-};
-
-#endif // QT_NO_QWS_MOUSE_YOPY
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMOUSEYOPY_QWS_H
diff --git a/src/gui/embedded/qscreenlinuxfb_qws.cpp b/src/gui/embedded/qscreenlinuxfb_qws.cpp
index 42c4fcd4b6..28458422a3 100644
--- a/src/gui/embedded/qscreenlinuxfb_qws.cpp
+++ b/src/gui/embedded/qscreenlinuxfb_qws.cpp
@@ -46,6 +46,7 @@
#include "qwsdisplay_qws.h"
#include "qpixmap.h"
#include <private/qwssignalhandler_p.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <unistd.h>
#include <stdlib.h>
@@ -122,12 +123,12 @@ void QLinuxFbScreenPrivate::openTty()
if (ttyDevice.isEmpty()) {
for (const char * const *dev = devs; *dev; ++dev) {
- ttyfd = ::open(*dev, O_RDWR);
+ ttyfd = QT_OPEN(*dev, O_RDWR);
if (ttyfd != -1)
break;
}
} else {
- ttyfd = ::open(ttyDevice.toAscii().constData(), O_RDWR);
+ ttyfd = QT_OPEN(ttyDevice.toAscii().constData(), O_RDWR);
}
if (ttyfd == -1)
@@ -144,7 +145,7 @@ void QLinuxFbScreenPrivate::openTty()
// No blankin' screen, no blinkin' cursor!, no cursor!
const char termctl[] = "\033[9;0]\033[?33l\033[?25l\033[?1c";
- ::write(ttyfd, termctl, sizeof(termctl));
+ QT_WRITE(ttyfd, termctl, sizeof(termctl));
}
void QLinuxFbScreenPrivate::closeTty()
@@ -157,9 +158,9 @@ void QLinuxFbScreenPrivate::closeTty()
// Blankin' screen, blinkin' cursor!
const char termctl[] = "\033[9;15]\033[?33h\033[?25h\033[?0c";
- ::write(ttyfd, termctl, sizeof(termctl));
+ QT_WRITE(ttyfd, termctl, sizeof(termctl));
- ::close(ttyfd);
+ QT_CLOSE(ttyfd);
ttyfd = -1;
}
@@ -281,7 +282,7 @@ bool QLinuxFbScreen::connect(const QString &displaySpec)
dev = QLatin1String("/dev/fb0");
if (access(dev.toLatin1().constData(), R_OK|W_OK) == 0)
- d_ptr->fd = open(dev.toLatin1().constData(), O_RDWR);
+ d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDWR);
if (d_ptr->fd == -1) {
if (QApplication::type() == QApplication::GuiServer) {
perror("QScreenLinuxFb::connect");
@@ -289,7 +290,7 @@ bool QLinuxFbScreen::connect(const QString &displaySpec)
return false;
}
if (access(dev.toLatin1().constData(), R_OK) == 0)
- d_ptr->fd = open(dev.toLatin1().constData(), O_RDONLY);
+ d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY);
}
fb_fix_screeninfo finfo;
@@ -681,7 +682,7 @@ bool QLinuxFbScreen::initDevice()
#ifdef __i386__
// Now init mtrr
if(!::getenv("QWS_NOMTRR")) {
- int mfd=open("/proc/mtrr",O_WRONLY,0);
+ int mfd=QT_OPEN("/proc/mtrr",O_WRONLY,0);
// MTRR entry goes away when file is closed - i.e.
// hopefully when QWS is killed
if(mfd != -1) {
@@ -702,6 +703,9 @@ bool QLinuxFbScreen::initDevice()
//sentry.base,sentry.size,strerror(errno));
}
}
+
+ // Should we close mfd here?
+ //QT_CLOSE(mfd);
}
#endif
if ((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4) || (finfo.visual==FB_VISUAL_DIRECTCOLOR))
diff --git a/src/gui/embedded/qscreenproxy_qws.cpp b/src/gui/embedded/qscreenproxy_qws.cpp
index ade16cafcf..3d7451b9ed 100644
--- a/src/gui/embedded/qscreenproxy_qws.cpp
+++ b/src/gui/embedded/qscreenproxy_qws.cpp
@@ -537,7 +537,7 @@ int QProxyScreen::transformOrientation() const
}
/*!
-\reimp
+\internal
*/
int QProxyScreen::memoryNeeded(const QString &str)
{
@@ -548,7 +548,7 @@ int QProxyScreen::memoryNeeded(const QString &str)
}
/*!
-\reimp
+\internal
*/
int QProxyScreen::sharedRamSize(void *ptr)
{
@@ -559,7 +559,7 @@ int QProxyScreen::sharedRamSize(void *ptr)
}
/*!
-\reimp
+\internal
*/
void QProxyScreen::haltUpdates()
{
@@ -568,7 +568,7 @@ void QProxyScreen::haltUpdates()
}
/*!
-\reimp
+\internal
*/
void QProxyScreen::resumeUpdates()
{
diff --git a/src/gui/embedded/qsoundqss_qws.cpp b/src/gui/embedded/qsoundqss_qws.cpp
index 4355eff480..e239e14431 100644
--- a/src/gui/embedded/qsoundqss_qws.cpp
+++ b/src/gui/embedded/qsoundqss_qws.cpp
@@ -53,6 +53,7 @@
#include <qtimer.h>
#include <qpointer.h>
#include <qendian.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <unistd.h>
#include <stdlib.h>
@@ -1141,7 +1142,7 @@ void QWSSoundServerPrivate::sendCompletedSignals()
int QWSSoundServerPrivate::openFile(int wid, int sid, const QString& filename)
{
stopFile(wid, sid); // close and re-open.
- int f = ::open(QFile::encodeName(filename), O_RDONLY|O_NONBLOCK);
+ int f = QT_OPEN(QFile::encodeName(filename), O_RDONLY|O_NONBLOCK);
if (f == -1) {
// XXX check ferror, check reason.
qDebug("Failed opening \"%s\"",filename.toLatin1().data());
@@ -1161,7 +1162,7 @@ bool QWSSoundServerPrivate::openDevice()
{
if (fd < 0) {
if( silent ) {
- fd = ::open( "/dev/null", O_WRONLY );
+ fd = QT_OPEN( "/dev/null", O_WRONLY );
// Emulate write to audio device
int delay = 1000*(sound_buffer_size>>(sound_stereo+sound_16bit))/sound_speed/2;
timerId = startTimer(delay);
@@ -1172,7 +1173,7 @@ bool QWSSoundServerPrivate::openDevice()
// Don't block open right away.
//
bool openOkay = false;
- if ((fd = ::open("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1) {
+ if ((fd = QT_OPEN("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1) {
int flags = fcntl(fd, F_GETFL);
flags &= ~O_NONBLOCK;
openOkay = (fcntl(fd, F_SETFL, flags) == 0);
@@ -1226,7 +1227,7 @@ bool QWSSoundServerPrivate::openDevice()
//
// Check system volume
//
- int mixerHandle = ::open( "/dev/mixer", O_RDWR|O_NONBLOCK );
+ int mixerHandle = QT_OPEN( "/dev/mixer", O_RDWR|O_NONBLOCK );
if ( mixerHandle >= 0 ) {
int volume;
ioctl( mixerHandle, MIXER_READ(0), &volume );
diff --git a/src/gui/embedded/qtransportauth_qws.cpp b/src/gui/embedded/qtransportauth_qws.cpp
index 05dce117c9..8523e272aa 100644
--- a/src/gui/embedded/qtransportauth_qws.cpp
+++ b/src/gui/embedded/qtransportauth_qws.cpp
@@ -56,6 +56,7 @@
#include "qlibraryinfo.h"
#include "qfile.h"
#include "qdebug.h"
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <syslog.h>
#include <unistd.h>
@@ -572,7 +573,7 @@ bool QTransportAuth::authorizeRequest( QTransportAuth::Data &d, const QString &r
//get cmdline from proc/pid/cmdline
snprintf( cmdlinePath, BUF_SIZE, "/proc/%d/cmdline", d.processId );
- int cmdlineFd = open( cmdlinePath, O_RDONLY );
+ int cmdlineFd = QT_OPEN( cmdlinePath, O_RDONLY );
if ( cmdlineFd == -1 )
{
qWarning( "SXE:- Error encountered in opening /proc/%u/cmdline: %s",
@@ -581,13 +582,13 @@ bool QTransportAuth::authorizeRequest( QTransportAuth::Data &d, const QString &r
}
else
{
- if ( -1 == ::read(cmdlineFd, cmdline, BUF_SIZE - 1 ) )
+ if ( -1 == QT_READ(cmdlineFd, cmdline, BUF_SIZE - 1 ) )
{
qWarning( "SXE:- Error encountered in reading /proc/%u/cmdline : %s",
d.processId, strerror(errno) );
snprintf( cmdline, BUF_SIZE, "%s", "Unknown" );
}
- close( cmdlineFd );
+ QT_CLOSE( cmdlineFd );
}
syslog( LOG_ERR | LOG_LOCAL6, "%s // PID:%u // ProgId:%u // Exe:%s // Request:%s // Cmdline:%s",
diff --git a/src/gui/embedded/qunixsocket.cpp b/src/gui/embedded/qunixsocket.cpp
index 070d3cf7bd..57a4a115d9 100644
--- a/src/gui/embedded/qunixsocket.cpp
+++ b/src/gui/embedded/qunixsocket.cpp
@@ -46,6 +46,7 @@
#include <QtCore/qsocketnotifier.h>
#include <QtCore/qqueue.h>
#include <QtCore/qdatetime.h>
+#include "private/qcore_unix_p.h" // overrides QT_OPEN
#ifdef QUNIXSOCKET_DEBUG
#include <QtCore/qdebug.h>
@@ -131,7 +132,7 @@ struct QUnixSocketRightsPrivate : public QSharedData
#ifdef QUNIXSOCKET_DEBUG
int closerv =
#endif
- ::close(fd);
+ QT_CLOSE(fd);
#ifdef QUNIXSOCKET_DEBUG
if(0 != closerv) {
qDebug() << "QUnixSocketRightsPrivate: Unable to close managed"
@@ -162,7 +163,7 @@ QUnixSocketRights::QUnixSocketRights(int fd)
if(-1 == fd) {
d->fd = -1;
} else {
- d->fd = ::dup(fd);
+ d->fd = qt_safe_dup(fd);
#ifdef QUNIXSOCKET_DEBUG
if(-1 == d->fd) {
qDebug() << "QUnixSocketRights: Unable to duplicate fd "
@@ -232,7 +233,7 @@ int QUnixSocketRights::dupFd() const
{
if(-1 == d->fd) return -1;
- int rv = ::dup(d->fd);
+ int rv = qt_safe_dup(d->fd);
#ifdef QUNIXSOCKET_DEBUG
if(-1 == rv)
@@ -825,7 +826,7 @@ public:
int numFds = (h->cmsg_len - CMSG_LEN(0)) / sizeof(int);
for(int ii = 0; ii < numFds; ++ii)
- ::close(fds[ii]);
+ QT_CLOSE(fds[ii]);
}
h = (::cmsghdr *)CMSG_NXTHDR(&(message), h);
@@ -1017,7 +1018,7 @@ connect_error: // Cleanup failed connection
#ifdef QUNIXSOCKET_DEBUG
int closerv =
#endif
- ::close(d->fd);
+ QT_CLOSE(d->fd);
#ifdef QUNIXSOCKET_DEBUG
if(0 != closerv) {
qDebug() << "QUnixSocket: Unable to close file descriptor after "
@@ -1762,7 +1763,12 @@ void QUnixSocketPrivate::readActivated()
message.msg_controllen = ancillaryBufferCapacity();
message.msg_control = ancillaryBuffer;
- int recvrv = ::recvmsg(fd, &message, 0);
+ int flags = 0;
+#ifdef MSG_CMSG_CLOEXEC
+ flags = MSG_CMSG_CLOEXEC;
+#endif
+
+ int recvrv = ::recvmsg(fd, &message, flags);
#ifdef QUNIXSOCKET_DEBUG
qDebug() << "QUnixSocket: Received message (" << recvrv << ')';
#endif