diff --git a/ChangeLog b/ChangeLog index feee3f9e7..fe83569a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ * e_shelf_desk_visible_get now takes const params * e_util_size_debug_set now also prints for object show/hide events * e_gadcon_unpopulate now correctly freezes the container while deleting gadgets + * e_popup is now a wrapper for drawing objects onto the compositor canvas 2013-02-13 Deon Thomas diff --git a/NEWS b/NEWS index 65c60c6b4..e8a339ccb 100644 --- a/NEWS +++ b/NEWS @@ -108,6 +108,7 @@ Improvements: * Menu->Applications now only list valid .desktop files * desklock now uses compositor canvas * e_gadcon_unpopulate now correctly freezes the container while deleting gadgets + * e_popup is now a wrapper for drawing objects onto the compositor canvas Fixes: * IBar menu didn't allow to configure different icon sources, show contents menu even on empty IBar. diff --git a/data/themes/edc/shelf.edc b/data/themes/edc/shelf.edc index 2a200c7ef..694257570 100644 --- a/data/themes/edc/shelf.edc +++ b/data/themes/edc/shelf.edc @@ -19,7 +19,7 @@ group { name: "e/shelf/default/base"; images.image: "holes_horiz.png" COMP; images.image: "shine.png" COMP; parts { - part { name: "bg"; mouse_events: 0; + part { name: "bg"; description { state: "default" 0.0; image.normal: "vgrad_med.png"; fill.smooth: 0; @@ -136,7 +136,7 @@ group { name: "e/shelf/default/inset"; color: 0 0 0 0; } } - part { name: "clip"; type: RECT; + part { name: "clip"; type: RECT; mouse_events: 0; description { state: "default" 0.0; rel1.offset: 3 1; rel2.offset: -4 -2; @@ -227,7 +227,7 @@ group { name: "e/shelf/invisible/base"; visible: 0; } } - part { name: "dots_start"; + part { name: "dots_start"; mouse_events: 1; description { state: "default" 0.0; rel1.offset: 0 0; rel2.offset: -1 -1; @@ -271,7 +271,7 @@ group { name: "e/shelf/default/plain"; color: 0 0 0 0; } } - part { name: "clip"; type: RECT; + part { name: "clip"; type: RECT; mouse_events: 0; description { state: "default" 0.0; color: 255 255 255 255; } diff --git a/src/bin/e_bg.c b/src/bin/e_bg.c index e8d27e029..d60a23c7a 100644 --- a/src/bin/e_bg.c +++ b/src/bin/e_bg.c @@ -243,7 +243,7 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition) edje_object_signal_callback_add(o, "e,state,done", "*", _e_bg_signal, zone); evas_object_move(o, zone->x, zone->y); evas_object_resize(o, zone->w, zone->h); - E_LAYER_SET(o, E_COMP_CANVAS_LAYER_BG); + evas_object_layer_set(o, E_COMP_CANVAS_LAYER_BG); evas_object_clip_set(o, zone->bg_clip_object); evas_object_show(o); } @@ -267,7 +267,7 @@ e_bg_zone_update(E_Zone *zone, E_Bg_Transition transition) { evas_object_move(o, zone->x, zone->y); evas_object_resize(o, zone->w, zone->h); - E_LAYER_SET(o, E_COMP_CANVAS_LAYER_BG); + evas_object_layer_set(o, E_COMP_CANVAS_LAYER_BG); } evas_object_clip_set(o, zone->bg_clip_object); evas_object_show(o); @@ -519,7 +519,7 @@ _e_bg_signal(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNU } evas_object_move(zone->bg_object, zone->x, zone->y); evas_object_resize(zone->bg_object, zone->w, zone->h); - E_LAYER_SET(zone->bg_object, E_COMP_CANVAS_LAYER_BG); + evas_object_layer_set(zone->bg_object, E_COMP_CANVAS_LAYER_BG); evas_object_clip_set(zone->bg_object, zone->bg_clip_object); evas_object_show(zone->bg_object); } diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c index f107a68e2..b3b49a1b0 100644 --- a/src/bin/e_comp.c +++ b/src/bin/e_comp.c @@ -30,6 +30,7 @@ static Eina_List *compositors = NULL; static Eina_Hash *windows = NULL; static Eina_Hash *borders = NULL; static Eina_Hash *damages = NULL; +static Eina_Hash *ignores = NULL; static E_Comp_Config *conf = NULL; static E_Config_DD *conf_edd = NULL; @@ -93,6 +94,8 @@ static void _e_comp_win_hide(E_Comp_Win *cw); static void _e_comp_win_configure(E_Comp_Win *cw, int x, int y, int w, int h, int border); static void _e_comp_shapes_update(void *data, E_Container_Shape *es, E_Container_Shape_Change ch); +static void _e_comp_injected_win_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED); + static void _e_comp_event_end(void *d EINA_UNUSED, E_Event_Comp *ev) { @@ -452,8 +455,26 @@ _e_comp_win_restack(E_Comp_Win *cw) static void _e_comp_win_geometry_update(E_Comp_Win *cw) { - e_layout_child_move(cw->shobj, cw->x, cw->y); - e_layout_child_resize(cw->shobj, cw->pw, cw->ph); + int x, y, w, h; + + if (cw->visible) + x = cw->x, y = cw->y; + else + x = cw->hidden.x, y = cw->hidden.y; + if (cw->real_obj) + w = cw->w, h = cw->h; + else + w = cw->pw, h = cw->ph; + if (cw->not_in_layout) + { + evas_object_move(cw->shobj, x, y); + evas_object_resize(cw->shobj, w, h); + } + else + { + e_layout_child_move(cw->shobj, x, y); + e_layout_child_resize(cw->shobj, w, h); + } } static void @@ -878,14 +899,16 @@ _e_comp_fps_update(E_Comp *c) { c->fps_bg = evas_object_rectangle_add(c->evas); evas_object_color_set(c->fps_bg, 0, 0, 0, 128); - E_LAYER_SET_ABOVE(c->fps_bg, E_COMP_CANVAS_LAYER_MAX); + evas_object_layer_set(c->fps_bg, E_COMP_CANVAS_LAYER_MAX); + evas_object_lower(c->fps_bg); evas_object_show(c->fps_bg); c->fps_fg = evas_object_text_add(c->evas); evas_object_text_font_set(c->fps_fg, "Sans", 10); evas_object_text_text_set(c->fps_fg, "???"); evas_object_color_set(c->fps_fg, 255, 255, 255, 255); - E_LAYER_SET_ABOVE(c->fps_fg, E_COMP_CANVAS_LAYER_MAX); + evas_object_layer_set(c->fps_fg, E_COMP_CANVAS_LAYER_MAX); + evas_object_stack_above(c->fps_fg, c->fps_bg); evas_object_show(c->fps_fg); } } @@ -917,8 +940,11 @@ _e_comp_win_release(E_Comp_Win *cw) ecore_x_image_free(cw->xim); cw->xim = NULL; } - evas_object_image_native_surface_set(cw->obj, NULL); - cw->native = 0; + if (!cw->real_obj) + { + evas_object_image_native_surface_set(cw->obj, NULL); + cw->native = 0; + } EINA_LIST_FOREACH(cw->obj_mirror, l, o) { if (cw->xim) @@ -1064,7 +1090,7 @@ _e_comp_cb_nocomp_end(E_Comp *c) { if (!cw->nocomp) { - if ((cw->input_only) || (cw->invalid)) continue; + if ((cw->input_only) || (cw->invalid) || cw->real_obj) continue; if (cw->nocomp_need_update) { @@ -1386,6 +1412,12 @@ _e_comp_win_damage_find(Ecore_X_Damage damage) return eina_hash_find(damages, e_util_winid_str_get(damage)); } +static Eina_Bool +_e_comp_ignore_find(Ecore_X_Window win) +{ + return !!eina_hash_find(ignores, e_util_winid_str_get(win)); +} + static Eina_Bool _e_comp_win_is_borderless(E_Comp_Win *cw) { @@ -1454,6 +1486,7 @@ _e_comp_object_del(void *data, void *obj) } else if (obj == cw->pop) { + cw->pop->cw = NULL; cw->pop = NULL; evas_object_data_del(cw->shobj, "popup"); } @@ -1467,6 +1500,7 @@ _e_comp_object_del(void *data, void *obj) e_object_delfn_del(obj, cw->dfn); cw->dfn = NULL; } + e_comp_win_del(cw); } static void @@ -1533,7 +1567,8 @@ _e_comp_win_shadow_setup(E_Comp_Win *cw) const char *title = NULL, *name = NULL, *clas = NULL, *role = NULL; Ecore_X_Window_Type primary_type = ECORE_X_WINDOW_TYPE_UNKNOWN; - evas_object_image_smooth_scale_set(cw->obj, conf->smooth_windows); + if (!cw->real_obj) + evas_object_image_smooth_scale_set(cw->obj, conf->smooth_windows); EINA_LIST_FOREACH(cw->obj_mirror, l, o) { evas_object_image_smooth_scale_set(o, conf->smooth_windows); @@ -1567,6 +1602,14 @@ _e_comp_win_shadow_setup(E_Comp_Win *cw) skip = (conf->match.disable_menus); fast = conf->fast_menus; } + else if (cw->real_obj) + { + list = conf->match.objects; + name = evas_object_name_get(cw->obj); + //skip = conf->match.disable_objects; + skip = 1; + fast = conf->fast_objects; + } else { list = conf->match.overrides; @@ -1836,9 +1879,89 @@ _e_comp_win_mirror_add(E_Comp_Win *cw) evas_object_image_size_set(o, w, h); evas_object_image_data_update_add(o, 0, 0, w, h); } + else if (cw->real_obj) + { + /* FIXME!!! */ + evas_object_image_alpha_set(o, 1); + evas_object_image_source_set(o, cw->obj); + } return o; } +static E_Comp_Win * +_e_comp_win_dummy_add(E_Comp *c, Evas_Object *obj, E_Object *eobj, Eina_Bool nolayout) +{ + E_Comp_Win *cw; + int x, y, w, h; + + cw = calloc(1, sizeof(E_Comp_Win)); + if (!cw) return NULL; + cw->not_in_layout = nolayout; + if (eobj) + { + switch (eobj->type) + { + case E_POPUP_TYPE: + cw->pop = (void*)eobj; + cw->pop->cw = cw; + cw->shape = cw->pop->shape; + cw->dfn = e_object_delfn_add(E_OBJECT(cw->pop), _e_comp_object_del, cw); + cw->show_ready = 1; + break; + //case E_MENU_TYPE: + //cw->menu = eobj; + //cw->menu->cw = cw; + //break; + default: + CRI("UNHANDLED"); + } + } + else + { + if (evas_object_visible_get(obj)) + cw->show_ready = 1; + else + cw->real_hid = 1; + } + + cw->obj = obj; + cw->c = c; + cw->real_obj = 1; + cw->argb = 1; + cw->opacity = 255.0; + if (cw->shape) cw->shape->comp_win = cw; + if (conf->grab) ecore_x_grab(); + + cw->shobj = edje_object_add(c->evas); + _e_comp_win_shadow_setup(cw); + + edje_object_signal_callback_add(cw->shobj, "e,action,show,done", "e", _e_comp_show_done, cw); + edje_object_signal_callback_add(cw->shobj, "e,action,hide,done", "e", _e_comp_hide_done, cw); + + evas_object_geometry_get(obj, &x, &y, &w, &h); + _e_comp_win_configure(cw, x, y, w, h, 0); + + if (!nolayout) _e_comp_win_layout_populate(cw); + + if (cw->bd) evas_object_data_set(cw->shobj, "border", cw->bd); + else if (cw->pop) + evas_object_data_set(cw->shobj, "popup", cw->pop); + else if (cw->menu) + evas_object_data_set(cw->shobj, "menu", cw->menu); + + cw->pending_count++; + _e_comp_event_source_add(cw); + evas_object_data_set(cw->shobj, "comp_win", cw); + evas_object_data_set(cw->obj, "comp_win", cw); + + c->wins_invalid = 1; + c->wins = eina_inlist_append(c->wins, EINA_INLIST_GET(cw)); + DBG(" [0x%x] add", cw->win); + if (conf->grab) ecore_x_ungrab(); + if (cw->show_ready) _e_comp_win_show(cw); + return cw; +} + static E_Comp_Win * _e_comp_win_add(E_Comp *c, Ecore_X_Window win) { @@ -1861,19 +1984,36 @@ _e_comp_win_add(E_Comp *c, Ecore_X_Window win) // setup on show // _e_comp_win_sync_setup(cw, cw->bd->client.win); } - else if ((cw->pop = e_popup_find_by_window(cw->win))) - { - cw->dfn = e_object_delfn_add(E_OBJECT(cw->pop), _e_comp_object_del, cw); - cw->show_ready = 1; - cw->shape = cw->pop->shape; - } + /* popups handled in _dummy_add */ else if ((cw->menu = e_menu_find_by_window(cw->win))) { cw->dfn = e_object_delfn_add(E_OBJECT(cw->menu), _e_comp_object_del, cw); cw->show_ready = 1; cw->shape = cw->menu->shape; } - else + // fixme: could use bd/pop/menu for this too + memset((&att), 0, sizeof(Ecore_X_Window_Attributes)); + if (!ecore_x_window_attributes_get(cw->win, &att)) + { + free(cw->name); + free(cw->clas); + free(cw->role); + free(cw); + if (conf->grab) ecore_x_ungrab(); + return NULL; + } + if ((!att.input_only) && + ((att.depth != 24) && (att.depth != 32))) + { + // printf("WARNING: window 0x%x not 24/32bpp -> %ibpp", cw->win, att.depth); + // cw->invalid = 1; + } + cw->input_only = att.input_only; + cw->override = att.override; + cw->vis = att.visual; + cw->cmap = att.colormap; + cw->depth = att.depth; + if ((!cw->bd) && (!cw->menu) && (!cw->input_only)) { char *netwm_title = NULL; @@ -1903,28 +2043,7 @@ _e_comp_win_add(E_Comp *c, Ecore_X_Window win) // FIXME: config - disable ready timeout for non-counter wins // cw->show_ready = 1; } - // fixme: could use bd/pop/menu for this too - memset((&att), 0, sizeof(Ecore_X_Window_Attributes)); - if (!ecore_x_window_attributes_get(cw->win, &att)) - { - free(cw->name); - free(cw->clas); - free(cw->role); - free(cw); - if (conf->grab) ecore_x_ungrab(); - return NULL; - } - if ((!att.input_only) && - ((att.depth != 24) && (att.depth != 32))) - { - // printf("WARNING: window 0x%x not 24/32bpp -> %ibpp", cw->win, att.depth); - // cw->invalid = 1; - } - cw->input_only = att.input_only; - cw->override = att.override; - cw->vis = att.visual; - cw->cmap = att.colormap; - cw->depth = att.depth; + cw->argb = ecore_x_window_argb_get(cw->win); eina_hash_add(windows, e_util_winid_str_get(cw->win), cw); cw->inhash = 1; @@ -1969,13 +2088,26 @@ _e_comp_win_add(E_Comp *c, Ecore_X_Window win) free(rects); } - if (cw->bd) evas_object_data_set(cw->shobj, "border", cw->bd); + if (cw->bd) + { + evas_object_data_set(cw->shobj, "border", cw->bd); + evas_object_name_set(cw->shobj, "cw->shobj::BORDER"); + } else if (cw->pop) - evas_object_data_set(cw->shobj, "popup", cw->pop); + { + evas_object_data_set(cw->shobj, "popup", cw->pop); + evas_object_name_set(cw->shobj, "cw->shobj::POPUP"); + } else if (cw->menu) - evas_object_data_set(cw->shobj, "menu", cw->menu); + { + evas_object_data_set(cw->shobj, "menu", cw->menu); + evas_object_name_set(cw->shobj, "cw->shobj::MENU"); + } + else + evas_object_name_set(cw->shobj, "cw->shobj::WINDOW"); evas_object_pass_events_set(cw->obj, 1); + evas_object_name_set(cw->obj, "cw->obj"); cw->pending_count++; _e_comp_event_source_add(cw); @@ -1983,7 +2115,7 @@ _e_comp_win_add(E_Comp *c, Ecore_X_Window win) else { cw->shobj = evas_object_rectangle_add(c->evas); - + e_util_size_debug_set(cw->shobj, 1); _e_comp_win_layout_populate(cw); evas_object_color_set(cw->shobj, 0, 0, 0, 0); @@ -2051,6 +2183,7 @@ _e_comp_win_del(E_Comp_Win *cw) } else if (cw->pop) { + cw->pop->cw = NULL; e_object_delfn_del(E_OBJECT(cw->pop), cw->dfn); cw->pop = NULL; } @@ -2078,6 +2211,8 @@ _e_comp_win_del(E_Comp_Win *cw) evas_object_del(o); } } + if (cw->real_obj && cw->obj) + evas_object_event_callback_del_full(cw->obj, EVAS_CALLBACK_DEL, _e_comp_injected_win_del_cb, cw); if (cw->obj) { evas_object_del(cw->obj); @@ -2114,7 +2249,7 @@ _e_comp_win_show(E_Comp_Win *cw) Eina_List *l; Evas_Object *o; - if (cw->visible) return; + if (cw->visible || cw->input_only || cw->invalid) return; cw->visible = 1; DBG(" [0x%x] sho ++ [redir=%i, pm=%x, dmg_up=%i]", cw->win, cw->redirected, cw->pixmap, cw->dmg_updates); @@ -2131,7 +2266,7 @@ _e_comp_win_show(E_Comp_Win *cw) // setup on show if (cw->bd) _e_comp_win_sync_setup(cw, cw->bd->client.win); - else + else if (cw->win) _e_comp_win_sync_setup(cw, cw->win); if (cw->real_hid) @@ -2173,15 +2308,13 @@ _e_comp_win_show(E_Comp_Win *cw) cw->pw = 0; cw->ph = 0; } - if (cw->pop) + if (!cw->win) cw->dmg_updates = 1; - else - cw->dmg_updates = 0; } else cw->dmg_updates = 1; - if ((!cw->redirected) || (!cw->pixmap)) + if (cw->win && ((!cw->redirected) || (!cw->pixmap))) { // we redirect all subwindows anyway // ecore_x_composite_redirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL); @@ -2231,12 +2364,12 @@ _e_comp_win_show(E_Comp_Win *cw) cw->c->animating++; } cw->animating = 1; - _e_comp_win_render_queue(cw); + if (!cw->real_obj) _e_comp_win_render_queue(cw); cw->pending_count++; _e_comp_event_source_visibility(cw); } - _e_comp_win_render_queue(cw); + if (!cw->real_obj) _e_comp_win_render_queue(cw); if (!cw->shape) return; cw->shape->visible = 0; e_container_shape_show(cw->shape); @@ -2294,7 +2427,7 @@ _e_comp_win_hide(E_Comp_Win *cw) ecore_timer_del(cw->update_timeout); cw->update_timeout = NULL; } - if (conf->keep_unmapped) + if (conf->keep_unmapped && cw->win) { if (conf->send_flush) { @@ -2353,6 +2486,7 @@ _e_comp_win_hide(E_Comp_Win *cw) cw->ph = 0; } _e_comp_win_render_queue(cw); + if (!cw->win) return; if (conf->send_flush) { if (cw->bd) ecore_x_e_comp_flush_send(cw->bd->client.win); @@ -2486,7 +2620,7 @@ _e_comp_win_configure(E_Comp_Win *cw, int x, int y, int w, int h, int border) // was cw->w / cw->h // evas_object_resize(cw->shobj, cw->pw, cw->ph); resized = EINA_TRUE; - _e_comp_win_damage(cw, 0, 0, cw->w, cw->h, 0); + if (!cw->real_obj) _e_comp_win_damage(cw, 0, 0, cw->w, cw->h, 0); } if (cw->border != border) { @@ -2497,9 +2631,12 @@ _e_comp_win_configure(E_Comp_Win *cw, int x, int y, int w, int h, int border) _e_comp_win_damage(cw, 0, 0, cw->w, cw->h, 0); } if ((cw->input_only) || (cw->invalid)) return; - _e_comp_win_render_queue(cw); + if (!cw->real_obj) _e_comp_win_render_queue(cw); } - if (moved || resized) _e_comp_win_geometry_update(cw); + /* need to block move/resize of the edje for real objects so the external object doesn't + * accidentally get shown and block our show callback + */ + if ((moved || resized) && ((!cw->real_obj) || cw->visible)) _e_comp_win_geometry_update(cw); // add pending manager comp event count to match below config send cw->pending_count++; _e_comp_event_source_configure(cw); @@ -2574,6 +2711,8 @@ _e_comp_create(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) if (_e_comp_win_find(ev->win)) return ECORE_CALLBACK_PASS_ON; if (c->win == ev->win) return ECORE_CALLBACK_PASS_ON; if (c->ee_win == ev->win) return ECORE_CALLBACK_PASS_ON; + if (c->man->root == ev->win) return ECORE_CALLBACK_PASS_ON; + if (_e_comp_ignore_find(ev->win)) return ECORE_CALLBACK_PASS_ON; cw = _e_comp_win_add(c, ev->win); if (!cw) return ECORE_CALLBACK_RENEW; _e_comp_win_configure(cw, ev->x, ev->y, ev->w, ev->h, ev->border); @@ -2593,7 +2732,7 @@ _e_comp_create(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) e_container_shape_move(cw->shape, ev->x, ev->y); e_container_shape_resize(cw->shape, ev->w, ev->h); } - cw->shape->comp_win = cw; + if (cw->shape) cw->shape->comp_win = cw; return ECORE_CALLBACK_PASS_ON; } @@ -2602,7 +2741,11 @@ _e_comp_destroy(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { Ecore_X_Event_Window_Destroy *ev = event; E_Comp_Win *cw = _e_comp_win_find(ev->win); - if (!cw) return ECORE_CALLBACK_PASS_ON; + if (!cw) + { + eina_hash_del_by_key(ignores, e_util_winid_str_get(ev->win)); + return ECORE_CALLBACK_PASS_ON; + } if (cw->animating) cw->delete_me = 1; else _e_comp_win_del(cw); return ECORE_CALLBACK_PASS_ON; @@ -3256,17 +3399,59 @@ _e_comp_bd_unfullscreen(void *data EINA_UNUSED, int type EINA_UNUSED, void *even return ECORE_CALLBACK_PASS_ON; } +static void +_e_comp_injected_win_focus_out_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + E_Comp_Win *cw = data; + edje_object_signal_emit(cw->shobj, "e,state,focus,off", "e"); +} + +static void +_e_comp_injected_win_focus_in_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + E_Comp_Win *cw = data; + edje_object_signal_emit(cw->shobj, "e,state,focus,on", "e"); +} + +static void +_e_comp_injected_win_hide_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + E_Comp_Win *cw = data; + + _e_comp_win_real_hide(cw); +} + +static void +_e_comp_injected_win_show_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + E_Comp_Win *cw = data; + + cw->defer_hide = 0; + cw->show_ready = 1; + _e_comp_win_geometry_update(cw); + _e_comp_win_show(cw); +} + +static void +_e_comp_injected_win_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + E_Comp_Win *cw = data; + + cw->obj = NULL; + if (cw->animating) cw->delete_me = 1; + else _e_comp_win_del(cw); +} +/* static void _e_comp_injected_win_moveresize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { - E_Comp *c = data; + E_Comp_Win *cw = data; int x, y, w, h; evas_object_geometry_get(obj, &x, &y, &w, &h); - e_layout_child_move(obj, x, y); - e_layout_child_resize(obj, w, h); + _e_comp_win_configure(cw, x, y, w, h, 0); } - +*/ #ifdef SHAPE_DEBUG static void _e_comp_shape_debug_rect(E_Comp *c, Ecore_X_Rectangle *rect, E_Color *color) @@ -3314,6 +3499,96 @@ _e_comp_shapes_update_object_checker_function_thingy(E_Comp *c, Evas_Object *o) return EINA_FALSE; } +static void +#ifdef SHAPE_DEBUG +_e_comp_shapes_update_comp_win_shape_comp_helper(E_Comp_Win *cw, Eina_Tiler *tb, Eina_List **rl) +#else +_e_comp_shapes_update_comp_win_shape_comp_helper(E_Comp_Win *cw, Eina_Tiler *tb) +#endif +{ + int x, y, w, h; + + /* ignore deleted shapes */ + if (!cw->shape) + { + SHAPE_INF("IGNORING DELETED: %u", cw->win); + return; + } + if (cw->invalid || cw->real_hid || (!cw->visible) || (!cw->shape->visible)) + { + SHAPE_DBG("SKIPPING SHAPE"); + return; + } +#ifdef SHAPE_DEBUG + if (cw->bd) + INF("COMP BD: %u", cw->win); + else if (cw->pop) + INF("COMP POP: %u", cw->win); + else if (cw->menu) + INF("COMP MENU: %u", cw->win); + else if (cw->real_obj) + INF("COMP OBJ: %s", evas_object_name_get(cw->obj)); + else + INF("COMP WIN: %u", cw->win); +#endif + + if (cw->rects) + { + int num; + Ecore_X_Rectangle *rect; + + for (num = 0, rect = cw->rects; num < cw->rects_num; num++, rect++) + { + x = rect->x, y = rect->y, w = rect->width, h = rect->height; + if (cw->bd) + x += cw->bd->x, y += cw->bd->y; + else + x += cw->x, y += cw->y; + //#ifdef SHAPE_DEBUG not sure we can shape check these? + //r = E_NEW(Eina_Rectangle, 1); + //EINA_RECTANGLE_SET(r, x, y, w, h); + //rl = eina_list_append(rl, r); + //#endif + eina_tiler_rect_del(tb, &(Eina_Rectangle){x, y, w, h}); + SHAPE_INF("DEL: %d,%d@%dx%d", x, y, w, h); + } + return; + } + /* borders and popups sometimes call shape changes before the changes have + * propagated to the comp_win :/ + */ + if (cw->bd) + x = cw->bd->x, y = cw->bd->y, w = cw->bd->w, h = cw->bd->h; + else if (cw->pop) + x = cw->pop->x + cw->pop->zone->x, y = cw->pop->y + cw->pop->zone->y, w = cw->pop->w, h = cw->pop->h; + /* + else if (cw->menu) + x = cw->menu->cur.x, y = cw->menu->cur.y, w = cw->menu->cur.w, h = cw->menu->cur.h; + */ + else + x = cw->x, y = cw->y, w = cw->w, h = cw->h; +#ifdef SHAPE_DEBUG + if (!cw->real_obj) + { + Eina_Rectangle *r; + + r = E_NEW(Eina_Rectangle, 1); + EINA_RECTANGLE_SET(r, x, y, w, h); + *rl = eina_list_append(*rl, r); + } +#endif + if (cw->real_obj) + { + eina_tiler_rect_add(tb, &(Eina_Rectangle){x, y, w, h}); + SHAPE_INF("ADD: %d,%d@%dx%d", x, y, w, h); + } + else + { + eina_tiler_rect_del(tb, &(Eina_Rectangle){x, y, w, h}); + SHAPE_INF("DEL: %d,%d@%dx%d", x, y, w, h); + } +} + static void _e_comp_shapes_update_job(E_Comp *c) { @@ -3351,78 +3626,35 @@ _e_comp_shapes_update_job(E_Comp *c) cw = evas_object_data_get(ch, "comp_win"); if (cw) - { - /* ignore deleted shapes */ - if (!cw->shape) - { - SHAPE_INF("IGNORING DELETED: %u", cw->win); - continue; - } - if (cw->invalid || cw->real_hid || (!cw->visible) || (!cw->shape->visible)) continue; + _e_comp_shapes_update_comp_win_shape_comp_helper(cw, tb #ifdef SHAPE_DEBUG - if (cw->bd) - INF("COMP BD: %u", cw->win); - else if (cw->pop) - INF("COMP POP: %u", cw->win); - else if (cw->menu) - INF("COMP MENU: %u", cw->win); + ,&rl #endif - - if (cw->rects) - { - int num; - Ecore_X_Rectangle *rect; - - for (num = 0, rect = cw->rects; num < cw->rects_num; num++, rect++) - { - x = rect->x, y = rect->y, w = rect->width, h = rect->height; - if (cw->bd) - x += cw->bd->x, y += cw->bd->y; - else - x += cw->x, y += cw->y; -//#ifdef SHAPE_DEBUG not sure we can shape check these? - //r = E_NEW(Eina_Rectangle, 1); - //EINA_RECTANGLE_SET(r, x, y, w, h); - //rl = eina_list_append(rl, r); -//#endif - eina_tiler_rect_del(tb, &(Eina_Rectangle){x, y, w, h}); - SHAPE_INF("DEL: %d,%d@%dx%d", x, y, w, h); - } - continue; - } - /* borders and popups sometimes call shape changes before the changes have - * propagated to the comp_win :/ - */ - if (cw->bd) - x = cw->bd->x, y = cw->bd->y, w = cw->bd->w, h = cw->bd->h; - else if (cw->pop) - x = cw->pop->x + cw->pop->zone->x, y = cw->pop->y + cw->pop->zone->y, w = cw->pop->w, h = cw->pop->h; -/* - else if (cw->menu) - x = cw->menu->cur.x, y = cw->menu->cur.y, w = cw->menu->cur.w, h = cw->menu->cur.h; -*/ - else - x = cw->x, y = cw->y, w = cw->w, h = cw->h; -#ifdef SHAPE_DEBUG - r = E_NEW(Eina_Rectangle, 1); - EINA_RECTANGLE_SET(r, x, y, w, h); - rl = eina_list_append(rl, r); -#endif - eina_tiler_rect_del(tb, &(Eina_Rectangle){x, y, w, h}); - SHAPE_INF("DEL: %d,%d@%dx%d", x, y, w, h); - } + ); else if (evas_object_visible_get(ch) && (!evas_object_pass_events_get(ch))) { - evas_object_geometry_get(o, &x, &y, &w, &h); + SHAPE_INF("COMP OBJ: %p", ch); + e_layout_child_geometry_get(ch, &x, &y, &w, &h); eina_tiler_rect_add(tb, &(Eina_Rectangle){x, y, w, h}); SHAPE_INF("ADD: %d,%d@%dx%d", x, y, w, h); } - } } else if (layout && evas_object_visible_get(o) && (!evas_object_pass_events_get(o))) { + E_Comp_Win *cw; + if (_e_comp_shapes_update_object_checker_function_thingy(c, o)) continue; + cw = evas_object_data_get(o, "comp_win"); + if (cw) + { + _e_comp_shapes_update_comp_win_shape_comp_helper(cw, tb +#ifdef SHAPE_DEBUG + ,&rl +#endif + ); + continue; + } SHAPE_INF("OBJ: %p:%s", o, evas_object_name_get(o)); evas_object_geometry_get(o, &x, &y, &w, &h); eina_tiler_rect_add(tb, &(Eina_Rectangle){x, y, w, h}); @@ -3447,7 +3679,7 @@ _e_comp_shapes_update_job(E_Comp *c) EINA_LIST_FOREACH(rl, l, r) { if (E_INTERSECTS(r->x, r->y, r->w, r->h, tr->x, tr->y, tr->w, tr->h)) - ERR("RECT FAIL!!!!"); + ERR("POSSIBLE RECT FAIL!!!!"); } #endif } @@ -3566,8 +3798,9 @@ _e_comp_populate(E_Comp *c) c->layout = e_layout_add(c->evas); evas_object_name_set(c->layout, "c->layout"); - E_LAYER_SET_ABOVE(c->layout, E_COMP_CANVAS_LAYER_LAYOUT); + evas_object_layer_set(c->layout, E_COMP_CANVAS_LAYER_LAYOUT); evas_object_show(c->layout); + e_drop_xdnd_register_set(c->win, 1); EINA_LIST_FOREACH(c->man->containers, l, con) { @@ -3614,13 +3847,17 @@ _e_comp_populate(E_Comp *c) } if (!cw->shape) cw->shape = e_container_shape_add(eina_list_data_get(c->man->containers)); } - cw->shape->comp_win = cw; - e_container_shape_move(cw->shape, x, y); - e_container_shape_resize(cw->shape, w, h); + if (cw->shape) + { + cw->shape->comp_win = cw; + e_container_shape_move(cw->shape, x, y); + e_container_shape_resize(cw->shape, w, h); + } if (ecore_x_window_visible_get(wins[i])) _e_comp_win_show(cw); } free(wins); + if (!c->shape_job) c->shape_job = ecore_job_add((Ecore_Cb)_e_comp_shapes_update_job, c); } static void @@ -3743,16 +3980,11 @@ _e_comp_add(E_Manager *man) ecore_job_add(_e_comp_add_fail_job, NULL); } - { - Ecore_X_Rectangle rect[1] = {{0}}; - - rect[0].width = man->w, rect[0].height = man->h; - ecore_x_window_shape_input_rectangles_set(c->win, rect, 1); - } ecore_evas_comp_sync_set(c->ee, 0); ecore_evas_name_class_set(c->ee, "E", "Comp_EE"); // ecore_evas_manual_render_set(c->ee, conf->lock_fps); c->evas = ecore_evas_get(c->ee); + ecore_evas_data_set(c->ee, "comp", c); ecore_evas_show(c->ee); c->ee_win = ecore_evas_window_get(c->ee); @@ -4166,6 +4398,8 @@ _e_comp_cfg_init(void) co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; E_CONFIGURE_OPTION_ADD(co, BOOL, fast_popups, conf, _("Use fast composite effects for popups"), _("composite"), _("popup"), _("theme"), _("animate")); co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; + E_CONFIGURE_OPTION_ADD(co, BOOL, fast_objects, conf, _("Use fast composite effects for objects"), _("composite"), _("theme"), _("animate")); + co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; E_CONFIGURE_OPTION_ADD(co, BOOL, fast_overrides, conf, _("Use fast composite effects for override-redirect windows (tooltips and such)"), _("composite"), _("theme"), _("animate")); co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; @@ -4175,6 +4409,8 @@ _e_comp_cfg_init(void) co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; E_CONFIGURE_OPTION_ADD(co, BOOL, match.disable_popups, conf, _("Disable composite effects for popups"), _("composite"), _("popup"), _("theme"), _("animate")); co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; + E_CONFIGURE_OPTION_ADD(co, BOOL, match.disable_objects, conf, _("Disable composite effects for objects"), _("composite"), _("theme"), _("animate")); + co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; E_CONFIGURE_OPTION_ADD(co, BOOL, match.disable_overrides, conf, _("Disable composite effects for override-redirect windows (tooltips and such)"), _("composite"), _("theme"), _("animate")); co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; E_CONFIGURE_OPTION_ADD(co, BOOL, disable_screen_effects, conf, _("Disable composite effects for the screen"), _("composite"), _("theme"), _("animate"), _("screen")); @@ -4279,6 +4515,7 @@ e_comp_init(void) windows = eina_hash_string_superfast_new(NULL); borders = eina_hash_string_superfast_new(NULL); damages = eina_hash_string_superfast_new(NULL); + ignores = eina_hash_string_superfast_new(NULL); E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_CREATE, _e_comp_create, NULL); E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_DESTROY, _e_comp_destroy, NULL); @@ -4391,9 +4628,11 @@ e_comp_shutdown(void) conf_match_edd = NULL; conf_edd = NULL; + if (ignores) eina_hash_free(ignores); if (damages) eina_hash_free(damages); if (windows) eina_hash_free(windows); if (borders) eina_hash_free(borders); + ignores = NULL; damages = NULL; windows = NULL; borders = NULL; @@ -4514,18 +4753,43 @@ EAPI E_Comp * e_comp_get(void *o) { E_Border *bd; + E_Popup *pop; + E_Shelf *es; E_Object *obj = o; E_Zone *zone = NULL; E_Container *con = NULL; E_Manager *man = NULL; + E_Gadcon_Popup *gp; if (!o) obj = (E_Object*)e_manager_current_get(); + /* try to get to zone type first */ switch (obj->type) { case E_BORDER_TYPE: bd = (E_Border*)obj; - zone = bd->zone; - EINA_SAFETY_ON_NULL_RETURN_VAL(zone, NULL); + obj = (void*)bd->zone; + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + break; + case E_POPUP_TYPE: + pop = (E_Popup*)obj; + obj = (void*)pop->zone; + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + break; + case E_SHELF_TYPE: + es = (E_Shelf*)obj; + obj = (void*)es->zone; + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + break; + case E_GADCON_POPUP_TYPE: + gp = (E_Gadcon_Popup*)obj; + obj = (void*)gp->win->zone; + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + break; + default: + break; + } + switch (obj->type) + { case E_ZONE_TYPE: if (!zone) zone = (E_Zone*)obj; con = zone->container; @@ -4576,11 +4840,12 @@ e_comp_zone_update(E_Comp_Zone *cz) edje_object_part_swallow(cz->base, "e.swallow.background", cz->zone->transition_object ?: cz->zone->bg_object); evas_object_move(o, cz->zone->x, cz->zone->y); evas_object_resize(o, cz->zone->w, cz->zone->h); - E_LAYER_SET(o, E_COMP_CANVAS_LAYER_BG); + evas_object_layer_set(o, E_COMP_CANVAS_LAYER_BG); evas_object_show(o); cz->over = o = edje_object_add(cz->comp->evas); - E_LAYER_SET_ABOVE(o, E_COMP_CANVAS_LAYER_MAX); + evas_object_layer_set(o, E_COMP_CANVAS_LAYER_MAX); + evas_object_raise(o); evas_object_name_set(cz->over, "cz->over"); evas_object_pass_events_set(o, 1); e_theme_edje_object_set(o, "base/theme/comp", over_styles[conf->disable_screen_effects]); @@ -4619,28 +4884,172 @@ e_comp_top_window_at_xy_get(E_Comp *c, Evas_Coord x, Evas_Coord y, Ecore_X_Windo return cw->win; } -EAPI void -e_comp_object_inject(E_Comp *c, Evas_Object *obj, E_Layer layer) +EAPI E_Comp_Win * +e_comp_object_inject(E_Comp *c, Evas_Object *obj, E_Object *eobj, E_Layer layer) { - E_Comp_Win *cw; + E_Comp_Win *cw, *cwn; E_Container *con; - int pos, x, y, w, h; + int pos; - EINA_SAFETY_ON_NULL_RETURN(c); - EINA_SAFETY_ON_NULL_RETURN(obj); + EINA_SAFETY_ON_NULL_RETURN_VAL(c, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); con = e_container_current_get(c->man); - EINA_SAFETY_ON_NULL_RETURN(con); + EINA_SAFETY_ON_NULL_RETURN_VAL(con, NULL); pos = 1 + (layer / 50); if (pos > 10) pos = 10; cw = _e_comp_win_find(con->layers[pos].win); - EINA_SAFETY_ON_NULL_RETURN(cw); - e_layout_pack(c->layout, obj); - e_layout_child_lower_below(obj, cw->shobj); - evas_object_geometry_get(obj, &x, &y, &w, &h); - e_layout_child_move(obj, x, y); - e_layout_child_resize(obj, w, h); - evas_object_smart_callback_add(obj, EVAS_CALLBACK_MOVE, _e_comp_injected_win_moveresize_cb, c); - evas_object_smart_callback_add(obj, EVAS_CALLBACK_RESIZE, _e_comp_injected_win_moveresize_cb, c); + EINA_SAFETY_ON_NULL_RETURN_VAL(cw, NULL); + + cwn = _e_comp_win_dummy_add(c, obj, eobj, 0); + + if (EINA_INLIST_GET(cw)->prev) + _e_comp_win_raise_above(cwn, (E_Comp_Win*)EINA_INLIST_GET(cw)->prev); + else + _e_comp_win_lower(cwn); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _e_comp_injected_win_del_cb, cwn); + evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_IN, _e_comp_injected_win_focus_in_cb, cwn); + evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _e_comp_injected_win_focus_out_cb, cwn); + return cwn; +} + +EAPI E_Comp_Win * +e_comp_object_add(E_Comp *c, Evas_Object *obj, E_Object *eobj) +{ + E_Comp_Win *cw; + + EINA_SAFETY_ON_NULL_RETURN_VAL(c, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); + + cw = _e_comp_win_dummy_add(c, obj, eobj, 1); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _e_comp_injected_win_del_cb, cw); + evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _e_comp_injected_win_show_cb, cw); + evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _e_comp_injected_win_hide_cb, cw); + evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_IN, _e_comp_injected_win_focus_in_cb, cw); + evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _e_comp_injected_win_focus_out_cb, cw); + return cw; +} + +EAPI void +e_comp_win_move(E_Comp_Win *cw, Evas_Coord x, Evas_Coord y) +{ + EINA_SAFETY_ON_FALSE_RETURN(cw->real_obj); + if (cw->visible) + { + if ((cw->x == x) && (cw->y == y)) return; + } + else + { + if ((cw->hidden.x == x) && (cw->hidden.y == y)) return; + } + if (cw->shape) e_container_shape_move(cw->shape, x, y); + _e_comp_win_configure(cw, x, y, cw->w, cw->h, 0); +} + +EAPI void +e_comp_win_resize(E_Comp_Win *cw, int w, int h) +{ + EINA_SAFETY_ON_FALSE_RETURN(cw->real_obj); + if ((cw->w == w) && (cw->h == h)) return; + if (cw->shape) e_container_shape_resize(cw->shape, w, h); + edje_extern_object_min_size_set(cw->obj, w, h); + _e_comp_win_configure(cw, cw->x, cw->y, w, h, 0); +} + +EAPI void +e_comp_win_moveresize(E_Comp_Win *cw, Evas_Coord x, Evas_Coord y, int w, int h) +{ + EINA_SAFETY_ON_FALSE_RETURN(cw->real_obj); + if ((cw->w == w) && (cw->h == h)) + { + if (cw->visible) + { + if ((cw->x == x) && (cw->y == y)) return; + } + else + { + if ((cw->hidden.x == x) && (cw->hidden.y == y)) return; + } + } + if (cw->shape) + { + e_container_shape_move(cw->shape, x, y); + e_container_shape_resize(cw->shape, w, h); + } + edje_extern_object_min_size_set(cw->obj, w, h); + _e_comp_win_configure(cw, x, y, w, h, 0); +} + +EAPI void +e_comp_win_del(E_Comp_Win *cw) +{ + if (!cw) return; + if (cw->animating) cw->delete_me = 1; + else _e_comp_win_del(cw); +} + +EAPI void +e_comp_win_hide(E_Comp_Win *cw) +{ + EINA_SAFETY_ON_NULL_RETURN(cw); + EINA_SAFETY_ON_FALSE_RETURN(cw->real_obj); + _e_comp_win_real_hide(cw); +} + +EAPI void +e_comp_win_show(E_Comp_Win *cw) +{ + EINA_SAFETY_ON_NULL_RETURN(cw); + EINA_SAFETY_ON_FALSE_RETURN(cw->real_obj); + cw->defer_hide = 0; + cw->show_ready = 1; + _e_comp_win_geometry_update(cw); + _e_comp_win_show(cw); +} + +EAPI void +e_comp_canvas_layer_set(Evas_Object *obj, E_Comp_Canvas_Layer comp_layer, E_Layer layer, E_Comp_Canvas_Stack stack) +{ + E_Comp_Win *cw; + + if (comp_layer == E_COMP_CANVAS_LAYER_LAYOUT) + cw = e_comp_object_inject(e_comp_util_evas_object_comp_get(obj), obj, evas_object_data_get(obj, "eobj"), layer); + else + { + cw = e_comp_object_add(e_comp_util_evas_object_comp_get(obj), obj, evas_object_data_get(obj, "eobj")); + evas_object_layer_set(cw->shobj, comp_layer); + } + if (stack == E_COMP_CANVAS_STACK_ABOVE) + _e_comp_win_raise(cw); + else if (stack == E_COMP_CANVAS_STACK_UNDER) + _e_comp_win_lower(cw); +} + +EAPI void +e_comp_util_wins_print(const E_Comp *c) +{ + E_Comp_Win *cw; + + EINA_INLIST_FOREACH(c->wins, cw) + { + if (cw->bd) + fprintf(stderr, "COMP BD: %p - %s\n", cw, cw->bd->client.icccm.name); + else if (cw->pop) + fprintf(stderr, "COMP POP: %p - %s\n", cw, cw->pop->name); + else if (cw->menu) + fprintf(stderr, "COMP MENU: %p - %s\n", cw, cw->menu->header.title); + else if (cw->real_obj) + fprintf(stderr, "COMP OBJ: %p - %s\n", cw, evas_object_name_get(cw->obj)); + else + fprintf(stderr, "COMP WIN: %p - %u%s\n", cw, cw->win, cw->input_only ? " INPUT" : ""); + } +} + +EAPI void +e_comp_ignore_win_add(Ecore_X_Window win) +{ + EINA_SAFETY_ON_TRUE_RETURN(_e_comp_ignore_find(win)); + eina_hash_add(ignores, e_util_winid_str_get(win), (void*)1); } diff --git a/src/bin/e_comp.h b/src/bin/e_comp.h index c40792620..9b8c78e07 100644 --- a/src/bin/e_comp.h +++ b/src/bin/e_comp.h @@ -9,6 +9,7 @@ typedef enum E_COMP_CANVAS_LAYER_BOTTOM = -100, E_COMP_CANVAS_LAYER_BG = -1, // zone bg stuff E_COMP_CANVAS_LAYER_DESKTOP = 0, // desktop objects: fileman, gadgets, shelves + E_COMP_CANVAS_LAYER_DESKTOP_TOP = 10, // raised desktop objects: gadgets, shelves E_COMP_CANVAS_LAYER_LAYOUT = 100, // should be nothing else on this layer E_COMP_CANVAS_LAYER_POPUP = 999, // popups E_COMP_CANVAS_LAYER_DESKLOCK = 9999, // desklock @@ -56,6 +57,7 @@ struct _E_Comp E_Manager *man; Eina_List *debug_rects; + Eina_List *ignore_wins; Eina_Inlist *wins; Eina_List *wins_list; @@ -177,6 +179,8 @@ struct _E_Comp_Win Eina_Bool bg_win : 1; // window is the bg win for a container Eina_Bool free_shape : 1; // container shape needs to be freed + Eina_Bool real_obj : 1; // real object (for dummy comp wins) + Eina_Bool not_in_layout : 1; // object is a dummy not in comp layout }; struct E_Event_Comp @@ -218,20 +222,33 @@ EAPI E_Comp *e_comp_get(void *o); EAPI Ecore_X_Window e_comp_top_window_at_xy_get(E_Comp *c, Evas_Coord x, Evas_Coord y, Ecore_X_Window *ignore, unsigned int ignore_num); -EAPI void e_comp_object_inject(E_Comp *c, Evas_Object *obj, E_Layer layer); +/* for injecting objects into the comp layout */ +EAPI E_Comp_Win *e_comp_object_inject(E_Comp *c, Evas_Object *obj, E_Object *eobj, E_Layer layer); +/* for giving objects the comp theme and such without injecting into layout */ +EAPI E_Comp_Win *e_comp_object_add(E_Comp *c, Evas_Object *obj, E_Object *eobj); -#define E_LAYER_SET(obj, layer) e_comp_canvas_layer_set(obj, layer, E_COMP_CANVAS_STACK_NONE) -#define E_LAYER_SET_UNDER(obj, layer) e_comp_canvas_layer_set(obj, layer, E_COMP_CANVAS_STACK_UNDER) -#define E_LAYER_SET_ABOVE(obj, layer) e_comp_canvas_layer_set(obj, layer, E_COMP_CANVAS_STACK_ABOVE) +EAPI void e_comp_win_move(E_Comp_Win *cw, Evas_Coord x, Evas_Coord y); +EAPI void e_comp_win_resize(E_Comp_Win *cw, int w, int h); +EAPI void e_comp_win_moveresize(E_Comp_Win *cw, Evas_Coord x, Evas_Coord y, int w, int h); +EAPI void e_comp_win_hide(E_Comp_Win *cw); +EAPI void e_comp_win_show(E_Comp_Win *cw); +EAPI void e_comp_win_del(E_Comp_Win *cw); -static inline void -e_comp_canvas_layer_set(Evas_Object *obj, E_Comp_Canvas_Layer layer, E_Comp_Canvas_Stack stack) +EAPI void e_comp_ignore_win_add(Ecore_X_Window win); + +#define E_LAYER_SET(obj, layer) e_comp_canvas_layer_set(obj, layer, 0, E_COMP_CANVAS_STACK_NONE) +#define E_LAYER_SET_UNDER(obj, layer) e_comp_canvas_layer_set(obj, layer, 0, E_COMP_CANVAS_STACK_UNDER) +#define E_LAYER_SET_ABOVE(obj, layer) e_comp_canvas_layer_set(obj, layer, 0, E_COMP_CANVAS_STACK_ABOVE) +#define E_LAYER_LAYOUT_ADD(obj, layer) e_comp_canvas_layer_set(obj, E_COMP_CANVAS_LAYER_LAYOUT, layer, E_COMP_CANVAS_STACK_NONE) +#define E_LAYER_LAYOUT_ADD_UNDER(obj, layer) e_comp_canvas_layer_set(obj, E_COMP_CANVAS_LAYER_LAYOUT, layer, E_COMP_CANVAS_STACK_UNDER) +#define E_LAYER_LAYOUT_ADD_ABOVE(obj, layer) e_comp_canvas_layer_set(obj, E_COMP_CANVAS_LAYER_LAYOUT, layer, E_COMP_CANVAS_STACK_ABOVE) + +EAPI void e_comp_canvas_layer_set(Evas_Object *obj, E_Comp_Canvas_Layer comp_layer, E_Layer layer, E_Comp_Canvas_Stack stack); + +static inline E_Comp * +e_comp_util_evas_object_comp_get(Evas_Object *obj) { - evas_object_layer_set(obj, layer); - if (stack == E_COMP_CANVAS_STACK_ABOVE) - evas_object_raise(obj); - else if (stack == E_COMP_CANVAS_STACK_UNDER) - evas_object_lower(obj); + return ecore_evas_data_get(ecore_evas_ecore_evas_get(evas_object_evas_get(obj)), "comp"); } static inline Eina_Bool @@ -244,5 +261,15 @@ e_comp_evas_exists(void *o) return c ? !!c->evas : EINA_FALSE; } +static inline void +e_comp_win_ignore_events_set(E_Comp_Win *cw, Eina_Bool ignore) +{ + EINA_SAFETY_ON_NULL_RETURN(cw); + ignore = !!ignore; + evas_object_pass_events_set(cw->shobj, ignore); +} + +EAPI void e_comp_util_wins_print(const E_Comp *c); + #endif #endif diff --git a/src/bin/e_comp_cfdata.c b/src/bin/e_comp_cfdata.c index 8074f947d..a68584858 100644 --- a/src/bin/e_comp_cfdata.c +++ b/src/bin/e_comp_cfdata.c @@ -62,10 +62,12 @@ e_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd) E_CONFIG_VAL(D, T, match.disable_borders, UCHAR); E_CONFIG_VAL(D, T, match.disable_overrides, UCHAR); E_CONFIG_VAL(D, T, match.disable_menus, UCHAR); + E_CONFIG_VAL(D, T, match.disable_objects, UCHAR); E_CONFIG_LIST(D, T, match.popups, *match_edd); E_CONFIG_LIST(D, T, match.borders, *match_edd); E_CONFIG_LIST(D, T, match.overrides, *match_edd); E_CONFIG_LIST(D, T, match.menus, *match_edd); + E_CONFIG_LIST(D, T, match.objects, *match_edd); } EAPI E_Comp_Config * @@ -205,6 +207,7 @@ e_comp_cfdata_config_free(E_Comp_Config *cfg) E_FREE_LIST(cfg->match.borders, e_comp_cfdata_match_free); E_FREE_LIST(cfg->match.overrides, e_comp_cfdata_match_free); E_FREE_LIST(cfg->match.menus, e_comp_cfdata_match_free); + E_FREE_LIST(cfg->match.objects, e_comp_cfdata_match_free); free(cfg); } diff --git a/src/bin/e_comp_cfdata.h b/src/bin/e_comp_cfdata.h index 8c6078286..fb74490f8 100644 --- a/src/bin/e_comp_cfdata.h +++ b/src/bin/e_comp_cfdata.h @@ -34,6 +34,7 @@ struct _E_Comp_Config Eina_Bool fast_borders; Eina_Bool fast_menus; Eina_Bool fast_overrides; + Eina_Bool fast_objects; struct { @@ -45,6 +46,8 @@ struct _E_Comp_Config Eina_List *overrides; // used for client menus, tooltips etc. Eina_Bool disable_menus; Eina_List *menus; // used for e menus + Eina_Bool disable_objects; + Eina_List *objects; // used for e objects which are not popups or menus } match; }; diff --git a/src/bin/e_comp_render_update.c b/src/bin/e_comp_render_update.c index 96b426edf..dae8c021d 100644 --- a/src/bin/e_comp_render_update.c +++ b/src/bin/e_comp_render_update.c @@ -27,6 +27,7 @@ e_comp_render_update_new(void) void e_comp_render_update_free(E_Comp_Render_Update *up) { + if (!up) return; free(up->tiles); free(up); } diff --git a/src/bin/e_container.c b/src/bin/e_container.c index 7d099fc80..e676efa13 100644 --- a/src/bin/e_container.c +++ b/src/bin/e_container.c @@ -67,7 +67,7 @@ e_container_new(E_Manager *man) o = evas_object_rectangle_add(con->bg_evas); con->bg_blank_object = o; - E_LAYER_SET(o, E_COMP_CANVAS_LAYER_BOTTOM); + evas_object_layer_set(o, E_COMP_CANVAS_LAYER_BOTTOM); evas_object_move(o, 0, 0); evas_object_resize(o, con->w, con->h); evas_object_color_set(o, 255, 255, 255, 255); diff --git a/src/bin/e_desklock.c b/src/bin/e_desklock.c index 2d7c80a11..d7ff618f7 100644 --- a/src/bin/e_desklock.c +++ b/src/bin/e_desklock.c @@ -308,6 +308,7 @@ e_desklock_show(Eina_Bool suspend) return 0; } works: + e_comp_ignore_win_add(edd->elock_wnd); if (e_config->desklock_language) e_intl_language_set(e_config->desklock_language); @@ -425,6 +426,7 @@ _e_desklock_popup_add(E_Zone *zone) evas = e_comp_get(zone)->evas; evas_event_freeze(evas); edp->bg_object = edje_object_add(evas); + evas_object_name_set(edp->bg_object, "desklock->bg_object"); if ((!bg) || (!strcmp(bg, "theme_desklock_background"))) { @@ -497,6 +499,7 @@ _e_desklock_login_box_add(E_Desklock_Popup_Data *edp) evas = evas_object_evas_get(edp->bg_object); edp->login_box = edje_object_add(evas); + evas_object_name_set(edp->login_box, "desklock->login_box"); e_theme_edje_object_set(edp->login_box, "base/theme/desklock", "e/desklock/login_box"); diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c index 22b91dcd0..a1fd340b8 100644 --- a/src/bin/e_dnd.c +++ b/src/bin/e_dnd.c @@ -780,7 +780,7 @@ _e_drag_win_get(const E_Drop_Handler *h, int xdnd) break; case E_POPUP_TYPE: - hwin = ((E_Popup *)(h->obj))->evas_win; + hwin = e_comp_get(h->obj)->win; break; /* FIXME: add more types as needed */ diff --git a/src/bin/e_gadcon_popup.c b/src/bin/e_gadcon_popup.c index 58ca9add0..a8ec8a0f9 100644 --- a/src/bin/e_gadcon_popup.c +++ b/src/bin/e_gadcon_popup.c @@ -2,14 +2,30 @@ /* local subsystem functions */ -static void -_e_gadcon_popup_free(E_Gadcon_Popup *pop) +static Eina_Bool +_e_popup_autoclose_deskafter_show_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { - if (pop->gadcon_was_locked) - _e_gadcon_popup_locked_set(pop, 0); - pop->gcc = NULL; - e_object_del(E_OBJECT(pop->win)); - free(pop); + E_Event_Desk_After_Show *ev = event; + E_Gadcon_Popup *pop = data; + + if (!pop->win->visible) return ECORE_CALLBACK_RENEW; + if (!e_gadcon_client_visible_get(pop->gcc, ev->desk)) + e_object_del(E_OBJECT(pop)); + + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_e_popup_autoclose_border_fullscreen_cb(void *data, int type EINA_UNUSED, void *event) +{ + E_Event_Border_Fullscreen *ev = event; + E_Gadcon_Popup *pop = data; + + if (!pop->win->visible) return ECORE_CALLBACK_RENEW; + if (!ev->border->fullscreen) return ECORE_CALLBACK_RENEW; + if (e_gadcon_client_visible_get(pop->gcc, ev->border->desk)) + e_object_del(E_OBJECT(pop)); + return ECORE_CALLBACK_RENEW; } static void @@ -23,23 +39,29 @@ _e_gadcon_popup_locked_set(E_Gadcon_Popup *pop, Eina_Bool locked) } static void -_e_gadcon_popup_size_recalc(E_Gadcon_Popup *pop, Evas_Object *obj) +_e_gadcon_popup_free(E_Gadcon_Popup *pop) { - Evas_Coord w = 0, h = 0; + E_FN_DEL(ecore_event_handler_del, pop->autoclose_handlers[0]); + E_FN_DEL(ecore_event_handler_del, pop->autoclose_handlers[1]); - e_widget_size_min_get(obj, &w, &h); - if ((!w) || (!h)) evas_object_size_hint_min_get(obj, &w, &h); - if ((!w) || (!h)) - { - edje_object_size_min_get(obj, &w, &h); - edje_object_size_min_restricted_calc(obj, &w, &h, w, h); - } - edje_extern_object_min_size_set(obj, w, h); - edje_object_size_min_calc(pop->o_bg, &pop->w, &pop->h); - evas_object_resize(pop->o_bg, pop->w, pop->h); + if (pop->gadcon_was_locked) + _e_gadcon_popup_locked_set(pop, 0); + pop->gcc = NULL; + evas_object_del(pop->content); + if (pop->win) + E_OBJECT_DEL_SET(pop->win, NULL); + E_FN_DEL(e_object_del, pop->win); + free(pop); +} - if (pop->win->visible) - _e_gadcon_popup_position(pop); +static void +_e_gadcon_popup_del_cb(void *obj) +{ + E_Gadcon_Popup *pop; + + pop = e_object_data_get(obj); + pop->win = NULL; + e_object_del(E_OBJECT(pop)); } static void @@ -125,6 +147,27 @@ _e_gadcon_popup_position(E_Gadcon_Popup *pop) _e_gadcon_popup_locked_set(pop, 1); } +static void +_e_gadcon_popup_size_recalc(E_Gadcon_Popup *pop, Evas_Object *obj) +{ + Evas_Coord w = 0, h = 0; + + e_widget_size_min_get(obj, &w, &h); + if ((!w) || (!h)) evas_object_size_hint_min_get(obj, &w, &h); + if ((!w) || (!h)) + { + edje_object_size_min_get(obj, &w, &h); + edje_object_size_min_restricted_calc(obj, &w, &h, w, h); + } + edje_extern_object_min_size_set(obj, w, h); + edje_object_size_min_calc(pop->o_bg, &pop->w, &pop->h); + evas_object_resize(pop->o_bg, pop->w, pop->h); + e_popup_resize(pop->win, pop->w, pop->h); + + if (pop->win->visible) + _e_gadcon_popup_position(pop); +} + static void _e_gadcon_popup_changed_size_hints_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) { @@ -147,13 +190,12 @@ e_gadcon_popup_new(E_Gadcon_Client *gcc) if (!pop) return NULL; zone = e_gadcon_client_zone_get(gcc); pop->win = e_popup_new(zone, 0, 0, 0, 0); - e_popup_layer_set(pop->win, E_LAYER_POPUP); + e_object_data_set(E_OBJECT(pop->win), pop); + E_OBJECT_DEL_SET(pop->win, _e_gadcon_popup_del_cb); o = edje_object_add(pop->win->evas); e_theme_edje_object_set(o, "base/theme/gadman", "e/gadman/popup"); - evas_object_show(o); - evas_object_move(o, 0, 0); - e_popup_edje_bg_object_set(pop->win, o); + e_popup_content_set(pop->win, o); pop->o_bg = o; pop->gcc = gcc; @@ -184,7 +226,7 @@ e_gadcon_popup_content_set(E_Gadcon_Popup *pop, Evas_Object *o) evas_object_event_callback_add(o, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _e_gadcon_popup_changed_size_hints_cb, pop); } - + pop->content = o; _e_gadcon_popup_size_recalc(pop, o); } @@ -197,9 +239,10 @@ e_gadcon_popup_show(E_Gadcon_Popup *pop) if (pop->win->visible) return; - e_popup_show(pop->win); - _e_gadcon_popup_position(pop); + pop->autoclose_handlers[0] = ecore_event_handler_add(E_EVENT_DESK_AFTER_SHOW, _e_popup_autoclose_deskafter_show_cb, NULL); + pop->autoclose_handlers[1] = ecore_event_handler_add(E_EVENT_BORDER_FULLSCREEN, _e_popup_autoclose_border_fullscreen_cb, NULL); + e_popup_show(pop->win); } EAPI void @@ -236,7 +279,6 @@ e_gadcon_popup_toggle_pinned(E_Gadcon_Popup *pop) EAPI void e_gadcon_popup_lock_set(E_Gadcon_Popup *pop, Eina_Bool setting) { - if (!pop) return; E_OBJECT_CHECK(pop); E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE); diff --git a/src/bin/e_gadcon_popup.h b/src/bin/e_gadcon_popup.h index e4c74ac62..1368adf82 100644 --- a/src/bin/e_gadcon_popup.h +++ b/src/bin/e_gadcon_popup.h @@ -16,6 +16,8 @@ struct _E_Gadcon_Popup E_Gadcon_Client *gcc; Evas_Coord w, h; Evas_Object *o_bg; + Evas_Object *content; + Ecore_Event_Handler *autoclose_handlers[2]; Eina_Bool pinned : 1; Eina_Bool gadcon_lock : 1; diff --git a/src/bin/e_int_shelf_config.c b/src/bin/e_int_shelf_config.c index 3cd0108fa..e87138823 100644 --- a/src/bin/e_int_shelf_config.c +++ b/src/bin/e_int_shelf_config.c @@ -304,7 +304,7 @@ _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) if ((cfdata->escfg->popup != 0) || (cfdata->escfg->layer != 1)) { cfdata->escfg->popup = 0; - cfdata->escfg->layer = 1; + cfdata->escfg->layer = E_COMP_CANVAS_LAYER_DESKTOP_TOP; recreate = 1; } } diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 2b95eb3e8..114358b57 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -161,6 +161,12 @@ _fix_user_default_edj(void) if (ecore_file_exists(buff)) ecore_file_unlink(buff); } +static void +_e_main_shelf_init_job(void *d EINA_UNUSED) +{ + e_shelf_config_update(); +} + /* externally accessible functions */ int main(int argc, char **argv) @@ -1043,11 +1049,7 @@ main(int argc, char **argv) TS("E_Shelf Init Done"); _e_main_shutdown_push(e_shelf_shutdown); - if (e_config->show_splash) - e_init_status_set(_("Configure Shelves")); - TS("E_Shelf Config Update"); - e_shelf_config_update(); - TS("E_Shelf Config Update Done"); + ecore_job_add(_e_main_shelf_init_job, NULL); TS("Manage all windows"); _e_main_manage_all(); @@ -1887,7 +1889,6 @@ _e_main_cb_idle_before(void *data __UNUSED__) e_menu_idler_before(); e_focus_idler_before(); e_border_idler_before(); - e_popup_idler_before(); e_drag_idler_before(); e_pointer_idler_before(); EINA_LIST_FOREACH(_idle_before_list, l, eb) diff --git a/src/bin/e_moveresize.c b/src/bin/e_moveresize.c index f27c75cc3..fcb5217e1 100644 --- a/src/bin/e_moveresize.c +++ b/src/bin/e_moveresize.c @@ -10,7 +10,6 @@ static void _e_move_end(void *data, void *bd); static void _e_move_resize_object_coords_set(int x, int y, int w, int h); static E_Popup *_disp_pop = NULL; -static Evas_Object *_obj = NULL; static Eina_List *hooks = NULL; static int visible = 0; static int obj_x = 0; @@ -54,13 +53,13 @@ static void _e_resize_begin(void *data __UNUSED__, void *border) { E_Border *bd = border; + Evas_Object *o; Evas_Coord ew, eh; char buf[40]; int w, h; if (_disp_pop) e_object_del(E_OBJECT(_disp_pop)); _disp_pop = NULL; - _obj = NULL; if (!e_config->resize_info_visible) return; @@ -74,27 +73,15 @@ _e_resize_begin(void *data __UNUSED__, void *border) _disp_pop = e_popup_new(bd->zone, 0, 0, 1, 1); if (!_disp_pop) return; - e_popup_layer_set(_disp_pop, E_LAYER_POPUP); - _obj = edje_object_add(_disp_pop->evas); - e_theme_edje_object_set(_obj, "base/theme/borders", + o = edje_object_add(_disp_pop->evas); + e_theme_edje_object_set(o, "base/theme/borders", "e/widgets/border/default/resize"); snprintf(buf, sizeof(buf), "9999x9999"); - edje_object_part_text_set(_obj, "e.text.label", buf); + edje_object_part_text_set(o, "e.text.label", buf); - edje_object_size_min_calc(_obj, &ew, &eh); - evas_object_move(_obj, 0, 0); - evas_object_resize(_obj, ew, eh); - evas_object_show(_obj); - e_popup_edje_bg_object_set(_disp_pop, _obj); - - if (!visible) - { - evas_object_show(_obj); - e_popup_show(_disp_pop); - visible = 1; - } + edje_object_size_min_calc(o, &ew, &eh); snprintf(buf, sizeof(buf), _("%i×%i"), w, h); - edje_object_part_text_set(_obj, "e.text.label", buf); + edje_object_part_text_set(_disp_pop->content, "e.text.label", buf); e_popup_move_resize(_disp_pop, (obj_x - _disp_pop->zone->x) + @@ -102,10 +89,10 @@ _e_resize_begin(void *data __UNUSED__, void *border) (obj_y - _disp_pop->zone->y) + ((obj_h - eh) / 2), ew, eh); + e_popup_content_set(_disp_pop, o); - e_popup_show(_disp_pop); - - visible = 1; + snprintf(buf, sizeof(buf), _("%i×%i"), w, h); + edje_object_part_text_set(o, "e.text.label", buf); } static void @@ -113,11 +100,6 @@ _e_resize_end(void *data __UNUSED__, void *border __UNUSED__) { if (e_config->resize_info_visible) { - if (_obj) - { - evas_object_del(_obj); - _obj = NULL; - } if (_disp_pop) { e_object_del(E_OBJECT(_disp_pop)); @@ -139,19 +121,16 @@ _e_resize_update(void *data __UNUSED__, void *border) if (e_config->resize_info_follows) _e_move_resize_object_coords_set(bd->x + bd->fx.x, bd->y + bd->fx.y, bd->w, bd->h); - else - _e_move_resize_object_coords_set(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h); _e_resize_border_extents(bd, &w, &h); if (!visible) { - evas_object_show(_obj); e_popup_show(_disp_pop); visible = 1; } snprintf(buf, sizeof(buf), _("%i×%i"), w, h); - edje_object_part_text_set(_obj, "e.text.label", buf); + edje_object_part_text_set(_disp_pop->content, "e.text.label", buf); } static void @@ -186,12 +165,12 @@ static void _e_move_begin(void *data __UNUSED__, void *border) { E_Border *bd = border; + Evas_Object *o; Evas_Coord ew, eh; char buf[40]; if (_disp_pop) e_object_del(E_OBJECT(_disp_pop)); _disp_pop = NULL; - _obj = NULL; if (!e_config->move_info_visible) return; @@ -202,17 +181,15 @@ _e_move_begin(void *data __UNUSED__, void *border) _e_move_resize_object_coords_set(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h); _disp_pop = e_popup_new(bd->zone, 0, 0, 1, 1); - _obj = edje_object_add(_disp_pop->evas); - e_theme_edje_object_set(_obj, "base/theme/borders", + o = edje_object_add(_disp_pop->evas); + e_theme_edje_object_set(o, "base/theme/borders", "e/widgets/border/default/move"); snprintf(buf, sizeof(buf), "9999 9999"); - edje_object_part_text_set(_obj, "e.text.label", buf); + edje_object_part_text_set(o, "e.text.label", buf); - edje_object_size_min_calc(_obj, &ew, &eh); - evas_object_move(_obj, 0, 0); - evas_object_resize(_obj, ew, eh); - evas_object_show(_obj); - e_popup_edje_bg_object_set(_disp_pop, _obj); + edje_object_size_min_calc(o, &ew, &eh); + snprintf(buf, sizeof(buf), "%i %i", bd->x, bd->y); + edje_object_part_text_set(o, "e.text.label", buf); e_popup_move_resize(_disp_pop, (obj_x - _disp_pop->zone->x) + @@ -220,6 +197,7 @@ _e_move_begin(void *data __UNUSED__, void *border) (obj_y - _disp_pop->zone->y) + ((obj_h - eh) / 2), ew, eh); + e_popup_content_set(_disp_pop, o); } static void @@ -227,11 +205,6 @@ _e_move_end(void *data __UNUSED__, void *border __UNUSED__) { if (e_config->move_info_visible) { - if (_obj) - { - evas_object_del(_obj); - _obj = NULL; - } if (_disp_pop) { e_object_del(E_OBJECT(_disp_pop)); @@ -252,17 +225,14 @@ _e_move_update(void *data __UNUSED__, void *border) if (e_config->move_info_follows) _e_move_resize_object_coords_set(bd->x + bd->fx.x, bd->y + bd->fx.y, bd->w, bd->h); - else - _e_move_resize_object_coords_set(bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h); if (!visible) { - evas_object_show(_obj); e_popup_show(_disp_pop); visible = 1; } snprintf(buf, sizeof(buf), "%i %i", bd->x, bd->y); - edje_object_part_text_set(_obj, "e.text.label", buf); + edje_object_part_text_set(_disp_pop->content, "e.text.label", buf); } static void diff --git a/src/bin/e_popup.c b/src/bin/e_popup.c index ccc409467..c2492ffc3 100644 --- a/src/bin/e_popup.c +++ b/src/bin/e_popup.c @@ -1,36 +1,127 @@ #include "e.h" -/* local subsystem functions */ -static void _e_popup_free(E_Popup *pop); -static Eina_Bool _e_popup_idle_enterer(void *data); -static Eina_Bool _e_popup_cb_window_shape(void *data, int ev_type, void *ev); - /* local subsystem globals */ -static Ecore_Event_Handler *_e_popup_window_shape_handler = NULL; static Eina_List *_e_popup_list = NULL; -static Eina_Hash *_e_popup_hash = NULL; +static E_Popup *autoclose_popup = NULL; +static Ecore_Event_Handler *autoclose_handlers[4] = {NULL}; +static Eina_Bool autoclose_down_obj = EINA_FALSE; +static unsigned int autoclose_event = 0; +/* local subsystem functions */ + +static void +_e_popup_autoclose_cleanup(void) +{ + if (autoclose_popup) + e_grabinput_release(0, e_comp_get(autoclose_popup)->ee_win); + E_FN_DEL(e_object_del, autoclose_popup); + E_FN_DEL(ecore_event_handler_del, autoclose_handlers[0]); + E_FN_DEL(ecore_event_handler_del, autoclose_handlers[1]); + E_FN_DEL(ecore_event_handler_del, autoclose_handlers[2]); + E_FN_DEL(ecore_event_handler_del, autoclose_handlers[3]); + autoclose_down_obj = 0; +} + +static void +_e_popup_free(E_Popup *pop) +{ + e_object_unref(E_OBJECT(pop->zone)); + if (pop->autoclose) + _e_popup_autoclose_cleanup(); + E_FN_DEL(e_object_del, pop->shape); + E_FREE_LIST(pop->objects, evas_object_del); + pop->zone->popups = eina_list_remove(pop->zone->popups, pop); + eina_stringshare_del(pop->name); + _e_popup_list = eina_list_remove(_e_popup_list, pop); + free(pop); +} + +static void +_e_popup_obj_autoclose_mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + autoclose_down_obj = 1; +} + +static Eina_Bool +_e_popup_autoclose_focus_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) +{ + _e_popup_autoclose_cleanup(); + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_e_popup_autoclose_key_down_cb(void *data, int type EINA_UNUSED, void *event) +{ + Ecore_Event_Key *ev = event; + Eina_Bool del = EINA_TRUE; + + if (autoclose_popup->key_cb) + del = !autoclose_popup->key_cb(data, ev); + if (del) _e_popup_autoclose_cleanup(); + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_e_popup_autoclose_mouse_up_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) +{ + Ecore_Event_Mouse_Button *ev = event; + + if (autoclose_event && ((!autoclose_down_obj) || (ev->event_window != e_comp_get(autoclose_popup)->ee_win))) + _e_popup_autoclose_cleanup(); + else + autoclose_event++; + autoclose_down_obj = 0; + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_e_popup_autoclose_mouse_down_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) +{ + Ecore_Event_Mouse_Button *ev = event; + + if (ev->event_window != e_comp_get(autoclose_popup)->ee_win) + _e_popup_autoclose_cleanup(); + autoclose_event++; + return ECORE_CALLBACK_RENEW; +} + +static void +_e_popup_autoclose_setup(E_Popup *pop) +{ + E_FN_DEL(e_object_del, autoclose_popup); + autoclose_event = 0; + evas_object_event_callback_add(pop->content, EVAS_CALLBACK_MOUSE_DOWN, _e_popup_obj_autoclose_mouse_down_cb, NULL); + autoclose_popup = pop; + if (autoclose_handlers[0]) + ecore_event_handler_data_set(autoclose_handlers[0], pop->key_data); + else + autoclose_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_popup_autoclose_mouse_down_cb, pop->key_data); + if (autoclose_handlers[1]) + ecore_event_handler_data_set(autoclose_handlers[1], pop->key_data); + else + autoclose_handlers[1] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _e_popup_autoclose_mouse_up_cb, pop->key_data); + if (autoclose_handlers[2]) + ecore_event_handler_data_set(autoclose_handlers[2], pop->key_data); + else + autoclose_handlers[2] = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _e_popup_autoclose_key_down_cb, pop->key_data); + if (autoclose_handlers[3]) + ecore_event_handler_data_set(autoclose_handlers[3], pop->key_data); + else + autoclose_handlers[3] = ecore_event_handler_add(E_EVENT_BORDER_FOCUS_IN, _e_popup_autoclose_focus_cb, pop->key_data); + e_grabinput_get(0, 0, e_comp_get(pop)->ee_win); +} /* externally accessible functions */ EINTERN int e_popup_init(void) { - _e_popup_window_shape_handler = - ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHAPE, - _e_popup_cb_window_shape, NULL); - if (!_e_popup_hash) _e_popup_hash = eina_hash_string_superfast_new(NULL); return 1; } EINTERN int e_popup_shutdown(void) { - if (_e_popup_hash) - { - eina_hash_free(_e_popup_hash); - _e_popup_hash = NULL; - } - E_FN_DEL(ecore_event_handler_del, _e_popup_window_shape_handler); + _e_popup_autoclose_cleanup(); return 1; } @@ -43,6 +134,7 @@ e_popup_new(E_Zone *zone, int x, int y, int w, int h) if (!pop) return NULL; e_object_delay_del_set(E_OBJECT(pop), e_popup_hide); pop->zone = zone; + pop->ecore_evas = zone->container->bg_ecore_evas; pop->zx = pop->zone->x; pop->zy = pop->zone->y; pop->x = x; @@ -50,38 +142,34 @@ e_popup_new(E_Zone *zone, int x, int y, int w, int h) pop->w = w; pop->h = h; pop->layer = E_LAYER_POPUP; - pop->ecore_evas = e_canvas_new(pop->zone->container->win, - pop->zone->x + pop->x, pop->zone->y + pop->y, pop->w, pop->h, 1, 1, - &(pop->evas_win)); - if (!pop->ecore_evas) - { - free(pop); - return NULL; - } - /* avoid excess exposes when shaped - set damage avoid to 1 */ -// ecore_evas_avoid_damage_set(pop->ecore_evas, 1); + pop->comp_layer = E_COMP_CANVAS_LAYER_LAYOUT; - e_canvas_add(pop->ecore_evas); - pop->shape = e_container_shape_add(pop->zone->container); - e_container_shape_move(pop->shape, pop->zone->x + pop->x, pop->zone->y + pop->y); - e_container_shape_resize(pop->shape, pop->w, pop->h); - pop->evas = ecore_evas_get(pop->ecore_evas); - e_container_window_raise(pop->zone->container, pop->evas_win, pop->layer); - ecore_x_window_shape_events_select(pop->evas_win, 1); - ecore_evas_name_class_set(pop->ecore_evas, "E", "_e_popup_window"); - ecore_evas_title_set(pop->ecore_evas, "E Popup"); + pop->evas = e_comp_get(zone)->evas; + pop->shape = e_container_shape_add(zone->container); e_object_ref(E_OBJECT(pop->zone)); pop->zone->popups = eina_list_append(pop->zone->popups, pop); _e_popup_list = eina_list_append(_e_popup_list, pop); - eina_hash_add(_e_popup_hash, e_util_winid_str_get(pop->evas_win), pop); return pop; } EAPI void -e_popup_name_set(E_Popup *pop, const char *name) +e_popup_content_set(E_Popup *pop, Evas_Object *obj) { - if (eina_stringshare_replace(&pop->name, name)) - ecore_evas_name_class_set(pop->ecore_evas, "E", pop->name); + E_OBJECT_CHECK(pop); + E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE); + + if (pop->content) evas_object_del(pop->content); + pop->content = obj; + evas_object_data_set(obj, "eobj", pop); + evas_object_move(obj, pop->zone->x + pop->x, pop->zone->y + pop->y); + evas_object_resize(obj, pop->w, pop->h); + e_popup_layer_set(pop, pop->comp_layer, pop->layer); + e_popup_ignore_events_set(pop, pop->ignore_events); + if (pop->visible) + { + e_comp_win_moveresize(pop->cw, pop->zone->x + pop->x, pop->zone->y + pop->y, pop->w, pop->h); + evas_object_show(obj); + } } EAPI void @@ -89,23 +177,13 @@ e_popup_show(E_Popup *pop) { E_OBJECT_CHECK(pop); E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE); + if (pop->visible) return; + pop->visible = 1; - if (pop->shaped && e_config->use_shaped_win) - { - ecore_evas_move(pop->ecore_evas, - pop->zone->container->manager->w, - pop->zone->container->manager->h); - ecore_evas_show(pop->ecore_evas); - if (pop->idle_enterer) ecore_idle_enterer_del(pop->idle_enterer); - pop->idle_enterer = ecore_idle_enterer_add(_e_popup_idle_enterer, pop); - } - else - { - ecore_evas_show(pop->ecore_evas); - if (!pop->shaped || e_config->use_shaped_win) - e_container_shape_show(pop->shape); - } + e_comp_win_moveresize(pop->cw, pop->zone->x + pop->x, pop->zone->y + pop->y, pop->w, pop->h); + e_comp_win_show(pop->cw); + if (pop->autoclose) _e_popup_autoclose_setup(pop); } EAPI void @@ -114,11 +192,12 @@ e_popup_hide(E_Popup *pop) E_OBJECT_CHECK(pop); E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE); if (!pop->visible) return; - if (pop->idle_enterer) ecore_idle_enterer_del(pop->idle_enterer); - pop->idle_enterer = NULL; pop->visible = 0; - ecore_evas_hide(pop->ecore_evas); - e_container_shape_hide(pop->shape); + e_comp_win_hide(pop->cw); + if (!pop->autoclose) return; + if (e_object_is_del(E_OBJECT(pop))) return; + autoclose_popup = NULL; + _e_popup_autoclose_cleanup(); } EAPI void @@ -132,12 +211,8 @@ e_popup_move(E_Popup *pop, int x, int y) pop->zy = pop->zone->y; pop->x = x; pop->y = y; - ecore_evas_move(pop->ecore_evas, - pop->zone->x + pop->x, - pop->zone->y + pop->y); - e_container_shape_move(pop->shape, - pop->zone->x + pop->x, - pop->zone->y + pop->y); + if (!pop->cw) return; + e_comp_win_move(pop->cw, pop->zone->x + pop->x, pop->zone->y + pop->y); } EAPI void @@ -148,8 +223,8 @@ e_popup_resize(E_Popup *pop, int w, int h) if ((pop->w == w) && (pop->h == h)) return; pop->w = w; pop->h = h; - ecore_evas_resize(pop->ecore_evas, pop->w, pop->h); - e_container_shape_resize(pop->shape, pop->w, pop->h); + if (!pop->cw) return; + e_comp_win_resize(pop->cw, pop->w, pop->h); } EAPI void @@ -160,206 +235,66 @@ e_popup_move_resize(E_Popup *pop, int x, int y, int w, int h) if ((pop->x == x) && (pop->y == y) && (pop->w == w) && (pop->h == h) && (pop->zone->x == pop->zx) && (pop->zone->y == pop->zy)) return; - pop->zx = pop->zone->x; - pop->zy = pop->zone->y; pop->x = x; pop->y = y; pop->w = w; pop->h = h; - ecore_evas_move_resize(pop->ecore_evas, - pop->zone->x + pop->x, - pop->zone->y + pop->y, - pop->w, pop->h); - e_container_shape_move(pop->shape, - pop->zone->x + pop->x, - pop->zone->y + pop->y); - e_container_shape_resize(pop->shape, pop->w, pop->h); + if (!pop->cw) return; + e_comp_win_moveresize(pop->cw, pop->zone->x + x, pop->zone->y + y, w, h); } EAPI void e_popup_ignore_events_set(E_Popup *pop, int ignore) { - ecore_evas_ignore_events_set(pop->ecore_evas, ignore); + E_OBJECT_CHECK(pop); + E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE); + + ignore = !!ignore; + pop->ignore_events = ignore; + if (pop->cw) + e_comp_win_ignore_events_set(pop->cw, ignore); } EAPI void -e_popup_edje_bg_object_set(E_Popup *pop, Evas_Object *o) -{ - const char *shape_option; - - E_OBJECT_CHECK(pop); - E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE); - shape_option = edje_object_data_get(o, "shaped"); - if (shape_option) - { - if (!strcmp(shape_option, "1")) - pop->shaped = 1; - else - pop->shaped = 0; - if (!e_config->use_shaped_win) - { - ecore_evas_alpha_set(pop->ecore_evas, pop->shaped); - eina_hash_del(_e_popup_hash, e_util_winid_str_get(pop->evas_win), pop); - pop->evas_win = ecore_evas_software_x11_window_get(pop->ecore_evas); - eina_hash_add(_e_popup_hash, e_util_winid_str_get(pop->evas_win), pop); - e_container_window_raise(pop->zone->container, pop->evas_win, pop->layer); - } - else - ecore_evas_shaped_set(pop->ecore_evas, pop->shaped); - } - else - { - pop->shaped = 0; - ecore_evas_alpha_set(pop->ecore_evas, pop->shaped); - eina_hash_del(_e_popup_hash, e_util_winid_str_get(pop->evas_win), pop); - pop->evas_win = ecore_evas_software_x11_window_get(pop->ecore_evas); - eina_hash_add(_e_popup_hash, e_util_winid_str_get(pop->evas_win), pop); - e_container_window_raise(pop->zone->container, pop->evas_win, pop->layer); - ecore_evas_shaped_set(pop->ecore_evas, pop->shaped); - } -} - -EAPI void -e_popup_layer_set(E_Popup *pop, E_Layer layer) +e_popup_layer_set(E_Popup *pop, E_Comp_Canvas_Layer comp_layer, E_Layer layer) { E_OBJECT_CHECK(pop); E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE); + pop->comp_layer = comp_layer; pop->layer = layer; - e_container_window_raise(pop->zone->container, pop->evas_win, pop->layer); + if (!pop->content) return; + if (comp_layer == E_COMP_CANVAS_LAYER_LAYOUT) + E_LAYER_LAYOUT_ADD(pop->content, layer); + else + E_LAYER_SET_ABOVE(pop->content, comp_layer); } EAPI void -e_popup_idler_before(void) +e_popup_name_set(E_Popup *pop, const char *name) { - Eina_List *l; - E_Popup *pop; - - EINA_LIST_FOREACH(_e_popup_list, l, pop) - { - if (pop->need_shape_export) - { - Ecore_X_Rectangle *rects, *orects; - int num; - - rects = ecore_x_window_shape_rectangles_get(pop->evas_win, &num); - if (rects) - { - int changed; - - changed = 1; - if ((num == pop->shape_rects_num) && (pop->shape_rects)) - { - int i; - - orects = pop->shape_rects; - changed = 0; - for (i = 0; i < num; i++) - { - if (rects[i].x < 0) - { - rects[i].width -= rects[i].x; - rects[i].x = 0; - } - if ((rects[i].x + (int)rects[i].width) > pop->w) - rects[i].width = rects[i].width - rects[i].x; - if (rects[i].y < 0) - { - rects[i].height -= rects[i].y; - rects[i].y = 0; - } - if ((rects[i].y + (int)rects[i].height) > pop->h) - rects[i].height = rects[i].height - rects[i].y; - - if ((orects[i].x != rects[i].x) || - (orects[i].y != rects[i].y) || - (orects[i].width != rects[i].width) || - (orects[i].height != rects[i].height)) - { - changed = 1; - break; - } - } - } - if (changed) - { - E_FREE(pop->shape_rects); - pop->shape_rects = rects; - pop->shape_rects_num = num; - e_container_shape_rects_set(pop->shape, rects, num); - } - else - free(rects); - } - else - { - E_FREE(pop->shape_rects); - pop->shape_rects = NULL; - pop->shape_rects_num = 0; - e_container_shape_rects_set(pop->shape, NULL, 0); - } - pop->need_shape_export = 0; - } - if ((pop->visible) && (!pop->idle_enterer) && - (!pop->shaped && !e_config->use_shaped_win)) - e_container_shape_show(pop->shape); - } + E_OBJECT_CHECK(pop); + E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE); + eina_stringshare_replace(&pop->name, name); } -EAPI E_Popup * -e_popup_find_by_window(Ecore_X_Window win) +EAPI void +e_popup_object_add(E_Popup *pop, Evas_Object *obj) { - E_Popup *pop; + E_OBJECT_CHECK(pop); + E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE); - pop = eina_hash_find(_e_popup_hash, e_util_winid_str_get(win)); - if ((pop) && (pop->evas_win != win)) - return NULL; - return pop; + pop->objects = eina_list_append(pop->objects, obj); } -/* local subsystem functions */ - -static void -_e_popup_free(E_Popup *pop) +EAPI void +e_popup_autoclose(E_Popup *pop, E_Popup_Key_Cb cb, const void *data) { - if (pop->idle_enterer) ecore_idle_enterer_del(pop->idle_enterer); - pop->idle_enterer = NULL; - E_FREE(pop->shape_rects); - pop->shape_rects_num = 0; - e_container_shape_hide(pop->shape); - e_object_del(E_OBJECT(pop->shape)); - e_canvas_del(pop->ecore_evas); - ecore_evas_free(pop->ecore_evas); - e_object_unref(E_OBJECT(pop->zone)); - pop->zone->popups = eina_list_remove(pop->zone->popups, pop); - _e_popup_list = eina_list_remove(_e_popup_list, pop); - eina_hash_del(_e_popup_hash, e_util_winid_str_get(pop->evas_win), pop); - if (pop->name) eina_stringshare_del(pop->name); - free(pop); + E_OBJECT_CHECK(pop); + E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE); + + pop->autoclose = 1; + pop->key_cb = cb; + pop->key_data = (void*)data; + if (!pop->visible) return; + _e_popup_autoclose_setup(pop); } - -static Eina_Bool -_e_popup_idle_enterer(void *data) -{ - E_Popup *pop; - - if (!(pop = data)) return ECORE_CALLBACK_CANCEL; - ecore_evas_move(pop->ecore_evas, - pop->zone->x + pop->x, - pop->zone->y + pop->y); - e_container_shape_show(pop->shape); - pop->idle_enterer = NULL; - return ECORE_CALLBACK_CANCEL; -} - -static Eina_Bool -_e_popup_cb_window_shape(void *data __UNUSED__, int ev_type __UNUSED__, void *ev) -{ - E_Popup *pop; - Ecore_X_Event_Window_Shape *e; - - e = ev; - pop = e_popup_find_by_window(e->win); - if (pop) pop->need_shape_export = 1; - return ECORE_CALLBACK_PASS_ON; -} - diff --git a/src/bin/e_popup.h b/src/bin/e_popup.h index 3a389a73a..c3e034a2f 100644 --- a/src/bin/e_popup.h +++ b/src/bin/e_popup.h @@ -1,6 +1,7 @@ #ifdef E_TYPEDEFS typedef struct _E_Popup E_Popup; +typedef Eina_Bool (*E_Popup_Key_Cb)(void *, Ecore_Event_Key *); #else #ifndef E_POPUP_H @@ -13,37 +14,39 @@ struct _E_Popup E_Object e_obj_inherit; int x, y, w, h, zx, zy; - E_Layer layer; - unsigned char visible : 1; - unsigned char shaped : 1; - unsigned char need_shape_export : 1; + E_Comp_Canvas_Layer comp_layer; + E_Layer layer; - Ecore_Evas *ecore_evas; Evas *evas; - Ecore_X_Window evas_win; - E_Container_Shape *shape; + E_Comp_Win *cw; E_Zone *zone; - const char *name; - int shape_rects_num; - Ecore_X_Rectangle *shape_rects; - Ecore_Idle_Enterer *idle_enterer; + Ecore_Evas *ecore_evas; + E_Container_Shape *shape; + Evas_Object *content; + Eina_List *objects; + Eina_Stringshare *name; + E_Popup_Key_Cb key_cb; + void *key_data; + + Eina_Bool visible : 1; + Eina_Bool ignore_events : 1; + Eina_Bool autoclose : 1; }; EINTERN int e_popup_init(void); EINTERN int e_popup_shutdown(void); EAPI E_Popup *e_popup_new(E_Zone *zone, int x, int y, int w, int h); -EAPI void e_popup_name_set(E_Popup *pop, const char *name); EAPI void e_popup_show(E_Popup *pop); EAPI void e_popup_hide(E_Popup *pop); EAPI void e_popup_move(E_Popup *pop, int x, int y); EAPI void e_popup_resize(E_Popup *pop, int w, int h); +EAPI void e_popup_content_set(E_Popup *pop, Evas_Object *obj); EAPI void e_popup_move_resize(E_Popup *pop, int x, int y, int w, int h); EAPI void e_popup_ignore_events_set(E_Popup *pop, int ignore); -EAPI void e_popup_edje_bg_object_set(E_Popup *pop, Evas_Object *o); -EAPI void e_popup_layer_set(E_Popup *pop, E_Layer layer); -EAPI void e_popup_idler_before(void); -EAPI E_Popup *e_popup_find_by_window(Ecore_X_Window win); - +EAPI void e_popup_layer_set(E_Popup *pop, E_Comp_Canvas_Layer comp_layer, E_Layer layer); +EAPI void e_popup_name_set(E_Popup *pop, const char *name); +EAPI void e_popup_object_add(E_Popup *pop, Evas_Object *obj); +EAPI void e_popup_autoclose(E_Popup *pop, E_Popup_Key_Cb cb, const void *data); #endif #endif diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index 4f2859e1d..0f9995fbd 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -36,12 +36,10 @@ static Eina_Bool _e_shelf_on_current_desk(E_Shelf *es, E_Event_Zone_Edge *ev) static void _e_shelf_cb_dummy_del(E_Shelf *, Evas *e, Evas_Object *obj, void *event_info); static void _e_shelf_cb_dummy_moveresize(E_Shelf *, Evas *e, Evas_Object *obj, void *event_info); static Eina_Bool _e_shelf_gadcon_populate_handler_cb(void *, int, void *); -static Eina_Bool _e_shelf_module_init_end_handler_cb(void *, int, void *); static void _e_shelf_event_rename_end_cb(void *data, E_Event_Shelf *ev); static Eina_List *shelves = NULL; static Eina_List *dummies = NULL; -static Eina_Hash *winid_shelves = NULL; static int orientations[] = { @@ -96,7 +94,6 @@ e_shelf_init(void) E_EVENT_SHELF_ADD = ecore_event_type_new(); E_EVENT_SHELF_DEL = ecore_event_type_new(); _e_shelf_gadcon_populate_handler = ecore_event_handler_add(E_EVENT_GADCON_POPULATE, _e_shelf_gadcon_populate_handler_cb, NULL); - _e_shelf_module_init_end_handler = ecore_event_handler_add(E_EVENT_MODULE_INIT_END, _e_shelf_module_init_end_handler_cb, NULL); return 1; } @@ -217,29 +214,24 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, E { es->popup = e_popup_new(zone, es->x, es->y, es->w, es->h); e_popup_name_set(es->popup, "shelf"); - e_popup_layer_set(es->popup, layer); - es->ee = es->popup->ecore_evas; - es->evas = es->popup->evas; - } - else - { - es->ee = zone->container->bg_ecore_evas; - es->evas = zone->container->bg_evas; + if (layer) + e_popup_layer_set(es->popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_ABOVE); + else + e_popup_layer_set(es->popup, E_COMP_CANVAS_LAYER_DESKTOP_TOP, 0); } + es->ee = zone->container->bg_ecore_evas; + es->evas = zone->container->bg_evas; es->fit_along = 1; es->layer = layer; - es->o_event = evas_object_rectangle_add(es->evas); - evas_object_color_set(es->o_event, 0, 0, 0, 0); - evas_object_resize(es->o_event, es->w, es->h); - evas_object_event_callback_add(es->o_event, EVAS_CALLBACK_MOUSE_DOWN, - _e_shelf_cb_mouse_down, es); - es->handlers = eina_list_append(es->handlers, ecore_event_handler_add(E_EVENT_ZONE_EDGE_MOVE, _e_shelf_cb_mouse_in, es)); es->o_base = edje_object_add(es->evas); + evas_object_event_callback_add(es->o_base, EVAS_CALLBACK_MOUSE_DOWN, + _e_shelf_cb_mouse_down, es); + evas_object_name_set(es->o_base, name); es->name = eina_stringshare_add(name); evas_object_resize(es->o_base, es->w, es->h); @@ -247,16 +239,11 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, E if (es->popup) { - evas_object_show(es->o_event); - evas_object_show(es->o_base); - ecore_x_netwm_window_type_set(es->popup->evas_win, - ECORE_X_WINDOW_TYPE_DOCK); + e_popup_show(es->popup); } else { - evas_object_move(es->o_event, es->zone->x + es->x, es->zone->y + es->y); evas_object_move(es->o_base, es->zone->x + es->x, es->zone->y + es->y); - E_LAYER_SET(es->o_event, layer); E_LAYER_SET(es->o_base, layer); } @@ -288,23 +275,9 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, E e_gadcon_zone_set(es->gadcon, zone); e_gadcon_ecore_evas_set(es->gadcon, es->ee); e_gadcon_shelf_set(es->gadcon, es); - if (popup) - { - if (!winid_shelves) - winid_shelves = eina_hash_string_superfast_new(NULL); - eina_hash_add(winid_shelves, - e_util_winid_str_get(es->popup->evas_win), es); - e_drop_xdnd_register_set(es->popup->evas_win, 1); - e_gadcon_xdnd_window_set(es->gadcon, es->popup->evas_win); - e_gadcon_dnd_window_set(es->gadcon, es->popup->evas_win); - } - else - { - e_drop_xdnd_register_set(es->zone->container->bg_win, 1); - e_gadcon_xdnd_window_set(es->gadcon, es->zone->container->bg_win); - e_gadcon_dnd_window_set(es->gadcon, es->zone->container->event_win); - evas_object_clip_set(es->o_base, es->zone->bg_clip_object); - } + e_gadcon_xdnd_window_set(es->gadcon, e_comp_get(es)->win); + e_gadcon_dnd_window_set(es->gadcon, e_comp_get(es)->win); + evas_object_clip_set(es->o_base, es->zone->bg_clip_object); e_gadcon_util_menu_attach_func_set(es->gadcon, _e_shelf_cb_menu_items_append, es); @@ -387,10 +360,7 @@ e_shelf_show(E_Shelf *es) if (es->popup) e_popup_show(es->popup); else - { - evas_object_show(es->o_event); - evas_object_show(es->o_base); - } + evas_object_show(es->o_base); } EAPI void @@ -401,10 +371,7 @@ e_shelf_hide(E_Shelf *es) if (es->popup) e_popup_hide(es->popup); else - { - evas_object_hide(es->o_event); - evas_object_hide(es->o_base); - } + evas_object_hide(es->o_base); } EAPI void @@ -527,10 +494,7 @@ e_shelf_move(E_Shelf *es, int x, int y) if (es->popup) e_popup_move(es->popup, es->x, es->y); else - { - evas_object_move(es->o_event, es->zone->x + es->x, es->zone->y + es->y); - evas_object_move(es->o_base, es->zone->x + es->x, es->zone->y + es->y); - } + evas_object_move(es->o_base, es->zone->x + es->x, es->zone->y + es->y); } EAPI void @@ -540,9 +504,10 @@ e_shelf_resize(E_Shelf *es, int w, int h) E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE); es->w = w; es->h = h; - if (es->popup) e_popup_resize(es->popup, es->w, es->h); - evas_object_resize(es->o_event, es->w, es->h); - evas_object_resize(es->o_base, es->w, es->h); + if (es->popup) + e_popup_resize(es->popup, es->w, es->h); + else + evas_object_resize(es->o_base, es->w, es->h); } EAPI void @@ -558,26 +523,8 @@ e_shelf_move_resize(E_Shelf *es, int x, int y, int w, int h) e_popup_move_resize(es->popup, es->x, es->y, es->w, es->h); else { - evas_object_move(es->o_event, es->zone->x + es->x, es->zone->y + es->y); evas_object_move(es->o_base, es->zone->x + es->x, es->zone->y + es->y); - } - evas_object_resize(es->o_event, es->w, es->h); - evas_object_resize(es->o_base, es->w, es->h); -} - -EAPI void -e_shelf_layer_set(E_Shelf *es, E_Layer layer) -{ - E_OBJECT_CHECK(es); - E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE); - - es->layer = layer; - if (es->popup) - e_popup_layer_set(es->popup, es->layer); - else - { - E_LAYER_SET(es->o_event, layer); - E_LAYER_SET(es->o_base, layer); + evas_object_resize(es->o_base, es->w, es->h); } } @@ -900,7 +847,7 @@ e_shelf_position_calc(E_Shelf *es) } EAPI Eina_Bool -e_shelf_desk_visible(E_Shelf *es, E_Desk *desk) +e_shelf_desk_visible(const E_Shelf *es, const E_Desk *desk) { Eina_List *ll; E_Config_Shelf *cf_es; @@ -966,57 +913,7 @@ e_shelf_style_set(E_Shelf *es, const char *style) else es->instant_delay = -1.0; - if (es->popup) e_popup_edje_bg_object_set(es->popup, es->o_base); -} - -EAPI void -e_shelf_popup_set(E_Shelf *es, int popup) -{ - /* FIXME: Needs to recreate the evas objects. */ - E_OBJECT_CHECK(es); - E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE); - - if (!es->cfg) return; - if (((popup) && (es->popup)) || ((!popup) && (!es->popup))) return; - - if (popup) - { - evas_object_clip_unset(es->o_base); - es->popup = e_popup_new(es->zone, es->x, es->y, es->w, es->h); - e_popup_name_set(es->popup, "shelf"); - e_popup_layer_set(es->popup, es->cfg->layer); - - es->ee = es->popup->ecore_evas; - es->evas = es->popup->evas; - evas_object_show(es->o_event); - evas_object_show(es->o_base); - e_popup_edje_bg_object_set(es->popup, es->o_base); - ecore_x_netwm_window_type_set(es->popup->evas_win, - ECORE_X_WINDOW_TYPE_DOCK); - - e_drop_xdnd_register_set(es->popup->evas_win, 1); - e_gadcon_xdnd_window_set(es->gadcon, es->popup->evas_win); - e_gadcon_dnd_window_set(es->gadcon, es->popup->evas_win); - } - else - { - e_drop_xdnd_register_set(es->popup->evas_win, 0); - e_object_del(E_OBJECT(es->popup)); - es->popup = NULL; - - es->ee = es->zone->container->bg_ecore_evas; - es->evas = es->zone->container->bg_evas; - - evas_object_move(es->o_event, es->zone->x + es->x, es->zone->y + es->y); - evas_object_move(es->o_base, es->zone->x + es->x, es->zone->y + es->y); - E_LAYER_SET(es->o_event, es->cfg->layer); - E_LAYER_SET(es->o_base, es->cfg->layer); - - e_drop_xdnd_register_set(es->zone->container->bg_win, 1); - e_gadcon_xdnd_window_set(es->gadcon, es->zone->container->bg_win); - e_gadcon_dnd_window_set(es->gadcon, es->zone->container->event_win); - evas_object_clip_set(es->o_base, es->zone->bg_clip_object); - } + if (es->popup && (es->popup->content != es->o_base)) e_popup_content_set(es->popup, es->o_base); } EAPI void @@ -1066,7 +963,6 @@ EAPI E_Shelf * e_shelf_config_new(E_Zone *zone, E_Config_Shelf *cf_es) { E_Shelf *es; - Eina_Bool can_show = EINA_FALSE; es = e_shelf_zone_new(zone, cf_es->name, cf_es->style, cf_es->popup, cf_es->layer, cf_es->id); @@ -1080,37 +976,15 @@ e_shelf_config_new(E_Zone *zone, E_Config_Shelf *cf_es) e_shelf_autohide_set(es, cf_es->autohide + (cf_es->autohide * cf_es->autohide_show_action)); e_shelf_orient(es, cf_es->orient); - e_shelf_position_calc(es); e_shelf_populate(es); + e_shelf_position_calc(es); if (cf_es->desk_show_mode) { - E_Desk *desk; - Eina_List *ll; - E_Config_Shelf_Desk *sd; - - desk = e_desk_current_get(zone); - EINA_LIST_FOREACH(cf_es->desk_list, ll, sd) - { - if ((desk->x == sd->x) && (desk->y == sd->y)) - { - can_show = EINA_TRUE; - break; - } - } + if (e_shelf_desk_visible(es, NULL)) e_shelf_show(es); } else - can_show = EINA_TRUE; - - if (can_show) - { - /* at this point, we cleverly avoid showing the shelf - * if its gadcon has not populated; instead we show it in - * the E_EVENT_GADCON_POPULATE handler - */ - if ((es->gadcon->populated_classes && es->gadcon->clients) || (!es->gadcon->cf->clients)) - if (e_shelf_desk_visible(es, NULL)) e_shelf_show(es); - } + e_shelf_show(es); e_shelf_toggle(es, 0); return es; @@ -1286,21 +1160,9 @@ _e_shelf_free(E_Shelf *es) } if (es->config_dialog) e_object_del(E_OBJECT(es->config_dialog)); es->config_dialog = NULL; - evas_object_del(es->o_event); evas_object_del(es->o_base); - es->o_base = es->o_event = NULL; - if (es->popup) - { - e_drop_xdnd_register_set(es->popup->evas_win, 0); - eina_hash_del(winid_shelves, - e_util_winid_str_get(es->popup->evas_win), es); - if (!eina_hash_population(winid_shelves)) - { - eina_hash_free(winid_shelves); - winid_shelves = NULL; - } - e_object_del(E_OBJECT(es->popup)); - } + es->o_base = NULL; + if (es->popup) e_object_del(E_OBJECT(es->popup)); if (es->autohide_timer) ecore_timer_del(es->autohide_timer); es->autohide_timer = NULL; es->popup = NULL; @@ -1827,6 +1689,7 @@ _e_shelf_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNU break; case 3: + if (es->menu) return; mn = e_menu_new(); e_menu_post_deactivate_callback_set(mn, _e_shelf_cb_menu_post, es); es->menu = mn; @@ -1968,7 +1831,7 @@ _e_shelf_cb_mouse_in(void *data, int type, void *event) * mouse in/out events. in the future, when we remove systray, we should go * back to mouse in/out events */ - inside = (es->popup && ((ev->event_window == es->popup->evas_win))); + inside = (es->popup && ((ev->event_window == e_comp_get(es)->win))); if (!inside) { inside = E_INSIDE(ev->root.x, ev->root.y, es->zone->x, es->zone->y, es->zone->w + 4, es->zone->h + 4); @@ -2287,34 +2150,6 @@ _e_shelf_cb_instant_hide_timer(void *data) return ECORE_CALLBACK_CANCEL; } -static Eina_Bool -_e_shelf_module_init_end_timer_cb(void *data) -{ - E_Shelf *es = data; - if (e_shelf_desk_visible(es, NULL)) e_shelf_show(es); - es->module_init_end_timer = NULL; - return EINA_FALSE; -} - -static Eina_Bool -_e_shelf_module_init_end_handler_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) -{ - Eina_List *l; - E_Shelf *es; - - EINA_LIST_FOREACH(shelves, l, es) - { - if ((!es->gadcon->populate_requests) || (!es->gadcon->cf->clients)) - { - if (e_shelf_desk_visible(es, NULL)) - e_shelf_show(es); - } - else if (!es->module_init_end_timer) - es->module_init_end_timer = ecore_timer_add(3.0, _e_shelf_module_init_end_timer_cb, es); - } - return ECORE_CALLBACK_RENEW; -} - static Eina_Bool _e_shelf_gadcon_populate_handler_cb(void *data __UNUSED__, int type __UNUSED__, void *event) { diff --git a/src/bin/e_shelf.h b/src/bin/e_shelf.h index 81ee9588e..561790058 100644 --- a/src/bin/e_shelf.h +++ b/src/bin/e_shelf.h @@ -18,7 +18,6 @@ struct _E_Shelf E_Popup *popup; /* NULL if its within an existing canvas */ E_Zone *zone; Evas_Object *o_base; - Evas_Object *o_event; Ecore_Evas *ee; Evas *evas; E_Gadcon *gadcon; @@ -83,18 +82,16 @@ EAPI void e_shelf_urgent_show(E_Shelf *es); EAPI void e_shelf_move(E_Shelf *es, int x, int y); EAPI void e_shelf_resize(E_Shelf *es, int w, int h); EAPI void e_shelf_move_resize(E_Shelf *es, int x, int y, int w, int h); -EAPI void e_shelf_layer_set(E_Shelf *es, E_Layer layer); EAPI void e_shelf_save(E_Shelf *es); EAPI void e_shelf_unsave(E_Shelf *es); EAPI void e_shelf_orient(E_Shelf *es, E_Gadcon_Orient orient); EAPI const char *e_shelf_orient_string_get(E_Shelf *es); EAPI void e_shelf_position_calc(E_Shelf *es); EAPI void e_shelf_style_set(E_Shelf *es, const char *style); -EAPI void e_shelf_popup_set(E_Shelf *es, int popup); EAPI E_Shelf *e_shelf_config_new(E_Zone *zone, E_Config_Shelf *cf_es); EAPI void e_shelf_name_set(E_Shelf *es, const char *name); EAPI void e_shelf_rename_dialog(E_Shelf *es); EAPI void e_shelf_autohide_set(E_Shelf *es, int autohide_type); -EAPI Eina_Bool e_shelf_desk_visible(E_Shelf *es, E_Desk *desk); +EAPI Eina_Bool e_shelf_desk_visible(const E_Shelf *es, const E_Desk *desk); #endif #endif diff --git a/src/modules/backlight/e_mod_main.c b/src/modules/backlight/e_mod_main.c index 332073d45..092a52e97 100644 --- a/src/modules/backlight/e_mod_main.c +++ b/src/modules/backlight/e_mod_main.c @@ -39,9 +39,6 @@ struct _Instance Evas_Object *o_backlight, *o_table, *o_slider; E_Gadcon_Popup *popup; double val; - Ecore_X_Window input_win; - Ecore_Event_Handler *hand_mouse_down; - Ecore_Event_Handler *hand_key_down; }; static Eina_List *backlight_instances = NULL; @@ -63,39 +60,12 @@ _backlight_gadget_update(Instance *inst) edje_object_message_send(inst->o_backlight, EDJE_MESSAGE_FLOAT, 0, &msg); } -static void -_backlight_input_win_del(Instance *inst) -{ - if (!inst->input_win) return; - e_grabinput_release(0, inst->input_win); - ecore_x_window_free(inst->input_win); - inst->input_win = 0; - ecore_event_handler_del(inst->hand_mouse_down); - inst->hand_mouse_down = NULL; - ecore_event_handler_del(inst->hand_key_down); - inst->hand_key_down = NULL; -} - static Eina_Bool -_backlight_input_win_mouse_down_cb(void *data, int type __UNUSED__, void *event) +_backlight_win_key_down_cb(void *data, Ecore_Event_Key *ev) { - Ecore_Event_Mouse_Button *ev = event; - Instance *inst = data; - - if (ev->window != inst->input_win) return ECORE_CALLBACK_PASS_ON; - _backlight_popup_free(inst); - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_backlight_input_win_key_down_cb(void *data, int type __UNUSED__, void *event) -{ - Ecore_Event_Key *ev = event; Instance *inst = data; const char *keysym; - if (ev->window != inst->input_win) return ECORE_CALLBACK_PASS_ON; - keysym = ev->key; if (!strcmp(keysym, "Escape")) _backlight_popup_free(inst); @@ -183,33 +153,6 @@ _backlight_input_win_key_down_cb(void *data, int type __UNUSED__, void *event) return ECORE_CALLBACK_PASS_ON; } -static void -_backlight_input_win_new(Instance *inst) -{ - Ecore_X_Window_Configure_Mask mask; - Ecore_X_Window w, popup_w; - E_Manager *man; - - man = inst->gcc->gadcon->zone->container->manager; - - w = ecore_x_window_input_new(man->root, 0, 0, man->w, man->h); - mask = (ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE | - ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING); - popup_w = inst->popup->win->evas_win; - ecore_x_window_configure(w, mask, 0, 0, 0, 0, 0, popup_w, - ECORE_X_WINDOW_STACK_BELOW); - ecore_x_window_show(w); - - inst->hand_mouse_down = - ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, - _backlight_input_win_mouse_down_cb, inst); - inst->hand_key_down = - ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, - _backlight_input_win_key_down_cb, inst); - inst->input_win = w; - e_grabinput_get(0, 0, inst->input_win); -} - static void _backlight_settings_cb(void *d1, void *d2 __UNUSED__) { @@ -227,6 +170,12 @@ _slider_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) e_backlight_level_set(inst->gcc->gadcon->zone, inst->val, 0.0); } +static void +_backlight_popup_del_cb(void *obj) +{ + _backlight_popup_free(e_object_data_get(obj)); +} + static void _backlight_popup_new(Instance *inst) { @@ -257,20 +206,16 @@ _backlight_popup_new(Instance *inst) 0, 1, 1, 1, 0, 0, 0, 0, 0.5, 1.0); e_gadcon_popup_content_set(inst->popup, inst->o_table); + e_popup_autoclose(inst->popup->win, _backlight_win_key_down_cb, inst); e_gadcon_popup_show(inst->popup); - _backlight_input_win_new(inst); + e_object_data_set(E_OBJECT(inst->popup), inst); + E_OBJECT_DEL_SET(inst->popup, _backlight_popup_del_cb); } static void _backlight_popup_free(Instance *inst) { - if (!inst->popup) return; - if (inst->popup) - { - _backlight_input_win_del(inst); - e_object_del(E_OBJECT(inst->popup)); - inst->popup = NULL; - } + E_FN_DEL(e_object_del, inst->popup); } static void @@ -392,7 +337,6 @@ _gc_shutdown(E_Gadcon_Client *gcc) Instance *inst; inst = gcc->data; - _backlight_input_win_del(inst); _backlight_popup_free(inst); backlight_instances = eina_list_remove(backlight_instances, inst); evas_object_del(inst->o_backlight); diff --git a/src/modules/conf_comp/e_mod_config.c b/src/modules/conf_comp/e_mod_config.c index 7914089e5..12e640aa3 100644 --- a/src/modules/conf_comp/e_mod_config.c +++ b/src/modules/conf_comp/e_mod_config.c @@ -22,6 +22,7 @@ struct _E_Config_Dialog_Data int disable_borders; int disable_overrides; int disable_menus; + int disable_objects; int disable_all; int toggle_changed : 1; } match; @@ -46,6 +47,7 @@ struct _E_Config_Dialog_Data int fast_borders; int fast_menus; int fast_overrides; + int fast_objects; int fast; Evas_Object *fast_ob; int fast_changed : 1; @@ -106,10 +108,12 @@ _create_data(E_Config_Dialog *cfd EINA_UNUSED) cfdata->fast_borders = _comp_mod->conf->fast_borders; cfdata->fast_overrides = _comp_mod->conf->fast_overrides; cfdata->fast_menus = _comp_mod->conf->fast_menus; + cfdata->fast_objects = _comp_mod->conf->fast_objects; cfdata->match.disable_popups = _comp_mod->conf->match.disable_popups; cfdata->match.disable_borders = _comp_mod->conf->match.disable_borders; cfdata->match.disable_overrides = _comp_mod->conf->match.disable_overrides; cfdata->match.disable_menus = _comp_mod->conf->match.disable_menus; + cfdata->match.disable_objects = _comp_mod->conf->match.disable_objects; cfdata->disable_screen_effects = _comp_mod->conf->disable_screen_effects; cfdata->indirect = _comp_mod->conf->indirect; @@ -210,6 +214,9 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data p = ob = e_widget_check_add(evas, _("Enable fast composite effects for popups"), &(cfdata->fast_popups)); e_widget_disabled_set(ob, cfdata->match.disable_popups); e_widget_framelist_object_append(of, ob); + p = ob = e_widget_check_add(evas, _("Enable fast composite effects for objects"), &(cfdata->fast_objects)); + e_widget_disabled_set(ob, cfdata->match.disable_objects); + e_widget_framelist_object_append(of, ob); o = ob = e_widget_check_add(evas, _("Enable fast composite effects for overrides"), &(cfdata->fast_overrides)); e_widget_disabled_set(ob, cfdata->match.disable_overrides); e_widget_framelist_object_append(of, ob); @@ -225,6 +232,9 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data ob = e_widget_check_add(evas, _("Disable composite effects for popups"), &(cfdata->match.disable_popups)); e_widget_on_change_hook_set(ob, _advanced_comp_style_toggle, p); e_widget_framelist_object_append(of, ob); + ob = e_widget_check_add(evas, _("Disable composite effects for objects"), &(cfdata->match.disable_objects)); + e_widget_on_change_hook_set(ob, _advanced_comp_style_toggle, p); + e_widget_framelist_object_append(of, ob); ob = e_widget_check_add(evas, _("Disable composite effects for overrides"), &(cfdata->match.disable_overrides)); e_widget_on_change_hook_set(ob, _advanced_comp_style_toggle, o); e_widget_framelist_object_append(of, ob); @@ -432,21 +442,25 @@ _advanced_apply_data(E_Config_Dialog *cfd __UNUSED__, (_comp_mod->conf->match.disable_borders != cfdata->match.disable_borders) || (_comp_mod->conf->match.disable_overrides != cfdata->match.disable_overrides) || (_comp_mod->conf->match.disable_menus != cfdata->match.disable_menus) || + (_comp_mod->conf->match.disable_objects != cfdata->match.disable_objects) || (_comp_mod->conf->disable_screen_effects != cfdata->disable_screen_effects) || (_comp_mod->conf->fast_popups != cfdata->fast_popups) || (_comp_mod->conf->fast_borders != cfdata->fast_borders) || (_comp_mod->conf->fast_overrides != cfdata->fast_overrides) || - (_comp_mod->conf->fast_menus != cfdata->fast_menus) + (_comp_mod->conf->fast_menus != cfdata->fast_menus) || + (_comp_mod->conf->fast_objects != cfdata->fast_objects) ) { _comp_mod->conf->fast_popups = cfdata->fast_popups; _comp_mod->conf->fast_borders = cfdata->fast_borders; _comp_mod->conf->fast_overrides = cfdata->fast_overrides; _comp_mod->conf->fast_menus = cfdata->fast_menus; + _comp_mod->conf->fast_objects = cfdata->fast_objects; _comp_mod->conf->match.disable_popups = cfdata->match.disable_popups; _comp_mod->conf->match.disable_borders = cfdata->match.disable_borders; _comp_mod->conf->match.disable_overrides = cfdata->match.disable_overrides; _comp_mod->conf->match.disable_menus = cfdata->match.disable_menus; + _comp_mod->conf->match.disable_objects = cfdata->match.disable_objects; _comp_mod->conf->disable_screen_effects = cfdata->disable_screen_effects; _comp_mod->conf->lock_fps = cfdata->lock_fps; _comp_mod->conf->smooth_windows = cfdata->smooth_windows; @@ -536,7 +550,7 @@ _basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, e_widget_list_object_append(ol, ob, 1, 0, 0.5); cfdata->fast = - (cfdata->fast_menus && cfdata->fast_menus && cfdata->fast_borders && cfdata->fast_popups); + (cfdata->fast_menus && cfdata->fast_menus && cfdata->fast_borders && cfdata->fast_popups && cfdata->fast_objects); cfdata->fast_ob = ob = e_widget_check_add(evas, _("Enable \"fast\" composite effects"), &(cfdata->fast)); evas_object_data_set(ob, "cfdata", cfdata); e_widget_list_object_append(ol, ob, 1, 0, 0.5); @@ -544,7 +558,7 @@ _basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, cfdata->match.disable_all = (cfdata->match.disable_menus && cfdata->match.disable_menus && cfdata->match.disable_borders && - cfdata->match.disable_popups && cfdata->disable_screen_effects); + cfdata->match.disable_popups && cfdata->match.disable_objects && cfdata->disable_screen_effects); e_widget_disabled_set(ob, cfdata->match.disable_all); ob = e_widget_check_add(evas, _("Disable composite effects"), &(cfdata->match.disable_all)); evas_object_data_set(ob, "cfdata", cfdata); @@ -615,6 +629,7 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, _comp_mod->conf->match.disable_borders = cfdata->match.disable_borders = cfdata->match.disable_all; _comp_mod->conf->match.disable_overrides = cfdata->match.disable_overrides = cfdata->match.disable_all; _comp_mod->conf->match.disable_menus = cfdata->match.disable_menus = cfdata->match.disable_all; + _comp_mod->conf->match.disable_objects = cfdata->match.disable_objects = cfdata->match.disable_all; _comp_mod->conf->disable_screen_effects = cfdata->disable_screen_effects = cfdata->match.disable_all; } if (cfdata->fast_changed) @@ -622,6 +637,7 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, _comp_mod->conf->fast_borders = cfdata->fast_borders = cfdata->fast; _comp_mod->conf->fast_popups = cfdata->fast_popups = cfdata->fast; _comp_mod->conf->fast_menus = cfdata->fast_menus = cfdata->fast; + _comp_mod->conf->fast_objects = cfdata->fast_objects = cfdata->fast; _comp_mod->conf->fast_overrides = cfdata->fast_overrides = cfdata->fast; } _comp_mod->conf->lock_fps = cfdata->lock_fps; diff --git a/src/modules/connman/e_mod_main.c b/src/modules/connman/e_mod_main.c index c9267fb55..fdee64a9d 100644 --- a/src/modules/connman/e_mod_main.c +++ b/src/modules/connman/e_mod_main.c @@ -177,54 +177,6 @@ econnman_mod_services_changed(struct Connman_Manager *cm) } } -static Eina_Bool -_econnman_popup_input_window_mouse_up_cb(void *data, int type, void *event) -{ - Ecore_Event_Mouse_Button *ev = event; - E_Connman_Instance *inst = data; - - if (ev->window != inst->ui.popup.input_win) - return ECORE_CALLBACK_PASS_ON; - - econnman_popup_del(inst); - - return ECORE_CALLBACK_PASS_ON; -} - -static void -_econnman_popup_input_window_destroy(E_Connman_Instance *inst) -{ - ecore_x_window_free(inst->ui.popup.input_win); - inst->ui.popup.input_win = 0; - - ecore_event_handler_del(inst->ui.popup.input_mouse_up); - inst->ui.popup.input_mouse_up = NULL; -} - -static void -_econnman_popup_input_window_create(E_Connman_Instance *inst) -{ - Ecore_X_Window_Configure_Mask mask; - Ecore_X_Window w, popup_w; - E_Manager *man; - - man = e_manager_current_get(); - - w = ecore_x_window_input_new(man->root, 0, 0, man->w, man->h); - mask = (ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE | - ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING); - popup_w = inst->popup->win->evas_win; - ecore_x_window_configure(w, mask, 0, 0, 0, 0, 0, popup_w, - ECORE_X_WINDOW_STACK_BELOW); - ecore_x_window_show(w); - - inst->ui.popup.input_mouse_up = - ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, - _econnman_popup_input_window_mouse_up_cb, inst); - - inst->ui.popup.input_win = w; -} - static void _econnman_app_launch(E_Connman_Instance *inst) { @@ -292,6 +244,12 @@ _e_connman_widget_size_set(E_Connman_Instance *inst, Evas_Object *widget, Evas_C e_widget_size_min_set(widget, w, h); } +static void +_econnman_popup_del_cb(void *obj) +{ + econnman_popup_del(e_object_data_get(obj)); +} + static void _econnman_popup_new(E_Connman_Instance *inst) { @@ -327,17 +285,16 @@ _econnman_popup_new(E_Connman_Instance *inst) /* 30,40 % -- min vga, max uvga */ _e_connman_widget_size_set(inst, list, 30, 40, 192, 192, 384, 384); e_gadcon_popup_content_set(inst->popup, list); + e_popup_autoclose(inst->popup->win, NULL, NULL); e_gadcon_popup_show(inst->popup); - _econnman_popup_input_window_create(inst); + e_object_data_set(E_OBJECT(inst->popup), inst); + E_OBJECT_DEL_SET(inst->popup, _econnman_popup_del_cb); } void econnman_popup_del(E_Connman_Instance *inst) { - if (!inst->popup) return; - _econnman_popup_input_window_destroy(inst); - e_object_del(E_OBJECT(inst->popup)); - inst->popup = NULL; + E_FN_DEL(e_object_del, inst->popup); } static void diff --git a/src/modules/connman/e_mod_main.h b/src/modules/connman/e_mod_main.h index bac950843..e3392755e 100644 --- a/src/modules/connman/e_mod_main.h +++ b/src/modules/connman/e_mod_main.h @@ -30,9 +30,6 @@ struct E_Connman_Instance { Evas_Object *list; Evas_Object *powered; - - Ecore_X_Window input_win; - Ecore_Event_Handler *input_mouse_up; } popup; } ui; }; diff --git a/src/modules/fileman/e_fwin.c b/src/modules/fileman/e_fwin.c index 0de5acc57..0f8f0c0ce 100644 --- a/src/modules/fileman/e_fwin.c +++ b/src/modules/fileman/e_fwin.c @@ -484,13 +484,13 @@ e_fwin_zone_new(E_Zone *zone, void *p) _e_fwin_pan_child_size_get); evas_object_propagate_events_set(page->fm_obj, 0); e_widget_can_focus_set(o, 0); - E_LAYER_SET(o, E_COMP_CANVAS_LAYER_DESKTOP); - page->scrollframe_obj = page->scr = o; - + evas_object_name_set(o, "zone_fwin"); e_zone_useful_geometry_get(zone, &x, &y, &w, &h); evas_object_move(o, x, y); evas_object_resize(o, w, h); + E_LAYER_SET_UNDER(o, E_COMP_CANVAS_LAYER_DESKTOP); evas_object_show(o); + page->scrollframe_obj = page->scr = o; e_fm2_window_object_set(page->fm_obj, E_OBJECT(fwin->zone)); @@ -799,12 +799,10 @@ _e_fwin_icon_popup(void *data) fx = fwin->win->x, fy = fwin->win->y; fwin->popup = e_popup_new(zone, 0, 0, 1, 1); e_popup_ignore_events_set(fwin->popup, 1); - ecore_x_window_shape_input_rectangle_set(fwin->popup->evas_win, 0, 0, 0, 0); bg = edje_object_add(fwin->popup->evas); e_theme_edje_object_set(bg, "base/theme/fileman", "e/fileman/popup/default"); - e_popup_edje_bg_object_set(fwin->popup, bg); mw = zone->w * fileman_config->tooltip.size / 100.0; mh = zone->h * fileman_config->tooltip.size / 100.0; @@ -822,9 +820,7 @@ _e_fwin_icon_popup(void *data) edje_object_part_swallow(bg, "e.swallow.content", list); edje_object_size_min_calc(bg, &mw, &mh); - evas_object_show(o); - evas_object_show(list); - evas_object_show(bg); + e_popup_object_add(fwin->popup, list); /* prefer tooltip left of icon */ px = (fx + x) - mw - 3; @@ -846,7 +842,7 @@ _e_fwin_icon_popup(void *data) /* give up */ if (py < 0) py = 0; e_popup_move_resize(fwin->popup, px, py, mw, mh); - evas_object_resize(bg, mw, mh); + e_popup_content_set(fwin->popup, bg); if (!fwin->popup_handlers) { E_LIST_HANDLER_APPEND(fwin->popup_handlers, ECORE_X_EVENT_XDND_ENTER, _e_fwin_icon_popup_handler, fwin); diff --git a/src/modules/gadman/e_mod_gadman.c b/src/modules/gadman/e_mod_gadman.c index 3e1dd2b0e..2986286dd 100644 --- a/src/modules/gadman/e_mod_gadman.c +++ b/src/modules/gadman/e_mod_gadman.c @@ -300,8 +300,9 @@ gadman_gadget_place(E_Gadcon_Client *gcc, const E_Gadcon_Client_Class *cc, E_Con edje_object_signal_emit(gcc->o_frame, "e,state,visibility,hide", "e"); else { - E_LAYER_SET(gcc->o_base, E_COMP_CANVAS_LAYER_DESKTOP); - E_LAYER_SET(gcc->o_frame, E_COMP_CANVAS_LAYER_DESKTOP); + /* FIXME: comp */ + evas_object_layer_set(gcc->o_base, E_COMP_CANVAS_LAYER_DESKTOP); + evas_object_layer_set(gcc->o_frame, E_COMP_CANVAS_LAYER_DESKTOP); } if (cc->name) { @@ -866,7 +867,7 @@ _create_mover(E_Gadcon *gc) mover = edje_object_add(gc->evas); if (gc->id == ID_GADMAN_LAYER_BG) { - E_LAYER_SET_ABOVE(mover, E_COMP_CANVAS_LAYER_DESKTOP); + evas_object_layer_set(mover, E_COMP_CANVAS_LAYER_DESKTOP); evas_object_event_callback_add(mover, EVAS_CALLBACK_DEL, _mover_del, NULL); } e_theme_edje_object_set(mover, "base/theme/gadman", "e/gadman/control"); @@ -901,10 +902,6 @@ _create_mover(E_Gadcon *gc) edje_object_signal_callback_add(mover, "e,action,resize,up,go", "", on_top, (void *)DRAG_MOVE); - evas_object_move(mover, 20, 30); - evas_object_resize(mover, 100, 100); - evas_object_hide(mover); - return mover; } diff --git a/src/modules/illume-keyboard/e_kbd_int.c b/src/modules/illume-keyboard/e_kbd_int.c index 713826ff9..9ac965ee0 100644 --- a/src/modules/illume-keyboard/e_kbd_int.c +++ b/src/modules/illume-keyboard/e_kbd_int.c @@ -529,7 +529,7 @@ _e_kbd_int_zoomkey_up(E_Kbd_Int *ki) if (ki->zoomkey.popup) return; ki->zoomkey.popup = e_popup_new(ki->win->border->zone, -1, -1, 1, 1); - e_popup_layer_set(ki->zoomkey.popup, 190); + e_popup_layer_set(ki->zoomkey.popup, E_COMP_CANVAS_LAYER_LAYOUT, 190); o = _theme_obj_new(ki->zoomkey.popup->evas, ki->themedir, "e/modules/kbd/zoom/default"); @@ -625,9 +625,9 @@ _e_kbd_int_zoomkey_up(E_Kbd_Int *ki) evas_object_resize(ki->zoomkey.base_obj, ki->zoomkey.popup->w, ki->zoomkey.popup->h); evas_object_show(ki->zoomkey.base_obj); - e_popup_edje_bg_object_set(ki->zoomkey.popup, ki->zoomkey.base_obj); + e_popup_content_set(ki->zoomkey.popup, ki->zoomkey.base_obj); e_popup_show(ki->zoomkey.popup); - e_popup_layer_set(ki->zoomkey.popup, 190); + e_popup_layer_set(ki->zoomkey.popup, E_COMP_CANVAS_LAYER_LAYOUT, 190); } static void @@ -1453,7 +1453,7 @@ _e_kbd_int_dictlist_up(E_Kbd_Int *ki) if (ki->dictlist.popup) return; ki->dictlist.popup = e_popup_new(ki->win->border->zone, -1, -1, 1, 1); - e_popup_layer_set(ki->dictlist.popup, 190); + e_popup_layer_set(ki->dictlist.popup, E_COMP_CANVAS_LAYER_LAYOUT, 190); o = _theme_obj_new(ki->dictlist.popup->evas, ki->themedir, "e/modules/kbd/match/default"); @@ -1553,7 +1553,7 @@ _e_kbd_int_dictlist_up(E_Kbd_Int *ki) evas_object_resize(ki->dictlist.base_obj, ki->dictlist.popup->w, ki->dictlist.popup->h); evas_object_show(ki->dictlist.base_obj); - e_popup_edje_bg_object_set(ki->dictlist.popup, ki->dictlist.base_obj); + e_popup_content_set(ki->dictlist.popup, ki->dictlist.base_obj); e_popup_show(ki->dictlist.popup); _e_kbd_int_matchlist_down(ki); } @@ -1600,7 +1600,7 @@ _e_kbd_int_matchlist_up(E_Kbd_Int *ki) if (!e_kbd_buf_string_matches_get(ki->kbuf)) return; if (ki->matchlist.popup) return; ki->matchlist.popup = e_popup_new(ki->win->border->zone, -1, -1, 1, 1); - e_popup_layer_set(ki->matchlist.popup, 190); + e_popup_layer_set(ki->matchlist.popup, E_COMP_CANVAS_LAYER_LAYOUT, 190); o = _theme_obj_new(ki->matchlist.popup->evas, ki->themedir, "e/modules/kbd/match/default"); @@ -1657,7 +1657,7 @@ _e_kbd_int_matchlist_up(E_Kbd_Int *ki) evas_object_resize(ki->matchlist.base_obj, ki->matchlist.popup->w, ki->matchlist.popup->h); evas_object_show(ki->matchlist.base_obj); - e_popup_edje_bg_object_set(ki->matchlist.popup, ki->matchlist.base_obj); + e_popup_content_set(ki->matchlist.popup, ki->matchlist.base_obj); e_popup_show(ki->matchlist.popup); _e_kbd_int_dictlist_down(ki); diff --git a/src/modules/mixer/e_mod_main.c b/src/modules/mixer/e_mod_main.c index 438e963c2..8fbe5630a 100644 --- a/src/modules/mixer/e_mod_main.c +++ b/src/modules/mixer/e_mod_main.c @@ -484,29 +484,11 @@ _mixer_app_cb_del(E_Dialog *dialog __UNUSED__, void *data) static void _mixer_popup_del(E_Mixer_Instance *inst); static Eina_Bool -_mixer_popup_input_window_mouse_up_cb(void *data, int type __UNUSED__, void *event) +_mixer_popup_key_down_cb(void *data, Ecore_Event_Key *ev) { - Ecore_Event_Mouse_Button *ev = event; - E_Mixer_Instance *inst = data; - - if (ev->window != inst->ui.input.win) - return ECORE_CALLBACK_PASS_ON; - - _mixer_popup_del(inst); - - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_mixer_popup_input_window_key_down_cb(void *data, int type __UNUSED__, void *event) -{ - Ecore_Event_Key *ev = event; E_Mixer_Instance *inst = data; const char *keysym; - if (ev->window != inst->ui.input.win) - return ECORE_CALLBACK_PASS_ON; - keysym = ev->key; if (strcmp(keysym, "Escape") == 0) _mixer_popup_del(inst); @@ -561,53 +543,9 @@ _mixer_popup_input_window_key_down_cb(void *data, int type __UNUSED__, void *eve return ECORE_CALLBACK_PASS_ON; } -static void -_mixer_popup_input_window_destroy(E_Mixer_Instance *inst) -{ - e_grabinput_release(0, inst->ui.input.win); - ecore_x_window_free(inst->ui.input.win); - inst->ui.input.win = 0; - - ecore_event_handler_del(inst->ui.input.mouse_up); - inst->ui.input.mouse_up = NULL; - - ecore_event_handler_del(inst->ui.input.key_down); - inst->ui.input.key_down = NULL; -} - -static void -_mixer_popup_input_window_create(E_Mixer_Instance *inst) -{ - Ecore_X_Window_Configure_Mask mask; - Ecore_X_Window w, popup_w; - E_Manager *man; - - man = e_manager_current_get(); - - w = ecore_x_window_input_new(man->root, 0, 0, man->w, man->h); - mask = (ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE | - ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING); - popup_w = inst->popup->win->evas_win; - ecore_x_window_configure(w, mask, 0, 0, 0, 0, 0, popup_w, - ECORE_X_WINDOW_STACK_BELOW); - ecore_x_window_show(w); - - inst->ui.input.mouse_up = - ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, - _mixer_popup_input_window_mouse_up_cb, inst); - - inst->ui.input.key_down = - ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, - _mixer_popup_input_window_key_down_cb, inst); - - inst->ui.input.win = w; - e_grabinput_get(0, 0, inst->ui.input.win); -} - static void _mixer_popup_del(E_Mixer_Instance *inst) { - _mixer_popup_input_window_destroy(inst); e_object_del(E_OBJECT(inst->popup)); inst->ui.label = NULL; inst->ui.left = NULL; @@ -621,6 +559,12 @@ _mixer_popup_del(E_Mixer_Instance *inst) inst->popup_timer = NULL; } +static void +_mixer_popup_del_cb(void *obj) +{ + _mixer_popup_del(e_object_data_get(obj)); +} + static void _mixer_app_select_current(E_Dialog *dialog, E_Mixer_Instance *inst) { @@ -724,8 +668,10 @@ _mixer_popup_new(E_Mixer_Instance *inst) e_widget_size_min_set(inst->ui.table, mw, mh); e_gadcon_popup_content_set(inst->popup, inst->ui.table); + e_popup_autoclose(inst->popup->win, _mixer_popup_key_down_cb, inst); e_gadcon_popup_show(inst->popup); - _mixer_popup_input_window_create(inst); + e_object_data_set(E_OBJECT(inst->popup), inst); + E_OBJECT_DEL_SET(inst->popup, _mixer_popup_del_cb); } static void @@ -806,8 +752,6 @@ _mixer_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSE { if (!inst->popup) _mixer_popup_new(inst); - else - _mixer_popup_del(inst); } else if (ev->button == 2) _mixer_toggle_mute(inst, EINA_FALSE); diff --git a/src/modules/mixer/e_mod_main.h b/src/modules/mixer/e_mod_main.h index cd79174ba..910b6443d 100644 --- a/src/modules/mixer/e_mod_main.h +++ b/src/modules/mixer/e_mod_main.h @@ -47,12 +47,6 @@ typedef struct E_Mixer_Instance Evas_Object *mute; Evas_Object *table; Evas_Object *button; - struct - { - Ecore_X_Window win; - Ecore_Event_Handler *mouse_up; - Ecore_Event_Handler *key_down; - } input; } ui; E_Mixer_System *sys; diff --git a/src/modules/music-control/private.h b/src/modules/music-control/private.h index ec18bf460..2248eb347 100644 --- a/src/modules/music-control/private.h +++ b/src/modules/music-control/private.h @@ -29,9 +29,6 @@ typedef struct _E_Music_Control_Instance Evas_Object *gadget; E_Gadcon_Popup *popup; Evas_Object *content_popup; - Ecore_X_Window win; - Ecore_Event_Handler *mouse_up; - Ecore_Event_Handler *key_down; } E_Music_Control_Instance; void music_control_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event); diff --git a/src/modules/music-control/ui.c b/src/modules/music-control/ui.c index 8b1f04402..33c655616 100644 --- a/src/modules/music-control/ui.c +++ b/src/modules/music-control/ui.c @@ -56,57 +56,10 @@ _player_name_update(E_Music_Control_Instance *inst) edje_object_message_send(inst->content_popup, EDJE_MESSAGE_STRING, 0, &msg); } -static Eina_Bool -_popup_input_window_mouse_up_cb(void *data, int type __UNUSED__, void *event) -{ - Ecore_Event_Mouse_Button *ev = event; - E_Music_Control_Instance *inst = data; - if (ev->window == inst->win) - music_control_popup_del(inst); - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_popup_input_window_key_down_cb(void *data, int type __UNUSED__, void *event) -{ - Ecore_Event_Key *ev = event; - E_Music_Control_Instance *inst = data; - if (ev->window == inst->win) - music_control_popup_del(inst); - return ECORE_CALLBACK_PASS_ON; -} - static void -_popup_input_window_create(E_Music_Control_Instance *inst) +_popup_del_cb(void *obj) { - Ecore_X_Window_Configure_Mask mask; - Ecore_X_Window popup_w; - E_Manager *man = e_manager_current_get(); - - inst->win = ecore_x_window_input_new(man->root, 0, 0, man->w, man->h); - mask = (ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE | - ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING); - popup_w = inst->popup->win->evas_win; - ecore_x_window_configure(inst->win, mask, 0, 0, 0, 0, 0, popup_w, - ECORE_X_WINDOW_STACK_BELOW); - ecore_x_window_show(inst->win); - - inst->mouse_up = - ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, - _popup_input_window_mouse_up_cb, inst); - inst->key_down = - ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, - _popup_input_window_key_down_cb, inst); - e_grabinput_get(0, 0, inst->win); -} - -static void -_popup_input_window_destroy(E_Music_Control_Instance *inst) -{ - e_grabinput_release(0, inst->win); - ecore_x_window_free(inst->win); - ecore_event_handler_del(inst->mouse_up); - ecore_event_handler_del(inst->key_down); + music_control_popup_del(e_object_data_get(obj)); } static void @@ -126,17 +79,16 @@ _popup_new(E_Music_Control_Instance *inst) _player_name_update(inst); _play_state_update(inst, EINA_TRUE); + e_popup_autoclose(inst->popup->win, NULL, NULL); e_gadcon_popup_show(inst->popup); - _popup_input_window_create(inst); + e_object_data_set(E_OBJECT(inst->popup), inst); + E_OBJECT_DEL_SET(inst->popup, _popup_del_cb); } void music_control_popup_del(E_Music_Control_Instance *inst) { - e_gadcon_popup_hide(inst->popup); - _popup_input_window_destroy(inst); - e_object_del(E_OBJECT(inst->popup)); - inst->popup = NULL; + E_FN_DEL(e_object_del, inst->popup); } struct _E_Config_Dialog_Data diff --git a/src/modules/notification/e_mod_popup.c b/src/modules/notification/e_mod_popup.c index ebb38347f..9b9c52847 100644 --- a/src/modules/notification/e_mod_popup.c +++ b/src/modules/notification/e_mod_popup.c @@ -211,7 +211,7 @@ _notification_popup_new(E_Notification_Notify *n, unsigned id) "modules/notification/main")) edje_object_file_set(popup->theme, buf, "modules/notification/main"); - e_popup_edje_bg_object_set(popup->win, popup->theme); + e_popup_content_set(popup->win, popup->theme); evas_object_show(popup->theme); edje_object_signal_callback_add @@ -227,7 +227,6 @@ _notification_popup_new(E_Notification_Notify *n, unsigned id) _notification_popup_refresh(popup); next_pos = _notification_popup_place(popup, next_pos); e_popup_show(popup->win); - e_popup_layer_set(popup->win, E_LAYER_POPUP); popups_displayed++; return popup; diff --git a/src/modules/pager/e_mod_main.c b/src/modules/pager/e_mod_main.c index 1f79a256b..a676fe952 100644 --- a/src/modules/pager/e_mod_main.c +++ b/src/modules/pager/e_mod_main.c @@ -775,7 +775,6 @@ _pager_popup_new(E_Zone *zone, int keyaction) free(pp); return NULL; } - e_popup_layer_set(pp->popup, E_LAYER_POPUP); pp->pager = _pager_new(pp->popup->evas, zone, NULL); pp->pager->popup = pp; @@ -807,15 +806,16 @@ _pager_popup_new(E_Zone *zone, int keyaction) evas_object_move(pp->o_bg, 0, 0); evas_object_resize(pp->o_bg, w, h); - e_popup_edje_bg_object_set(pp->popup, pp->o_bg); + e_popup_content_set(pp->popup, pp->o_bg); //e_popup_ignore_events_set(pp->popup, 1); e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh); zx -= zone->x; zy -= zone->y; e_popup_move_resize(pp->popup, zx + ((zw - w) / 2), zy + ((zh - h) / 2), w, h); - e_bindings_mouse_grab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); - e_bindings_wheel_grab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); + /* FIXME: COMP */ + //e_bindings_mouse_grab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); + //e_bindings_wheel_grab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); e_popup_show(pp->popup); @@ -830,8 +830,9 @@ _pager_popup_free(Pager_Popup *pp) if (pp->timer) ecore_timer_del(pp->timer); evas_object_del(pp->o_bg); _pager_free(pp->pager); - e_bindings_mouse_ungrab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); - e_bindings_wheel_ungrab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); + /* FIXME: COMP */ + //e_bindings_mouse_ungrab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); + //e_bindings_wheel_ungrab(E_BINDING_CONTEXT_POPUP, pp->popup->evas_win); e_object_del(E_OBJECT(pp->popup)); free(pp); } @@ -2476,7 +2477,8 @@ _pager_popup_show(void) _pager_drop_cb_leave, _pager_drop_cb_drop, drop, 3, x, y, w, h); - e_bindings_key_grab(E_BINDING_CONTEXT_POPUP, act_popup->popup->evas_win); + /* FIXME: COMP */ + //e_bindings_key_grab(E_BINDING_CONTEXT_POPUP, act_popup->popup->evas_win); evas_event_freeze(act_popup->popup->evas); evas_event_feed_mouse_in(act_popup->popup->evas, @@ -2493,7 +2495,8 @@ _pager_popup_show(void) static void _pager_popup_hide(int switch_desk) { - e_bindings_key_ungrab(E_BINDING_CONTEXT_POPUP, act_popup->popup->evas_win); + /* FIXME: COMP */ + //e_bindings_key_ungrab(E_BINDING_CONTEXT_POPUP, act_popup->popup->evas_win); hold_count = 0; hold_mod = 0; while (handlers) diff --git a/src/modules/syscon/e_syscon.c b/src/modules/syscon/e_syscon.c index 01b01f57b..eb52e3db0 100644 --- a/src/modules/syscon/e_syscon.c +++ b/src/modules/syscon/e_syscon.c @@ -97,7 +97,6 @@ e_syscon_show(E_Zone *zone, const char *defact) return 0; } evas_event_freeze(popup->evas); - e_popup_layer_set(popup, E_LAYER_POPUP); handlers = eina_list_append (handlers, ecore_event_handler_add @@ -296,7 +295,7 @@ e_syscon_show(E_Zone *zone, const char *defact) evas_object_move(o_bg, 0, 0); evas_object_resize(o_bg, w, h); evas_object_show(o_bg); - e_popup_edje_bg_object_set(popup, o_bg); + e_popup_content_set(popup, o_bg); if (e_config->syscon.do_input) { diff --git a/src/modules/systray/e_mod_xembed.c b/src/modules/systray/e_mod_xembed.c index e4d45e452..10a09e9bd 100644 --- a/src/modules/systray/e_mod_xembed.c +++ b/src/modules/systray/e_mod_xembed.c @@ -830,7 +830,7 @@ systray_xembed_new(Instance *inst) xembed->inst = inst; if ((gc->shelf) && (gc->shelf->popup)) - xembed->win.parent = gc->shelf->popup->evas_win; + xembed->win.parent = e_comp_get(gc->shelf)->win; else xembed->win.parent = (Ecore_X_Window)ecore_evas_window_get(gc->ecore_evas); diff --git a/src/modules/tiling/e_mod_tiling.c b/src/modules/tiling/e_mod_tiling.c index aef0a1e12..d0769e5f9 100644 --- a/src/modules/tiling/e_mod_tiling.c +++ b/src/modules/tiling/e_mod_tiling.c @@ -627,7 +627,7 @@ _do_overlay(E_Border *focused_bd, if (!extra->overlay.popup) continue; - e_popup_layer_set(extra->overlay.popup, E_LAYER_NORMAL); + e_popup_layer_set(extra->overlay.popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); extra->overlay.obj = edje_object_add(extra->overlay.popup->evas); e_theme_edje_object_set(extra->overlay.obj, @@ -661,7 +661,7 @@ _do_overlay(E_Border *focused_bd, evas_object_move(extra->overlay.obj, 0, 0); evas_object_resize(extra->overlay.obj, ew, eh); evas_object_show(extra->overlay.obj); - e_popup_edje_bg_object_set(extra->overlay.popup, + e_popup_content_set(extra->overlay.popup, extra->overlay.obj); evas_object_show(extra->overlay.obj); @@ -1810,12 +1810,12 @@ _check_moving_anims(const E_Border *bd, const Border_Extra *extra, int stack) if (!overlay->popup) return; - e_popup_layer_set(overlay->popup, E_LAYER_NORMAL); + e_popup_layer_set(overlay->popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); overlay->obj = edje_object_add(overlay->popup->evas); _theme_edje_object_set(overlay->obj, "modules/tiling/move/left"); edje_object_size_min_calc(overlay->obj, &ew, &eh); - e_popup_edje_bg_object_set(overlay->popup, + e_popup_content_set(overlay->popup, overlay->obj); evas_object_show(overlay->obj); e_popup_move_resize(overlay->popup, @@ -1862,12 +1862,12 @@ _check_moving_anims(const E_Border *bd, const Border_Extra *extra, int stack) if (!overlay->popup) return; - e_popup_layer_set(overlay->popup, E_LAYER_NORMAL); + e_popup_layer_set(overlay->popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); overlay->obj = edje_object_add(overlay->popup->evas); _theme_edje_object_set(overlay->obj, "modules/tiling/move/right"); edje_object_size_min_calc(overlay->obj, &ew, &eh); - e_popup_edje_bg_object_set(overlay->popup, + e_popup_content_set(overlay->popup, overlay->obj); evas_object_show(overlay->obj); e_popup_move_resize(overlay->popup, @@ -1913,11 +1913,11 @@ _check_moving_anims(const E_Border *bd, const Border_Extra *extra, int stack) if (!overlay->popup) return; - e_popup_layer_set(overlay->popup, E_LAYER_NORMAL); + e_popup_layer_set(overlay->popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); overlay->obj = edje_object_add(overlay->popup->evas); _theme_edje_object_set(overlay->obj, "modules/tiling/move/up"); edje_object_size_min_calc(overlay->obj, &ew, &eh); - e_popup_edje_bg_object_set(overlay->popup, + e_popup_content_set(overlay->popup, overlay->obj); evas_object_show(overlay->obj); e_popup_move_resize(overlay->popup, @@ -1964,12 +1964,12 @@ _check_moving_anims(const E_Border *bd, const Border_Extra *extra, int stack) if (!overlay->popup) return; - e_popup_layer_set(overlay->popup, E_LAYER_NORMAL); + e_popup_layer_set(overlay->popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); overlay->obj = edje_object_add(overlay->popup->evas); _theme_edje_object_set(overlay->obj, "modules/tiling/move/down"); edje_object_size_min_calc(overlay->obj, &ew, &eh); - e_popup_edje_bg_object_set(overlay->popup, + e_popup_content_set(overlay->popup, overlay->obj); evas_object_show(overlay->obj); e_popup_move_resize(overlay->popup, @@ -2840,7 +2840,7 @@ _transition_overlay_key_down(void *data __UNUSED__, if (!trov->overlay.popup) { trov->overlay.popup = e_popup_new(_G.tinfo->desk->zone, 0, 0, 1, 1); - e_popup_layer_set(trov->overlay.popup, E_LAYER_NORMAL); + e_popup_layer_set(trov->overlay.popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); } if (!trov->overlay.obj) { trov->overlay.obj = @@ -2856,7 +2856,7 @@ _transition_overlay_key_down(void *data __UNUSED__, } edje_object_size_min_calc(trov->overlay.obj, &ew, &eh); - e_popup_edje_bg_object_set(trov->overlay.popup, + e_popup_content_set(trov->overlay.popup, trov->overlay.obj); evas_object_show(trov->overlay.obj); if (bd) { @@ -2965,7 +2965,7 @@ _do_transition_overlay(void) continue; } - e_popup_layer_set(trov->overlay.popup, E_LAYER_NORMAL); + e_popup_layer_set(trov->overlay.popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); trov->overlay.obj = edje_object_add(trov->overlay.popup->evas); e_theme_edje_object_set(trov->overlay.obj, "base/theme/borders", @@ -3000,7 +3000,7 @@ _do_transition_overlay(void) evas_object_move(trov->overlay.obj, 0, 0); evas_object_resize(trov->overlay.obj, ew, eh); evas_object_show(trov->overlay.obj); - e_popup_edje_bg_object_set(trov->overlay.popup, + e_popup_content_set(trov->overlay.popup, trov->overlay.obj); evas_object_show(trov->overlay.obj); @@ -3038,7 +3038,7 @@ _do_transition_overlay(void) if (!trov->overlay.popup) continue; - e_popup_layer_set(trov->overlay.popup, E_LAYER_NORMAL); + e_popup_layer_set(trov->overlay.popup, E_COMP_CANVAS_LAYER_LAYOUT, E_LAYER_NORMAL); trov->overlay.obj = edje_object_add(trov->overlay.popup->evas); e_theme_edje_object_set(trov->overlay.obj, "base/theme/borders", @@ -3073,7 +3073,7 @@ _do_transition_overlay(void) evas_object_move(trov->overlay.obj, 0, 0); evas_object_resize(trov->overlay.obj, ew, eh); evas_object_show(trov->overlay.obj); - e_popup_edje_bg_object_set(trov->overlay.popup, + e_popup_content_set(trov->overlay.popup, trov->overlay.obj); evas_object_show(trov->overlay.obj); diff --git a/src/modules/winlist/e_winlist.c b/src/modules/winlist/e_winlist.c index 17655feed..accbd6897 100644 --- a/src/modules/winlist/e_winlist.c +++ b/src/modules/winlist/e_winlist.c @@ -141,7 +141,6 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) evas_event_feed_mouse_move(_winlist->evas, -1000000, -1000000, ecore_x_current_time_get(), NULL); - e_popup_layer_set(_winlist, E_LAYER_POPUP); evas_event_freeze(_winlist->evas); o = edje_object_add(_winlist->evas); _bg_object = o; @@ -150,7 +149,7 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) evas_object_move(o, 0, 0); evas_object_resize(o, w, h); evas_object_show(o); - e_popup_edje_bg_object_set(_winlist, o); + e_popup_content_set(_winlist, o); o = e_box_add(_winlist->evas); _list_object = o; diff --git a/src/modules/wizard/e_wizard.c b/src/modules/wizard/e_wizard.c index 619641183..940a2b210 100644 --- a/src/modules/wizard/e_wizard.c +++ b/src/modules/wizard/e_wizard.c @@ -3,7 +3,7 @@ static void _e_wizard_next_eval(void); static E_Popup *_e_wizard_main_new(E_Zone *zone); static E_Popup *_e_wizard_extra_new(E_Zone *zone); -static void _e_wizard_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event); +static Eina_Bool _e_wizard_cb_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event); static void _e_wizard_cb_next(void *data, Evas_Object *obj, const char *emission, const char *source); static Eina_Bool _e_wizard_check_xdg(void); @@ -64,6 +64,7 @@ e_wizard_init(void) E_LIST_HANDLER_APPEND(handlers, EFREET_EVENT_ICON_CACHE_UPDATE, _e_wizard_cb_icons_update, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_KEY_DOWN, _e_wizard_cb_key_down, NULL); return 1; } @@ -274,55 +275,24 @@ static E_Popup * _e_wizard_main_new(E_Zone *zone) { E_Popup *popup; - Evas_Object *o; - Evas_Modifier_Mask mask; - Eina_Bool kg; popup = e_popup_new(zone, 0, 0, zone->w, zone->h); - e_popup_layer_set(popup, E_LAYER_TOP); - o = edje_object_add(popup->evas); + o_bg = edje_object_add(popup->evas); - e_theme_edje_object_set(o, "base/theme/wizard", "e/wizard/main"); - evas_object_move(o, 0, 0); - evas_object_resize(o, zone->w, zone->h); - evas_object_show(o); - edje_object_signal_callback_add(o, "e,action,next", "", + e_theme_edje_object_set(o_bg, "base/theme/wizard", "e/wizard/main"); + edje_object_part_text_set(o_bg, "e.text.title", _("Welcome to Enlightenment")); + edje_object_signal_callback_add(o_bg, "e,action,next", "", _e_wizard_cb_next, popup); - o_bg = o; - - o = evas_object_rectangle_add(popup->evas); - mask = 0; - kg = evas_object_key_grab(o, "Tab", mask, ~mask, 0); - if (!kg) - fprintf(stderr, "ERROR: unable to redirect \"Tab\" key events to object %p.\n", o); - mask = evas_key_modifier_mask_get(popup->evas, "Shift"); - kg = evas_object_key_grab(o, "Tab", mask, ~mask, 0); - if (!kg) - fprintf(stderr, "ERROR: unable to redirect \"Tab\" key events to object %p.\n", o); - mask = 0; - kg = evas_object_key_grab(o, "Return", mask, ~mask, 0); - if (!kg) - fprintf(stderr, "ERROR: unable to redirect \"Return\" key events to object %p.\n", o); - mask = 0; - kg = evas_object_key_grab(o, "KP_Enter", mask, ~mask, 0); - if (!kg) - fprintf(stderr, "ERROR: unable to redirect \"KP_Enter\" key events to object %p.\n", o); - evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, - _e_wizard_cb_key_down, popup); + o_bg = o_bg; + e_popup_move_resize(popup, 0, 0, zone->w, zone->h); + e_popup_layer_set(popup, E_COMP_CANVAS_LAYER_POPUP, 0); + e_popup_content_set(popup, o_bg); /* set up next/prev buttons */ - edje_object_part_text_set(o_bg, "e.text.title", _("Welcome to Enlightenment")); // edje_object_signal_emit(o_bg, "e,state,next,disable", "e"); e_wizard_labels_update(); - e_popup_edje_bg_object_set(popup, o_bg); e_popup_show(popup); - if (!e_grabinput_get(ecore_evas_software_x11_window_get(popup->ecore_evas), - 1, ecore_evas_software_x11_window_get(popup->ecore_evas))) - { - e_object_del(E_OBJECT(popup)); - popup = NULL; - } return popup; } @@ -333,40 +303,43 @@ _e_wizard_extra_new(E_Zone *zone) Evas_Object *o; popup = e_popup_new(zone, 0, 0, zone->w, zone->h); - e_popup_layer_set(popup, E_LAYER_TOP); + e_popup_layer_set(popup, E_COMP_CANVAS_LAYER_POPUP, 0); o = edje_object_add(popup->evas); e_theme_edje_object_set(o, "base/theme/wizard", "e/wizard/extra"); evas_object_move(o, 0, 0); evas_object_resize(o, zone->w, zone->h); evas_object_show(o); - e_popup_edje_bg_object_set(popup, o); + e_popup_content_set(popup, o); e_popup_show(popup); return popup; } -static void -_e_wizard_cb_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event) +static Eina_Bool +_e_wizard_cb_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { - Evas_Event_Key_Down *ev; + Ecore_Event_Key *ev = event; - ev = event; - if (!o_content) return; + if (!o_content) return ECORE_CALLBACK_RENEW; if (!strcmp(ev->keyname, "Tab")) { - if (evas_key_modifier_is_set(ev->modifiers, "Shift")) + if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) e_widget_focus_jump(o_content, 0); else e_widget_focus_jump(o_content, 1); } - else if (((!strcmp(ev->keyname, "Return")) || - (!strcmp(ev->keyname, "KP_Enter")) || - (!strcmp(ev->keyname, "space")))) + else if ((!strcmp(ev->keyname, "Return")) || (!strcmp(ev->keyname, "KP_Enter"))) + { + if (next_can) + e_wizard_next(); + } + else if (!strcmp(ev->keyname, "space")) { Evas_Object *o; o = e_widget_focused_object_get(o_content); if (o) e_widget_activate(o); } + return ECORE_CALLBACK_RENEW; } static void