summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--data/themes/edc/menu.edc18
-rw-r--r--src/bin/e_comp.c55
-rw-r--r--src/bin/e_comp.h1
-rw-r--r--src/bin/e_fm.c1
-rw-r--r--src/bin/e_menu.c303
-rw-r--r--src/bin/e_menu.h15
8 files changed, 269 insertions, 129 deletions
diff --git a/ChangeLog b/ChangeLog
index cd66fb222..aa49380e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,3 @@
12013-02-25 Mike Blumenkrantz
2
3 * menus are now drawn directly on the compositor canvas
4
52013-02-18 Mike Blumenkrantz 12013-02-18 Mike Blumenkrantz
6 2
7 * fixed disable of input methods in input method config dialog 3 * fixed disable of input methods in input method config dialog
diff --git a/NEWS b/NEWS
index 2b5035775..b3e3af227 100644
--- a/NEWS
+++ b/NEWS
@@ -111,7 +111,6 @@ 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
115 114
116Fixes: 115Fixes:
117 * IBar menu didn't allow to configure different icon sources, show contents menu even on empty IBar. 116 * 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 d926f0524..dd8097fc6 100644
--- a/data/themes/edc/menu.edc
+++ b/data/themes/edc/menu.edc
@@ -193,11 +193,6 @@ 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 }
201 } 196 }
202 programs { 197 programs {
203 program { 198 program {
@@ -221,7 +216,7 @@ group { name: "e/widgets/menu/default/item_bg";
221 216
222group { name: "e/widgets/menu/default/icon"; 217group { name: "e/widgets/menu/default/icon";
223 parts { 218 parts {
224 part { name: "clip"; type: RECT; mouse_events: 0; 219 part { name: "clip"; type: RECT;
225 description { state: "default" 0.0; 220 description { state: "default" 0.0;
226 color: 255 255 255 255; 221 color: 255 255 255 255;
227 } 222 }
@@ -254,11 +249,6 @@ group { name: "e/widgets/menu/default/icon";
254 249
255group { name: "e/widgets/menu/default/label"; 250group { name: "e/widgets/menu/default/label";
256 parts { 251 parts {
257 part { name: "base"; type: RECT;
258 description { state: "default";
259 color: 0 0 0 0;
260 }
261 }
262 part { name: "e.text.label"; type: TEXT; mouse_events: 0; 252 part { name: "e.text.label"; type: TEXT; mouse_events: 0;
263 effect: SHADOW BOTTOM; 253 effect: SHADOW BOTTOM;
264 scale: 1; 254 scale: 1;
@@ -374,7 +364,7 @@ group { name: "e/widgets/menu/default/submenu";
374 images.image: "sym_right_glow_normal.png" COMP; 364 images.image: "sym_right_glow_normal.png" COMP;
375 images.image: "vertical_separated_bar_glow.png" COMP; 365 images.image: "vertical_separated_bar_glow.png" COMP;
376 parts { 366 parts {
377 part { name: "base"; 367 part { name: "base"; mouse_events: 0;
378 description { state: "default" 0.0; 368 description { state: "default" 0.0;
379 image.normal: "sym_right_light_normal.png"; 369 image.normal: "sym_right_light_normal.png";
380 rel2.offset: -2 -1; 370 rel2.offset: -2 -1;
@@ -423,7 +413,7 @@ group { name: "e/widgets/menu/default/check";
423 images.image: "bevel_in.png" COMP; 413 images.image: "bevel_in.png" COMP;
424 images.image: "sym_check_alum.png" COMP; 414 images.image: "sym_check_alum.png" COMP;
425 parts { 415 parts {
426 part { name: "base"; type: RECT; 416 part { name: "base"; type: RECT; mouse_events: 0;
427 description { state: "default" 0.0; 417 description { state: "default" 0.0;
428 rel1.offset: 1 1; 418 rel1.offset: 1 1;
429 rel1.to: "inset"; 419 rel1.to: "inset";
@@ -488,7 +478,7 @@ group { name: "e/widgets/menu/default/radio";
488 images.image: "inset_shadow_circle_tiny.png" COMP; 478 images.image: "inset_shadow_circle_tiny.png" COMP;
489 images.image: "sym_radio_alum.png" COMP; 479 images.image: "sym_radio_alum.png" COMP;
490 parts { 480 parts {
491 part { name: "base"; 481 part { name: "base"; mouse_events: 0;
492 description { state: "default" 0.0; 482 description { state: "default" 0.0;
493 image.normal: "inset_shadow_circle_tiny.png"; 483 image.normal: "inset_shadow_circle_tiny.png";
494 min: 13 13; 484 min: 13 13;
diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c
index ba8974338..b2f172f0f 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_resize(cw->shobj, w, h);
471 evas_object_move(cw->shobj, x, y); 470 evas_object_move(cw->shobj, x, y);
471 evas_object_resize(cw->shobj, w, h);
472 } 472 }
473 else 473 else
474 { 474 {
@@ -1376,7 +1376,6 @@ _e_comp_render_queue(E_Comp *c)
1376static void 1376static void
1377_e_comp_win_render_queue(E_Comp_Win *cw) 1377_e_comp_win_render_queue(E_Comp_Win *cw)
1378{ 1378{
1379 if (cw->real_obj) return;
1380 DBG("JOB3..."); 1379 DBG("JOB3...");
1381 _e_comp_render_queue(cw->c); 1380 _e_comp_render_queue(cw->c);
1382} 1381}
@@ -1433,10 +1432,6 @@ static Eina_Bool
1433_e_comp_win_do_shadow(E_Comp_Win *cw) 1432_e_comp_win_do_shadow(E_Comp_Win *cw)
1434{ 1433{
1435 if (cw->shaped) return 0; 1434 if (cw->shaped) return 0;
1436 if (cw->real_obj)
1437 {
1438 return ((!!cw->pop) || (!!cw->menu));
1439 }
1440 if (cw->argb) 1435 if (cw->argb)
1441 { 1436 {
1442 if (_e_comp_win_is_borderless(cw)) return 0; 1437 if (_e_comp_win_is_borderless(cw)) return 0;
@@ -1497,7 +1492,6 @@ _e_comp_object_del(void *data, void *obj)
1497 } 1492 }
1498 else if (obj == cw->menu) 1493 else if (obj == cw->menu)
1499 { 1494 {
1500 cw->menu->cw = NULL;
1501 cw->menu = NULL; 1495 cw->menu = NULL;
1502 evas_object_data_del(cw->shobj, "menu"); 1496 evas_object_data_del(cw->shobj, "menu");
1503 } 1497 }
@@ -1940,17 +1934,12 @@ _e_comp_win_dummy_add(E_Comp *c, Evas_Object *obj, E_Object *eobj, Eina_Bool nol
1940 cw->pop->cw = cw; 1934 cw->pop->cw = cw;
1941 cw->shape = cw->pop->shape; 1935 cw->shape = cw->pop->shape;
1942 cw->dfn = e_object_delfn_add(E_OBJECT(cw->pop), _e_comp_object_del, cw); 1936 cw->dfn = e_object_delfn_add(E_OBJECT(cw->pop), _e_comp_object_del, cw);
1937 cw->show_ready = 1;
1943 break; 1938 break;
1944 case E_MENU_TYPE: 1939 //case E_MENU_TYPE:
1945 cw->menu = (void*)eobj; 1940 //cw->menu = eobj;
1946 cw->menu->cw = cw; 1941 //cw->menu->cw = cw;
1947 cw->shape = cw->menu->shape; 1942 //break;
1948 cw->dfn = e_object_delfn_add(E_OBJECT(cw->menu), _e_comp_object_del, cw);
1949 if (cw->menu->cur.visible)
1950 cw->show_ready = 1;
1951 else
1952 cw->real_hid = 1;
1953 break;
1954 default: 1943 default:
1955 CRI("UNHANDLED"); 1944 CRI("UNHANDLED");
1956 } 1945 }
@@ -2024,7 +2013,12 @@ _e_comp_win_add(E_Comp *c, Ecore_X_Window win)
2024 // _e_comp_win_sync_setup(cw, cw->bd->client.win); 2013 // _e_comp_win_sync_setup(cw, cw->bd->client.win);
2025 } 2014 }
2026 /* popups handled in _dummy_add */ 2015 /* popups handled in _dummy_add */
2027 /* menus handled in _dummy_add */ 2016 else if ((cw->menu = e_menu_find_by_window(cw->win)))
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 }
2028 // fixme: could use bd/pop/menu for this too 2022 // fixme: could use bd/pop/menu for this too
2029 memset((&att), 0, sizeof(Ecore_X_Window_Attributes)); 2023 memset((&att), 0, sizeof(Ecore_X_Window_Attributes));
2030 if (!ecore_x_window_attributes_get(cw->win, &att)) 2024 if (!ecore_x_window_attributes_get(cw->win, &att))
@@ -2224,7 +2218,6 @@ _e_comp_win_del(E_Comp_Win *cw)
2224 else if (cw->menu) 2218 else if (cw->menu)
2225 { 2219 {
2226 e_object_delfn_del(E_OBJECT(cw->menu), cw->dfn); 2220 e_object_delfn_del(E_OBJECT(cw->menu), cw->dfn);
2227 cw->menu->cw = NULL;
2228 cw->menu = NULL; 2221 cw->menu = NULL;
2229 } 2222 }
2230 cw->dfn = NULL; 2223 cw->dfn = NULL;
@@ -2403,12 +2396,12 @@ _e_comp_win_show(E_Comp_Win *cw)
2403 cw->c->animating++; 2396 cw->c->animating++;
2404 } 2397 }
2405 cw->animating = 1; 2398 cw->animating = 1;
2406 _e_comp_win_render_queue(cw); 2399 if (!cw->real_obj) _e_comp_win_render_queue(cw);
2407 2400
2408 cw->pending_count++; 2401 cw->pending_count++;
2409 _e_comp_event_source_visibility(cw); 2402 _e_comp_event_source_visibility(cw);
2410 } 2403 }
2411 _e_comp_win_render_queue(cw); 2404 if (!cw->real_obj) _e_comp_win_render_queue(cw);
2412 if (!cw->shape) return; 2405 if (!cw->shape) return;
2413 cw->shape->visible = 0; 2406 cw->shape->visible = 0;
2414 e_container_shape_show(cw->shape); 2407 e_container_shape_show(cw->shape);
@@ -2670,7 +2663,7 @@ _e_comp_win_configure(E_Comp_Win *cw, int x, int y, int w, int h, int border)
2670 _e_comp_win_damage(cw, 0, 0, cw->w, cw->h, 0); 2663 _e_comp_win_damage(cw, 0, 0, cw->w, cw->h, 0);
2671 } 2664 }
2672 if ((cw->input_only) || (cw->invalid)) return; 2665 if ((cw->input_only) || (cw->invalid)) return;
2673 _e_comp_win_render_queue(cw); 2666 if (!cw->real_obj) _e_comp_win_render_queue(cw);
2674 } 2667 }
2675 /* need to block move/resize of the edje for real objects so the external object doesn't 2668 /* need to block move/resize of the edje for real objects so the external object doesn't
2676 * accidentally get shown and block our show callback 2669 * accidentally get shown and block our show callback
@@ -3582,8 +3575,10 @@ _e_comp_shapes_update_comp_win_shape_comp_helper(E_Comp_Win *cw, Eina_Tiler *tb)
3582 x = cw->bd->x, y = cw->bd->y, w = cw->bd->w, h = cw->bd->h; 3575 x = cw->bd->x, y = cw->bd->y, w = cw->bd->w, h = cw->bd->h;
3583 else if (cw->pop) 3576 else if (cw->pop)
3584 x = cw->pop->x + cw->pop->zone->x, y = cw->pop->y + cw->pop->zone->y, w = cw->pop->w, h = cw->pop->h; 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;
3585 //else if (cw->menu) 3578 /*
3586 //x = cw->menu->x + cw->menu->zone->x, y = cw->menu->y + cw->menu->zone->y, w = cw->menu->w, h = cw->menu->h; 3579 else if (cw->menu)
3580 x = cw->menu->cur.x, y = cw->menu->cur.y, w = cw->menu->cur.w, h = cw->menu->cur.h;
3581 */
3587 else 3582 else
3588 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;
3589#ifdef SHAPE_DEBUG 3584#ifdef SHAPE_DEBUG
@@ -4765,8 +4760,6 @@ e_comp_get(void *o)
4765 E_Border *bd; 4760 E_Border *bd;
4766 E_Popup *pop; 4761 E_Popup *pop;
4767 E_Shelf *es; 4762 E_Shelf *es;
4768 E_Menu *m;
4769 E_Menu_Item *mi;
4770 E_Object *obj = o; 4763 E_Object *obj = o;
4771 E_Zone *zone = NULL; 4764 E_Zone *zone = NULL;
4772 E_Container *con = NULL; 4765 E_Container *con = NULL;
@@ -4787,16 +4780,6 @@ e_comp_get(void *o)
4787 obj = (void*)pop->zone; 4780 obj = (void*)pop->zone;
4788 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); 4781 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
4789 break; 4782 break;
4790 case E_MENU_TYPE:
4791 m = (E_Menu*)obj;
4792 obj = (void*)m->zone;
4793 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
4794 break;
4795 case E_MENU_ITEM_TYPE:
4796 mi = (E_Menu_Item*)obj;
4797 obj = (void*)mi->menu->zone;
4798 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
4799 break;
4800 case E_SHELF_TYPE: 4783 case E_SHELF_TYPE:
4801 es = (E_Shelf*)obj; 4784 es = (E_Shelf*)obj;
4802 obj = (void*)es->zone; 4785 obj = (void*)es->zone;
diff --git a/src/bin/e_comp.h b/src/bin/e_comp.h
index 5285b11b0..c246f2786 100644
--- a/src/bin/e_comp.h
+++ b/src/bin/e_comp.h
@@ -12,7 +12,6 @@ typedef enum
12 E_COMP_CANVAS_LAYER_DESKTOP_TOP = 10, // raised desktop objects: gadgets, shelves 12 E_COMP_CANVAS_LAYER_DESKTOP_TOP = 10, // raised desktop objects: gadgets, shelves
13 E_COMP_CANVAS_LAYER_LAYOUT = 100, // should be nothing else on this layer 13 E_COMP_CANVAS_LAYER_LAYOUT = 100, // should be nothing else on this layer
14 E_COMP_CANVAS_LAYER_POPUP = 999, // popups 14 E_COMP_CANVAS_LAYER_POPUP = 999, // popups
15 E_COMP_CANVAS_LAYER_MENU = 5000, // menus
16 E_COMP_CANVAS_LAYER_DESKLOCK = 9999, // desklock 15 E_COMP_CANVAS_LAYER_DESKLOCK = 9999, // desklock
17 E_COMP_CANVAS_LAYER_MAX = 32767 // EVAS_LAYER_MAX 16 E_COMP_CANVAS_LAYER_MAX = 32767 // EVAS_LAYER_MAX
18} E_Comp_Canvas_Layer; 17} E_Comp_Canvas_Layer;
diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c
index b016535c5..c8d2bb1e3 100644
--- a/src/bin/e_fm.c
+++ b/src/bin/e_fm.c
@@ -7404,7 +7404,6 @@ _e_fm2_cb_icon_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSE
7404 ev = event_info; 7404 ev = event_info;
7405 7405
7406 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; 7406 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
7407 if (e_menu_grab_window_get()) return;
7408 evas_object_smart_callback_call(ic->sd->obj, "icon_mouse_in", &ic->info); 7407 evas_object_smart_callback_call(ic->sd->obj, "icon_mouse_in", &ic->info);
7409} 7408}
7410 7409
diff --git a/src/bin/e_menu.c b/src/bin/e_menu.c
index df932d672..167521afe 100644
--- a/src/bin/e_menu.c
+++ b/src/bin/e_menu.c
@@ -70,6 +70,7 @@ 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);
73static void _e_menu_cb_item_in(void *data, Evas *evas, Evas_Object *obj, void *event_info); 74static void _e_menu_cb_item_in(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); 75static void _e_menu_cb_item_out(void *data, Evas *evas, Evas_Object *obj, void *event_info);
75static Eina_Bool _e_menu_cb_key_down(void *data, int type, void *event); 76static Eina_Bool _e_menu_cb_key_down(void *data, int type, void *event);
@@ -79,12 +80,14 @@ static Eina_Bool _e_menu_cb_mouse_up(void *data, int type, void *event);
79static Eina_Bool _e_menu_cb_mouse_move(void *data, int type, void *event); 80static Eina_Bool _e_menu_cb_mouse_move(void *data, int type, void *event);
80static Eina_Bool _e_menu_cb_mouse_wheel(void *data, int type, void *event); 81static Eina_Bool _e_menu_cb_mouse_wheel(void *data, int type, void *event);
81static Eina_Bool _e_menu_cb_scroll_animator(void *data); 82static Eina_Bool _e_menu_cb_scroll_animator(void *data);
83static Eina_Bool _e_menu_cb_window_shape(void *data, int ev_type, void *ev);
82static void _e_menu_cb_item_submenu_post_default(void *data, E_Menu *m, E_Menu_Item *mi); 84static void _e_menu_cb_item_submenu_post_default(void *data, E_Menu *m, E_Menu_Item *mi);
83static Eina_Bool _e_menu_categories_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata); 85static Eina_Bool _e_menu_categories_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata);
84 86
85/* local subsystem globals */ 87/* local subsystem globals */
86static Ecore_X_Window _e_menu_win = 0; 88static Ecore_X_Window _e_menu_win = 0;
87static Eina_List *_e_active_menus = NULL; 89static Eina_List *_e_active_menus = NULL;
90static Eina_Hash *_e_menu_hash = NULL;
88static E_Menu_Item *_e_active_menu_item = NULL; 91static E_Menu_Item *_e_active_menu_item = NULL;
89static E_Menu_Item *_e_prev_active_menu_item = NULL; 92static E_Menu_Item *_e_prev_active_menu_item = NULL;
90/*static Eina_Hash *_e_menu_category_items = NULL;*/ 93/*static Eina_Hash *_e_menu_category_items = NULL;*/
@@ -106,6 +109,7 @@ static Ecore_Event_Handler *_e_menu_mouse_down_handler = NULL;
106static Ecore_Event_Handler *_e_menu_mouse_up_handler = NULL; 109static Ecore_Event_Handler *_e_menu_mouse_up_handler = NULL;
107static Ecore_Event_Handler *_e_menu_mouse_move_handler = NULL; 110static Ecore_Event_Handler *_e_menu_mouse_move_handler = NULL;
108static Ecore_Event_Handler *_e_menu_mouse_wheel_handler = NULL; 111static Ecore_Event_Handler *_e_menu_mouse_wheel_handler = NULL;
112static Ecore_Event_Handler *_e_menu_window_shape_handler = NULL;
109static Eina_Bool _e_menu_lock = EINA_FALSE; 113static Eina_Bool _e_menu_lock = EINA_FALSE;
110 114
111static Eina_List * 115static Eina_List *
@@ -174,8 +178,12 @@ e_menu_init(void)
174 _e_menu_mouse_wheel_handler = 178 _e_menu_mouse_wheel_handler =
175 ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, 179 ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
176 _e_menu_cb_mouse_wheel, NULL); 180 _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);
177 _e_menu_categories = eina_hash_string_superfast_new(NULL); 184 _e_menu_categories = eina_hash_string_superfast_new(NULL);
178 185
186 if (!_e_menu_hash) _e_menu_hash = eina_hash_string_superfast_new(NULL);
179 e_int_menus_init(); 187 e_int_menus_init();
180 return 1; 188 return 1;
181} 189}
@@ -191,6 +199,7 @@ e_menu_shutdown(void)
191 E_FN_DEL(ecore_event_handler_del, _e_menu_mouse_up_handler); 199 E_FN_DEL(ecore_event_handler_del, _e_menu_mouse_up_handler);
192 E_FN_DEL(ecore_event_handler_del, _e_menu_mouse_move_handler); 200 E_FN_DEL(ecore_event_handler_del, _e_menu_mouse_move_handler);
193 E_FN_DEL(ecore_event_handler_del, _e_menu_mouse_wheel_handler); 201 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);
194 203
195 if (!x_fatal) 204 if (!x_fatal)
196 { 205 {
@@ -210,6 +219,11 @@ e_menu_shutdown(void)
210 _e_menu_categories = NULL; 219 _e_menu_categories = NULL;
211 } 220 }
212 221
222 if (_e_menu_hash)
223 {
224 eina_hash_free(_e_menu_hash);
225 _e_menu_hash = NULL;
226 }
213 _e_menu_lock = EINA_FALSE; 227 _e_menu_lock = EINA_FALSE;
214 e_int_menus_shutdown(); 228 e_int_menus_shutdown();
215 229
@@ -1121,7 +1135,8 @@ e_menu_idler_before(void)
1121 if ((!m->cur.visible) && (m->prev.visible)) 1135 if ((!m->cur.visible) && (m->prev.visible))
1122 { 1136 {
1123 m->prev.visible = m->cur.visible; 1137 m->prev.visible = m->cur.visible;
1124 if (m->cw) e_comp_win_hide(m->cw); 1138 ecore_evas_hide(m->ecore_evas);
1139 e_container_shape_hide(m->shape);
1125 } 1140 }
1126 } 1141 }
1127 /* phase 2. move & reisze all the menus that want to moves/resized */ 1142 /* phase 2. move & reisze all the menus that want to moves/resized */
@@ -1140,8 +1155,8 @@ e_menu_idler_before(void)
1140 m->prev.h = m->cur.h; 1155 m->prev.h = m->cur.h;
1141 w = m->cur.w; 1156 w = m->cur.w;
1142 h = m->cur.h; 1157 h = m->cur.h;
1143 if (m->cw) 1158 ecore_evas_resize(m->ecore_evas, w, h);
1144 e_comp_win_resize(m->cw, w, h); 1159 e_container_shape_resize(m->shape, w, h);
1145 } 1160 }
1146 if (((m->cur.x) != (m->prev.x)) || 1161 if (((m->cur.x) != (m->prev.x)) ||
1147 ((m->cur.y) != (m->prev.y))) 1162 ((m->cur.y) != (m->prev.y)))
@@ -1164,9 +1179,8 @@ e_menu_idler_before(void)
1164 } 1179 }
1165 m->prev.x = m->cur.x; 1180 m->prev.x = m->cur.x;
1166 m->prev.y = m->cur.y; 1181 m->prev.y = m->cur.y;
1167 if (m->cw) 1182 ecore_evas_move(m->ecore_evas, m->cur.x, m->cur.y);
1168 e_comp_win_move(m->cw, m->cur.x, m->cur.y); 1183 e_container_shape_move(m->shape, m->cur.x, m->cur.y);
1169
1170 } 1184 }
1171 } 1185 }
1172 } 1186 }
@@ -1178,13 +1192,9 @@ e_menu_idler_before(void)
1178 if ((m->cur.visible) && (!m->prev.visible)) 1192 if ((m->cur.visible) && (!m->prev.visible))
1179 { 1193 {
1180 m->prev.visible = m->cur.visible; 1194 m->prev.visible = m->cur.visible;
1181 if (!m->cw) 1195 ecore_evas_raise(m->ecore_evas);
1182 { 1196 ecore_evas_show(m->ecore_evas);
1183 evas_object_move(m->bg_object, m->cur.x, m->cur.y); 1197 if (!m->shaped) e_container_shape_show(m->shape);
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);
1188 } 1198 }
1189 } 1199 }
1190 /* phase 4. de-activate... */ 1200 /* phase 4. de-activate... */
@@ -1205,6 +1215,59 @@ e_menu_idler_before(void)
1205 e_object_unref(E_OBJECT(m)); 1215 e_object_unref(E_OBJECT(m));
1206 } 1216 }
1207 } 1217 }
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 }
1208 /* del refcount to all menus we worked with */ 1271 /* del refcount to all menus we worked with */
1209 _e_menu_list_free_unref(tmp); 1272 _e_menu_list_free_unref(tmp);
1210 1273
@@ -1212,7 +1275,8 @@ e_menu_idler_before(void)
1212 { 1275 {
1213 if (_e_menu_win) 1276 if (_e_menu_win)
1214 { 1277 {
1215 e_grabinput_release(0, _e_menu_win); 1278 ecore_x_window_free(_e_menu_win);
1279 e_grabinput_release(_e_menu_win, _e_menu_win);
1216 _e_menu_win = 0; 1280 _e_menu_win = 0;
1217 } 1281 }
1218 } 1282 }
@@ -1224,6 +1288,17 @@ e_menu_grab_window_get(void)
1224 return _e_menu_win; 1288 return _e_menu_win;
1225} 1289}
1226 1290
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
1227/* local subsystem functions */ 1302/* local subsystem functions */
1228static void 1303static void
1229_e_menu_free(E_Menu *m) 1304_e_menu_free(E_Menu *m)
@@ -1246,6 +1321,8 @@ _e_menu_free(E_Menu *m)
1246 if (m->parent_item && (m->parent_item->submenu == m)) 1321 if (m->parent_item && (m->parent_item->submenu == m))
1247 m->parent_item->submenu = NULL; 1322 m->parent_item->submenu = NULL;
1248 _e_menu_unrealize(m); 1323 _e_menu_unrealize(m);
1324 E_FREE(m->shape_rects);
1325 m->shape_rects_num = 0;
1249 EINA_LIST_FOREACH_SAFE(m->items, l, l_next, mi) 1326 EINA_LIST_FOREACH_SAFE(m->items, l, l_next, mi)
1250 e_object_del(E_OBJECT(mi)); 1327 e_object_del(E_OBJECT(mi));
1251 if (m->in_active_list) 1328 if (m->in_active_list)
@@ -1299,6 +1376,7 @@ _e_menu_cb_intercept_item_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Co
1299 mi = data; 1376 mi = data;
1300 mi->x = x; 1377 mi->x = x;
1301 mi->y = y; 1378 mi->y = y;
1379 evas_object_move(mi->event_object, x, y);
1302 evas_object_move(o, x, y); 1380 evas_object_move(o, x, y);
1303 if ((mi->submenu) && (mi->submenu->parent_item)) 1381 if ((mi->submenu) && (mi->submenu->parent_item))
1304 { 1382 {
@@ -1315,6 +1393,7 @@ _e_menu_cb_intercept_item_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_
1315 mi = data; 1393 mi = data;
1316 mi->w = w; 1394 mi->w = w;
1317 mi->h = h; 1395 mi->h = h;
1396 evas_object_resize(mi->event_object, w, h);
1318 evas_object_resize(o, w, h); 1397 evas_object_resize(o, w, h);
1319 if ((mi->submenu) && (mi->submenu->parent_item)) 1398 if ((mi->submenu) && (mi->submenu->parent_item))
1320 _e_menu_reposition(mi->submenu); 1399 _e_menu_reposition(mi->submenu);
@@ -1367,12 +1446,9 @@ _e_menu_item_realize(E_Menu_Item *mi)
1367 { 1446 {
1368 o = edje_object_add(mi->menu->evas); 1447 o = edje_object_add(mi->menu->evas);
1369 mi->bg_object = o; 1448 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);
1374 evas_object_intercept_move_callback_add(o, _e_menu_cb_intercept_item_move, mi); 1449 evas_object_intercept_move_callback_add(o, _e_menu_cb_intercept_item_move, mi);
1375 evas_object_intercept_resize_callback_add(o, _e_menu_cb_intercept_item_resize, mi); 1450 evas_object_intercept_resize_callback_add(o, _e_menu_cb_intercept_item_resize, mi);
1451
1376 if ((mi->submenu) || (mi->submenu_pre_cb.func)) 1452 if ((mi->submenu) || (mi->submenu_pre_cb.func))
1377 { 1453 {
1378 if (!e_theme_edje_object_set(mi->bg_object, "base/theme/menus", 1454 if (!e_theme_edje_object_set(mi->bg_object, "base/theme/menus",
@@ -1388,7 +1464,6 @@ no_submenu_item:
1388 evas_object_show(o); 1464 evas_object_show(o);
1389 1465
1390 o = e_box_add(mi->menu->evas); 1466 o = e_box_add(mi->menu->evas);
1391 evas_object_name_set(o, "mi->container_object");
1392 e_box_homogenous_set(o, 0); 1467 e_box_homogenous_set(o, 0);
1393 mi->container_object = o; 1468 mi->container_object = o;
1394 e_box_orientation_set(o, 1); 1469 e_box_orientation_set(o, 1);
@@ -1399,10 +1474,10 @@ no_submenu_item:
1399 if (mi->check) 1474 if (mi->check)
1400 { 1475 {
1401 o = edje_object_add(mi->menu->evas); 1476 o = edje_object_add(mi->menu->evas);
1402 evas_object_name_set(o, "mi->toggle_object");
1403 mi->toggle_object = o; 1477 mi->toggle_object = o;
1404 e_theme_edje_object_set(o, "base/theme/menus", 1478 e_theme_edje_object_set(o, "base/theme/menus",
1405 "e/widgets/menu/default/check"); 1479 "e/widgets/menu/default/check");
1480 evas_object_pass_events_set(o, 1);
1406 evas_object_show(o); 1481 evas_object_show(o);
1407 e_box_pack_end(mi->container_object, o); 1482 e_box_pack_end(mi->container_object, o);
1408 edje_object_size_min_calc(mi->toggle_object, &ww, &hh); 1483 edje_object_size_min_calc(mi->toggle_object, &ww, &hh);
@@ -1419,10 +1494,10 @@ no_submenu_item:
1419 else if (mi->radio) 1494 else if (mi->radio)
1420 { 1495 {
1421 o = edje_object_add(mi->menu->evas); 1496 o = edje_object_add(mi->menu->evas);
1422 evas_object_name_set(o, "mi->toggle_object");
1423 mi->toggle_object = o; 1497 mi->toggle_object = o;
1424 e_theme_edje_object_set(o, "base/theme/menus", 1498 e_theme_edje_object_set(o, "base/theme/menus",
1425 "e/widgets/menu/default/radio"); 1499 "e/widgets/menu/default/radio");
1500 evas_object_pass_events_set(o, 1);
1426 evas_object_show(o); 1501 evas_object_show(o);
1427 e_box_pack_end(mi->container_object, o); 1502 e_box_pack_end(mi->container_object, o);
1428 edje_object_size_min_calc(mi->toggle_object, &ww, &hh); 1503 edje_object_size_min_calc(mi->toggle_object, &ww, &hh);
@@ -1439,9 +1514,9 @@ no_submenu_item:
1439 else 1514 else
1440 { 1515 {
1441 o = evas_object_rectangle_add(mi->menu->evas); 1516 o = evas_object_rectangle_add(mi->menu->evas);
1442 evas_object_name_set(o, "mi->toggle_object");
1443 mi->toggle_object = o; 1517 mi->toggle_object = o;
1444 evas_object_color_set(o, 0, 0, 0, 0); 1518 evas_object_color_set(o, 0, 0, 0, 0);
1519 evas_object_pass_events_set(o, 1);
1445 e_box_pack_end(mi->container_object, o); 1520 e_box_pack_end(mi->container_object, o);
1446 } 1521 }
1447 if ((!e_config->menu_icons_hide) && ((mi->icon) || (mi->realize_cb.func))) 1522 if ((!e_config->menu_icons_hide) && ((mi->icon) || (mi->realize_cb.func)))
@@ -1452,7 +1527,6 @@ no_submenu_item:
1452 if (e_theme_edje_object_set(o, "base/theme/menus", 1527 if (e_theme_edje_object_set(o, "base/theme/menus",
1453 "e/widgets/menu/default/icon")) 1528 "e/widgets/menu/default/icon"))
1454 { 1529 {
1455 evas_object_name_set(o, "mi->icon_bg_object");
1456 mi->icon_bg_object = o; 1530 mi->icon_bg_object = o;
1457 evas_object_show(o); 1531 evas_object_show(o);
1458 } 1532 }
@@ -1461,7 +1535,6 @@ no_submenu_item:
1461 evas_object_del(o); 1535 evas_object_del(o);
1462 o = NULL; 1536 o = NULL;
1463 } 1537 }
1464 //if (o) evas_object_pass_events_set(o, 1);
1465 1538
1466 /* FIXME: Not sure why there are two different tries to get the icon size, surely only the last one si needed. */ 1539 /* FIXME: Not sure why there are two different tries to get the icon size, surely only the last one si needed. */
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. 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.
@@ -1484,7 +1557,6 @@ no_submenu_item:
1484 if (edje_object_file_set(o, mi->icon, mi->icon_key)) 1557 if (edje_object_file_set(o, mi->icon, mi->icon_key))
1485 { 1558 {
1486 mi->icon_object = o; 1559 mi->icon_object = o;
1487 evas_object_name_set(o, "mi->icon_object");
1488 edje_object_size_max_get(o, &iww, &ihh); 1560 edje_object_size_max_get(o, &iww, &ihh);
1489 icon_w = iww; 1561 icon_w = iww;
1490 icon_h = ihh; 1562 icon_h = ihh;
@@ -1498,7 +1570,6 @@ no_submenu_item:
1498 if (!mi->icon_object) 1570 if (!mi->icon_object)
1499 { 1571 {
1500 o = e_icon_add(mi->menu->evas); 1572 o = e_icon_add(mi->menu->evas);
1501 evas_object_name_set(o, "mi->icon_object");
1502 mi->icon_object = o; 1573 mi->icon_object = o;
1503 e_icon_scale_size_set(o, e_util_icon_size_normalize(24 * e_scale)); 1574 e_icon_scale_size_set(o, e_util_icon_size_normalize(24 * e_scale));
1504 e_icon_preload_set(mi->icon_object, 1); 1575 e_icon_preload_set(mi->icon_object, 1);
@@ -1514,6 +1585,7 @@ no_submenu_item:
1514 e_icon_size_get(o, &icon_w, &icon_h); 1585 e_icon_size_get(o, &icon_w, &icon_h);
1515 } 1586 }
1516 1587
1588 evas_object_pass_events_set(o, 1);
1517 evas_object_show(o); 1589 evas_object_show(o);
1518 1590
1519 if (mi->icon_bg_object) 1591 if (mi->icon_bg_object)
@@ -1537,7 +1609,6 @@ no_submenu_item:
1537 else 1609 else
1538 { 1610 {
1539 o = edje_object_add(mi->menu->evas); 1611 o = edje_object_add(mi->menu->evas);
1540 evas_object_name_set(o, "mi->icon_bg_object");
1541 e_icon_size_get(mi->icon_object, &icon_w, &icon_h); 1612 e_icon_size_get(mi->icon_object, &icon_w, &icon_h);
1542 mi->icon_w = icon_w; 1613 mi->icon_w = icon_w;
1543 mi->icon_h = icon_h; 1614 mi->icon_h = icon_h;
@@ -1554,21 +1625,21 @@ no_submenu_item:
1554 else 1625 else
1555 { 1626 {
1556 o = evas_object_rectangle_add(mi->menu->evas); 1627 o = evas_object_rectangle_add(mi->menu->evas);
1557 evas_object_name_set(o, "mi->icon_object");
1558 mi->icon_object = o; 1628 mi->icon_object = o;
1559 evas_object_color_set(o, 0, 0, 0, 0); 1629 evas_object_color_set(o, 0, 0, 0, 0);
1630 evas_object_pass_events_set(o, 1);
1560 e_box_pack_end(mi->container_object, o); 1631 e_box_pack_end(mi->container_object, o);
1561 } 1632 }
1562 1633
1563 if (mi->label) 1634 if (mi->label)
1564 { 1635 {
1565 o = edje_object_add(mi->menu->evas); 1636 o = edje_object_add(mi->menu->evas);
1566 evas_object_name_set(o, "mi->label_object");
1567 mi->label_object = o; 1637 mi->label_object = o;
1568 e_theme_edje_object_set(o, "base/theme/menus", 1638 e_theme_edje_object_set(o, "base/theme/menus",
1569 "e/widgets/menu/default/label"); 1639 "e/widgets/menu/default/label");
1570 /* default label */ 1640 /* default label */
1571 edje_object_part_text_set(o, "e.text.label", mi->label); 1641 edje_object_part_text_set(o, "e.text.label", mi->label);
1642 evas_object_pass_events_set(o, 1);
1572 evas_object_show(o); 1643 evas_object_show(o);
1573 e_box_pack_end(mi->container_object, o); 1644 e_box_pack_end(mi->container_object, o);
1574 edje_object_size_min_calc(mi->label_object, &ww, &hh); 1645 edje_object_size_min_calc(mi->label_object, &ww, &hh);
@@ -1585,18 +1656,18 @@ no_submenu_item:
1585 else 1656 else
1586 { 1657 {
1587 o = evas_object_rectangle_add(mi->menu->evas); 1658 o = evas_object_rectangle_add(mi->menu->evas);
1588 evas_object_name_set(o, "mi->label_object");
1589 mi->label_object = o; 1659 mi->label_object = o;
1590 evas_object_color_set(o, 0, 0, 0, 0); 1660 evas_object_color_set(o, 0, 0, 0, 0);
1661 evas_object_pass_events_set(o, 1);
1591 e_box_pack_end(mi->container_object, o); 1662 e_box_pack_end(mi->container_object, o);
1592 } 1663 }
1593 if ((mi->submenu) || (mi->submenu_pre_cb.func)) 1664 if ((mi->submenu) || (mi->submenu_pre_cb.func))
1594 { 1665 {
1595 o = edje_object_add(mi->menu->evas); 1666 o = edje_object_add(mi->menu->evas);
1596 evas_object_name_set(o, "mi->submenu_object");
1597 mi->submenu_object = o; 1667 mi->submenu_object = o;
1598 e_theme_edje_object_set(o, "base/theme/menus", 1668 e_theme_edje_object_set(o, "base/theme/menus",
1599 "e/widgets/menu/default/submenu"); 1669 "e/widgets/menu/default/submenu");
1670 evas_object_pass_events_set(o, 1);
1600 evas_object_show(o); 1671 evas_object_show(o);
1601 e_box_pack_end(mi->container_object, o); 1672 e_box_pack_end(mi->container_object, o);
1602 edje_object_size_min_calc(mi->submenu_object, &ww, &hh); 1673 edje_object_size_min_calc(mi->submenu_object, &ww, &hh);
@@ -1613,15 +1684,26 @@ no_submenu_item:
1613 else 1684 else
1614 { 1685 {
1615 o = evas_object_rectangle_add(mi->menu->evas); 1686 o = evas_object_rectangle_add(mi->menu->evas);
1616 evas_object_name_set(o, "mi->submenu_object");
1617 mi->submenu_object = o; 1687 mi->submenu_object = o;
1618 evas_object_color_set(o, 0, 0, 0, 0); 1688 evas_object_color_set(o, 0, 0, 0, 0);
1689 evas_object_pass_events_set(o, 1);
1619 e_box_pack_end(mi->container_object, o); 1690 e_box_pack_end(mi->container_object, o);
1620 } 1691 }
1621 1692
1622 edje_object_part_swallow(mi->bg_object, "e.swallow.content", 1693 edje_object_part_swallow(mi->bg_object, "e.swallow.content",
1623 mi->container_object); 1694 mi->container_object);
1624 1695
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
1625 e_box_pack_end(mi->menu->container_object, mi->bg_object); 1707 e_box_pack_end(mi->menu->container_object, mi->bg_object);
1626 e_box_thaw(mi->container_object); 1708 e_box_thaw(mi->container_object);
1627 } 1709 }
@@ -1636,29 +1718,72 @@ _e_menu_realize(E_Menu *m)
1636 Evas_Object *o; 1718 Evas_Object *o;
1637 Eina_List *l; 1719 Eina_List *l;
1638 E_Menu_Item *mi; 1720 E_Menu_Item *mi;
1721 int ok = 0;
1722 int w, h;
1639 1723
1640 if (m->realized || (!m->items)) return; 1724 if (m->realized || (!m->items)) return;
1641 m->realized = 1; 1725 m->realized = 1;
1642 1726 m->ecore_evas = e_canvas_new(m->zone->container->win,
1643 m->evas = e_comp_get(m)->evas; 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);
1644 m->shape = e_container_shape_add(m->zone->container); 1731 m->shape = e_container_shape_add(m->zone->container);
1732 e_container_shape_move(m->shape, m->cur.x, m->cur.y);
1733
1734 ecore_evas_callback_resize_set(m->ecore_evas, _e_menu_cb_ecore_evas_resize);
1735 m->evas = ecore_evas_get(m->ecore_evas);
1645 evas_event_freeze(m->evas); 1736 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");
1646 1744
1647 o = edje_object_add(m->evas); 1745 o = edje_object_add(m->evas);
1648 m->bg_object = o; 1746 m->bg_object = o;
1649 evas_object_name_set(o, "menu->bg_object"); 1747 evas_object_name_set(o, "menu/background");
1650 evas_object_data_set(o, "e_menu", m); 1748 evas_object_data_set(o, "e_menu", m);
1651 evas_object_data_set(o, "eobj", m); 1749 evas_object_move(o, 0, 0);
1652 e_theme_edje_object_set(o, "base/theme/menus", "e/widgets/menu/default/background"); 1750 ok = e_theme_edje_object_set(o, "base/theme/menus",
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 }
1653 if (m->header.title) 1762 if (m->header.title)
1654 { 1763 {
1655 edje_object_part_text_set(o, "e.text.title", m->header.title); 1764 edje_object_part_text_set(o, "e.text.title", m->header.title);
1656 edje_object_signal_emit(o, "e,action,show,title", "e"); 1765 edje_object_signal_emit(o, "e,action,show,title", "e");
1657 edje_object_message_signal_process(o); 1766 edje_object_message_signal_process(o);
1658 } 1767 }
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);
1659 1785
1660 o = e_box_add(m->evas); 1786 o = e_box_add(m->evas);
1661 evas_object_name_set(o, "menu->container_object");
1662 m->container_object = o; 1787 m->container_object = o;
1663 evas_object_intercept_move_callback_add(o, _e_menu_cb_intercept_container_move, m); 1788 evas_object_intercept_move_callback_add(o, _e_menu_cb_intercept_container_move, m);
1664 evas_object_intercept_resize_callback_add(o, _e_menu_cb_intercept_container_resize, m); 1789 evas_object_intercept_resize_callback_add(o, _e_menu_cb_intercept_container_resize, m);
@@ -1672,7 +1797,10 @@ _e_menu_realize(E_Menu *m)
1672 1797
1673 _e_menu_items_layout_update(m); 1798 _e_menu_items_layout_update(m);
1674 e_box_thaw(m->container_object); 1799 e_box_thaw(m->container_object);
1675 1800 w = m->cur.w;
1801 h = m->cur.h;
1802 e_container_shape_resize(m->shape, w, h);
1803 evas_object_resize(m->bg_object, w, h);
1676 evas_event_thaw(m->evas); 1804 evas_event_thaw(m->evas);
1677} 1805}
1678 1806
@@ -1907,6 +2035,8 @@ _e_menu_item_unrealize(E_Menu_Item *mi)
1907 mi->label_object = NULL; 2035 mi->label_object = NULL;
1908 if (mi->submenu_object) evas_object_del(mi->submenu_object); 2036 if (mi->submenu_object) evas_object_del(mi->submenu_object);
1909 mi->submenu_object = NULL; 2037 mi->submenu_object = NULL;
2038 if (mi->event_object) evas_object_del(mi->event_object);
2039 mi->event_object = NULL;
1910} 2040}
1911 2041
1912static void 2042static void
@@ -1917,7 +2047,9 @@ _e_menu_unrealize(E_Menu *m)
1917 2047
1918 if (!m->realized) return; 2048 if (!m->realized) return;
1919 evas_event_freeze(m->evas); 2049 evas_event_freeze(m->evas);
1920 E_FN_DEL(e_object_del, m->shape); 2050 e_container_shape_hide(m->shape);
2051 e_object_del(E_OBJECT(m->shape));
2052 m->shape = NULL;
1921 e_box_freeze(m->container_object); 2053 e_box_freeze(m->container_object);
1922 EINA_LIST_FOREACH(m->items, l, mi) 2054 EINA_LIST_FOREACH(m->items, l, mi)
1923 _e_menu_item_unrealize(mi); 2055 _e_menu_item_unrealize(mi);
@@ -1931,9 +2063,12 @@ _e_menu_unrealize(E_Menu *m)
1931 m->prev.visible = 0; 2063 m->prev.visible = 0;
1932 m->realized = 0; 2064 m->realized = 0;
1933 m->zone = NULL; 2065 m->zone = NULL;
1934 m->cw = NULL; 2066 e_canvas_del(m->ecore_evas);
1935 evas_event_thaw(m->evas); 2067 ecore_evas_free(m->ecore_evas);
2068 m->ecore_evas = NULL;
1936 m->evas = NULL; 2069 m->evas = NULL;
2070 eina_hash_del(_e_menu_hash, e_util_winid_str_get(m->evas_win), m);
2071 m->evas_win = 0;
1937} 2072}
1938 2073
1939static void 2074static void
@@ -1948,9 +2083,13 @@ _e_menu_activate_internal(E_Menu *m, E_Zone *zone)
1948 m->pending_new_submenu = 0; 2083 m->pending_new_submenu = 0;
1949 if (!_e_menu_win) 2084 if (!_e_menu_win)
1950 { 2085 {
1951 _e_menu_win = e_comp_get(zone)->ee_win; 2086 _e_menu_win = ecore_x_window_input_new(zone->container->win,
1952 if (!e_grabinput_get(0, 0, _e_menu_win)) 2087 zone->x, zone->y,
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))
1953 { 2091 {
2092 ecore_x_window_free(_e_menu_win);
1954 _e_menu_win = 0; 2093 _e_menu_win = 0;
1955 return; 2094 return;
1956 } 2095 }
@@ -2074,7 +2213,7 @@ _e_menu_reposition(E_Menu *m)
2074 if (!m->parent_item) return; 2213 if (!m->parent_item) return;
2075 m->cur.x = m->parent_item->menu->cur.x + m->parent_item->menu->cur.w; 2214 m->cur.x = m->parent_item->menu->cur.x + m->parent_item->menu->cur.w;
2076 2215
2077 parent_item_bottom = m->parent_item->y; 2216 parent_item_bottom = m->parent_item->menu->cur.y + m->parent_item->y;
2078 if (m->cur.h > m->zone->h) 2217 if (m->cur.h > m->zone->h)
2079 { 2218 {
2080 /* menu is larger than screen */ 2219 /* menu is larger than screen */
@@ -2088,12 +2227,12 @@ _e_menu_reposition(E_Menu *m)
2088 else 2227 else
2089 { 2228 {
2090 /* menu is smaller than screen */ 2229 /* menu is smaller than screen */
2091 if (((parent_item_bottom + m->cur.h) > m->zone->h) && 2230 if (((parent_item_bottom + m->cur.h - m->container_y) > m->zone->h) &&
2092 (parent_item_bottom > (m->zone->h / 2))) 2231 (parent_item_bottom > (m->zone->h / 2)))
2093 /* menu is partially out of screen and more is shown if menu goes up */ 2232 /* menu is partially out of screen and more is shown if menu goes up */
2094 m->cur.y = parent_item_bottom - m->cur.h + m->parent_item->h; 2233 m->cur.y = (parent_item_bottom - (m->container_h + 1)) + m->parent_item->h;
2095 else 2234 else
2096 m->cur.y = parent_item_bottom; 2235 m->cur.y = parent_item_bottom - m->container_y;
2097 } 2236 }
2098 2237
2099 /* FIXME: this will suck for big menus */ 2238 /* FIXME: this will suck for big menus */
@@ -2694,6 +2833,19 @@ _e_menu_auto_place(E_Menu *m, int x, int y, int w, int h)
2694} 2833}
2695 2834
2696static void 2835static 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
2697_e_menu_cb_item_in(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 2849_e_menu_cb_item_in(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2698{ 2850{
2699 E_Menu_Item *mi; 2851 E_Menu_Item *mi;
@@ -2801,11 +2953,7 @@ _e_menu_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event)
2801 Ecore_Event_Mouse_Button *ev; 2953 Ecore_Event_Mouse_Button *ev;
2802 2954
2803 ev = event; 2955 ev = event;
2804 if (ev->window != _e_menu_win) 2956 if (ev->window != _e_menu_win) return ECORE_CALLBACK_PASS_ON;
2805 {
2806 _e_menu_deactivate_all();
2807 return ECORE_CALLBACK_PASS_ON;
2808 }
2809 2957
2810 /* Only allow dragging from floating menus for now. 2958 /* Only allow dragging from floating menus for now.
2811 * The reason for this is that for non floating menus, 2959 * The reason for this is that for non floating menus,
@@ -2826,11 +2974,7 @@ _e_menu_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event)
2826 int ret = 0; 2974 int ret = 0;
2827 2975
2828 ev = event; 2976 ev = event;
2829 if (ev->window != _e_menu_win) 2977 if (ev->window != _e_menu_win) return ECORE_CALLBACK_PASS_ON;
2830 {
2831 _e_menu_deactivate_all();
2832 return ECORE_CALLBACK_PASS_ON;
2833 }
2834 2978
2835 t = ev->timestamp - _e_menu_activate_time; 2979 t = ev->timestamp - _e_menu_activate_time;
2836 if ((_e_menu_activate_time != 0) && 2980 if ((_e_menu_activate_time != 0) &&
@@ -2889,22 +3033,27 @@ _e_menu_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
2889 3033
2890 EINA_LIST_FOREACH(_e_active_menus, l, m) 3034 EINA_LIST_FOREACH(_e_active_menus, l, m)
2891 { 3035 {
2892 if ((!m->realized) || (!m->cur.visible)) continue; 3036 if ((m->realized) && (m->cur.visible))
2893 if (is_fast)
2894 m->fast_mouse = 1;
2895 else if (dt > 0.0)
2896 { 3037 {
2897 m->fast_mouse = 0; 3038 if (is_fast)
2898 if (m->pending_new_submenu) 3039 m->fast_mouse = 1;
3040 else if (dt > 0.0)
2899 { 3041 {
2900 E_Menu_Item *mi; 3042 m->fast_mouse = 0;
3043 if (m->pending_new_submenu)
3044 {
3045 E_Menu_Item *mi;
2901 3046
2902 mi = _e_menu_item_active_get(); 3047 mi = _e_menu_item_active_get();
2903 if (mi) 3048 if (mi)
2904 _e_menu_submenu_activate(mi); 3049 _e_menu_submenu_activate(mi);
3050 }
2905 } 3051 }
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);
2906 } 3056 }
2907 evas_event_feed_mouse_move(m->evas, ev->x, ev->y, ev->timestamp, NULL);
2908 } 3057 }
2909 3058
2910 _e_menu_list_free_unref(tmp); 3059 _e_menu_list_free_unref(tmp);
@@ -2990,6 +3139,22 @@ _e_menu_cb_scroll_animator(void *data __UNUSED__)
2990 return 1; 3139 return 1;
2991} 3140}
2992 3141
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
2993static void 3158static void
2994_e_menu_cb_item_submenu_post_default(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_Item *mi) 3159_e_menu_cb_item_submenu_post_default(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_Item *mi)
2995{ 3160{
diff --git a/src/bin/e_menu.h b/src/bin/e_menu.h
index f57fdcf11..f0ef7383c 100644
--- a/src/bin/e_menu.h
+++ b/src/bin/e_menu.h
@@ -52,12 +52,15 @@ 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 E_Comp_Win *cw; 55 Ecore_Evas *ecore_evas;
56 E_Container_Shape *shape; 56 Evas *evas;
57 Evas *evas; 57 Ecore_X_Window evas_win;
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;
61 64
62 struct { 65 struct {
63 void *data; 66 void *data;
@@ -71,6 +74,8 @@ struct _E_Menu
71 Eina_Bool pending_new_submenu : 1; 74 Eina_Bool pending_new_submenu : 1;
72 Eina_Bool have_submenu : 1; 75 Eina_Bool have_submenu : 1;
73 Eina_Bool in_active_list : 1; 76 Eina_Bool in_active_list : 1;
77 Eina_Bool shaped : 1;
78 Eina_Bool need_shape_export : 1;
74}; 79};
75 80
76struct _E_Menu_Item 81struct _E_Menu_Item
@@ -94,6 +99,8 @@ struct _E_Menu_Item
94 Evas_Object *label_object; 99 Evas_Object *label_object;
95 Evas_Object *submenu_object; 100 Evas_Object *submenu_object;
96 101
102 Evas_Object *event_object;
103
97 Eina_List *list_position; 104 Eina_List *list_position;
98 105
99 int label_w, label_h; 106 int label_w, label_h;
@@ -205,5 +212,7 @@ EAPI void e_menu_idler_before(void);
205 212
206EAPI Ecore_X_Window e_menu_grab_window_get(void); 213EAPI Ecore_X_Window e_menu_grab_window_get(void);
207 214
215EAPI E_Menu *e_menu_find_by_window(Ecore_X_Window win);
216
208#endif 217#endif
209#endif 218#endif