-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index de3aa52..08318bd 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -351,50 +351,52 @@ void Keyboard::mousePressEvent(QMouseEvent *e) | |||
351 | 351 | ||
352 | unicode = 0; | 352 | unicode = 0; |
353 | if (shift || lock) { | 353 | if (shift || lock) { |
354 | 354 | ||
355 | // diaeresis | 355 | // diaeresis |
356 | qkeycode = 0x2001; | 356 | qkeycode = 0x2001; |
357 | } | 357 | } |
358 | else { | 358 | else { |
359 | 359 | ||
360 | // circumflex | 360 | // circumflex |
361 | qkeycode = 0x2000; | 361 | qkeycode = 0x2000; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | 364 | ||
365 | // Back accent character support | 365 | // Back accent character support |
366 | 366 | ||
367 | if (unicode == 0x60) { | 367 | //if (unicode == 0x60) { // the keys from 2c6 ~ 2cf should be used instead of the ascii one |
368 | if (unicode == 0x2cb) { | ||
368 | 369 | ||
369 | unicode = 0; | 370 | unicode = 0; |
370 | if (shift || lock) { | 371 | if (shift || lock) { |
371 | 372 | ||
372 | // circumblex | 373 | // circumblex |
373 | qkeycode = 0x2000; | 374 | qkeycode = 0x2000; |
374 | } | 375 | } |
375 | else { | 376 | else { |
376 | 377 | ||
377 | // back accent | 378 | // back accent |
378 | qkeycode = 0x2002; | 379 | qkeycode = 0x2002; |
379 | } | 380 | } |
380 | } | 381 | } |
381 | 382 | ||
382 | // Accent character support | 383 | // Accent character support |
383 | 384 | ||
384 | if (unicode == 0xb4) { | 385 | //if (unicode == 0xb4) { |
386 | if (unicode == 0x2ca) { | ||
385 | 387 | ||
386 | unicode = 0; | 388 | unicode = 0; |
387 | if (shift || lock) { | 389 | if (shift || lock) { |
388 | 390 | ||
389 | // diaeresis | 391 | // diaeresis |
390 | qkeycode = 0x2001; | 392 | qkeycode = 0x2001; |
391 | } | 393 | } |
392 | else { | 394 | else { |
393 | 395 | ||
394 | // accent | 396 | // accent |
395 | qkeycode = 0x2003; | 397 | qkeycode = 0x2003; |
396 | } | 398 | } |
397 | } | 399 | } |
398 | 400 | ||
399 | 401 | ||
400 | if (unicode == 0) { // either Qt char, or nothing | 402 | if (unicode == 0) { // either Qt char, or nothing |
@@ -753,32 +755,39 @@ void Keyboard::mouseReleaseEvent(QMouseEvent*) | |||
753 | pressed = FALSE; | 755 | pressed = FALSE; |
754 | //if ( pressTid == 0 ) | 756 | //if ( pressTid == 0 ) |
755 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 757 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
756 | if ( unicode != -1 ) { | 758 | if ( unicode != -1 ) { |
757 | emit key( unicode, qkeycode, modifiers, false, false ); | 759 | emit key( unicode, qkeycode, modifiers, false, false ); |
758 | repeatTimer->stop(); | 760 | repeatTimer->stop(); |
759 | } | 761 | } |
760 | #endif | 762 | #endif |
761 | if (shift && unicode != 0) { | 763 | if (shift && unicode != 0) { |
762 | 764 | ||
763 | 765 | ||
764 | *shift = 0; // unpress shift key | 766 | *shift = 0; // unpress shift key |
765 | shift = 0; // reset the shift pointer | 767 | shift = 0; // reset the shift pointer |
766 | repaint(FALSE); | 768 | repaint(FALSE); |
767 | 769 | ||
768 | } | 770 | } |
771 | if (ctrl && unicode != 0) { | ||
772 | |||
773 | *ctrl = 0; | ||
774 | ctrl = 0; | ||
775 | repaint(FALSE); | ||
776 | |||
777 | } | ||
769 | 778 | ||
770 | /* | 779 | /* |
771 | * do not make the meta key release after being pressed | 780 | * do not make the meta key release after being pressed |
772 | * | 781 | * |
773 | 782 | ||
774 | else if (meta && unicode != 0) { | 783 | else if (meta && unicode != 0) { |
775 | 784 | ||
776 | *meta = 0; | 785 | *meta = 0; |
777 | meta = 0; | 786 | meta = 0; |
778 | repaint(FALSE); | 787 | repaint(FALSE); |
779 | } | 788 | } |
780 | 789 | ||
781 | */ | 790 | */ |
782 | 791 | ||
783 | else clearHighlight(); | 792 | else clearHighlight(); |
784 | } | 793 | } |
@@ -1002,35 +1011,35 @@ void Keyboard::loadKeyboardColors() { | |||
1002 | /* korean input functions {{{1 | 1011 | /* korean input functions {{{1 |
1003 | * | 1012 | * |
1004 | * TODO | 1013 | * TODO |
1005 | * one major problem with this implementation is that you can't move the | 1014 | * one major problem with this implementation is that you can't move the |
1006 | * cursor after inputing korean chars, otherwise it will eat up and replace | 1015 | * cursor after inputing korean chars, otherwise it will eat up and replace |
1007 | * the char before the cursor you move to. fix that | 1016 | * the char before the cursor you move to. fix that |
1008 | * | 1017 | * |
1009 | * make backspace delete one single char, not the whole thing if still | 1018 | * make backspace delete one single char, not the whole thing if still |
1010 | * editing. | 1019 | * editing. |
1011 | * | 1020 | * |
1012 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | 1021 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
1013 | * | 1022 | * |
1014 | * how korean input works | 1023 | * how korean input works |
1015 | * | 1024 | * |
1016 | * all following chars means unicode char value and are in hex | 1025 | * all following chars means unicode char value and are in hex |
1017 | * | 1026 | * |
1018 | * ĆŹĄ½ = schar (start char) | 1027 | * ģ“ģ = schar (start char) |
1019 | * Įߥ½ = mchar (middle char) | 1028 | * ģ¤ģ = mchar (middle char) |
1020 | * ³”Ą½ = echar (end char) | 1029 | * ėģ = echar (end char) |
1021 | * | 1030 | * |
1022 | * there are 19 schars. unicode position is at 1100 - 1112 | 1031 | * there are 19 schars. unicode position is at 1100 - 1112 |
1023 | * there are 21 mchars. unicode position is at 1161 - 1175 | 1032 | * there are 21 mchars. unicode position is at 1161 - 1175 |
1024 | * there are 27 echars. unicode position is at 11a8 - 11c2 | 1033 | * there are 27 echars. unicode position is at 11a8 - 11c2 |
1025 | * | 1034 | * |
1026 | * the map with everything combined is at ac00 - d7a3 | 1035 | * the map with everything combined is at ac00 - d7a3 |
1027 | * | 1036 | * |
1028 | */ | 1037 | */ |
1029 | 1038 | ||
1030 | ushort Keyboard::parseKoreanInput (ushort c) { | 1039 | ushort Keyboard::parseKoreanInput (ushort c) { |
1031 | 1040 | ||
1032 | if ((c != 0 && (c < 0x1100 || 0x11c2 < c) && (c < 0xac00 || 0xd7a3 < c)) | 1041 | if ((c != 0 && (c < 0x1100 || 0x11c2 < c) && (c < 0xac00 || 0xd7a3 < c)) |
1033 | || | 1042 | || |
1034 | (c == 0 && qkeycode != Qt::Key_Shift && Qt::Key_CapsLock != qkeycode | 1043 | (c == 0 && qkeycode != Qt::Key_Shift && Qt::Key_CapsLock != qkeycode |
1035 | && qkeycode != Qt::Key_Control && qkeycode != Qt::Key_Alt)) { | 1044 | && qkeycode != Qt::Key_Control && qkeycode != Qt::Key_Alt)) { |
1036 | 1045 | ||
@@ -1044,75 +1053,75 @@ ushort Keyboard::parseKoreanInput (ushort c) { | |||
1044 | schar = c; mchar = 0; echar = 0; | 1053 | schar = c; mchar = 0; echar = 0; |
1045 | return c; | 1054 | return c; |
1046 | } | 1055 | } |
1047 | else if (mchar != 0) { | 1056 | else if (mchar != 0) { |
1048 | 1057 | ||
1049 | if (echar == 0) { | 1058 | if (echar == 0) { |
1050 | 1059 | ||
1051 | if (!(echar = constoe(c))) { | 1060 | if (!(echar = constoe(c))) { |
1052 | 1061 | ||
1053 | schar = c; mchar = 0; echar = 0; | 1062 | schar = c; mchar = 0; echar = 0; |
1054 | return c; | 1063 | return c; |
1055 | } | 1064 | } |
1056 | 1065 | ||
1057 | } | 1066 | } |
1058 | else { // must figure out what the echar is | 1067 | else { // must figure out what the echar is |
1059 | 1068 | ||
1060 | if (echar == 0x11a8) { // ¤” | 1069 | if (echar == 0x11a8) { // ć± |
1061 | 1070 | ||
1062 | if (c == 0x1100) echar = 0x11a9; // ¤” + ¤” | 1071 | if (c == 0x1100) echar = 0x11a9; // ć± + ć± |
1063 | else if (c == 0x1109) echar = 0x11aa; // ¤” + ¤µ | 1072 | else if (c == 0x1109) echar = 0x11aa; // ć± + ć |
1064 | else { | 1073 | else { |
1065 | schar = c; mchar = 0; echar = 0; | 1074 | schar = c; mchar = 0; echar = 0; |
1066 | return c; | 1075 | return c; |
1067 | } | 1076 | } |
1068 | 1077 | ||
1069 | } else if (echar == 0x11ab) { // ¤¤ | 1078 | } else if (echar == 0x11ab) { // ć“ |
1070 | 1079 | ||
1071 | if (c == 0x110c) echar = 0x11ac; // ¤¤ + ¤ø | 1080 | if (c == 0x110c) echar = 0x11ac; // ć“ + ć |
1072 | else if (c == 0x1112) echar = 0x11ad; // ¤¤ + ¤¾ | 1081 | else if (c == 0x1112) echar = 0x11ad; // ć“ + ć |
1073 | else { | 1082 | else { |
1074 | schar = c; mchar = 0; echar = 0; | 1083 | schar = c; mchar = 0; echar = 0; |
1075 | return c; | 1084 | return c; |
1076 | } | 1085 | } |
1077 | 1086 | ||
1078 | } else if (echar == 0x11af) { // ¤© | 1087 | } else if (echar == 0x11af) { // ć¹ |
1079 | 1088 | ||
1080 | if (c == 0x1100) echar = 0x11b0; // ¤© + ¤” | 1089 | if (c == 0x1100) echar = 0x11b0; // ć¹ + ć± |
1081 | else if (c == 0x1106) echar = 0x11b1; // ¤© + ¤± | 1090 | else if (c == 0x1106) echar = 0x11b1; // ć¹ + ć |
1082 | else if (c == 0x1107) echar = 0x11b2; // ¤© + ¤² | 1091 | else if (c == 0x1107) echar = 0x11b2; // ć¹ + ć |
1083 | else if (c == 0x1109) echar = 0x11b3; // ¤© + ¤µ | 1092 | else if (c == 0x1109) echar = 0x11b3; // ć¹ + ć |
1084 | else if (c == 0x1110) echar = 0x11b4; // ¤© + ¤¼ | 1093 | else if (c == 0x1110) echar = 0x11b4; // ć¹ + ć |
1085 | else if (c == 0x1111) echar = 0x11b5; // ¤© + ¤½ | 1094 | else if (c == 0x1111) echar = 0x11b5; // ć¹ + ć |
1086 | else if (c == 0x1112) echar = 0x11b6; // ¤© + ¤¾ | 1095 | else if (c == 0x1112) echar = 0x11b6; // ć¹ + ć |
1087 | else { | 1096 | else { |
1088 | schar = c; mchar = 0; echar = 0; | 1097 | schar = c; mchar = 0; echar = 0; |
1089 | return c; | 1098 | return c; |
1090 | } | 1099 | } |
1091 | 1100 | ||
1092 | } else if (echar == 0x11b8) { // ¤² | 1101 | } else if (echar == 0x11b8) { // ć |
1093 | 1102 | ||
1094 | if (c == 0x1109) echar = 0x11b9; // ¤² + ¤µ | 1103 | if (c == 0x1109) echar = 0x11b9; // ć + ć |
1095 | else { | 1104 | else { |
1096 | schar = c; mchar = 0; echar = 0; | 1105 | schar = c; mchar = 0; echar = 0; |
1097 | return c; | 1106 | return c; |
1098 | } | 1107 | } |
1099 | 1108 | ||
1100 | } else if (echar == 0x11ba) { // ¤µ | 1109 | } else if (echar == 0x11ba) { // ć |
1101 | 1110 | ||
1102 | if (c == 0x1109) echar = 0x11bb; // ¤µ + ¤µ | 1111 | if (c == 0x1109) echar = 0x11bb; // ć + ć |
1103 | else { | 1112 | else { |
1104 | schar = c; mchar = 0; echar = 0; | 1113 | schar = c; mchar = 0; echar = 0; |
1105 | return c; | 1114 | return c; |
1106 | } | 1115 | } |
1107 | 1116 | ||
1108 | } else { // if any other char, cannot combine chars | 1117 | } else { // if any other char, cannot combine chars |
1109 | 1118 | ||
1110 | schar = c; mchar = 0; echar = 0; | 1119 | schar = c; mchar = 0; echar = 0; |
1111 | return c; | 1120 | return c; |
1112 | } | 1121 | } |
1113 | 1122 | ||
1114 | unicode = echar; | 1123 | unicode = echar; |
1115 | } | 1124 | } |
1116 | } | 1125 | } |
1117 | 1126 | ||
1118 | } | 1127 | } |
@@ -1449,33 +1458,33 @@ void Keys::setKeysFromFile(const char * filename) { | |||
1449 | tmp >> d >> lower >> shift; | 1458 | tmp >> d >> lower >> shift; |
1450 | 1459 | ||
1451 | diaeresisMap.insert(lower, shift); | 1460 | diaeresisMap.insert(lower, shift); |
1452 | 1461 | ||
1453 | buf = t.readLine(); | 1462 | buf = t.readLine(); |
1454 | } | 1463 | } |
1455 | // back accent | 1464 | // back accent |
1456 | else if (buf.contains(QRegExp("^\\s*b\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { | 1465 | else if (buf.contains(QRegExp("^\\s*b\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { |
1457 | 1466 | ||
1458 | QTextStream tmp (buf, IO_ReadOnly); | 1467 | QTextStream tmp (buf, IO_ReadOnly); |
1459 | ushort lower, shift; | 1468 | ushort lower, shift; |
1460 | QChar d; | 1469 | QChar d; |
1461 | tmp >> d >> lower >> shift; | 1470 | tmp >> d >> lower >> shift; |
1462 | 1471 | ||
1463 | baccentMap.insert(lower, shift); | 1472 | baccentMap.insert(lower, shift); |
1464 | 1473 | ||
1465 | qDebug ("Estoy ańadiendo %i con %i", lower, shift); | 1474 | qDebug ("Estoy aadiendo %i con %i", lower, shift); |
1466 | buf = t.readLine(); | 1475 | buf = t.readLine(); |
1467 | } | 1476 | } |
1468 | // accent | 1477 | // accent |
1469 | else if (buf.contains(QRegExp("^\\s*a\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { | 1478 | else if (buf.contains(QRegExp("^\\s*a\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { |
1470 | 1479 | ||
1471 | QTextStream tmp (buf, IO_ReadOnly); | 1480 | QTextStream tmp (buf, IO_ReadOnly); |
1472 | ushort lower, shift; | 1481 | ushort lower, shift; |
1473 | QChar d; | 1482 | QChar d; |
1474 | tmp >> d >> lower >> shift; | 1483 | tmp >> d >> lower >> shift; |
1475 | 1484 | ||
1476 | accentMap.insert(lower, shift); | 1485 | accentMap.insert(lower, shift); |
1477 | 1486 | ||
1478 | buf = t.readLine(); | 1487 | buf = t.readLine(); |
1479 | } | 1488 | } |
1480 | 1489 | ||
1481 | // other variables like lang & title | 1490 | // other variables like lang & title |