From e36585b1e15be05e10a7dd0363b5034169606430 Mon Sep 17 00:00:00 2001 From: Jihye Won Date: Mon, 11 Jan 2016 13:28:46 +0900 Subject: [PATCH] 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) --- tizen/src/ui/input/keyboardhelper.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tizen/src/ui/input/keyboardhelper.cpp b/tizen/src/ui/input/keyboardhelper.cpp index 12279e5e18..30c2e5d50c 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) @@ -352,6 +353,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) { @@ -510,6 +517,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); -- 2.34.1