author | zecke <zecke> | 2004-03-02 21:04:44 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-02 21:04:44 (UTC) |
commit | dcf196abd97485cd9634d6ac135028a605c54fb5 (patch) (unidiff) | |
tree | a424872b45f52418e4c84148c7ed4cfcc0b1a681 | |
parent | 0a67659dce57ac1475841838369e924f2441e991 (diff) | |
download | opie-dcf196abd97485cd9634d6ac135028a605c54fb5.zip opie-dcf196abd97485cd9634d6ac135028a605c54fb5.tar.gz opie-dcf196abd97485cd9634d6ac135028a605c54fb5.tar.bz2 |
Fix key handling bug 1268
-rw-r--r-- | noncore/comm/keypebble/krfbdecoder.cpp | 79 |
1 files changed, 34 insertions, 45 deletions
diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp index 2c9ad71..db95154 100644 --- a/noncore/comm/keypebble/krfbdecoder.cpp +++ b/noncore/comm/keypebble/krfbdecoder.cpp | |||
@@ -211,3 +211,3 @@ void KRFBDecoder::gotDesktopName() | |||
211 | 211 | ||
212 | disconnect( con, SIGNAL( gotEnoughData() ), | 212 | disconnect( con, SIGNAL( gotEnoughData() ), |
213 | this, SLOT( gotDesktopName() ) ); | 213 | this, SLOT( gotDesktopName() ) ); |
@@ -265,3 +265,3 @@ void KRFBDecoder::decidePixelFormat() | |||
265 | info->depth, | 265 | info->depth, |
266 | bestDepth, | 266 | bestDepth, |
267 | con->options()->colors256, chosenDepth ); | 267 | con->options()->colors256, chosenDepth ); |
@@ -375,3 +375,3 @@ void KRFBDecoder::gotUpdateHeader() | |||
375 | 375 | ||
376 | disconnect( con, SIGNAL( gotEnoughData() ), | 376 | disconnect( con, SIGNAL( gotEnoughData() ), |
377 | this, SLOT( gotUpdateHeader() ) ); | 377 | this, SLOT( gotUpdateHeader() ) ); |
@@ -399,3 +399,3 @@ void KRFBDecoder::gotUpdateHeader() | |||
399 | } | 399 | } |
400 | return; | 400 | return; |
401 | } | 401 | } |
@@ -422,3 +422,3 @@ void KRFBDecoder::gotRectHeader() | |||
422 | 422 | ||
423 | disconnect( con, SIGNAL( gotEnoughData() ), | 423 | disconnect( con, SIGNAL( gotEnoughData() ), |
424 | this, SLOT( gotRectHeader() ) ); | 424 | this, SLOT( gotRectHeader() ) ); |
@@ -438,3 +438,3 @@ void KRFBDecoder::gotRectHeader() | |||
438 | // CARD32 encodingLocal = Swap32IfLE( encoding ); | 438 | // CARD32 encodingLocal = Swap32IfLE( encoding ); |
439 | // qWarning( "Rect: x=%d, y= %d, w=%d, h=%d, encoding=%ld", | 439 | // qWarning( "Rect: x=%d, y= %d, w=%d, h=%d, encoding=%ld", |
440 | // x, y, w, h, encodingLocal ); | 440 | // x, y, w, h, encodingLocal ); |
@@ -522,3 +522,3 @@ void KRFBDecoder::gotRawRectChunk() | |||
522 | 522 | ||
523 | disconnect( con, SIGNAL( gotEnoughData() ), | 523 | disconnect( con, SIGNAL( gotEnoughData() ), |
524 | this, SLOT( gotRawRectChunk() ) ); | 524 | this, SLOT( gotRawRectChunk() ) ); |
@@ -530,3 +530,3 @@ void KRFBDecoder::gotRawRectChunk() | |||
530 | // | 530 | // |
531 | 531 | ||
532 | // TODO: Replace this! | 532 | // TODO: Replace this! |
@@ -722,3 +722,3 @@ void KRFBDecoder::gotServerCutText() | |||
722 | /* For some reason QApplication::clipboard()->setText() segfaults when called | 722 | /* For some reason QApplication::clipboard()->setText() segfaults when called |
723 | * from within keypebble's mass of signals and slots | 723 | * from within keypebble's mass of signals and slots |
724 | qWarning( "Server cut: %s", cutbuf ); | 724 | qWarning( "Server cut: %s", cutbuf ); |
@@ -800,42 +800,31 @@ void KRFBDecoder::sendKeyReleaseEvent( QKeyEvent *event ) | |||
800 | 800 | ||
801 | |||
802 | |||
803 | // | ||
804 | // The RFB protocol spec says 'For most ordinary keys, the 'keysym' | ||
805 | // is the same as the corresponding ASCII value.', but doesn't | ||
806 | // elaborate what the most ordinary keys are. The spec also lists | ||
807 | // a set (possibly subset, it's unspecified) of mappings for | ||
808 | // "other common keys" (backspace, tab, return, escape, etc). | ||
809 | // | ||
801 | int KRFBDecoder::toKeySym( QKeyEvent *k ) | 810 | int KRFBDecoder::toKeySym( QKeyEvent *k ) |
802 | { | 811 | { |
803 | int ke = 0; | ||
804 | |||
805 | ke = k->ascii(); | ||
806 | // Markus: Crappy hack. I dont know why lower case letters are | ||
807 | // not defined in qkeydefs.h. The key() for e.g. 'l' == 'L'. | ||
808 | // This sucks. :-( | ||
809 | |||
810 | if ( (ke == 'a') || (ke == 'b') || (ke == 'c') || (ke == 'd') | ||
811 | || (ke == 'e') || (ke == 'f') || (ke == 'g') || (ke == 'h') | ||
812 | || (ke == 'i') || (ke == 'j') || (ke == 'k') || (ke == 'l') | ||
813 | || (ke == 'm') || (ke == 'n') || (ke == 'o') || (ke == 'p') | ||
814 | || (ke == 'q') || (ke == 'r') || (ke == 's') || (ke == 't') | ||
815 | || (ke == 'u') || (ke == 'v') ||( ke == 'w') || (ke == 'x') | ||
816 | || (ke == 'y') || (ke == 'z') ) { | ||
817 | ke = k->key(); | ||
818 | ke = ke + 0x20; | ||
819 | return ke; | ||
820 | } | ||
821 | 812 | ||
822 | // qkeydefs = xkeydefs! :-) | 813 | // |
823 | if ( ( k->key() >= 0x0a0 ) && k->key() <= 0x0ff ) | 814 | // Try and map these "other common keys" first. |
824 | return k->key(); | 815 | // |
825 | 816 | if ((k->key() >= Qt::Key_Escape) && (k->key() <= Qt::Key_F12)) { | |
826 | if ( ( k->key() >= 0x20 ) && ( k->key() <= 0x7e ) ) | 817 | for(int i = 0; keyMap[i].keycode != 0; i++) { |
827 | return k->key(); | 818 | if (k->key() == keyMap[i].keycode) { |
828 | 819 | return keyMap[i].keysym; | |
829 | // qkeydefs != xkeydefs! :-( | 820 | } |
830 | // This is gonna suck :-( | 821 | } |
831 | 822 | } | |
832 | int i = 0; | ||
833 | while ( keyMap[i].keycode ) { | ||
834 | if ( k->key() == keyMap[i].keycode ) | ||
835 | return keyMap[i].keysym; | ||
836 | i++; | ||
837 | } | ||
838 | 823 | ||
839 | return 0; | 824 | // |
825 | // If these keys aren't matched, return the ascii code and let the | ||
826 | // server figure it out. We don't return k->key(), as the data in | ||
827 | // key differs between input methods, and we don't want special cases. | ||
828 | // | ||
829 | return k->ascii(); | ||
840 | } | 830 | } |
841 | |||