From: GiWoong Kim Date: Sat, 25 Apr 2015 07:54:35 +0000 (+0900) Subject: input: key handling for multi-touch mode X-Git-Tag: TizenStudio_2.0_p3.0~214^2~53^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=13dd76dbf5ecb16cb3537520169f3e7b74217c91;p=sdk%2Femulator%2Fqemu.git input: key handling for multi-touch mode Ctrl(or Shift) - independent moving mode Ctrl + Shift - parallel moving mode Ctrl + Alt - symmetrical moving mode Change-Id: I22c2b303584cd238baaab84911995445f541cb9d Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/ui/input/keyboardhelper.cpp b/tizen/src/ui/input/keyboardhelper.cpp index 8f126d9..5c3e21f 100644 --- a/tizen/src/ui/input/keyboardhelper.cpp +++ b/tizen/src/ui/input/keyboardhelper.cpp @@ -214,10 +214,12 @@ void KeyboardHelper::autoKeyRelease(void) keyCodeList.removeLast(); } -#if 0 - clear_finger_slot(false); - qDebug() << "disable multi-touch"; -#endif + /* disable multi-touch mode */ + if (get_multi_touch_enable() != 0) { + set_multi_touch_enable(0); + + qDebug() << "disable multi-touch"; + } } int KeyboardHelper::keyCodeOperation(QKeyEvent *event, int keyCode) @@ -273,30 +275,56 @@ bool KeyboardHelper::isSpecialKey(int keyCode) return false; } +static void pressFilterMtChecking(QKeyEvent *event) { + switch(event->key()) { + case Qt::Key_Alt: + if (event->modifiers() == (Qt::ControlModifier | Qt::AltModifier)) { + set_multi_touch_enable(3); + qDebug() << "enable multi-touch mode : 3"; + } + + break; + case Qt::Key_Shift: + if (event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)) { + set_multi_touch_enable(2); + qDebug() << "enable multi-touch mode : 2"; + } else if (event->modifiers() == Qt::ShiftModifier) { + set_multi_touch_enable(1); + qDebug() << "enable multi-touch mode : 1"; + } + + break; + case Qt::Key_Control: + if (event->modifiers() == Qt::ControlModifier) { + set_multi_touch_enable(1); + qDebug() << "enable multi-touch mode : 1"; + } else if (event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)) { + set_multi_touch_enable(2); + qDebug() << "enable multi-touch mode : 2"; + } + + break; + default: + if (get_multi_touch_enable() != 0) { + set_multi_touch_enable(0); + qDebug() << "disable multi-touch"; + } + + break; + } +} + void KeyboardHelper::keyPressed(QKeyEvent *event) { - int keyCode = event->key(); - qDebug() << "key pressed :" << event->key() << event->text() << + const int keyCode = event->key(); + qDebug() << "key pressed :" << keyCode << event->text() << event->nativeScanCode() << event->modifiers() << event->nativeModifiers(); -#if 0 - /* TODO: multi-touch */ + /* multi-touch checking */ if (get_emul_max_touch_point() > 1) { - /* multi-touch checking */ - if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { - get_emul_multi_touch_state()->multitouch_enable = 2; - /* add a finger before start the multi-touch processing - if already exist the pressed touch in display */ - - qDebug() << "enable multi-touch = mode 2"; - } else if (event->modifiers() == Qt::ShiftModifier || - event->modifiers() == Qt::ControlModifier) { - get_emul_multi_touch_state()->multitouch_enable = 1; - - qDebug() << "enable multi-touch = mode 1"; - } + pressFilterMtChecking(event); + /* fall through */ } -#endif /* NumLock or CapsLock key */ if (keyCode == Qt::Key_NumLock) { @@ -389,25 +417,56 @@ void KeyboardHelper::keyPressed(QKeyEvent *event) } } +static void releaseFilterMtChecking(QKeyEvent *event) { + switch(event->key()) { + case Qt::Key_Alt: + if (event->modifiers() == Qt::ControlModifier) { + set_multi_touch_enable(1); + qDebug() << "enabled multi-touch mode : 3 -> 1"; + } else { + set_multi_touch_enable(0); + qDebug() << "disable multi-touch"; + } + + break; + case Qt::Key_Shift: + if (event->modifiers() == Qt::ControlModifier) { + set_multi_touch_enable(1); + qDebug() << "enabled multi-touch mode : 2 -> 1"; + } else { + set_multi_touch_enable(0); + qDebug() << "disable multi-touch"; + } + + break; + case Qt::Key_Control: + if (event->modifiers() == Qt::ShiftModifier) { + set_multi_touch_enable(1); + qDebug() << "enabled multi-touch mode : 2 -> 1"; + } else { + set_multi_touch_enable(0); + qDebug() << "disable multi-touch"; + } + + break; + default: + break; + } +} + void KeyboardHelper::keyReleased(QKeyEvent *event) { int keyCode = event->key(); qDebug() << "key released :" << event->key() << event->text() << event->nativeScanCode() << event->modifiers() << event->nativeModifiers(); -#if 0 - /* TODO: multi-touch */ - if (event->key() == Qt::Key_Shift && event->modifiers() == Qt::ControlModifier) { - get_emul_multi_touch_state()->multitouch_enable = 1; - - qDebug() << "enabled multi-touch = mode 1"; - } else if (event->key() == Qt::Key_Shift || event->key() == Qt::Key_Control) { - clear_finger_slot(false); - - qDebug() << "disable multi-touch"; + /* multi-touch checking */ + if (get_emul_max_touch_point() > 1) { + releaseFilterMtChecking(event); + /* fall through */ } -#endif + /* NumLock or CapsLock key */ if (keyCode == Qt::Key_NumLock) { qDebug() << "num_lock state : " << numLockState << "released"; return; diff --git a/tizen/src/ui/skinview.cpp b/tizen/src/ui/skinview.cpp index 702122c..7b6806f 100644 --- a/tizen/src/ui/skinview.cpp +++ b/tizen/src/ui/skinview.cpp @@ -149,4 +149,8 @@ void SkinView::keyReleaseEvent(QKeyEvent *event) SkinView::~SkinView() { qDebug("destroy skin view"); + + if (kbd != NULL) { + delete kbd; + } }