summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Gstädtner <thomas@gstaedtner.net>2013-06-17 07:49:22 +0100
committerMike Blumenkrantz <m.blumenkran@samsung.com>2013-06-17 07:49:22 +0100
commit4e2dd06861d2c9b38465bb44d01e39cce16fa509 (patch)
tree3c99940761c13dac59665637f04bfbd028c5999d /src
parent8b4802ad45b96fec704e43fe4139048b7fcf35d0 (diff)
ibar exec list: allow fast application switching by scrollwheel
Diffstat (limited to 'src')
-rw-r--r--src/modules/ibar/e_mod_main.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c
index 7bc36c7a0..fbb621668 100644
--- a/src/modules/ibar/e_mod_main.c
+++ b/src/modules/ibar/e_mod_main.c
@@ -70,6 +70,7 @@ struct _IBar_Icon
70 Ecore_Timer *timer; 70 Ecore_Timer *timer;
71 E_Exec_Instance *exe_inst; 71 E_Exec_Instance *exe_inst;
72 Eina_List *exes; //all instances 72 Eina_List *exes; //all instances
73 Eina_List *exe_current;
73 E_Gadcon_Popup *menu; 74 E_Gadcon_Popup *menu;
74 int mouse_down; 75 int mouse_down;
75 struct 76 struct
@@ -112,6 +113,7 @@ static void _ibar_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj
112static void _ibar_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); 113static void _ibar_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
113static void _ibar_cb_icon_move(void *data, Evas *e, Evas_Object *obj, void *event_info); 114static void _ibar_cb_icon_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
114static void _ibar_cb_icon_resize(void *data, Evas *e, Evas_Object *obj, void *event_info); 115static void _ibar_cb_icon_resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
116static void _ibar_cb_icon_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info);
115static void _ibar_inst_cb_enter(void *data, const char *type, void *event_info); 117static void _ibar_inst_cb_enter(void *data, const char *type, void *event_info);
116static void _ibar_inst_cb_move(void *data, const char *type, void *event_info); 118static void _ibar_inst_cb_move(void *data, const char *type, void *event_info);
117static void _ibar_inst_cb_leave(void *data, const char *type, void *event_info); 119static void _ibar_inst_cb_leave(void *data, const char *type, void *event_info);
@@ -636,6 +638,8 @@ _ibar_icon_new(IBar *b, Efreet_Desktop *desktop)
636 _ibar_cb_icon_mouse_up, ic); 638 _ibar_cb_icon_mouse_up, ic);
637 evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOUSE_MOVE, 639 evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOUSE_MOVE,
638 _ibar_cb_icon_mouse_move, ic); 640 _ibar_cb_icon_mouse_move, ic);
641 evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOUSE_WHEEL,
642 _ibar_cb_icon_wheel, ic);
639 evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOVE, 643 evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOVE,
640 _ibar_cb_icon_move, ic); 644 _ibar_cb_icon_move, ic);
641 evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_RESIZE, 645 evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_RESIZE,
@@ -660,6 +664,7 @@ _ibar_icon_free(IBar_Icon *ic)
660 664
661 if (ic->reset_timer) ecore_timer_del(ic->reset_timer); 665 if (ic->reset_timer) ecore_timer_del(ic->reset_timer);
662 ic->reset_timer = NULL; 666 ic->reset_timer = NULL;
667 ic->exe_current = NULL;
663 if (ic->ibar->ic_drop_before == ic) 668 if (ic->ibar->ic_drop_before == ic)
664 ic->ibar->ic_drop_before = NULL; 669 ic->ibar->ic_drop_before = NULL;
665 _ibar_icon_empty(ic); 670 _ibar_icon_empty(ic);
@@ -1115,6 +1120,40 @@ _ibar_cb_icon_reset(void *data)
1115} 1120}
1116 1121
1117static void 1122static void
1123_ibar_cb_icon_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1124{
1125 Evas_Event_Mouse_Wheel *ev;
1126 E_Exec_Instance *exe;
1127 IBar_Icon *ic;
1128
1129 ev = event_info;
1130 ic = data;
1131
1132 if (!ic->exes) return;
1133
1134 if (!ic->exe_current)
1135 ic->exe_current = eina_list_nth_list(ic->exes, 0);
1136
1137 if (ev->z < 0)
1138 {
1139 ic->exe_current = eina_list_next(ic->exe_current);
1140 if (!ic->exe_current)
1141 ic->exe_current = eina_list_nth_list(ic->exes, 0);
1142 }
1143 else if (ev->z > 0)
1144 {
1145 ic->exe_current = eina_list_prev(ic->exe_current);
1146 if (!ic->exe_current)
1147 ic->exe_current = eina_list_last(ic->exes);
1148 }
1149
1150 exe = eina_list_data_get(ic->exe_current);
1151
1152 if (!exe->bd) return;
1153 e_border_activate(exe->bd, 1);
1154}
1155
1156static void
1118_ibar_instance_watch(void *data, E_Exec_Instance *inst, E_Exec_Watch_Type type) 1157_ibar_instance_watch(void *data, E_Exec_Instance *inst, E_Exec_Watch_Type type)
1119{ 1158{
1120 IBar_Icon *ic = data; 1159 IBar_Icon *ic = data;