summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--data/themes/edc/menu.edc18
-rw-r--r--src/bin/e_comp.c44
-rw-r--r--src/bin/e_menu.c303
-rw-r--r--src/bin/e_menu.h15
6 files changed, 119 insertions, 266 deletions
diff --git a/ChangeLog b/ChangeLog
index aa49380e7..cd66fb222 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
12013-02-25 Mike Blumenkrantz
2
3 * menus are now drawn directly on the compositor canvas
4
12013-02-18 Mike Blumenkrantz 52013-02-18 Mike Blumenkrantz
2 6
3 * fixed disable of input methods in input method config dialog 7 * fixed disable of input methods in input method config dialog
diff --git a/NEWS b/NEWS
index b3e3af227..2b5035775 100644
--- a/NEWS
+++ b/NEWS
@@ -111,6 +111,7 @@ Improvements:
111 * e_gadcon_unpopulate now correctly freezes the container while deleting gadgets 111 * e_gadcon_unpopulate now correctly freezes the container while deleting gadgets
112 * e_popup is now a wrapper for drawing objects onto the compositor canvas 112 * e_popup is now a wrapper for drawing objects onto the compositor canvas
113 * compositor nocomp mode now dynamically enables/disables based on the state and stacking of fullscreen windows and comp objects 113 * compositor nocomp mode now dynamically enables/disables based on the state and stacking of fullscreen windows and comp objects
114 * menus are now drawn directly on the compositor canvas
114 115
115Fixes: 116Fixes:
116 * IBar menu didn't allow to configure different icon sources, show contents menu even on empty IBar. 117 * IBar menu didn't allow to configure different icon sources, show contents menu even on empty IBar.
diff --git a/data/themes/edc/menu.edc b/data/themes/edc/menu.edc
index dd8097fc6..d926f0524 100644
--- a/data/themes/edc/menu.edc
+++ b/data/themes/edc/menu.edc
@@ -193,6 +193,11 @@ group { name: "e/widgets/menu/default/item_bg";
193 visible: 1; 193 visible: 1;
194 } 194 }
195 } 195 }
196 part { name: "events"; type: RECT;
197 description { state: "default";
198 color: 0 0 0 0;
199 }
200 }
196 } 201 }
197 programs { 202 programs {
198 program { 203 program {
@@ -216,7 +221,7 @@ group { name: "e/widgets/menu/default/item_bg";
216 221
217group { name: "e/widgets/menu/default/icon"; 222group { name: "e/widgets/menu/default/icon";
218 parts { 223 parts {
219 part { name: "clip"; type: RECT; 224 part { name: "clip"; type: RECT; mouse_events: 0;
220 description { state: "default" 0.0; 225 description { state: "default" 0.0;
221 color: 255 255 255 255; 226 color: 255 255 255 255;
222 } 227 }
@@ -249,6 +254,11 @@ group { name: "e/widgets/menu/default/icon";
249 254
250group { name: "e/widgets/menu/default/label"; 255group { name: "e/widgets/menu/default/label";
251 parts { 256 parts {
257 part { name: "base"; type: RECT;
258 description { state: "default";
259 color: 0 0 0 0;
260 }
261 }
252 part { name: "e.text.label"; type: TEXT; mouse_events: 0; 262 part { name: "e.text.label"; type: TEXT; mouse_events: 0;
253 effect: SHADOW BOTTOM; 263 effect: SHADOW BOTTOM;
254 scale: 1; 264 scale: 1;
@@ -364,7 +374,7 @@ group { name: "e/widgets/menu/default/submenu";
364 images.image: "sym_right_glow_normal.png" COMP; 374 images.image: "sym_right_glow_normal.png" COMP;
365 images.image: "vertical_separated_bar_glow.png" COMP; 375 images.image: "vertical_separated_bar_glow.png" COMP;
366 parts { 376 parts {
367 part { name: "base"; mouse_events: 0; 377 part { name: "base";
368 description { state: "default" 0.0; 378 description { state: "default" 0.0;
369 image.normal: "sym_right_light_normal.png"; 379 image.normal: "sym_right_light_normal.png";
370 rel2.offset: -2 -1; 380 rel2.offset: -2 -1;
@@ -413,7 +423,7 @@ group { name: "e/widgets/menu/default/check";
413 images.image: "bevel_in.png" COMP; 423 images.image: "bevel_in.png" COMP;
414 images.image: "sym_check_alum.png" COMP; 424 images.image: "sym_check_alum.png" COMP;
415 parts { 425 parts {
416 part { name: "base"; type: RECT; mouse_events: 0; 426 part { name: "base"; type: RECT;
417 description { state: "default" 0.0; 427 description { state: "default" 0.0;
418 rel1.offset: 1 1; 428 rel1.offset: 1 1;
419 rel1.to: "inset"; 429 rel1.to: "inset";
@@ -478,7 +488,7 @@ group { name: "e/widgets/menu/default/radio";
478 images.image: "inset_shadow_circle_tiny.png" COMP; 488 images.image: "inset_shadow_circle_tiny.png" COMP;
479 images.image: "sym_radio_alum.png" COMP; 489 images.image: "sym_radio_alum.png" COMP;
480 parts { 490 parts {
481 part { name: "base"; mouse_events: 0; 491 part { name: "base";
482 description { state: "default" 0.0; 492 description { state: "default" 0.0;
483 image.normal: "inset_shadow_circle_tiny.png"; 493 image.normal: "inset_shadow_circle_tiny.png";
484 min: 13 13; 494 min: 13 13;
diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c
index b2f172f0f..7d2ac81b9 100644
--- a/src/bin/e_comp.c
+++ b/src/bin/e_comp.c
@@ -467,8 +467,8 @@ _e_comp_win_geometry_update(E_Comp_Win *cw)
467 w = cw->pw, h = cw->ph; 467 w = cw->pw, h = cw->ph;
468 if (cw->not_in_layout) 468 if (cw->not_in_layout)
469 { 469 {
470 evas_object_move(cw->shobj, x, y);
471 evas_object_resize(cw->shobj, w, h); 470 evas_object_resize(cw->shobj, w, h);
471 evas_object_move(cw->shobj, x, y);
472 } 472 }
473 else 473 else
474 { 474 {
@@ -1492,6 +1492,7 @@ _e_comp_object_del(void *data, void *obj)
1492 } 1492 }
1493 else if (obj == cw->menu) 1493 else if (obj == cw->menu)
1494 { 1494 {
1495 cw->menu->cw = NULL;
1495 cw->menu = NULL; 1496 cw->menu = NULL;
1496 evas_object_data_del(cw->shobj, "menu"); 1497 evas_object_data_del(cw->shobj, "menu");
1497 } 1498 }
@@ -1934,12 +1935,17 @@ _e_comp_win_dummy_add(E_Comp *c, Evas_Object *obj, E_Object *eobj, Eina_Bool nol
1934 cw->pop->cw = cw; 1935 cw->pop->cw = cw;
1935 cw->shape = cw->pop->shape; 1936 cw->shape = cw->pop->shape;
1936 cw->dfn = e_object_delfn_add(E_OBJECT(cw->pop), _e_comp_object_del, cw); 1937 cw->dfn = e_object_delfn_add(E_OBJECT(cw->pop), _e_comp_object_del, cw);
1937 cw->show_ready = 1;
1938 break; 1938 break;
1939 //case E_MENU_TYPE: 1939 case E_MENU_TYPE:
1940 //cw->menu = eobj; 1940 cw->menu = (void*)eobj;
1941 //cw->menu->cw = cw; 1941 cw->menu->cw = cw;
1942 //break; 1942 cw->shape = cw->menu->shape;
1943 cw->dfn = e_object_delfn_add(E_OBJECT(cw->menu), _e_comp_object_del, cw);
1944 if (cw->menu->cur.visible)
1945 cw->show_ready = 1;
1946 else
1947 cw->real_hid = 1;
1948 break;
1943 default: 1949 default:
1944 CRI("UNHANDLED"); 1950 CRI("UNHANDLED");
1945 } 1951 }
@@ -2013,12 +2019,7 @@ _e_comp_win_add(E_Comp *c, Ecore_X_Window win)
2013 // _e_comp_win_sync_setup(cw, cw->bd->client.win); 2019 // _e_comp_win_sync_setup(cw, cw->bd->client.win);
2014 } 2020 }
2015 /* popups handled in _dummy_add */ 2021 /* popups handled in _dummy_add */
2016 else if ((cw->menu = e_menu_find_by_window(cw->win))) 2022 /* menus handled in _dummy_add */
2017 {
2018 cw->dfn = e_object_delfn_add(E_OBJECT(cw->menu), _e_comp_object_del, cw);
2019 cw->show_ready = 1;
2020 cw->shape = cw->menu->shape;
2021 }
2022 // fixme: could use bd/pop/menu for this too 2023 // fixme: could use bd/pop/menu for this too
2023 memset((&att), 0, sizeof(Ecore_X_Window_Attributes)); 2024 memset((&att), 0, sizeof(Ecore_X_Window_Attributes));
2024 if (!ecore_x_window_attributes_get(cw->win, &att)) 2025 if (!ecore_x_window_attributes_get(cw->win, &att))
@@ -2218,6 +2219,7 @@ _e_comp_win_del(E_Comp_Win *cw)
2218 else if (cw->menu) 2219 else if (cw->menu)
2219 { 2220 {
2220 e_object_delfn_del(E_OBJECT(cw->menu), cw->dfn); 2221 e_object_delfn_del(E_OBJECT(cw->menu), cw->dfn);
2222 cw->menu->cw = NULL;
2221 cw->menu = NULL; 2223 cw->menu = NULL;
2222 } 2224 }
2223 cw->dfn = NULL; 2225 cw->dfn = NULL;
@@ -3575,10 +3577,8 @@ _e_comp_shapes_update_comp_win_shape_comp_helper(E_Comp_Win *cw, Eina_Tiler *tb)
3575 x = cw->bd->x, y = cw->bd->y, w = cw->bd->w, h = cw->bd->h; 3577 x = cw->bd->x, y = cw->bd->y, w = cw->bd->w, h = cw->bd->h;
3576 else if (cw->pop) 3578 else if (cw->pop)
3577 x = cw->pop->x + cw->pop->zone->x, y = cw->pop->y + cw->pop->zone->y, w = cw->pop->w, h = cw->pop->h; 3579 x = cw->pop->x + cw->pop->zone->x, y = cw->pop->y + cw->pop->zone->y, w = cw->pop->w, h = cw->pop->h;
3578 /* 3580 //else if (cw->menu)
3579 else if (cw->menu) 3581 //x = cw->menu->x + cw->menu->zone->x, y = cw->menu->y + cw->menu->zone->y, w = cw->menu->w, h = cw->menu->h;
3580 x = cw->menu->cur.x, y = cw->menu->cur.y, w = cw->menu->cur.w, h = cw->menu->cur.h;
3581 */
3582 else 3582 else
3583 x = cw->x, y = cw->y, w = cw->w, h = cw->h; 3583 x = cw->x, y = cw->y, w = cw->w, h = cw->h;
3584#ifdef SHAPE_DEBUG 3584#ifdef SHAPE_DEBUG
@@ -4760,6 +4760,8 @@ e_comp_get(void *o)
4760 E_Border *bd; 4760 E_Border *bd;
4761 E_Popup *pop; 4761 E_Popup *pop;
4762 E_Shelf *es; 4762 E_Shelf *es;
4763 E_Menu *m;
4764 E_Menu_Item *mi;
4763 E_Object *obj = o; 4765 E_Object *obj = o;
4764 E_Zone *zone = NULL; 4766 E_Zone *zone = NULL;
4765 E_Container *con = NULL; 4767 E_Container *con = NULL;
@@ -4780,6 +4782,16 @@ e_comp_get(void *o)
4780 obj = (void*)pop->zone; 4782 obj = (void*)pop->zone;
4781 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); 4783 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
4782 break; 4784 break;
4785 case E_MENU_TYPE:
4786 m = (E_Menu*)obj;
4787 obj = (void*)m->zone;
4788 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
4789 break;
4790 case E_MENU_ITEM_TYPE:
4791 mi = (E_Menu_Item*)obj;
4792 obj = (void*)mi->menu->zone;
4793 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
4794 break;
4783 case E_SHELF_TYPE: 4795 case E_SHELF_TYPE:
4784 es = (E_Shelf*)obj; 4796 es = (E_Shelf*)obj;
4785 obj = (void*)es->zone; 4797 obj = (void*)es->zone;
diff --git a/src/bin/e_menu.c b/src/bin/e_menu.c
index 167521afe..df932d672 100644
--- a/src/bin/e_menu.c
+++ b/src/bin/e_menu.c
@@ -70,7 +70,6 @@ static void _e_menu_cb_intercept_item_move(void *data, Evas_Object *o, E
70static void _e_menu_cb_intercept_item_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h); 70static void _e_menu_cb_intercept_item_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h);
71static void _e_menu_cb_intercept_container_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y); 71static void _e_menu_cb_intercept_container_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y);
72static void _e_menu_cb_intercept_container_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h); 72static void _e_menu_cb_intercept_container_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h);
73static void _e_menu_cb_ecore_evas_resize(Ecore_Evas *ee);
74static void _e_menu_cb_item_in(void *data, Evas *evas, Evas_Object *obj, void *event_info); 73static void _e_menu_cb_item_in(void *data, Evas *evas, Evas_Object *obj, void *event_info);
75static void _e_menu_cb_item_out(void *data, Evas *evas, Evas_Object *obj, void *event_info); 74static void _e_menu_cb_item_out(void *data, Evas *evas, Evas_Object *obj, void *event_info);
76static Eina_Bool _e_menu_cb_key_down(void *data, int type, void *event); 75static Eina_Bool _e_menu_cb_key_down(void *data, int type, void *event);
@@ -80,14 +79,12 @@ static Eina_Bool _e_menu_cb_mouse_up(void *data, int type, void *event);
80static Eina_Bool _e_menu_cb_mouse_move(void *data, int type, void *event); 79static Eina_Bool _e_menu_cb_mouse_move(void *data, int type, void *event);
81static Eina_Bool _e_menu_cb_mouse_wheel(void *data, int type, void *event); 80static Eina_Bool _e_menu_cb_mouse_wheel(void *data, int type, void *event);
82static Eina_Bool _e_menu_cb_scroll_animator(void *data); 81static Eina_Bool _e_menu_cb_scroll_animator(void *data);
83static Eina_Bool _e_menu_cb_window_shape(void *data, int ev_type, void *ev);
84static void _e_menu_cb_item_submenu_post_default(void *data, E_Menu *m, E_Menu_Item *mi); 82static void _e_menu_cb_item_submenu_post_default(void *data, E_Menu *m, E_Menu_Item *mi);
85static Eina_Bool _e_menu_categories_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata); 83static Eina_Bool _e_menu_categories_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata);
86 84
87/* local subsystem globals */ 85/* local subsystem globals */
88static Ecore_X_Window _e_menu_win = 0; 86static Ecore_X_Window _e_menu_win = 0;
89static Eina_List *_e_active_menus = NULL; 87static Eina_List *_e_active_menus = NULL;
90static Eina_Hash *_e_menu_hash = NULL;
91static E_Menu_Item *_e_active_menu_item = NULL; 88static E_Menu_Item *_e_active_menu_item = NULL;
92static E_Menu_Item *_e_prev_active_menu_item = NULL; 89static E_Menu_Item *_e_prev_active_menu_item = NULL;
93/*static Eina_Hash *_e_menu_category_items = NULL;*/ 90/*static Eina_Hash *_e_menu_category_items = NULL;*/
@@ -109,7 +106,6 @@ static Ecore_Event_Handler *_e_menu_mouse_down_handler = NULL;
109static Ecore_Event_Handler *_e_menu_mouse_up_handler = NULL; 106static Ecore_Event_Handler *_e_menu_mouse_up_handler = NULL;
110static Ecore_Event_Handler *_e_menu_mouse_move_handler = NULL; 107static Ecore_Event_Handler *_e_menu_mouse_move_handler = NULL;
111static Ecore_Event_Handler *_e_menu_mouse_wheel_handler = NULL; 108static Ecore_Event_Handler *_e_menu_mouse_wheel_handler = NULL;
112static Ecore_Event_Handler *_e_menu_window_shape_handler = NULL;
113static Eina_Bool _e_menu_lock = EINA_FALSE; 109static Eina_Bool _e_menu_lock = EINA_FALSE;
114 110
115static Eina_List * 111static Eina_List *
@@ -178,12 +174,8 @@ e_menu_init(void)
178 _e_menu_mouse_wheel_handler = 174 _e_menu_mouse_wheel_handler =
179 ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, 175 ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
180 _e_menu_cb_mouse_wheel, NULL); 176 _e_menu_cb_mouse_wheel, NULL);
181 _e_menu_window_shape_handler =
182 ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHAPE,
183 _e_menu_cb_window_shape, NULL);
184 _e_menu_categories = eina_hash_string_superfast_new(NULL); 177 _e_menu_categories = eina_hash_string_superfast_new(NULL);
185 178
186 if (!_e_menu_hash) _e_menu_hash = eina_hash_string_superfast_new(NULL);
187 e_int_menus_init(); 179 e_int_menus_init();
188 return 1; 180 return 1;
189} 181}
@@ -199,7 +191,6 @@ e_menu_shutdown(void)
199 E_FN_DEL(ecore_event_handler_del, _e_menu_mouse_up_handler); 191 E_FN_DEL(ecore_event_handler_del, _e_menu_mouse_up_handler);
200 E_FN_DEL(ecore_event_handler_del, _e_menu_mouse_move_handler); 192 E_FN_DEL(ecore_event_handler_del, _e_menu_mouse_move_handler);
201 E_FN_DEL(ecore_event_handler_del, _e_menu_mouse_wheel_handler); 193 E_FN_DEL(ecore_event_handler_del, _e_menu_mouse_wheel_handler);
202 E_FN_DEL(ecore_event_handler_del, _e_menu_window_shape_handler);
203 194
204 if (!x_fatal) 195 if (!x_fatal)
205 { 196 {
@@ -219,11 +210,6 @@ e_menu_shutdown(void)
219 _e_menu_categories = NULL; 210 _e_menu_categories = NULL;
220 } 211 }
221 212
222 if (_e_menu_hash)
223 {
224 eina_hash_free(_e_menu_hash);
225 _e_menu_hash = NULL;
226 }
227 _e_menu_lock = EINA_FALSE; 213 _e_menu_lock = EINA_FALSE;
228 e_int_menus_shutdown(); 214 e_int_menus_shutdown();
229 215
@@ -1135,8 +1121,7 @@ e_menu_idler_before(void)
1135 if ((!m->cur.visible) && (m->prev.visible)) 1121 if ((!m->cur.visible) && (m->prev.visible))
1136 { 1122 {
1137 m->prev.visible = m->cur.visible; 1123 m->prev.visible = m->cur.visible;
1138 ecore_evas_hide(m->ecore_evas); 1124 if (m->cw) e_comp_win_hide(m->cw);
1139 e_container_shape_hide(m->shape);
1140 } 1125 }
1141 } 1126 }
1142 /* phase 2. move & reisze all the menus that want to moves/resized */ 1127 /* phase 2. move & reisze all the menus that want to moves/resized */
@@ -1155,8 +1140,8 @@ e_menu_idler_before(void)
1155 m->prev.h = m->cur.h; 1140 m->prev.h = m->cur.h;
1156 w = m->cur.w; 1141 w = m->cur.w;
1157 h = m->cur.h; 1142 h = m->cur.h;
1158 ecore_evas_resize(m->ecore_evas, w, h); 1143 if (m->cw)
1159 e_container_shape_resize(m->shape, w, h); 1144 e_comp_win_resize(m->cw, w, h);
1160 } 1145 }
1161 if (((m->cur.x) != (m->prev.x)) || 1146 if (((m->cur.x) != (m->prev.x)) ||
1162 ((m->cur.y) != (m->prev.y))) 1147 ((m->cur.y) != (m->prev.y)))
@@ -1179,8 +1164,9 @@ e_menu_idler_before(void)
1179 } 1164 }
1180 m->prev.x = m->cur.x; 1165 m->prev.x = m->cur.x;
1181 m->prev.y = m->cur.y; 1166 m->prev.y = m->cur.y;
1182 ecore_evas_move(m->ecore_evas, m->cur.x, m->cur.y); 1167 if (m->cw)
1183 e_container_shape_move(m->shape, m->cur.x, m->cur.y); 1168 e_comp_win_move(m->cw, m->cur.x, m->cur.y);
1169
1184 } 1170 }
1185 } 1171 }
1186 } 1172 }
@@ -1192,9 +1178,13 @@ e_menu_idler_before(void)
1192 if ((m->cur.visible) && (!m->prev.visible)) 1178 if ((m->cur.visible) && (!m->prev.visible))
1193 { 1179 {
1194 m->prev.visible = m->cur.visible; 1180 m->prev.visible = m->cur.visible;
1195 ecore_evas_raise(m->ecore_evas); 1181 if (!m->cw)
1196 ecore_evas_show(m->ecore_evas); 1182 {
1197 if (!m->shaped) e_container_shape_show(m->shape); 1183 evas_object_move(m->bg_object, m->cur.x, m->cur.y);
1184 evas_object_resize(m->bg_object, m->cur.w, m->cur.h);
1185 E_LAYER_SET(m->bg_object, E_COMP_CANVAS_LAYER_MENU);
1186 }
1187 e_comp_win_show(m->cw);
1198 } 1188 }
1199 } 1189 }
1200 /* phase 4. de-activate... */ 1190 /* phase 4. de-activate... */
@@ -1215,59 +1205,6 @@ e_menu_idler_before(void)
1215 e_object_unref(E_OBJECT(m)); 1205 e_object_unref(E_OBJECT(m));
1216 } 1206 }
1217 } 1207 }
1218 /* phase 5. shapes... */
1219 EINA_LIST_FOREACH(_e_active_menus, l, m)
1220 {
1221 if (m->need_shape_export)
1222 {
1223 Ecore_X_Rectangle *rects, *orects;
1224 int num = 0;
1225
1226 rects = ecore_x_window_shape_rectangles_get(m->evas_win, &num);
1227 if (rects)
1228 {
1229 int changed = 1;
1230
1231 if ((num == m->shape_rects_num) && (m->shape_rects))
1232 {
1233 int i = 0;
1234
1235 orects = m->shape_rects;
1236 for (i = 0; i < num; i++)
1237 {
1238 if ((orects[i].x != rects[i].x) ||
1239 (orects[i].y != rects[i].y) ||
1240 (orects[i].width != rects[i].width) ||
1241 (orects[i].height != rects[i].height))
1242 {
1243 changed = 1;
1244 break;
1245 }
1246 }
1247 // TODO: This is meaningless
1248 changed = 0;
1249 }
1250 if (changed)
1251 {
1252 E_FREE(m->shape_rects);
1253 m->shape_rects = rects;
1254 m->shape_rects_num = num;
1255 e_container_shape_rects_set(m->shape, rects, num);
1256 }
1257 else
1258 free(rects);
1259 }
1260 else
1261 {
1262 E_FREE(m->shape_rects);
1263 m->shape_rects = NULL;
1264 m->shape_rects_num = 0;
1265 e_container_shape_rects_set(m->shape, NULL, 0);
1266 }
1267 m->need_shape_export = 0;
1268 if (m->cur.visible) e_container_shape_show(m->shape);
1269 }
1270 }
1271 /* del refcount to all menus we worked with */ 1208 /* del refcount to all menus we worked with */
1272 _e_menu_list_free_unref(tmp); 1209 _e_menu_list_free_unref(tmp);
1273 1210
@@ -1275,8 +1212,7 @@ e_menu_idler_before(void)
1275 { 1212 {
1276 if (_e_menu_win) 1213 if (_e_menu_win)
1277 { 1214 {
1278 ecore_x_window_free(_e_menu_win); 1215 e_grabinput_release(0, _e_menu_win);
1279 e_grabinput_release(_e_menu_win, _e_menu_win);
1280 _e_menu_win = 0; 1216 _e_menu_win = 0;
1281 } 1217 }
1282 } 1218 }
@@ -1288,17 +1224,6 @@ e_menu_grab_window_get(void)
1288 return _e_menu_win; 1224 return _e_menu_win;
1289} 1225}
1290 1226
1291EAPI E_Menu *
1292e_menu_find_by_window(Ecore_X_Window win)
1293{
1294 E_Menu *m;
1295
1296 m = eina_hash_find(_e_menu_hash, e_util_winid_str_get(win));
1297 if ((m) && (m->evas_win != win))
1298 return NULL;
1299 return m;
1300}
1301
1302/* local subsystem functions */ 1227/* local subsystem functions */
1303static void 1228static void
1304_e_menu_free(E_Menu *m) 1229_e_menu_free(E_Menu *m)
@@ -1321,8 +1246,6 @@ _e_menu_free(E_Menu *m)
1321 if (m->parent_item && (m->parent_item->submenu == m)) 1246 if (m->parent_item && (m->parent_item->submenu == m))
1322 m->parent_item->submenu = NULL; 1247 m->parent_item->submenu = NULL;
1323 _e_menu_unrealize(m); 1248 _e_menu_unrealize(m);
1324 E_FREE(m->shape_rects);
1325 m->shape_rects_num = 0;
1326 EINA_LIST_FOREACH_SAFE(m->items, l, l_next, mi) 1249 EINA_LIST_FOREACH_SAFE(m->items, l, l_next, mi)
1327 e_object_del(E_OBJECT(mi)); 1250 e_object_del(E_OBJECT(mi));
1328 if (m->in_active_list) 1251 if (m->in_active_list)
@@ -1376,7 +1299,6 @@ _e_menu_cb_intercept_item_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Co
1376 mi = data; 1299 mi = data;
1377 mi->x = x; 1300 mi->x = x;
1378 mi->y = y; 1301 mi->y = y;
1379 evas_object_move(mi->event_object, x, y);
1380 evas_object_move(o, x, y); 1302 evas_object_move(o, x, y);
1381 if ((mi->submenu) && (mi->submenu->parent_item)) 1303 if ((mi->submenu) && (mi->submenu->parent_item))
1382 { 1304 {
@@ -1393,7 +1315,6 @@ _e_menu_cb_intercept_item_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_
1393 mi = data; 1315 mi = data;
1394 mi->w = w; 1316 mi->w = w;
1395 mi->h = h; 1317 mi->h = h;
1396 evas_object_resize(mi->event_object, w, h);
1397 evas_object_resize(o, w, h); 1318 evas_object_resize(o, w, h);
1398 if ((mi->submenu) && (mi->submenu->parent_item)) 1319 if ((mi->submenu) && (mi->submenu->parent_item))
1399 _e_menu_reposition(mi->submenu); 1320 _e_menu_reposition(mi->submenu);
@@ -1446,9 +1367,12 @@ _e_menu_item_realize(E_Menu_Item *mi)
1446 { 1367 {
1447 o = edje_object_add(mi->menu->evas); 1368 o = edje_object_add(mi->menu->evas);
1448 mi->bg_object = o; 1369 mi->bg_object = o;
1370 evas_object_name_set(o, "mi->bg_object");
1371 evas_object_data_set(o, "e_menu_item", mi);
1372 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _e_menu_cb_item_in, mi);
1373 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _e_menu_cb_item_out, mi);
1449 evas_object_intercept_move_callback_add(o, _e_menu_cb_intercept_item_move, mi); 1374 evas_object_intercept_move_callback_add(o, _e_menu_cb_intercept_item_move, mi);
1450 evas_object_intercept_resize_callback_add(o, _e_menu_cb_intercept_item_resize, mi); 1375 evas_object_intercept_resize_callback_add(o, _e_menu_cb_intercept_item_resize, mi);
1451
1452 if ((mi->submenu) || (mi->submenu_pre_cb.func)) 1376 if ((mi->submenu) || (mi->submenu_pre_cb.func))
1453 { 1377 {
1454 if (!e_theme_edje_object_set(mi->bg_object, "base/theme/menus", 1378 if (!e_theme_edje_object_set(mi->bg_object, "base/theme/menus",
@@ -1464,6 +1388,7 @@ no_submenu_item:
1464 evas_object_show(o); 1388 evas_object_show(o);
1465 1389
1466 o = e_box_add(mi->menu->evas); 1390 o = e_box_add(mi->menu->evas);
1391 evas_object_name_set(o, "mi->container_object");
1467 e_box_homogenous_set(o, 0); 1392 e_box_homogenous_set(o, 0);
1468 mi->container_object = o; 1393 mi->container_object = o;
1469 e_box_orientation_set(o, 1); 1394 e_box_orientation_set(o, 1);
@@ -1474,10 +1399,10 @@ no_submenu_item:
1474 if (mi->check) 1399 if (mi->check)
1475 { 1400 {
1476 o = edje_object_add(mi->menu->evas); 1401 o = edje_object_add(mi->menu->evas);
1402 evas_object_name_set(o, "mi->toggle_object");
1477 mi->toggle_object = o; 1403 mi->toggle_object = o;
1478 e_theme_edje_object_set(o, "base/theme/menus", 1404 e_theme_edje_object_set(o, "base/theme/menus",
1479 "e/widgets/menu/default/check"); 1405 "e/widgets/menu/default/check");
1480 evas_object_pass_events_set(o, 1);
1481 evas_object_show(o); 1406 evas_object_show(o);
1482 e_box_pack_end(mi->container_object, o); 1407 e_box_pack_end(mi->container_object, o);
1483 edje_object_size_min_calc(mi->toggle_object, &ww, &hh); 1408 edje_object_size_min_calc(mi->toggle_object, &ww, &hh);
@@ -1494,10 +1419,10 @@ no_submenu_item:
1494 else if (mi->radio) 1419 else if (mi->radio)
1495 { 1420 {
1496 o = edje_object_add(mi->menu->evas); 1421 o = edje_object_add(mi->menu->evas);
1422 evas_object_name_set(o, "mi->toggle_object");
1497 mi->toggle_object = o; 1423 mi->toggle_object = o;
1498 e_theme_edje_object_set(o, "base/theme/menus", 1424 e_theme_edje_object_set(o, "base/theme/menus",
1499 "e/widgets/menu/default/radio"); 1425 "e/widgets/menu/default/radio");
1500 evas_object_pass_events_set(o, 1);
1501 evas_object_show(o); 1426 evas_object_show(o);
1502 e_box_pack_end(mi->container_object, o); 1427 e_box_pack_end(mi->container_object, o);
1503 edje_object_size_min_calc(mi->toggle_object, &ww, &hh); 1428 edje_object_size_min_calc(mi->toggle_object, &ww, &hh);
@@ -1514,9 +1439,9 @@ no_submenu_item:
1514 else 1439 else
1515 { 1440 {
1516 o = evas_object_rectangle_add(mi->menu->evas); 1441 o = evas_object_rectangle_add(mi->menu->evas);
1442 evas_object_name_set(o, "mi->toggle_object");
1517 mi->toggle_object = o; 1443 mi->toggle_object = o;
1518 evas_object_color_set(o, 0, 0, 0, 0); 1444 evas_object_color_set(o, 0, 0, 0, 0);
1519 evas_object_pass_events_set(o, 1);
1520 e_box_pack_end(mi->container_object, o); 1445 e_box_pack_end(mi->container_object, o);
1521 } 1446 }
1522 if ((!e_config->menu_icons_hide) && ((mi->icon) || (mi->realize_cb.func))) 1447 if ((!e_config->menu_icons_hide) && ((mi->icon) || (mi->realize_cb.func)))
@@ -1527,6 +1452,7 @@ no_submenu_item:
1527 if (e_theme_edje_object_set(o, "base/theme/menus", 1452 if (e_theme_edje_object_set(o, "base/theme/menus",
1528 "e/widgets/menu/default/icon")) 1453 "e/widgets/menu/default/icon"))
1529 { 1454 {
1455 evas_object_name_set(o, "mi->icon_bg_object");
1530 mi->icon_bg_object = o; 1456 mi->icon_bg_object = o;
1531 evas_object_show(o); 1457 evas_object_show(o);
1532 } 1458 }
@@ -1535,6 +1461,7 @@ no_submenu_item:
1535 evas_object_del(o); 1461 evas_object_del(o);
1536 o = NULL; 1462 o = NULL;
1537 } 1463 }
1464 //if (o) evas_object_pass_events_set(o, 1);
1538 1465
1539 /* FIXME: Not sure why there are two different tries to get the icon size, surely only the last one si needed. */ 1466 /* FIXME: Not sure why there are two different tries to get the icon size, surely only the last one si needed. */
1540 /* FIXME: Do it this way later, when e_app_icon_add() just registers a request for an icon to be filled in when it's ready. 1467 /* FIXME: Do it this way later, when e_app_icon_add() just registers a request for an icon to be filled in when it's ready.
@@ -1557,6 +1484,7 @@ no_submenu_item:
1557 if (edje_object_file_set(o, mi->icon, mi->icon_key)) 1484 if (edje_object_file_set(o, mi->icon, mi->icon_key))
1558 { 1485 {
1559 mi->icon_object = o; 1486 mi->icon_object = o;
1487 evas_object_name_set(o, "mi->icon_object");
1560 edje_object_size_max_get(o, &iww, &ihh); 1488 edje_object_size_max_get(o, &iww, &ihh);
1561 icon_w = iww; 1489 icon_w = iww;
1562 icon_h = ihh; 1490 icon_h = ihh;
@@ -1570,6 +1498,7 @@ no_submenu_item:
1570 if (!mi->icon_object) 1498 if (!mi->icon_object)
1571 { 1499 {
1572 o = e_icon_add(mi->menu->evas); 1500 o = e_icon_add(mi->menu->evas);
1501 evas_object_name_set(o, "mi->icon_object");
1573 mi->icon_object = o; 1502 mi->icon_object = o;
1574 e_icon_scale_size_set(o, e_util_icon_size_normalize(24 * e_scale)); 1503 e_icon_scale_size_set(o, e_util_icon_size_normalize(24 * e_scale));
1575 e_icon_preload_set(mi->icon_object, 1); 1504 e_icon_preload_set(mi->icon_object, 1);
@@ -1585,7 +1514,6 @@ no_submenu_item:
1585 e_icon_size_get(o, &icon_w, &icon_h); 1514 e_icon_size_get(o, &icon_w, &icon_h);
1586 } 1515 }
1587 1516
1588 evas_object_pass_events_set(o, 1);
1589 evas_object_show(o); 1517 evas_object_show(o);
1590 1518
1591 if (mi->icon_bg_object) 1519 if (mi->icon_bg_object)
@@ -1609,6 +1537,7 @@ no_submenu_item:
1609 else 1537 else
1610 { 1538 {
1611 o = edje_object_add(mi->menu->evas); 1539 o = edje_object_add(mi->menu->evas);
1540 evas_object_name_set(o, "mi->icon_bg_object");
1612 e_icon_size_get(mi->icon_object, &icon_w, &icon_h); 1541 e_icon_size_get(mi->icon_object, &icon_w, &icon_h);
1613 mi->icon_w = icon_w; 1542 mi->icon_w = icon_w;
1614 mi->icon_h = icon_h; 1543 mi->icon_h = icon_h;
@@ -1625,21 +1554,21 @@ no_submenu_item:
1625 else 1554 else
1626 { 1555 {
1627 o = evas_object_rectangle_add(mi->menu->evas); 1556 o = evas_object_rectangle_add(mi->menu->evas);
1557 evas_object_name_set(o, "mi->icon_object");
1628 mi->icon_object = o; 1558 mi->icon_object = o;
1629 evas_object_color_set(o, 0, 0, 0, 0); 1559 evas_object_color_set(o, 0, 0, 0, 0);
1630 evas_object_pass_events_set(o, 1);
1631 e_box_pack_end(mi->container_object, o); 1560 e_box_pack_end(mi->container_object, o);
1632 } 1561 }
1633 1562
1634 if (mi->label) 1563 if (mi->label)
1635 { 1564 {
1636 o = edje_object_add(mi->menu->evas); 1565 o = edje_object_add(mi->menu->evas);
1566 evas_object_name_set(o, "mi->label_object");
1637 mi->label_object = o; 1567 mi->label_object = o;
1638 e_theme_edje_object_set(o, "base/theme/menus", 1568 e_theme_edje_object_set(o, "base/theme/menus",
1639 "e/widgets/menu/default/label"); 1569 "e/widgets/menu/default/label");
1640 /* default label */ 1570 /* default label */
1641 edje_object_part_text_set(o, "e.text.label", mi->label); 1571 edje_object_part_text_set(o, "e.text.label", mi->label);
1642 evas_object_pass_events_set(o, 1);
1643 evas_object_show(o); 1572 evas_object_show(o);
1644 e_box_pack_end(mi->container_object, o); 1573 e_box_pack_end(mi->container_object, o);
1645 edje_object_size_min_calc(mi->label_object, &ww, &hh); 1574 edje_object_size_min_calc(mi->label_object, &ww, &hh);
@@ -1656,18 +1585,18 @@ no_submenu_item:
1656 else 1585 else
1657 { 1586 {
1658 o = evas_object_rectangle_add(mi->menu->evas); 1587 o = evas_object_rectangle_add(mi->menu->evas);
1588 evas_object_name_set(o, "mi->label_object");
1659 mi->label_object = o; 1589 mi->label_object = o;
1660 evas_object_color_set(o, 0, 0, 0, 0); 1590 evas_object_color_set(o, 0, 0, 0, 0);
1661 evas_object_pass_events_set(o, 1);
1662 e_box_pack_end(mi->container_object, o); 1591 e_box_pack_end(mi->container_object, o);
1663 } 1592 }
1664 if ((mi->submenu) || (mi->submenu_pre_cb.func)) 1593 if ((mi->submenu) || (mi->submenu_pre_cb.func))
1665 { 1594 {
1666 o = edje_object_add(mi->menu->evas); 1595 o = edje_object_add(mi->menu->evas);
1596 evas_object_name_set(o, "mi->submenu_object");
1667 mi->submenu_object = o; 1597 mi->submenu_object = o;
1668 e_theme_edje_object_set(o, "base/theme/menus", 1598 e_theme_edje_object_set(o, "base/theme/menus",
1669 "e/widgets/menu/default/submenu"); 1599 "e/widgets/menu/default/submenu");
1670 evas_object_pass_events_set(o, 1);
1671 evas_object_show(o); 1600 evas_object_show(o);
1672 e_box_pack_end(mi->container_object, o); 1601 e_box_pack_end(mi->container_object, o);
1673 edje_object_size_min_calc(mi->submenu_object, &ww, &hh); 1602 edje_object_size_min_calc(mi->submenu_object, &ww, &hh);
@@ -1684,26 +1613,15 @@ no_submenu_item:
1684 else 1613 else
1685 { 1614 {
1686 o = evas_object_rectangle_add(mi->menu->evas); 1615 o = evas_object_rectangle_add(mi->menu->evas);
1616 evas_object_name_set(o, "mi->submenu_object");
1687 mi->submenu_object = o; 1617 mi->submenu_object = o;
1688 evas_object_color_set(o, 0, 0, 0, 0); 1618 evas_object_color_set(o, 0, 0, 0, 0);
1689 evas_object_pass_events_set(o, 1);
1690 e_box_pack_end(mi->container_object, o); 1619 e_box_pack_end(mi->container_object, o);
1691 } 1620 }
1692 1621
1693 edje_object_part_swallow(mi->bg_object, "e.swallow.content", 1622 edje_object_part_swallow(mi->bg_object, "e.swallow.content",
1694 mi->container_object); 1623 mi->container_object);
1695 1624
1696 o = evas_object_rectangle_add(mi->menu->evas);
1697 evas_object_color_set(o, 0, 0, 0, 0);
1698 //evas_object_layer_set(o, 1); FIXME: COMP
1699 evas_object_repeat_events_set(o, 1);
1700 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN,
1701 _e_menu_cb_item_in, mi);
1702 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT,
1703 _e_menu_cb_item_out, mi);
1704 evas_object_show(o);
1705 mi->event_object = o;
1706
1707 e_box_pack_end(mi->menu->container_object, mi->bg_object); 1625 e_box_pack_end(mi->menu->container_object, mi->bg_object);
1708 e_box_thaw(mi->container_object); 1626 e_box_thaw(mi->container_object);
1709 } 1627 }
@@ -1718,72 +1636,29 @@ _e_menu_realize(E_Menu *m)
1718 Evas_Object *o; 1636 Evas_Object *o;
1719 Eina_List *l; 1637 Eina_List *l;
1720 E_Menu_Item *mi; 1638 E_Menu_Item *mi;
1721 int ok = 0;
1722 int w, h;
1723 1639
1724 if (m->realized || (!m->items)) return; 1640 if (m->realized || (!m->items)) return;
1725 m->realized = 1; 1641 m->realized = 1;
1726 m->ecore_evas = e_canvas_new(m->zone->container->win,
1727 m->cur.x, m->cur.y, m->cur.w, m->cur.h, 1, 1,
1728 &(m->evas_win));
1729 e_canvas_add(m->ecore_evas);
1730 eina_hash_add(_e_menu_hash, e_util_winid_str_get(m->evas_win), m);
1731 m->shape = e_container_shape_add(m->zone->container);
1732 e_container_shape_move(m->shape, m->cur.x, m->cur.y);
1733 1642
1734 ecore_evas_callback_resize_set(m->ecore_evas, _e_menu_cb_ecore_evas_resize); 1643 m->evas = e_comp_get(m)->evas;
1735 m->evas = ecore_evas_get(m->ecore_evas); 1644 m->shape = e_container_shape_add(m->zone->container);
1736 evas_event_freeze(m->evas); 1645 evas_event_freeze(m->evas);
1737 /* move cursor out to avoid event cycles during setup */
1738 evas_event_feed_mouse_in(m->evas, ecore_x_current_time_get(), NULL);
1739 evas_event_feed_mouse_move(m->evas, -1000000, -1000000,
1740 ecore_x_current_time_get(), NULL);
1741 ecore_x_window_shape_events_select(m->evas_win, 1);
1742 ecore_evas_name_class_set(m->ecore_evas, "E", "_e_menu_window");
1743 ecore_evas_title_set(m->ecore_evas, "E Menu");
1744 1646
1745 o = edje_object_add(m->evas); 1647 o = edje_object_add(m->evas);
1746 m->bg_object = o; 1648 m->bg_object = o;
1747 evas_object_name_set(o, "menu/background"); 1649 evas_object_name_set(o, "menu->bg_object");
1748 evas_object_data_set(o, "e_menu", m); 1650 evas_object_data_set(o, "e_menu", m);
1749 evas_object_move(o, 0, 0); 1651 evas_object_data_set(o, "eobj", m);
1750 ok = e_theme_edje_object_set(o, "base/theme/menus", 1652 e_theme_edje_object_set(o, "base/theme/menus", "e/widgets/menu/default/background");
1751 "e/widgets/menu/default/background");
1752 if (ok)
1753 {
1754 const char *shape_option;
1755
1756 shape_option = edje_object_data_get(o, "shaped");
1757 if (shape_option)
1758 {
1759 if (!strcmp(shape_option, "1")) m->shaped = 1;
1760 }
1761 }
1762 if (m->header.title) 1653 if (m->header.title)
1763 { 1654 {
1764 edje_object_part_text_set(o, "e.text.title", m->header.title); 1655 edje_object_part_text_set(o, "e.text.title", m->header.title);
1765 edje_object_signal_emit(o, "e,action,show,title", "e"); 1656 edje_object_signal_emit(o, "e,action,show,title", "e");
1766 edje_object_message_signal_process(o); 1657 edje_object_message_signal_process(o);
1767 } 1658 }
1768 evas_object_show(o);
1769
1770 if (m->shaped)
1771 {
1772 if (!e_config->use_shaped_win)
1773 {
1774 ecore_evas_alpha_set(m->ecore_evas, m->shaped);
1775
1776 eina_hash_del(_e_menu_hash, e_util_winid_str_get(m->evas_win), m);
1777 m->evas_win = ecore_evas_software_x11_window_get(m->ecore_evas);
1778 eina_hash_add(_e_menu_hash, e_util_winid_str_get(m->evas_win), m);
1779 }
1780 else
1781 ecore_evas_shaped_set(m->ecore_evas, m->shaped);
1782 }
1783
1784 ecore_x_netwm_window_type_set(m->evas_win, ECORE_X_WINDOW_TYPE_MENU);
1785 1659
1786 o = e_box_add(m->evas); 1660 o = e_box_add(m->evas);
1661 evas_object_name_set(o, "menu->container_object");
1787 m->container_object = o; 1662 m->container_object = o;
1788 evas_object_intercept_move_callback_add(o, _e_menu_cb_intercept_container_move, m); 1663 evas_object_intercept_move_callback_add(o, _e_menu_cb_intercept_container_move, m);
1789 evas_object_intercept_resize_callback_add(o, _e_menu_cb_intercept_container_resize, m); 1664 evas_object_intercept_resize_callback_add(o, _e_menu_cb_intercept_container_resize, m);
@@ -1797,10 +1672,7 @@ _e_menu_realize(E_Menu *m)
1797 1672
1798 _e_menu_items_layout_update(m); 1673 _e_menu_items_layout_update(m);
1799 e_box_thaw(m->container_object); 1674 e_box_thaw(m->container_object);
1800 w = m->cur.w; 1675
1801 h = m->cur.h;
1802 e_container_shape_resize(m->shape, w, h);
1803 evas_object_resize(m->bg_object, w, h);
1804 evas_event_thaw(m->evas); 1676 evas_event_thaw(m->evas);
1805} 1677}
1806 1678
@@ -2035,8 +1907,6 @@ _e_menu_item_unrealize(E_Menu_Item *mi)
2035 mi->label_object = NULL; 1907 mi->label_object = NULL;
2036 if (mi->submenu_object) evas_object_del(mi->submenu_object); 1908 if (mi->submenu_object) evas_object_del(mi->submenu_object);
2037 mi->submenu_object = NULL; 1909 mi->submenu_object = NULL;
2038 if (mi->event_object) evas_object_del(mi->event_object);
2039 mi->event_object = NULL;
2040} 1910}
2041 1911
2042static void 1912static void
@@ -2047,9 +1917,7 @@ _e_menu_unrealize(E_Menu *m)
2047 1917
2048 if (!m->realized) return; 1918 if (!m->realized) return;
2049 evas_event_freeze(m->evas); 1919 evas_event_freeze(m->evas);
2050 e_container_shape_hide(m->shape); 1920 E_FN_DEL(e_object_del, m->shape);
2051 e_object_del(E_OBJECT(m->shape));
2052 m->shape = NULL;
2053 e_box_freeze(m->container_object); 1921 e_box_freeze(m->container_object);
2054 EINA_LIST_FOREACH(m->items, l, mi) 1922 EINA_LIST_FOREACH(m->items, l, mi)
2055 _e_menu_item_unrealize(mi); 1923 _e_menu_item_unrealize(mi);
@@ -2063,12 +1931,9 @@ _e_menu_unrealize(E_Menu *m)
2063 m->prev.visible = 0; 1931 m->prev.visible = 0;
2064 m->realized = 0; 1932 m->realized = 0;
2065 m->zone = NULL; 1933 m->zone = NULL;
2066 e_canvas_del(m->ecore_evas); 1934 m->cw = NULL;
2067 ecore_evas_free(m->ecore_evas); 1935 evas_event_thaw(m->evas);
2068 m->ecore_evas = NULL;
2069 m->evas = NULL; 1936 m->evas = NULL;
2070 eina_hash_del(_e_menu_hash, e_util_winid_str_get(m->evas_win), m);
2071 m->evas_win = 0;
2072} 1937}
2073 1938
2074static void 1939static void
@@ -2083,13 +1948,9 @@ _e_menu_activate_internal(E_Menu *m, E_Zone *zone)
2083 m->pending_new_submenu = 0; 1948 m->pending_new_submenu = 0;
2084 if (!_e_menu_win) 1949 if (!_e_menu_win)
2085 { 1950 {
2086 _e_menu_win = ecore_x_window_input_new(zone->container->win, 1951 _e_menu_win = e_comp_get(zone)->ee_win;
2087 zone->x, zone->y, 1952 if (!e_grabinput_get(0, 0, _e_menu_win))
2088 zone->w, zone->h);
2089 ecore_x_window_show(_e_menu_win);
2090 if (!e_grabinput_get(_e_menu_win, 1, _e_menu_win))
2091 { 1953 {
2092 ecore_x_window_free(_e_menu_win);
2093 _e_menu_win = 0; 1954 _e_menu_win = 0;
2094 return; 1955 return;
2095 } 1956 }
@@ -2213,7 +2074,7 @@ _e_menu_reposition(E_Menu *m)
2213 if (!m->parent_item) return; 2074 if (!m->parent_item) return;
2214 m->cur.x = m->parent_item->menu->cur.x + m->parent_item->menu->cur.w; 2075 m->cur.x = m->parent_item->menu->cur.x + m->parent_item->menu->cur.w;
2215 2076
2216 parent_item_bottom = m->parent_item->menu->cur.y + m->parent_item->y; 2077 parent_item_bottom = m->parent_item->y;
2217 if (m->cur.h > m->zone->h) 2078 if (m->cur.h > m->zone->h)
2218 { 2079 {
2219 /* menu is larger than screen */ 2080 /* menu is larger than screen */
@@ -2227,12 +2088,12 @@ _e_menu_reposition(E_Menu *m)
2227 else 2088 else
2228 { 2089 {
2229 /* menu is smaller than screen */ 2090 /* menu is smaller than screen */
2230 if (((parent_item_bottom + m->cur.h - m->container_y) > m->zone->h) && 2091 if (((parent_item_bottom + m->cur.h) > m->zone->h) &&
2231 (parent_item_bottom > (m->zone->h / 2))) 2092 (parent_item_bottom > (m->zone->h / 2)))
2232 /* menu is partially out of screen and more is shown if menu goes up */ 2093 /* menu is partially out of screen and more is shown if menu goes up */
2233 m->cur.y = (parent_item_bottom - (m->container_h + 1)) + m->parent_item->h; 2094 m->cur.y = parent_item_bottom - m->cur.h + m->parent_item->h;
2234 else 2095 else
2235 m->cur.y = parent_item_bottom - m->container_y; 2096 m->cur.y = parent_item_bottom;
2236 } 2097 }
2237 2098
2238 /* FIXME: this will suck for big menus */ 2099 /* FIXME: this will suck for big menus */
@@ -2833,19 +2694,6 @@ _e_menu_auto_place(E_Menu *m, int x, int y, int w, int h)
2833} 2694}
2834 2695
2835static void 2696static void
2836_e_menu_cb_ecore_evas_resize(Ecore_Evas *ee)
2837{
2838 Evas *evas;
2839 Evas_Object *o;
2840 Evas_Coord w, h;
2841
2842 evas = ecore_evas_get(ee);
2843 evas_output_viewport_get(evas, NULL, NULL, &w, &h);
2844 o = evas_object_name_find(evas, "menu/background");
2845 evas_object_resize(o, w, h);
2846}
2847
2848static void
2849_e_menu_cb_item_in(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 2697_e_menu_cb_item_in(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2850{ 2698{
2851 E_Menu_Item *mi; 2699 E_Menu_Item *mi;
@@ -2953,7 +2801,11 @@ _e_menu_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event)
2953 Ecore_Event_Mouse_Button *ev; 2801 Ecore_Event_Mouse_Button *ev;
2954 2802
2955 ev = event; 2803 ev = event;
2956 if (ev->window != _e_menu_win) return ECORE_CALLBACK_PASS_ON; 2804 if (ev->window != _e_menu_win)
2805 {
2806 _e_menu_deactivate_all();
2807 return ECORE_CALLBACK_PASS_ON;
2808 }
2957 2809
2958 /* Only allow dragging from floating menus for now. 2810 /* Only allow dragging from floating menus for now.
2959 * The reason for this is that for non floating menus, 2811 * The reason for this is that for non floating menus,
@@ -2974,7 +2826,11 @@ _e_menu_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event)
2974 int ret = 0; 2826 int ret = 0;
2975 2827
2976 ev = event; 2828 ev = event;
2977 if (ev->window != _e_menu_win) return ECORE_CALLBACK_PASS_ON; 2829 if (ev->window != _e_menu_win)
2830 {
2831 _e_menu_deactivate_all();
2832 return ECORE_CALLBACK_PASS_ON;
2833 }
2978 2834
2979 t = ev->timestamp - _e_menu_activate_time; 2835 t = ev->timestamp - _e_menu_activate_time;
2980 if ((_e_menu_activate_time != 0) && 2836 if ((_e_menu_activate_time != 0) &&
@@ -3033,27 +2889,22 @@ _e_menu_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
3033 2889
3034 EINA_LIST_FOREACH(_e_active_menus, l, m) 2890 EINA_LIST_FOREACH(_e_active_menus, l, m)
3035 { 2891 {
3036 if ((m->realized) && (m->cur.visible)) 2892 if ((!m->realized) || (!m->cur.visible)) continue;
2893 if (is_fast)
2894 m->fast_mouse = 1;
2895 else if (dt > 0.0)
3037 { 2896 {
3038 if (is_fast) 2897 m->fast_mouse = 0;
3039 m->fast_mouse = 1; 2898 if (m->pending_new_submenu)
3040 else if (dt > 0.0)
3041 { 2899 {
3042 m->fast_mouse = 0; 2900 E_Menu_Item *mi;
3043 if (m->pending_new_submenu)
3044 {
3045 E_Menu_Item *mi;
3046 2901
3047 mi = _e_menu_item_active_get(); 2902 mi = _e_menu_item_active_get();
3048 if (mi) 2903 if (mi)
3049 _e_menu_submenu_activate(mi); 2904 _e_menu_submenu_activate(mi);
3050 }
3051 } 2905 }
3052 evas_event_feed_mouse_move(m->evas,
3053 ev->x - m->cur.x + m->zone->x,
3054 ev->y - m->cur.y + m->zone->y,
3055 ev->timestamp, NULL);
3056 } 2906 }
2907 evas_event_feed_mouse_move(m->evas, ev->x, ev->y, ev->timestamp, NULL);
3057 } 2908 }
3058 2909
3059 _e_menu_list_free_unref(tmp); 2910 _e_menu_list_free_unref(tmp);
@@ -3139,22 +2990,6 @@ _e_menu_cb_scroll_animator(void *data __UNUSED__)
3139 return 1; 2990 return 1;
3140} 2991}
3141 2992
3142static Eina_Bool
3143_e_menu_cb_window_shape(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
3144{
3145 Eina_List *l;
3146 Ecore_X_Event_Window_Shape *e;
3147 E_Menu *m;
3148
3149 e = ev;
3150 EINA_LIST_FOREACH(_e_active_menus, l, m)
3151 {
3152 if (m->evas_win == e->win)
3153 m->need_shape_export = 1;
3154 }
3155 return ECORE_CALLBACK_PASS_ON;
3156}
3157
3158static void 2993static void
3159_e_menu_cb_item_submenu_post_default(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_Item *mi) 2994_e_menu_cb_item_submenu_post_default(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_Item *mi)
3160{ 2995{
diff --git a/src/bin/e_menu.h b/src/bin/e_menu.h
index f0ef7383c..f57fdcf11 100644
--- a/src/bin/e_menu.h
+++ b/src/bin/e_menu.h
@@ -52,15 +52,12 @@ struct _E_Menu
52 E_Menu_Item *parent_item; 52 E_Menu_Item *parent_item;
53 53
54 /* only useful if realized != 0 (ie menu is ACTUALLY realized) */ 54 /* only useful if realized != 0 (ie menu is ACTUALLY realized) */
55 Ecore_Evas *ecore_evas; 55 E_Comp_Win *cw;
56 Evas *evas; 56 E_Container_Shape *shape;
57 Ecore_X_Window evas_win; 57 Evas *evas;
58 Evas_Object *bg_object; 58 Evas_Object *bg_object;
59 Evas_Object *container_object; 59 Evas_Object *container_object;
60 Evas_Coord container_x, container_y, container_w, container_h; 60 Evas_Coord container_x, container_y, container_w, container_h;
61 E_Container_Shape *shape;
62 int shape_rects_num;
63 Ecore_X_Rectangle *shape_rects;
64 61
65 struct { 62 struct {
66 void *data; 63 void *data;
@@ -74,8 +71,6 @@ struct _E_Menu
74 Eina_Bool pending_new_submenu : 1; 71 Eina_Bool pending_new_submenu : 1;
75 Eina_Bool have_submenu : 1; 72 Eina_Bool have_submenu : 1;
76 Eina_Bool in_active_list : 1; 73 Eina_Bool in_active_list : 1;
77 Eina_Bool shaped : 1;
78 Eina_Bool need_shape_export : 1;
79}; 74};
80 75
81struct _E_Menu_Item 76struct _E_Menu_Item
@@ -99,8 +94,6 @@ struct _E_Menu_Item
99 Evas_Object *label_object; 94 Evas_Object *label_object;
100 Evas_Object *submenu_object; 95 Evas_Object *submenu_object;
101 96
102 Evas_Object *event_object;
103
104 Eina_List *list_position; 97 Eina_List *list_position;
105 98
106 int label_w, label_h; 99 int label_w, label_h;
@@ -212,7 +205,5 @@ EAPI void e_menu_idler_before(void);
212 205
213EAPI Ecore_X_Window e_menu_grab_window_get(void); 206EAPI Ecore_X_Window e_menu_grab_window_get(void);
214 207
215EAPI E_Menu *e_menu_find_by_window(Ecore_X_Window win);
216
217#endif 208#endif
218#endif 209#endif