45 #ifndef QT_NO_QWS_KEYBOARD 48 #include <QDataStream> 49 #include <QStringList> 57 #include <QWindowSystemInterface> 88 foreach (
const QString &arg, args) {
221 quint32 qmap_magic, qmap_version, qmap_keymap_size, qmap_keycompose_size;
225 ds >> qmap_magic >> qmap_version >> qmap_keymap_size >> qmap_keycompose_size;
235 for (
quint32 i = 0; i < qmap_keymap_size; ++i)
236 ds >> qmap_keymap[i];
237 for (
quint32 i = 0; i < qmap_keycompose_size; ++i)
238 ds >> qmap_keycompose[i];
241 delete [] qmap_keymap;
242 delete [] qmap_keycompose;
366 #if defined(Q_WS_QWS) 368 #elif defined(Q_WS_QPA) 371 if (unicode != 0xffff)
401 static int dir_keyrot = -1;
402 if (dir_keyrot < 0) {
405 case 90: dir_keyrot = 1;
break;
406 case 180: dir_keyrot = 2;
break;
407 case 270: dir_keyrot = 3;
break;
408 default: dir_keyrot = 0;
break;
435 d->beginAutoRepeat(uni, code, mod);
524 bool first_press = pressed && !autorepeat;
530 for (
int i = 0; i <
d->m_keymap_size && !(map_plain && map_withmod); ++i) {
536 quint8 testmods =
d->m_modifiers;
544 #ifdef QT_DEBUG_KEYMAP 545 qWarning(
"Processing key event: keycode=%3d, modifiers=%02x pressed=%d, autorepeat=%d | plain=%d, withmod=%d, size=%d", \
546 keycode,
d->m_modifiers, pressed ? 1 : 0, autorepeat ? 1 : 0, \
547 map_plain ? map_plain -
d->m_keymap : -1, \
548 map_withmod ? map_withmod -
d->m_keymap : -1, \
555 #ifdef QT_DEBUG_KEYMAP 557 qWarning(
"Could not find a suitable mapping for keycode: %3d, modifiers: %02x", keycode,
d->m_modifiers);
620 if (first_press &&
d->m_composing == 1 &&
d->m_dead_unicode == unicode) {
623 }
else if (first_press && unicode != 0xffff) {
624 d->m_dead_unicode = unicode;
639 if ((it == map_plain && it != map_withmod) ||
640 (map_withmod && !(map_withmod->
qtcode & modmask))) {
646 if (unicode != 0xffff) {
649 for ( ; idx <
d->m_keycompose_size; ++idx) {
650 if (
d->m_keycompose[idx].first == unicode)
655 d->m_dead_unicode = unicode;
668 if (unicode != 0xffff) {
671 for ( ; idx <
d->m_keycompose_size; ++idx) {
672 if (
d->m_keycompose[idx].first ==
d->m_dead_unicode &&
d->m_keycompose[idx].second == unicode)
676 quint16 composed =
d->m_keycompose[idx].result;
677 if (composed != 0xffff) {
685 unicode =
d->m_dead_unicode;
692 #ifdef QT_DEBUG_KEYMAP 693 qWarning(
"Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode & ~modmask, (qtcode & modmask));
697 processKeyEvent(unicode, qtcode & ~modmask, Qt::KeyboardModifiers(qtcode & modmask), pressed, autorepeat);
705 #include "qkbd_qws.moc" 707 #endif // QT_NO_QWS_KEYBOARD Q_GUI_EXPORT QScreen * qt_screen
Status status() const
Returns the status of the data stream.
void setSingleShot(bool singleShot)
void endAutoRepeat()
Stops auto-repeating a key press.
The QWSKeyboardHandler class is a base class for keyboard drivers in Qt for Embedded Linux...
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QWSKbPrivate(QWSKeyboardHandler *h, const QString &device)
#define QT_END_NAMESPACE
This macro expands to.
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
#define it(className, varName)
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString &text=QString(), bool autorep=false, ushort count=1)
int transformDirKey(int key)
Transforms the arrow key specified by the given keycode, to the orientation of the display and return...
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
static void processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat)
Processes the given key event.
void beginAutoRepeat(int uni, int code, Qt::KeyboardModifiers mod)
#define QT_BEGIN_NAMESPACE
This macro expands to.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
The QStringList class provides a list of strings.
static int toInt(const QByteArray &str)
QWSKeyboardHandler()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Q_CORE_EXPORT void qWarning(const char *,...)
bool loadKeymap(const QString &file)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
const QWSKeyboard::Mapping * m_keymap
static Qt::KeyboardModifiers toQtModifiers(quint8 mod)
QWSKeyboardHandler * m_handler
KeycodeAction
This enum describes the various special actions that actual QWSKeyboardHandler implementations have t...
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Qt::KeyboardModifiers m_ar_modifier
The QFile class provides an interface for reading from and writing to files.
const QWSKeyboard::Composing * m_keycompose
Type
This enum type defines the valid event types in Qt.
void beginAutoRepeat(int uni, int code, Qt::KeyboardModifiers mod)
Begins auto-repeating the specified key press; after a short delay the key press is sent periodically...
static QReadWriteLock lock
virtual int transformOrientation() const
Returns the current rotation as an integer value.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
The QDataStream class provides serialization of binary data to a QIODevice.
virtual void processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat)
Sends a key event to the Qt for Embedded Linux server application.
The QTimer class provides repetitive and single-shot timers.
void stop()
Stops the timer.
static const QWSKeyboard::Composing s_keycompose_default[]
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
#define qPrintable(string)
KeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat)
Maps keycode according to a keymap and sends that key event to the Qt for Embedded Linux server appli...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
static const QWSKeyboard::Mapping s_keymap_default[]
QWSServer Q_GUI_EXPORT * qwsServer
virtual ~QWSKeyboardHandler()
Destroys this keyboard driver.