Reduce the number of string compare in processing back key 96/116096/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 23 Feb 2017 02:33:17 +0000 (11:33 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 23 Feb 2017 02:33:23 +0000 (11:33 +0900)
Change-Id: I00ce1122039339acbcaca317ca8c70b55f6ab1bd
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/ise.cpp

index 5123ece..1434428 100644 (file)
@@ -1522,9 +1522,19 @@ void ise_update_table(const vector<string> &vec_str)
 
 void ise_process_key_event(scim::KeyEvent& key, sclu32 &ret)
 {
-    if (key.get_key_string().compare("KeyRelease+XF86Back") == 0 || key.get_key_string().compare("XF86Back") == 0) {
+    Eina_Bool back_key_pressed = EINA_FALSE;
+    Eina_Bool back_key_released = EINA_FALSE;
+
+    if (key.get_key_string().compare("XF86Back") == 0) {
+        back_key_pressed = EINA_TRUE;
+    }
+    else if (key.get_key_string().compare("KeyRelease+XF86Back") == 0) {
+        back_key_released = EINA_TRUE;
+    }
+
+    if (back_key_pressed || back_key_released) {
         if (g_popup_opened == TRUE) {
-            if (key.get_key_string().compare("KeyRelease+XF86Back") == 0) {
+            if (back_key_released) {
                 g_ui->close_all_popups();
                 g_popup_opened = FALSE;
             }