Dismiss disambiguation popup when touch outside of it.
authorAntonio Gomes <a1.gomes@samsung.com>
Wed, 9 Dec 2015 20:47:45 +0000 (16:47 -0400)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 07:55:23 +0000 (07:55 +0000)
When disambiguation popup gets shown, it is only possible
to dismiss it when clicking on the zoomed area. This differs
from s-browser, where clicking outside the zoomed dismiss it.

Patch implements the same for chromium-efl.

Original beta/m47 patch:
- http://165.213.202.130/gerrit/98592

Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=15238

Reviewed by: g.czajkowski

Change-Id: Ieff0a1ce0d4784d30036c2ec02bdc5ca6c7ddc9b
Signed-off-by: Antonio Gomes <a1.gomes@samsung.com>
tizen_src/chromium_impl/content/browser/renderer_host/disambiguation_popup_efl.cc

index 62309f8..e977478 100644 (file)
@@ -30,7 +30,7 @@ void _back_hard_key_cb(void* data, Evas_Object* obj, void*) {
 }
 #endif
 
-void _OnMouseUp(void* data, Evas*, Evas_Object* image, void* event_info) {
+void OnMouseUp(void* data, Evas*, Evas_Object* image, void* event_info) {
   Evas_Event_Mouse_Up* up_event =
       static_cast<Evas_Event_Mouse_Up*>(event_info);
   DisambiguationPopupEfl* disambiguation_popup =
@@ -38,7 +38,7 @@ void _OnMouseUp(void* data, Evas*, Evas_Object* image, void* event_info) {
   disambiguation_popup->HandleMouseEventUp(up_event);
 }
 
-void _OnMouseDown(void* data, Evas*, Evas_Object* image, void* event_info) {
+void OnMouseDown(void* data, Evas*, Evas_Object* image, void* event_info) {
   Evas_Event_Mouse_Down* down_event =
       static_cast<Evas_Event_Mouse_Down*>(event_info);
   DisambiguationPopupEfl* disambiguation_popup =
@@ -46,6 +46,12 @@ void _OnMouseDown(void* data, Evas*, Evas_Object* image, void* event_info) {
   disambiguation_popup->HandleMouseEventDown(down_event);
 }
 
+void TouchedOnOutterArea(void* data, Evas*, Evas_Object* image, void* event_info) {
+  DisambiguationPopupEfl* disambiguation_popup =
+      static_cast<DisambiguationPopupEfl*>(data);
+  disambiguation_popup->Dismiss();
+}
+
 } // namespace
 
 DisambiguationPopupEfl::DisambiguationPopupEfl(
@@ -104,9 +110,14 @@ void DisambiguationPopupEfl::Show(const gfx::Rect& target,
   UpdateImage(display_image);
 
   evas_object_event_callback_add(content_image_,
-      EVAS_CALLBACK_MOUSE_UP, _OnMouseUp, this);
+      EVAS_CALLBACK_MOUSE_UP, OnMouseUp, this);
   evas_object_event_callback_add(content_image_,
-      EVAS_CALLBACK_MOUSE_DOWN, _OnMouseDown, this);
+      EVAS_CALLBACK_MOUSE_DOWN, OnMouseDown, this);
+
+  evas_object_event_callback_add(popup_,
+      EVAS_CALLBACK_MOUSE_UP, TouchedOnOutterArea, this);
+  evas_object_event_callback_add(popup_,
+      EVAS_CALLBACK_MULTI_DOWN, TouchedOnOutterArea, this);
 
   int parent_view_x = 0, parent_view_y = 0;
   evas_object_geometry_get(parent_view_, &parent_view_x, &parent_view_y, 0, 0);