summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Alzyod <ali198724@gmail.com>2020-02-07 14:15:20 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-02-07 14:20:29 +0100
commit6ce2698bb5b9051bc72adf776125a414c4908bea (patch)
tree3a558d81cb0f219c743cc079e0080994d89c7833
parentea3c30ca1ee218aaad5ee349deb5bf21d8cc301d (diff)
efl.ui.textbox: prevent longpress + right click from working on scrollbars
summary_: Longpress and right click one textbox scrollbars will not show up the menu. Reviewers: woohyun, bu5hm4n Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8604 Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11295
-rw-r--r--src/lib/elementary/efl_ui_textbox.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lib/elementary/efl_ui_textbox.c b/src/lib/elementary/efl_ui_textbox.c
index 936471c..a53c265 100644
--- a/src/lib/elementary/efl_ui_textbox.c
+++ b/src/lib/elementary/efl_ui_textbox.c
@@ -1049,11 +1049,31 @@ _menu_call(Evas_Object *obj)
1049 } 1049 }
1050} 1050}
1051 1051
1052static Eina_Bool
1053_is_pointer_inside_viewport(Eo *textbox,Efl_Ui_Textbox_Data *sd)
1054{
1055 if (sd->scroller)
1056 {
1057 Eo *top = efl_provider_find(textbox, EFL_UI_WIN_CLASS);
1058 Eina_Position2D pos = {0};
1059 if (efl_canvas_scene_pointer_position_get(top, NULL, &pos))
1060 {
1061 Eina_Rect rc = efl_ui_scrollable_viewport_geometry_get(sd->scroller);
1062 if (!eina_rectangle_coords_inside(&rc.rect, pos.x, pos.y))
1063 return EINA_FALSE;
1064 }
1065 }
1066 return EINA_TRUE;
1067}
1068
1052static void 1069static void
1053_long_press_cb(void *data, const Efl_Event *ev EINA_UNUSED) 1070_long_press_cb(void *data, const Efl_Event *ev EINA_UNUSED)
1054{ 1071{
1055 EFL_UI_TEXT_DATA_GET(data, sd); 1072 EFL_UI_TEXT_DATA_GET(data, sd);
1056 1073
1074 if (!_is_pointer_inside_viewport(data, sd))
1075 return;
1076
1057 /* Context menu will not appear if context menu disabled is set 1077 /* Context menu will not appear if context menu disabled is set
1058 * as false on a long press callback */ 1078 * as false on a long press callback */
1059 if (!_elm_config->context_menu_disabled && 1079 if (!_elm_config->context_menu_disabled &&
@@ -1122,6 +1142,8 @@ _mouse_down_cb(void *data, const Efl_Event *event)
1122 { 1142 {
1123 if (_elm_config->desktop_entry) 1143 if (_elm_config->desktop_entry)
1124 { 1144 {
1145 if (!_is_pointer_inside_viewport(data, sd))
1146 return;
1125 sd->use_down = 1; 1147 sd->use_down = 1;
1126 _menu_call(data); 1148 _menu_call(data);
1127 } 1149 }