rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=f58d9a9c9326e74ef4682f0569dee3a986b95360

commit f58d9a9c9326e74ef4682f0569dee3a986b95360
Author: Andrii Kroitor <[email protected]>
Date:   Tue Jul 5 17:24:01 2016 +0300

    shortcuts: remove popup-specific shortcuts
    
    handler API should be used instead
---
 src/bin/common/signals.h         |   5 +-
 src/bin/ui/shortcuts/shortcuts.c | 110 ++++++++++++++++++---------------------
 src/bin/ui/shortcuts/shortcuts.h |   5 +-
 src/bin/ui/tabs.c                |   2 +-
 4 files changed, 55 insertions(+), 67 deletions(-)

diff --git a/src/bin/common/signals.h b/src/bin/common/signals.h
index 8ac1976..f5c80ad 100644
--- a/src/bin/common/signals.h
+++ b/src/bin/common/signals.h
@@ -480,7 +480,6 @@ typedef struct {
 #define SIGNAL_SHORTCUT_PART_PREV "SIGNAL_SHORTCUT_PART_PREV"
 #define SIGNAL_SHORTCUT_PART_SHOWHIDE "SIGNAL_SHORTCUT_PART_SHOWHIDE"
 #define SIGNAL_SHORTCUT_ALL_PARTS_SHOWHIDE "SIGNAL_SHORTCUT_ALL_PARTS_SHOWHIDE"
-#define SIGNAL_SHORTCUT_PART_UNSELECT "SIGNAL_SHORTCUT_PART_UNSELECT"
 #define SIGNAL_SHORTCUT_ZOOM_IN "SIGNAL_SHORTCUT_ZOOM_IN"
 #define SIGNAL_SHORTCUT_ZOOM_OUT "SIGNAL_SHORTCUT_ZOOM_OUT"
 #define SIGNAL_SHORTCUT_ZOOM_RESET "SIGNAL_SHORTCUT_ZOOM_RESET"
@@ -488,8 +487,8 @@ typedef struct {
 #define SIGNAL_SHORTCUT_FIT "SIGNAL_SHORTCUT_FIT"
 #define SIGNAL_SHORTCUT_OBJECT_AREA "SIGNAL_SHORTCUT_OBJECT_AREA"
 #define SIGNAL_SHORTCUT_RULERS_VISIBLED "SIGNAL_SHORTCUT_RULERS_VISIBLED"
-#define SIGNAL_SHORTCUT_POPUP_CANCEL "SIGNAL_SHORTCUT_POPUP_CANCEL"
-#define SIGNAL_SHORTCUT_POPUP_DONE "SIGNAL_SHORTCUT_POPUP_DONE"
+#define SIGNAL_SHORTCUT_CANCEL "SIGNAL_SHORTCUT_POPUP_CANCEL"
+#define SIGNAL_SHORTCUT_DONE "SIGNAL_SHORTCUT_POPUP_DONE"
 
 /**
  * emited when shortcut is pressed.
diff --git a/src/bin/ui/shortcuts/shortcuts.c b/src/bin/ui/shortcuts/shortcuts.c
index 16f3c59..9f145d2 100644
--- a/src/bin/ui/shortcuts/shortcuts.c
+++ b/src/bin/ui/shortcuts/shortcuts.c
@@ -116,7 +116,6 @@ struct _Shortcut_Module
                                                         unpressing for
                                                         shortcuts */
    Eina_List *shortcuts;      /**< list of user's shortcuts */
-   Eina_List *popup_shortcuts;/**< list of user's popup shortcuts */
    Eina_List *held_shortcuts; /**< list of functions that is being held */
    unsigned int last_modifiers;
 };
@@ -173,7 +172,6 @@ _shortcut_handle(Shortcut_Type type)
         SHORTCUT(PART_PREV);
         SHORTCUT(PART_SHOWHIDE);
         SHORTCUT(ALL_PARTS_SHOWHIDE);
-        SHORTCUT(PART_UNSELECT);
         SHORTCUT_NUM(TAB_NUM1, SIGNAL_SHORTCUT_TAB_NUM, 1);
         SHORTCUT_NUM(TAB_NUM2, SIGNAL_SHORTCUT_TAB_NUM, 2);
         SHORTCUT_NUM(TAB_NUM3, SIGNAL_SHORTCUT_TAB_NUM, 3);
@@ -198,8 +196,8 @@ _shortcut_handle(Shortcut_Type type)
         SHORTCUT(ZOOM_OUT);
         SHORTCUT(ZOOM_RESET);
         SHORTCUT(OBJECT_AREA);
-        SHORTCUT(POPUP_CANCEL);
-        SHORTCUT(POPUP_DONE);
+        SHORTCUT(CANCEL);
+        SHORTCUT(DONE);
 
       case SHORTCUT_TYPE_NONE:
          break;
@@ -285,8 +283,7 @@ _key_press_event_cb(void *data __UNUSED__, int type 
__UNUSED__, void *event)
    if (shortcut)
      return ECORE_CALLBACK_PASS_ON;
 
-   shortcut = eina_list_search_sorted(ap.popup!=NULL ? 
ap.shortcuts->popup_shortcuts : ap.shortcuts->shortcuts,
-                                      (Eina_Compare_Cb)_shortcut_cmp, &sc);
+   shortcut = eina_list_search_sorted(ap.shortcuts->shortcuts, 
(Eina_Compare_Cb)_shortcut_cmp, &sc);
    if (shortcut)
      {
         ap.shortcuts->held_shortcuts = 
eina_list_sorted_insert(ap.shortcuts->held_shortcuts,
@@ -373,8 +370,7 @@ _win_unfocused_cb(void *data __UNUSED__,
 }
 
 static void
-_add_shortcut(Eina_Bool popup,
-              Shortcut_Type type_press,
+_add_shortcut(Shortcut_Type type_press,
               Shortcut_Type type_unpress,
               unsigned int modifiers,
               unsigned int keycode)
@@ -388,11 +384,7 @@ _add_shortcut(Eina_Bool popup,
    sc->keycode = keycode;
    sc->modifiers = modifiers;
 
-   if (popup)
-     ap.shortcuts->popup_shortcuts = 
eina_list_sorted_insert(ap.shortcuts->popup_shortcuts,
-                                                             
(Eina_Compare_Cb)_shortcut_cmp, sc);
-   else
-     ap.shortcuts->shortcuts = eina_list_sorted_insert(ap.shortcuts->shortcuts,
+   ap.shortcuts->shortcuts = eina_list_sorted_insert(ap.shortcuts->shortcuts,
                                                        
(Eina_Compare_Cb)_shortcut_cmp, sc);
 }
 
@@ -401,105 +393,103 @@ _default_shortcuts_add()
 {
    assert(ap.shortcuts != NULL);
 
-   _add_shortcut(false, SHORTCUT_TYPE_QUIT, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_QUIT, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 24/*q*/);
 
-   _add_shortcut(false, SHORTCUT_TYPE_UNDO, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_UNDO, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 52/*z*/);
-   _add_shortcut(false, SHORTCUT_TYPE_REDO, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_REDO, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 29/*y*/);
-   _add_shortcut(false, SHORTCUT_TYPE_SAVE, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_SAVE, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 39/*s*/);
-   _add_shortcut(false, SHORTCUT_TYPE_ADD_GROUP, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_ADD_GROUP, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 57/*n*/);
-   _add_shortcut(false, SHORTCUT_TYPE_ADD_PART, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_ADD_PART, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 24/*q*/);
-   _add_shortcut(false, SHORTCUT_TYPE_ADD_STATE, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_ADD_STATE, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 25/*w*/);
-   _add_shortcut(false, SHORTCUT_TYPE_ADD_ITEM, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_ADD_ITEM, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 26/*e*/);
-   _add_shortcut(false, SHORTCUT_TYPE_ADD_PROGRAM, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_ADD_PROGRAM, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 27/*r*/);
-   _add_shortcut(false, SHORTCUT_TYPE_ADD_DATA_ITEM, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_ADD_DATA_ITEM, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 28/*t*/);
-   _add_shortcut(false, SHORTCUT_TYPE_DEL, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_DEL, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 119/*del*/);
-   _add_shortcut(false, SHORTCUT_TYPE_STATE_NEXT, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_STATE_NEXT, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 39/*s*/);
-   _add_shortcut(false, SHORTCUT_TYPE_PART_NEXT, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_PART_NEXT, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 53/*x*/);
-   _add_shortcut(false, SHORTCUT_TYPE_PART_PREV, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_PART_PREV, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 52/*z*/);
-   _add_shortcut(false, SHORTCUT_TYPE_PART_SHOWHIDE, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_PART_SHOWHIDE, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 43/*h*/);
-   _add_shortcut(false, SHORTCUT_TYPE_ALL_PARTS_SHOWHIDE, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_ALL_PARTS_SHOWHIDE, SHORTCUT_TYPE_NONE,
                  MOD_SHIFT, 43/*h*/);
-   _add_shortcut(false, SHORTCUT_TYPE_PART_UNSELECT, SHORTCUT_TYPE_NONE,
-                 MOD_NONE, 9/*ESC*/);
 
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_NUM1, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_NUM1, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 10/*1*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_NUM2, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_NUM2, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 11/*2*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_NUM3, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_NUM3, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 12/*3*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_NUM4, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_NUM4, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 13/*4*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_NUM5, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_NUM5, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 14/*5*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_NUM6, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_NUM6, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 15/*6*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_NUM7, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_NUM7, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 16/*7*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_NUM8, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_NUM8, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 17/*8*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_NUM9, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_NUM9, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 18/*9*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_NUM10, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_NUM10, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 19/*0*/);
 
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_NEXT, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_NEXT, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 23/*TAB*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_PREV, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_PREV, SHORTCUT_TYPE_NONE,
                  MOD_CTRL|MOD_SHIFT, 23/*TAB*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_NEXT, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_NEXT, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 117/*PG_DOWN*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_PREV, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_PREV, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 112/*PG_UP*/);
 
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_CLOSE, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_CLOSE, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 25/*w*/);
 
-   _add_shortcut(false, SHORTCUT_TYPE_MODE_NORMAL, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_MODE_NORMAL, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 67/*F1*/);
-   _add_shortcut(false, SHORTCUT_TYPE_MODE_CODE, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_MODE_CODE, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 68/*F2*/);
-   _add_shortcut(false, SHORTCUT_TYPE_MODE_DEMO, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_MODE_DEMO, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 69/*F3*/);
 
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_IMAGE_MANAGER, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_IMAGE_MANAGER, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 73/*F7*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_SOUND_MANAGER, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_SOUND_MANAGER, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 74/*F8*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_STYLE_MANAGER, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_STYLE_MANAGER, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 75/*F9*/);
-   _add_shortcut(false, SHORTCUT_TYPE_TAB_COLOR_CLASS_MANAGER, 
SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_TAB_COLOR_CLASS_MANAGER, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 76/*F10*/);
 
-   _add_shortcut(false, SHORTCUT_TYPE_ZOOM_IN, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_ZOOM_IN, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 86/*KP_+*/);
-   _add_shortcut(false, SHORTCUT_TYPE_ZOOM_OUT, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_ZOOM_OUT, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 82/*KP_-*/);
-   _add_shortcut(false, SHORTCUT_TYPE_ZOOM_RESET, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_ZOOM_RESET, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 106/*KP_/ */);
-   _add_shortcut(false, SHORTCUT_TYPE_OBJECT_AREA, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_OBJECT_AREA, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 32/*o*/);
 
-   _add_shortcut(true, SHORTCUT_TYPE_POPUP_CANCEL, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_CANCEL, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 9/*ESC*/);
-   _add_shortcut(true, SHORTCUT_TYPE_POPUP_DONE, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_DONE, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 36/*ENTER*/);
-   _add_shortcut(true, SHORTCUT_TYPE_POPUP_DONE, SHORTCUT_TYPE_NONE,
+   _add_shortcut(SHORTCUT_TYPE_DONE, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 104/*KP_ENTER*/);
 
 }
diff --git a/src/bin/ui/shortcuts/shortcuts.h b/src/bin/ui/shortcuts/shortcuts.h
index 4314384..e1bbef9 100644
--- a/src/bin/ui/shortcuts/shortcuts.h
+++ b/src/bin/ui/shortcuts/shortcuts.h
@@ -90,13 +90,12 @@ typedef enum {
    SHORTCUT_TYPE_PART_PREV,
    SHORTCUT_TYPE_PART_SHOWHIDE,
    SHORTCUT_TYPE_ALL_PARTS_SHOWHIDE,
-   SHORTCUT_TYPE_PART_UNSELECT,
    SHORTCUT_TYPE_ZOOM_IN,
    SHORTCUT_TYPE_ZOOM_OUT,
    SHORTCUT_TYPE_ZOOM_RESET,
    SHORTCUT_TYPE_OBJECT_AREA,
-   SHORTCUT_TYPE_POPUP_DONE,
-   SHORTCUT_TYPE_POPUP_CANCEL,
+   SHORTCUT_TYPE_DONE,
+   SHORTCUT_TYPE_CANCEL,
 
    SHORTCUT_TYPE_LAST,
 } Shortcut_Type;
diff --git a/src/bin/ui/tabs.c b/src/bin/ui/tabs.c
index 7cdb3d2..cfb1ddf 100644
--- a/src/bin/ui/tabs.c
+++ b/src/bin/ui/tabs.c
@@ -1047,7 +1047,7 @@ tabs_add(void)
    evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_PART_NEXT, 
_shortcut_part_next_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_PART_PREV, 
_shortcut_part_prev_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_PART_SHOWHIDE, 
_shortcut_part_showhide_cb, NULL);
-   evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_PART_UNSELECT, 
_shortcut_part_unselect_cb, NULL);
+   evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_CANCEL, 
_shortcut_part_unselect_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_ALL_PARTS_SHOWHIDE, 
_shortcut_all_parts_showhide_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_TAB_NEXT, 
_shortcut_tab_next_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_TAB_PREV, 
_shortcut_tab_prev_cb, NULL);

-- 


Reply via email to