#include "ui/events/keycodes/keyboard_code_conversion.h"
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+#include "tizen_src/ewk/efl_integration/common/application_type.h"
+#endif
+
namespace ui {
namespace {
}
}
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+ if (IsTvProfile()) {
+ thiz->ConvertUpToReturnBackIfNeeded(key_down, true);
+
+ // In non webapp scene,"Cancel" key haven't added on the map,the keycode is
+ // 0. "Cancel" key is delivered by IME, for hiding IME panel,no need deliver
+ // the key event. Or else,the keycode 0 may exception handling by website.
+ if (!strcmp(key_down->key, "Cancel") && !content::IsTIZENWRT())
+ return;
+ }
+#endif
KeyEvent event = MakeWebKeyEvent(true, key_down);
auto im_context_efl = thiz->GetIMContextEfl();
#endif
if (IsTvProfile()) {
+#if BUILDFLAG(IS_TIZEN_TV)
+ thiz->ConvertUpToReturnBackIfNeeded(key_up, false);
+#endif
+
// For TV IME "Select" and "Cancel" key
if (thiz->im_context_efl_ && thiz->im_context_efl_->IsVisible()) {
if (!strcmp(key_up->key, "Select") || !strcmp(key_up->key, "Cancel"))
thiz->im_context_efl_->HidePanel();
}
+
+#if BUILDFLAG(IS_TIZEN_TV)
+ // In non webapp scene,"Cancel" key haven't added on the map,the keycode is
+ // 0. "Cancel" key is delivered by IME, for hiding IME panel,no need deliver
+ // the key event. Or else,the keycode 0 may exception handling by website.
+ if (!strcmp(key_up->key, "Cancel") && !content::IsTIZENWRT())
+ return;
+#endif
}
KeyEvent event = MakeWebKeyEvent(false, key_up);
return false;
}
+// New requirement from tizen 6.5:
+// press "up" key on the top of IME panel should handled as same behavior as
+// press "Return Back" key on IME panel behavior:
+// For WebBrowser, need hide IME panel and don't deliver the Return Back key
+// event to WebBrowser; For WebApp, need hide IME panel and deliver the Return
+// Back key event to WebApp.
+#if BUILDFLAG(IS_TIZEN_TV)
+template <typename EVT>
+void EflEventHandler::ConvertUpToReturnBackIfNeeded(EVT* evt, bool is_press) {
+ if (!im_context_efl_ || !im_context_efl_->IsVisible() ||
+ strcmp(evt->key, "Up"))
+ return;
+
+ // No need hide IME panel when press the IME panel's up key.
+ Evas_Device_Class device_id = evas_device_class_get(evt->dev);
+ const char* device_name = evas_device_name_get(evt->dev);
+ if (device_id != EVAS_DEVICE_CLASS_KEYBOARD || !strcmp(device_name, "ime"))
+ return;
+
+ if (is_press) {
+ was_up_keypress_on_ime_top_ = true;
+ } else {
+ // make sure "press up key on the top of IME" scenes
+ if (!was_up_keypress_on_ime_top_)
+ return;
+
+ was_up_keypress_on_ime_top_ = false;
+ }
+
+ if (content::IsWebBrowser() || content::IsTIZENWRT()) {
+ evt->keyname = (char*)"Cancel"; /*Return Back key name*/
+ evt->key = (char*)"Cancel"; /*Return Back key*/
+ evt->string = (char*)""; /*Return Back string*/
+ evt->keycode = 0; /*Return Back keycode*/
+ LOG(INFO) << "Press Up key on the top of IME panel, handle the Up key as "
+ "same as Return Back key!";
+ }
+}
+#endif
+
void EflEventHandler::OnMultiTouchDownEvent(void* data,
Evas* evas,
Evas_Object* obj,