bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=634ebfeaf15ba475ed9f8dabcb9ca66c9d06f939

commit 634ebfeaf15ba475ed9f8dabcb9ca66c9d06f939
Author: Marcel Hollerbach <m...@marcel-hollerbach.de>
Date:   Tue Aug 20 20:10:56 2019 +0200

    efl_ui_collection: honor desktop vs. touch setting of elm config
    
    with this commit we do desktop-like selection on desktop systems:
    - Multiselect with CTRL pressed
    - Normal single selection if no CTRL is pressed
    on touch devices this is simple on/off selection:
    - click to add it to multiselect
    - click to remote it from mutliselect
    
    ref T8057
    
    Reviewed-by: Mike Blumenkrantz <michael.blumenkra...@gmail.com>
    Reviewed-by: Cedric BAIL <cedric.b...@free.fr>
    Differential Revision: https://phab.enlightenment.org/D9664
---
 src/lib/elementary/efl_ui_collection.c | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/lib/elementary/efl_ui_collection.c 
b/src/lib/elementary/efl_ui_collection.c
index 210dcd9476..fff72b3eb2 100644
--- a/src/lib/elementary/efl_ui_collection.c
+++ b/src/lib/elementary/efl_ui_collection.c
@@ -529,6 +529,20 @@ _apply_fallback(Eo *obj EINA_UNUSED, 
Efl_Ui_Collection_Data *pd)
      }
 }
 
+static inline void
+_single_selection_behaviour(Eo *obj EINA_UNUSED, Efl_Ui_Collection_Data *pd, 
Efl_Ui_Selectable *new_selection)
+{
+   //we might get the situation that the item is already in the list and 
selected again, so just free the list, it will be rebuild below
+   if (eina_list_data_get(pd->selected) == new_selection)
+     {
+       pd->selected = eina_list_free(pd->selected);
+     }
+   else
+     {
+        deselect_all(pd);
+     }
+}
+
 static void
 _selection_changed(void *data, const Efl_Event *ev)
 {
@@ -546,16 +560,14 @@ _selection_changed(void *data, const Efl_Event *ev)
      {
         if (pd->mode == EFL_UI_SELECT_MODE_SINGLE_ALWAYS || pd->mode == 
EFL_UI_SELECT_MODE_SINGLE)
           {
-             //we might get the situation that the item is already in the list 
and selected again, so just free the list, it will be rebuild below
-             if (eina_list_data_get(pd->selected) == ev->object)
-               {
-                 pd->selected = eina_list_free(pd->selected);
-               }
-             else
-               {
-                  deselect_all(pd);
-               }
-
+             _single_selection_behaviour(obj, pd, ev->object);
+          }
+        else if (pd->mode == EFL_UI_SELECT_MODE_MULTI && 
_elm_config->desktop_entry)
+          {
+             const Evas_Modifier *mod = 
evas_key_modifier_get(evas_object_evas_get(ev->object));
+             if (!(efl_input_clickable_interaction_get(ev->object)
+                   && evas_key_modifier_is_set(mod, "Control")))
+               _single_selection_behaviour(obj, pd, ev->object);
           }
         else if (pd->mode == EFL_UI_SELECT_MODE_NONE)
           {

-- 


Reply via email to