44 #include "qplatformdefs.h" 46 #include "private/qcore_unix_p.h" 47 #include "QtCore/qdebug.h" 49 #include <sys/dcmd_input.h> 50 #include <sys/keycodes.h> 111 qDebug(
"QWSQnxKeyboardHandler: connected.");
128 return sym >= 0xF100 && (
sizeof(wchar_t) > 2 || sym < 0x10000);
129 return (sym & ~0x9F) != 0;
137 _keyboard_packet packet;
141 if (bytesRead == -1) {
142 qErrnoWarning(
errno,
"QWSQnxKeyboardHandler::socketActivated(): Unable to read data.");
147 Q_ASSERT(bytesRead ==
sizeof(_keyboard_packet));
149 if (packet.data.flags & KEY_SYM_VALID_EX)
150 packet.data.flags |= KEY_SYM_VALID;
151 else if (!(packet.data.flags & (KEY_SYM_VALID | KEY_CAP_VALID)))
155 qDebug() <<
"keyboard got scancode" 156 <<
hex << packet.data.modifiers
158 << packet.data.key_cap
159 << packet.data.key_sym
160 << packet.data.key_scan;
168 if (packet.data.modifiers & KEYMOD_SHIFT)
170 if (packet.data.modifiers & KEYMOD_CTRL)
172 if (packet.data.modifiers & KEYMOD_ALT)
174 if (packet.data.modifiers & KEYMOD_NUM_LOCK)
178 if (packet.data.modifiers & KEYMOD_ALTGR)
183 bool isPress = packet.data.flags & KEY_DOWN;
185 bool isRepeat = packet.data.flags & KEY_REPEAT;
190 if (((packet.data.flags & KEY_SYM_VALID) &&
key_sym_displayable(unicode = packet.data.key_sym))
191 || ((packet.data.flags & KEY_CAP_VALID) &&
key_sym_displayable(unicode = packet.data.key_cap))) {
192 if (unicode <= 0x0ff) {
193 if (unicode >=
'a' && unicode <=
'z')
204 unsigned long sym = 0;
205 if (packet.data.flags & KEY_SYM_VALID)
206 sym = packet.data.key_sym;
207 else if (packet.data.flags & KEY_CAP_VALID)
208 sym = packet.data.key_cap;
212 case KEYCODE_TAB: key =
Qt::Key_Tab; unicode = 9;
break;
218 case KEYCODE_KP_INSERT:
220 case KEYCODE_KP_DELETE:
240 case KEYCODE_KP_HOME:
246 case KEYCODE_KP_LEFT:
252 case KEYCODE_KP_RIGHT:
255 case KEYCODE_KP_DOWN:
258 case KEYCODE_KP_PG_UP:
260 case KEYCODE_PG_DOWN:
261 case KEYCODE_KP_PG_DOWN:
264 case KEYCODE_LEFT_SHIFT:
265 case KEYCODE_RIGHT_SHIFT:
267 case KEYCODE_LEFT_CTRL:
268 case KEYCODE_RIGHT_CTRL:
270 case KEYCODE_LEFT_ALT:
271 case KEYCODE_RIGHT_ALT:
273 case KEYCODE_CAPS_LOCK:
275 case KEYCODE_NUM_LOCK:
277 case KEYCODE_SCROLL_LOCK:
302 case KEYCODE_KP_FIVE:
303 if (!(modifiers & Qt::KeypadModifier))
319 processKeyEvent(unicode, key, modifiers, isPress || isRepeat, isRepeat);
#define QT_END_NAMESPACE
This macro expands to.
The QString class provides a Unicode character string.
Q_CORE_EXPORT QTextStream & hex(QTextStream &s)
The QSocketNotifier class provides support for monitoring activity on a file descriptor.
QWSQnxKeyboardHandler(const QString &device)
Constructs a keyboard handler for the specified device, defaulting to /dev/devi/keyboard0.
Q_CORE_EXPORT void qDebug(const char *,...)
#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.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
static bool key_sym_displayable(unsigned long sym)
const char * constData() const
Returns a pointer to the data stored in the byte array.
~QWSQnxKeyboardHandler()
Destroys this keyboard handler and closes the connection to the keyboard device.
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.
void qErrnoWarning(const char *msg,...)