diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index 0a7b6ec9f..f333f16b1 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -26,6 +26,8 @@ static int _e_shelf_cb_instant_hide_timer(void *data); static void _e_shelf_menu_del_hook(void *data); static void _e_shelf_menu_pre_cb(void *data, E_Menu *m); +static void _e_shelf_edge_event_register(E_Shelf *es, int reg); + static Evas_List *shelves = NULL; static Evas_Hash *winid_shelves = NULL; @@ -102,6 +104,7 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i es->y = 0; es->w = 32; es->h = 32; + es->zone = zone; if (popup) { es->popup = e_popup_new(zone, es->x, es->y, es->w, es->h); @@ -118,7 +121,6 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i } es->fit_along = 1; es->layer = layer; - es->zone = zone; es->style = evas_stringshare_add(style); es->o_event = evas_object_rectangle_add(es->evas); @@ -602,17 +604,21 @@ e_shelf_popup_set(E_Shelf *es, int popup) if (!es->cfg) return; if (((popup) && (es->popup)) || ((!popup) && (!es->popup))) return; + if (popup) { es->popup = e_popup_new(es->zone, es->x, es->y, es->w, es->h); e_drop_xdnd_register_set(es->popup->evas_win, 1); e_popup_layer_set(es->popup, es->cfg->layer); + es->ee = es->popup->ecore_evas; es->evas = es->popup->evas; es->win = es->popup->evas_win; evas_object_show(es->o_event); evas_object_show(es->o_base); e_popup_edje_bg_object_set(es->popup, es->o_base); + + _e_shelf_edge_event_register(es, 1); } else { @@ -623,6 +629,8 @@ e_shelf_popup_set(E_Shelf *es, int popup) evas_object_move(es->o_base, es->zone->x + es->x, es->zone->y + es->y); evas_object_layer_set(es->o_event, es->cfg->layer); evas_object_layer_set(es->o_base, es->cfg->layer); + + _e_shelf_edge_event_register(es, 0); } } @@ -666,6 +674,8 @@ e_shelf_config_new(E_Zone *zone, E_Config_Shelf *cf_es) else e_shelf_show(es); + if (es->popup) + _e_shelf_edge_event_register(es, 1); e_shelf_toggle(es, 0); return es; } @@ -701,6 +711,7 @@ _e_shelf_free(E_Shelf *es) evas_object_del(es->o_base); if (es->popup) { + _e_shelf_edge_event_register(es, 0); e_drop_xdnd_register_set(es->popup->evas_win, 0); winid_shelves = evas_hash_del(winid_shelves, e_util_winid_str_get(es->popup->evas_win), es); e_object_del(E_OBJECT(es->popup)); @@ -1639,3 +1650,51 @@ _e_shelf_menu_pre_cb(void *data, E_Menu *m) e_util_menu_item_edje_icon_set(mi, "enlightenment/delete"); e_menu_item_callback_set(mi, _e_shelf_cb_menu_delete, es); } + +static void +_e_shelf_edge_event_register(E_Shelf *es, int reg) +{ + if (!es) return; + if ((!reg) && (!es->edge)) return; + if ((reg) && (es->edge)) return; + if ((reg) && ((!es->cfg->autohide) || (es->cfg->autohide_show_action) || (!es->popup))) return; + es->edge = reg; + + switch (es->gadcon->orient) + { + case E_GADCON_ORIENT_LEFT: + e_zone_edge_event_register(es->zone, E_ZONE_EDGE_LEFT, es->edge); + break; + case E_GADCON_ORIENT_RIGHT: + e_zone_edge_event_register(es->zone, E_ZONE_EDGE_RIGHT, es->edge); + break; + case E_GADCON_ORIENT_TOP: + e_zone_edge_event_register(es->zone, E_ZONE_EDGE_TOP, es->edge); + break; + case E_GADCON_ORIENT_BOTTOM: + e_zone_edge_event_register(es->zone, E_ZONE_EDGE_BOTTOM, es->edge); + break; + case E_GADCON_ORIENT_CORNER_TL: + case E_GADCON_ORIENT_CORNER_LT: + e_zone_edge_event_register(es->zone, E_ZONE_EDGE_TOP, es->edge); + e_zone_edge_event_register(es->zone, E_ZONE_EDGE_LEFT, es->edge); + break; + case E_GADCON_ORIENT_CORNER_TR: + case E_GADCON_ORIENT_CORNER_RT: + e_zone_edge_event_register(es->zone, E_ZONE_EDGE_TOP, es->edge); + e_zone_edge_event_register(es->zone, E_ZONE_EDGE_RIGHT, es->edge); + break; + case E_GADCON_ORIENT_CORNER_BL: + case E_GADCON_ORIENT_CORNER_LB: + e_zone_edge_event_register(es->zone, E_ZONE_EDGE_BOTTOM, es->edge); + e_zone_edge_event_register(es->zone, E_ZONE_EDGE_LEFT, es->edge); + break; + case E_GADCON_ORIENT_CORNER_BR: + case E_GADCON_ORIENT_CORNER_RB: + e_zone_edge_event_register(es->zone, E_ZONE_EDGE_BOTTOM, es->edge); + e_zone_edge_event_register(es->zone, E_ZONE_EDGE_RIGHT, es->edge); + break; + default: + break; + } +} diff --git a/src/bin/e_shelf.h b/src/bin/e_shelf.h index 74ddeaa33..6a5e2ecbd 100644 --- a/src/bin/e_shelf.h +++ b/src/bin/e_shelf.h @@ -45,6 +45,7 @@ struct _E_Shelf unsigned char hidden : 1; unsigned char locked : 1; unsigned char toggle : 1; + unsigned char edge : 1; }; EAPI int e_shelf_init(void); diff --git a/src/bin/e_zone.c b/src/bin/e_zone.c index 5685df11a..d6c0614c4 100644 --- a/src/bin/e_zone.c +++ b/src/bin/e_zone.c @@ -17,6 +17,7 @@ static int _e_zone_cb_mouse_out(void *data, int type, void *event); static int _e_zone_cb_timer(void *data); static int _e_zone_cb_desk_show(void *data, int type, void *event); static void _e_zone_update_flip(E_Zone *zone); +static void _e_zone_update_edge(E_Zone *zone); static void _e_zone_event_move_resize_free(void *data, void *ev); static void _e_zone_event_add_free(void *data, void *ev); static void _e_zone_event_del_free(void *data, void *ev); @@ -76,16 +77,12 @@ e_zone_new(E_Container *con, int num, int id, int x, int y, int w, int h) zone->id = id; zone->edge.left = ecore_x_window_input_new(con->win, zone->x, zone->y, 1, zone->h); - ecore_x_window_show(zone->edge.left); e_container_window_raise(zone->container, zone->edge.left, 999); zone->edge.right = ecore_x_window_input_new(con->win, zone->x + zone->w - 1, zone->y, 1, zone->h); - ecore_x_window_show(zone->edge.right); e_container_window_raise(zone->container, zone->edge.right, 999); zone->edge.top = ecore_x_window_input_new(con->win, zone->x + 1, zone->y, zone->w - 2, 1); - ecore_x_window_show(zone->edge.top); e_container_window_raise(zone->container, zone->edge.top, 999); zone->edge.bottom = ecore_x_window_input_new(con->win, zone->x + 1, zone->y + zone->h - 1, zone->w - 2, 1); - ecore_x_window_show(zone->edge.bottom); e_container_window_raise(zone->container, zone->edge.bottom, 999); zone->handlers = evas_list_append(zone->handlers, @@ -149,6 +146,7 @@ e_zone_new(E_Container *con, int num, int id, int x, int y, int w, int h) e_config->zone_desks_y_count); _e_zone_update_flip(zone); + _e_zone_update_edge(zone); e_object_del_attach_func_set(E_OBJECT(zone), _e_zone_object_del_attach); @@ -639,15 +637,37 @@ e_zone_flip_win_restore(void) E_Zone *zone; zone = lll->data; - ecore_x_window_show(zone->edge.left); - ecore_x_window_show(zone->edge.right); - ecore_x_window_show(zone->edge.top); - ecore_x_window_show(zone->edge.bottom); + _e_zone_update_edge(zone); } } } } +EAPI void +e_zone_edge_event_register(E_Zone *zone, E_Zone_Edge edge, int reg) +{ + switch (edge) + { + case E_ZONE_EDGE_LEFT: + if (reg) zone->show.left++; + else zone->show.left--; + break; + case E_ZONE_EDGE_RIGHT: + if (reg) zone->show.right++; + else zone->show.right--; + break; + case E_ZONE_EDGE_TOP: + if (reg) zone->show.top++; + else zone->show.top--; + break; + case E_ZONE_EDGE_BOTTOM: + if (reg) zone->show.bottom++; + else zone->show.bottom--; + break; + } + _e_zone_update_edge(zone); +} + /* local subsystem functions */ static void _e_zone_free(E_Zone *zone) @@ -1000,9 +1020,13 @@ _e_zone_cb_desk_show(void *data, int type, void *event) static void _e_zone_update_flip(E_Zone *zone) { + if (zone->flip.left) zone->show.left--; zone->flip.left = 0; + if (zone->flip.right) zone->show.right--; zone->flip.right = 0; + if (zone->flip.top) zone->show.top--; zone->flip.top = 0; + if (zone->flip.bottom) zone->show.bottom--; zone->flip.bottom = 0; if (e_config->edge_flip_moving) @@ -1037,19 +1061,47 @@ _e_zone_update_flip(E_Zone *zone) } if (one_col && E_ZONE_FLIP_LEFT(zone)) - zone->flip.left = 1; + { + zone->flip.left = 1; + zone->show.left++; + } if (one_col && E_ZONE_FLIP_RIGHT(zone)) - zone->flip.right = 1; + { + zone->flip.right = 1; + zone->show.right++; + } if (one_row && E_ZONE_FLIP_UP(zone)) - zone->flip.top = 1; + { + zone->flip.top = 1; + zone->show.top++; + } if (one_row && E_ZONE_FLIP_DOWN(zone)) - zone->flip.bottom = 1; + { + zone->flip.bottom = 1; + zone->show.bottom++; + } } } +static void +_e_zone_update_edge(E_Zone *zone) +{ + if (zone->show.left) ecore_x_window_show(zone->edge.left); + else ecore_x_window_hide(zone->edge.left); + + if (zone->show.right) ecore_x_window_show(zone->edge.right); + else ecore_x_window_hide(zone->edge.right); + + if (zone->show.top) ecore_x_window_show(zone->edge.top); + else ecore_x_window_hide(zone->edge.top); + + if (zone->show.bottom) ecore_x_window_show(zone->edge.bottom); + else ecore_x_window_hide(zone->edge.bottom); +} + static void _e_zone_event_move_resize_free(void *data, void *ev) { diff --git a/src/bin/e_zone.h b/src/bin/e_zone.h index 2566d8d0e..eb80da317 100644 --- a/src/bin/e_zone.h +++ b/src/bin/e_zone.h @@ -64,6 +64,9 @@ struct _E_Zone struct { Ecore_X_Window top, right, bottom, left; } edge; + struct { + int top, right, bottom, left; + } show; E_Action *cur_mouse_action; Evas_List *popups; @@ -132,6 +135,7 @@ EAPI void e_zone_desk_linear_flip_by(E_Zone *zone, int dx); EAPI void e_zone_desk_linear_flip_to(E_Zone *zone, int x); EAPI void e_zone_flip_win_disable(void); EAPI void e_zone_flip_win_restore(void); +EAPI void e_zone_edge_event_register(E_Zone *zone, E_Zone_Edge edge, int reg); extern EAPI int E_EVENT_ZONE_DESK_COUNT_SET; extern EAPI int E_EVENT_ZONE_MOVE_RESIZE;