From: Enlightenment S. <no-...@en...> - 2012-04-30 12:29:41
|
Log: fix edge bindings to work if you add other bindings to corners other than edge flips. Author: raster Date: 2012-04-30 05:29:34 -0700 (Mon, 30 Apr 2012) New Revision: 70558 Trac: http://trac.enlightenment.org/e/changeset/70558 Modified: trunk/e/src/bin/e_bindings.c trunk/e/src/bin/e_bindings.h trunk/e/src/bin/e_zone.c Modified: trunk/e/src/bin/e_bindings.c =================================================================== --- trunk/e/src/bin/e_bindings.c 2012-04-30 12:28:57 UTC (rev 70557) +++ trunk/e/src/bin/e_bindings.c 2012-04-30 12:29:34 UTC (rev 70558) @@ -532,6 +532,25 @@ return EINA_FALSE; } +EAPI Eina_Bool +e_bindings_edge_non_flippable_get(E_Zone_Edge edge) +{ + E_Binding_Edge *bind; + Eina_List *l; + + EINA_LIST_FOREACH(edge_bindings, l, bind) + { + if ((bind->edge == edge) && (bind->action)) + { + if ((!strcmp(bind->action, "desk_flip_in_direction")) || + (!strcmp(bind->action, "desk_flip_by"))) + continue; + return EINA_TRUE; + } + } + return EINA_FALSE; +} + EAPI E_Binding_Edge * e_bindings_edge_get(const char *action, E_Zone_Edge edge, Eina_Bool click) { Modified: trunk/e/src/bin/e_bindings.h =================================================================== --- trunk/e/src/bin/e_bindings.h 2012-04-30 12:28:57 UTC (rev 70557) +++ trunk/e/src/bin/e_bindings.h 2012-04-30 12:29:34 UTC (rev 70558) @@ -125,6 +125,7 @@ EAPI void e_bindings_edge_add(E_Binding_Context ctxt, E_Zone_Edge edge, E_Binding_Modifier mod, int any_mod, const char *action, const char *params, float delay); EAPI Eina_Bool e_bindings_edge_flippable_get(E_Zone_Edge edge); +EAPI Eina_Bool e_bindings_edge_non_flippable_get(E_Zone_Edge edge); EAPI E_Binding_Edge *e_bindings_edge_get(const char *action, E_Zone_Edge edge, Eina_Bool click); EAPI void e_bindings_edge_del(E_Binding_Context ctxt, E_Zone_Edge edge, E_Binding_Modifier mod, int any_mod, const char *action, const char *params, float delay); EAPI E_Action *e_bindings_edge_in_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Zone_Edge *ev); Modified: trunk/e/src/bin/e_zone.c =================================================================== --- trunk/e/src/bin/e_zone.c 2012-04-30 12:28:57 UTC (rev 70557) +++ trunk/e/src/bin/e_zone.c 2012-04-30 12:29:34 UTC (rev 70558) @@ -840,102 +840,53 @@ EAPI void e_zone_edges_desk_flip_capable(E_Zone *zone, Eina_Bool l, Eina_Bool r, Eina_Bool t, Eina_Bool b) { - if (l) - { - if (e_bindings_edge_flippable_get(E_ZONE_EDGE_LEFT)) - { - if (zone->edge.left) ecore_x_window_show(zone->edge.left); - } - } - else - { - if (zone->edge.left) ecore_x_window_hide(zone->edge.left); - } - if (r) - { - if (e_bindings_edge_flippable_get(E_ZONE_EDGE_RIGHT)) - { - if (zone->edge.right) ecore_x_window_show(zone->edge.right); - } - } - else - { - if (zone->edge.right) ecore_x_window_hide(zone->edge.right); - } - if (t) - { - if (e_bindings_edge_flippable_get(E_ZONE_EDGE_TOP)) - { - if (zone->edge.top) ecore_x_window_show(zone->edge.top); - } - } - else - { - if (zone->edge.top) ecore_x_window_hide(zone->edge.top); - } - if (b) - { - if (e_bindings_edge_flippable_get(E_ZONE_EDGE_BOTTOM)) - { - if (zone->edge.bottom) ecore_x_window_show(zone->edge.bottom); - } - } - else - { - if (zone->edge.bottom) ecore_x_window_hide(zone->edge.bottom); - } - if ((!l) && (!t)) - { - if (zone->corner.left_top) ecore_x_window_hide(zone->corner.left_top); - if (zone->corner.top_left) ecore_x_window_hide(zone->corner.top_left); - } - else - { - if (e_bindings_edge_flippable_get(E_ZONE_EDGE_TOP_LEFT)) - { - if (zone->corner.left_top) ecore_x_window_show(zone->corner.left_top); - if (zone->corner.top_left) ecore_x_window_show(zone->corner.top_left); - } - } - if ((!r) && (!t)) - { - if (zone->corner.right_top) ecore_x_window_hide(zone->corner.right_top); - if (zone->corner.top_right) ecore_x_window_hide(zone->corner.top_right); - } - else - { - if (e_bindings_edge_flippable_get(E_ZONE_EDGE_TOP_RIGHT)) - { - if (zone->corner.right_top) ecore_x_window_show(zone->corner.right_top); - if (zone->corner.top_right) ecore_x_window_show(zone->corner.top_right); - } - } - if ((!l) && (!b)) - { - if (zone->corner.left_bottom) ecore_x_window_hide(zone->corner.left_bottom); - if (zone->corner.bottom_left) ecore_x_window_hide(zone->corner.bottom_left); - } - else - { - if (e_bindings_edge_flippable_get(E_ZONE_EDGE_BOTTOM_LEFT)) - { - if (zone->corner.left_bottom) ecore_x_window_show(zone->corner.left_bottom); - if (zone->corner.bottom_left) ecore_x_window_show(zone->corner.bottom_left); - } - } - if ((!r) && (!b)) - { - if (zone->corner.right_bottom) ecore_x_window_hide(zone->corner.right_bottom); - if (zone->corner.bottom_right) ecore_x_window_hide(zone->corner.bottom_right); - } - else - { - if (e_bindings_edge_flippable_get(E_ZONE_EDGE_BOTTOM_RIGHT)) - { - if (zone->corner.right_bottom) ecore_x_window_show(zone->corner.right_bottom); - if (zone->corner.bottom_right) ecore_x_window_show(zone->corner.bottom_right); - } - } +#define NEED_FLIP_EDGE(x) \ + (e_bindings_edge_flippable_get(x) || e_bindings_edge_non_flippable_get(x)) +#define NEED_EDGE(x) \ + (e_bindings_edge_non_flippable_get(x)) +#define CHECK_EDGE(v, ed, win) \ + do { \ + if (v) { \ + if (NEED_FLIP_EDGE(ed)) { if (zone->edge.win) ecore_x_window_show(zone->edge.win); } \ + else if (zone->edge.win) ecore_x_window_hide(zone->edge.win); \ + } \ + else { \ + if (NEED_EDGE(ed)) { if (zone->edge.win) ecore_x_window_show(zone->edge.win); } \ + else if (zone->edge.win) ecore_x_window_hide(zone->edge.win); \ + } \ + } while (0) + + CHECK_EDGE(l, E_ZONE_EDGE_LEFT, left); + CHECK_EDGE(r, E_ZONE_EDGE_RIGHT, right); + CHECK_EDGE(t, E_ZONE_EDGE_TOP, top); + CHECK_EDGE(b, E_ZONE_EDGE_BOTTOM, bottom); + +#define CHECK_CORNER(v1, v2, ed, win1, win2) \ + if ((!v1) && (!v2)) { \ + if (NEED_EDGE(ed)) { \ + if (zone->corner.win1) ecore_x_window_show(zone->corner.win1); \ + if (zone->corner.win2) ecore_x_window_show(zone->corner.win2); \ + } \ + else { \ + if (zone->corner.win1) ecore_x_window_hide(zone->corner.win1); \ + if (zone->corner.win2) ecore_x_window_hide(zone->corner.win2); \ + } \ + } \ + else { \ + if (NEED_FLIP_EDGE(ed)) { \ + if (zone->corner.win1) ecore_x_window_show(zone->corner.win1); \ + if (zone->corner.win2) ecore_x_window_show(zone->corner.win2); \ + } \ + else { \ + if (zone->corner.win1) ecore_x_window_hide(zone->corner.win1); \ + if (zone->corner.win2) ecore_x_window_hide(zone->corner.win2); \ + } \ + } + + CHECK_CORNER(l, t, E_ZONE_EDGE_TOP_LEFT, left_top, top_left); + CHECK_CORNER(r, t, E_ZONE_EDGE_TOP_RIGHT, right_top, top_right); + CHECK_CORNER(l, b, E_ZONE_EDGE_BOTTOM_LEFT, left_bottom, bottom_left); + CHECK_CORNER(r, b, E_ZONE_EDGE_BOTTOM_RIGHT, right_bottom, bottom_right); } EAPI Eina_Bool |