From: Jihye Won Date: Mon, 11 Jan 2016 04:28:46 +0000 (+0900) Subject: keyboard: ignore key events while the display is off X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~40^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=34313d85b6b913bbbbbc964d894089ec8110bf6a;p=sdk%2Femulator%2Fqemu.git keyboard: ignore key events while the display is off There was a bug when a user presses the HW key shortcut in display-off mode. The reason is that the guest OS receives key events while the display is off. After applying this commit, the emulator ignores key events while the display is off. Change-Id: I97f2e21f1d0aaaa9aa4ddba9c18518a5a5df74bc Signed-off-by: Jihye Won (cherry picked from commit 36cec4673a2927d99696122ef795eec01da723a9) --- diff --git a/tizen/src/ui/input/keyboardhelper.cpp b/tizen/src/ui/input/keyboardhelper.cpp index 4fe8d3fc22..53dcbe4e37 100644 --- a/tizen/src/ui/input/keyboardhelper.cpp +++ b/tizen/src/ui/input/keyboardhelper.cpp @@ -37,6 +37,7 @@ extern "C" { #include "util/ui_operations.h" void virtio_keyboard_event(int keycode); +bool is_display_off(void); } KeyboardHelper::KeyboardHelper(QWidget *parent) @@ -350,6 +351,12 @@ void KeyboardHelper::keyPressed(QKeyEvent *event) qDebug() << "key pressed:" << keyCode << event->text() << event->nativeScanCode() << event->modifiers() << event->nativeModifiers(); + /* ignore key event only if the display is off */ + if (is_display_off() == true) { + qDebug() << "ignore key event(" << keyCode << ") while display is off"; + return; + } + /* multi-touch checking */ if (mtTracker != NULL && mtTracker->isTrackingReady() == true) { if (get_max_touch_point() > 1) { @@ -503,6 +510,12 @@ void KeyboardHelper::keyReleased(QKeyEvent *event) qDebug() << "key released:" << event->key() << event->text() << event->nativeScanCode() << event->modifiers() << event->nativeModifiers(); + /* ignore key event only if the display is off */ + if (is_display_off() == true) { + qDebug() << "ignore key event(" << keyCode << ") while display is off"; + return; + } + /* multi-touch checking */ if (mtTracker != NULL && get_max_touch_point() > 1) { releaseFilterMtChecking(event);