diff options
author | Ritt Konstantin <ritt.ks@gmail.com> | 2011-06-06 11:52:09 (GMT) |
---|---|---|
committer | Harald Fernengel <harald.fernengel@nokia.com> | 2011-06-06 11:52:09 (GMT) |
commit | afafb37b7ef6130ab0545c9d12c7995e85dfb9b0 (patch) | |
tree | ff20e0b8e44bbb320e9fc93947bbed4ecc731248 /src/gui | |
parent | f9053a429993a5081d7a3e67934f58345ee3e25b (diff) | |
download | Qt-afafb37b7ef6130ab0545c9d12c7995e85dfb9b0.zip Qt-afafb37b7ef6130ab0545c9d12c7995e85dfb9b0.tar.gz Qt-afafb37b7ef6130ab0545c9d12c7995e85dfb9b0.tar.bz2 |
minor code simplification
`ascii` wasn't used
Merge-request: 2627
Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/embedded/qwindowsystem_qws.cpp | 26 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_qws.cpp | 9 |
2 files changed, 14 insertions, 21 deletions
diff --git a/src/gui/embedded/qwindowsystem_qws.cpp b/src/gui/embedded/qwindowsystem_qws.cpp index 0e4e27c..36802a8 100644 --- a/src/gui/embedded/qwindowsystem_qws.cpp +++ b/src/gui/embedded/qwindowsystem_qws.cpp @@ -2494,7 +2494,7 @@ QWSWindow *QWSServer::windowAt(const QPoint& pos) } #ifndef QT_NO_QWS_KEYBOARD -static int keyUnicode(int keycode) +static inline int keyUnicode(int keycode) { int code = 0xffff; @@ -2550,18 +2550,16 @@ void QWSServer::sendKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers mod void QWSServerPrivate::sendKeyEventUnfiltered(int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat) { + QWSWindow *win = keyboardGrabber ? keyboardGrabber : qwsServerPrivate->focusw; - QWSKeyEvent event; - QWSWindow *win = keyboardGrabber ? keyboardGrabber : - qwsServerPrivate->focusw; - - event.simpleData.window = win ? win->winId() : 0; - - event.simpleData.unicode = #ifndef QT_NO_QWS_KEYBOARD - unicode < 0 ? keyUnicode(keycode) : + if (unicode < 0) + unicode = keyUnicode(keycode); #endif - unicode; + + QWSKeyEvent event; + event.simpleData.window = win ? win->winId() : 0; + event.simpleData.unicode = unicode; event.simpleData.keycode = keycode; event.simpleData.modifiers = modifiers; event.simpleData.is_press = isPress; @@ -4127,11 +4125,11 @@ void QWSServer::processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers #endif // If we press a key and it's going to be blocked, wake up the screen - if ( block && isPress ) - qwsServerPrivate->_q_screenSaverWake(); - - if ( block ) + if (block) { + if (isPress) + qwsServerPrivate->_q_screenSaverWake(); return; + } if (keyFilters) { for (int i = 0; i < keyFilters->size(); ++i) { diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index e11571c..1197c77 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -3552,13 +3552,8 @@ bool QETWidget::translateKeyEvent(const QWSKeyEvent *event, bool grab) /* grab i QEvent::KeyPress : QEvent::KeyRelease; bool autor = event->simpleData.is_auto_repeat; QString text; - char ascii = 0; - if (event->simpleData.unicode) { - QChar ch(event->simpleData.unicode); - if (ch.unicode() != 0xffff) - text += ch; - ascii = ch.toLatin1(); - } + if (event->simpleData.unicode && event->simpleData.unicode != 0xffff) + text += QChar(event->simpleData.unicode); code = event->simpleData.keycode; #if defined QT3_SUPPORT && !defined(QT_NO_SHORTCUT) |