| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 1992-2006 TROLLTECH ASA. All rights reserved. | 
|---|
| 4 | ** | 
|---|
| 5 | ** This file is part of the Phone Edition of the Qt Toolkit. | 
|---|
| 6 | ** | 
|---|
| 7 | ** $QT_BEGIN_LICENSE:LGPL$ | 
|---|
| 8 | ** Commercial Usage | 
|---|
| 9 | ** Licensees holding valid Qt Commercial licenses may use this file in | 
|---|
| 10 | ** accordance with the Qt Commercial License Agreement provided with the | 
|---|
| 11 | ** Software or, alternatively, in accordance with the terms contained in | 
|---|
| 12 | ** a written agreement between you and Nokia. | 
|---|
| 13 | ** | 
|---|
| 14 | ** GNU Lesser General Public License Usage | 
|---|
| 15 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
|---|
| 16 | ** General Public License version 2.1 as published by the Free Software | 
|---|
| 17 | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
|---|
| 18 | ** packaging of this file.  Please review the following information to | 
|---|
| 19 | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
|---|
| 20 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | 
|---|
| 21 | ** | 
|---|
| 22 | ** In addition, as a special exception, Nokia gives you certain | 
|---|
| 23 | ** additional rights. These rights are described in the Nokia Qt LGPL | 
|---|
| 24 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this | 
|---|
| 25 | ** package. | 
|---|
| 26 | ** | 
|---|
| 27 | ** GNU General Public License Usage | 
|---|
| 28 | ** Alternatively, this file may be used under the terms of the GNU | 
|---|
| 29 | ** General Public License version 3.0 as published by the Free Software | 
|---|
| 30 | ** Foundation and appearing in the file LICENSE.GPL included in the | 
|---|
| 31 | ** packaging of this file.  Please review the following information to | 
|---|
| 32 | ** ensure the GNU General Public License version 3.0 requirements will be | 
|---|
| 33 | ** met: http://www.gnu.org/copyleft/gpl.html. | 
|---|
| 34 | ** | 
|---|
| 35 | ** If you are unsure which license is appropriate for your use, please | 
|---|
| 36 | ** contact the sales department at qt-sales@nokia.com. | 
|---|
| 37 | ** $QT_END_LICENSE$ | 
|---|
| 38 | ** | 
|---|
| 39 | ****************************************************************************/ | 
|---|
| 40 |  | 
|---|
| 41 | #ifndef X11KEYFAKER_H | 
|---|
| 42 | #define X11KEYFAKER_H | 
|---|
| 43 |  | 
|---|
| 44 | #include <QObject> | 
|---|
| 45 | #include <QX11Info> | 
|---|
| 46 | #include <qnamespace.h> | 
|---|
| 47 |  | 
|---|
| 48 | QT_BEGIN_NAMESPACE | 
|---|
| 49 |  | 
|---|
| 50 | class X11KeyFaker : public QObject | 
|---|
| 51 | { | 
|---|
| 52 | Q_OBJECT | 
|---|
| 53 | public: | 
|---|
| 54 | X11KeyFaker(const QString& displayName, QObject *parent = 0); | 
|---|
| 55 | ~X11KeyFaker(); | 
|---|
| 56 |  | 
|---|
| 57 | bool isConnected() const { return dpy != 0; } | 
|---|
| 58 |  | 
|---|
| 59 | void sendKeyEvent(int qtCode, bool isPress); | 
|---|
| 60 |  | 
|---|
| 61 | private slots: | 
|---|
| 62 | void connect(); | 
|---|
| 63 | void readyRead(); | 
|---|
| 64 |  | 
|---|
| 65 | signals: | 
|---|
| 66 | void connected(); | 
|---|
| 67 | void couldNotConnect(); | 
|---|
| 68 |  | 
|---|
| 69 | private: | 
|---|
| 70 | QString displayName; | 
|---|
| 71 | Display *dpy; | 
|---|
| 72 | int retryCount; | 
|---|
| 73 | int shiftKeycode; | 
|---|
| 74 | int modeSwitchKeycode; | 
|---|
| 75 | int modifiers; | 
|---|
| 76 | }; | 
|---|
| 77 |  | 
|---|
| 78 | QT_END_NAMESPACE | 
|---|
| 79 |  | 
|---|
| 80 | #endif | 
|---|