-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 @@ -343,66 +343,68 @@ void Keyboard::mousePressEvent(QMouseEvent *e) // might need to repaint if two or more of the same keys. // should be faster if just paint one key even though multiple keys exist. bool need_repaint = FALSE; // circumflex and diaeresis support // messy to have this here, but too hard to implement any other method if (unicode == 0x2c6) { unicode = 0; if (shift || lock) { // diaeresis qkeycode = 0x2001; } else { // circumflex qkeycode = 0x2000; } } // Back accent character support - if (unicode == 0x60) { + //if (unicode == 0x60) { // the keys from 2c6 ~ 2cf should be used instead of the ascii one + if (unicode == 0x2cb) { unicode = 0; if (shift || lock) { // circumblex qkeycode = 0x2000; } else { // back accent qkeycode = 0x2002; } } // Accent character support - if (unicode == 0xb4) { + //if (unicode == 0xb4) { + if (unicode == 0x2ca) { unicode = 0; if (shift || lock) { // diaeresis qkeycode = 0x2001; } else { // accent qkeycode = 0x2003; } } if (unicode == 0) { // either Qt char, or nothing if (qkeycode == Qt::Key_F1) { // toggle the pickboard if ( configdlg ) { delete (ConfigDlg *) configdlg; configdlg = 0; } @@ -745,48 +747,55 @@ void Keyboard::mousePressEvent(QMouseEvent *e) //pressTid = startTimer(80); } /* Keyboard::mouseReleaseEvent {{{1 */ void Keyboard::mouseReleaseEvent(QMouseEvent*) { pressed = FALSE; //if ( pressTid == 0 ) #if defined(Q_WS_QWS) || defined(_WS_QWS_) if ( unicode != -1 ) { emit key( unicode, qkeycode, modifiers, false, false ); repeatTimer->stop(); } #endif if (shift && unicode != 0) { *shift = 0; // unpress shift key shift = 0; // reset the shift pointer repaint(FALSE); } + if (ctrl && unicode != 0) { + + *ctrl = 0; + ctrl = 0; + repaint(FALSE); + + } /* * do not make the meta key release after being pressed * else if (meta && unicode != 0) { *meta = 0; meta = 0; repaint(FALSE); } */ else clearHighlight(); } /* Keyboard::timerEvent {{{1 */ /* dont know what this does, but i think it is here so that if your screen * sticks (like on an ipaq) then it will stop repeating if you click another * key... but who knows what anything does in this thing anyway? void Keyboard::timerEvent(QTimerEvent* e) @@ -994,133 +1003,133 @@ void Keyboard::loadKeyboardColors() { color = QStringList::split(",", "43,54,68"); config.writeEntry("textcolor", color.join(",")); } textcolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); } /* korean input functions {{{1 * * TODO * one major problem with this implementation is that you can't move the * cursor after inputing korean chars, otherwise it will eat up and replace * the char before the cursor you move to. fix that * * make backspace delete one single char, not the whole thing if still * editing. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * how korean input works * * all following chars means unicode char value and are in hex * - * = schar (start char) - * = mchar (middle char) - * = echar (end char) + * 초음 = schar (start char) + * 중음 = mchar (middle char) + * 끝음 = echar (end char) * * there are 19 schars. unicode position is at 1100 - 1112 * there are 21 mchars. unicode position is at 1161 - 1175 * there are 27 echars. unicode position is at 11a8 - 11c2 * * the map with everything combined is at ac00 - d7a3 * */ ushort Keyboard::parseKoreanInput (ushort c) { if ((c != 0 && (c < 0x1100 || 0x11c2 < c) && (c < 0xac00 || 0xd7a3 < c)) || (c == 0 && qkeycode != Qt::Key_Shift && Qt::Key_CapsLock != qkeycode && qkeycode != Qt::Key_Control && qkeycode != Qt::Key_Alt)) { schar = 0, mchar = 0, echar = 0; return c; } if ( 0x1100 <= c && c <= 0x1112 ) { // schar or echar was input if (schar == 0 || (schar != 0 && mchar == 0)) { schar = c; mchar = 0; echar = 0; return c; } else if (mchar != 0) { if (echar == 0) { if (!(echar = constoe(c))) { schar = c; mchar = 0; echar = 0; return c; } } else { // must figure out what the echar is - if (echar == 0x11a8) { // + if (echar == 0x11a8) { // ㄱ - if (c == 0x1100) echar = 0x11a9; // + - else if (c == 0x1109) echar = 0x11aa; // + + if (c == 0x1100) echar = 0x11a9; // ㄱ + ㄱ + else if (c == 0x1109) echar = 0x11aa; // ㄱ + ㅅ else { schar = c; mchar = 0; echar = 0; return c; } - } else if (echar == 0x11ab) { // + } else if (echar == 0x11ab) { // ㄴ - if (c == 0x110c) echar = 0x11ac; // + - else if (c == 0x1112) echar = 0x11ad; // + + if (c == 0x110c) echar = 0x11ac; // ㄴ + ㅈ + else if (c == 0x1112) echar = 0x11ad; // ㄴ + ㅎ else { schar = c; mchar = 0; echar = 0; return c; } - } else if (echar == 0x11af) { // + } else if (echar == 0x11af) { // ㄹ - if (c == 0x1100) echar = 0x11b0; // + - else if (c == 0x1106) echar = 0x11b1; // + - else if (c == 0x1107) echar = 0x11b2; // + - else if (c == 0x1109) echar = 0x11b3; // + - else if (c == 0x1110) echar = 0x11b4; // + - else if (c == 0x1111) echar = 0x11b5; // + - else if (c == 0x1112) echar = 0x11b6; // + + if (c == 0x1100) echar = 0x11b0; // ㄹ + ㄱ + else if (c == 0x1106) echar = 0x11b1; // ㄹ + ㅁ + else if (c == 0x1107) echar = 0x11b2; // ㄹ + ㅂ + else if (c == 0x1109) echar = 0x11b3; // ㄹ + ㅅ + else if (c == 0x1110) echar = 0x11b4; // ㄹ + ㅌ + else if (c == 0x1111) echar = 0x11b5; // ㄹ + ㅍ + else if (c == 0x1112) echar = 0x11b6; // ㄹ + ㅎ else { schar = c; mchar = 0; echar = 0; return c; } - } else if (echar == 0x11b8) { // + } else if (echar == 0x11b8) { // ㅂ - if (c == 0x1109) echar = 0x11b9; // + + if (c == 0x1109) echar = 0x11b9; // ㅂ + ㅅ else { schar = c; mchar = 0; echar = 0; return c; } - } else if (echar == 0x11ba) { // + } else if (echar == 0x11ba) { // ㅅ - if (c == 0x1109) echar = 0x11bb; // + + if (c == 0x1109) echar = 0x11bb; // ㅅ + ㅅ else { schar = c; mchar = 0; echar = 0; return c; } } else { // if any other char, cannot combine chars schar = c; mchar = 0; echar = 0; return c; } unicode = echar; } } } else if (0x1161 <= c && c <= 0x1175) { // mchar was input if (schar != 0 && mchar == 0) { mchar = c; } else if (schar != 0 && mchar != 0 && echar == 0) { switch (mchar) { case 0x1169: @@ -1441,49 +1450,49 @@ void Keys::setKeysFromFile(const char * filename) { buf = t.readLine(); } // diaeresis else if (buf.contains(QRegExp("^\\s*d\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { QTextStream tmp (buf, IO_ReadOnly); ushort lower, shift; QChar d; tmp >> d >> lower >> shift; diaeresisMap.insert(lower, shift); buf = t.readLine(); } // back accent else if (buf.contains(QRegExp("^\\s*b\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { QTextStream tmp (buf, IO_ReadOnly); ushort lower, shift; QChar d; tmp >> d >> lower >> shift; baccentMap.insert(lower, shift); - qDebug ("Estoy aadiendo %i con %i", lower, shift); + qDebug ("Estoy aadiendo %i con %i", lower, shift); buf = t.readLine(); } // accent else if (buf.contains(QRegExp("^\\s*a\\s+[0-9a-fx]+\\s+[0-9a-fx]+\\s*$", FALSE, FALSE))) { QTextStream tmp (buf, IO_ReadOnly); ushort lower, shift; QChar d; tmp >> d >> lower >> shift; accentMap.insert(lower, shift); buf = t.readLine(); } // other variables like lang & title else if (buf.contains(QRegExp("^\\s*[a-zA-Z]+\\s*=\\s*[a-zA-Z0-9/]+\\s*$", FALSE, FALSE))) { QTextStream tmp (buf, IO_ReadOnly); QString name, equals, value; tmp >> name >> equals >> value; if (name == "lang") { |