/* local subsystem functions */
static void _e_bindings_mouse_free(E_Binding_Mouse *bind);
static void _e_bindings_key_free(E_Binding_Key *bind);
-static void _e_bindings_edge_free(E_Binding_Edge *bind);
static void _e_bindings_signal_free(E_Binding_Signal *bind);
static void _e_bindings_wheel_free(E_Binding_Wheel *bind);
static int _e_bindings_context_match(E_Binding_Context bctxt, E_Binding_Context ctxt);
static E_Binding_Modifier _e_bindings_modifiers(unsigned int modifiers);
-static Eina_Bool _e_bindings_edge_cb_timer(void *data);
/* local subsystem globals */
static Eina_List *mouse_bindings = NULL;
static Eina_List *key_bindings = NULL;
-static Eina_List *edge_bindings = NULL;
static Eina_List *signal_bindings = NULL;
static Eina_List *wheel_bindings = NULL;
-typedef struct _E_Binding_Edge_Data E_Binding_Edge_Data;
-
-struct _E_Binding_Edge_Data
-{
- E_Binding_Edge *bind;
- E_Event_Zone_Edge *ev;
- E_Action *act;
- E_Object *obj;
-};
-
/* externally accessible functions */
EINTERN int
{
E_FREE_LIST(mouse_bindings, _e_bindings_mouse_free);
E_FREE_LIST(key_bindings, _e_bindings_key_free);
- E_FREE_LIST(edge_bindings, _e_bindings_edge_free);
E_FREE_LIST(signal_bindings, _e_bindings_signal_free);
E_FREE_LIST(wheel_bindings, _e_bindings_wheel_free);
}
EINTERN void
-e_bindings_edge_reset(void)
-{
-}
-
-EINTERN void
e_bindings_mouse_reset(void)
{
}
EINTERN void
-e_bindings_edge_add(E_Binding_Context ctxt, E_Zone_Edge edge, Eina_Bool drag_only, E_Binding_Modifier mod, int any_mod, const char *action, const char *params, float delay)
-{
- E_Binding_Edge *binding;
-
- binding = calloc(1, sizeof(E_Binding_Edge));
- if (!binding) return;
- binding->ctxt = ctxt;
- binding->edge = edge;
- binding->mod = mod;
- binding->any_mod = any_mod;
- binding->delay = delay;
- binding->drag_only = drag_only;
- if (action) binding->action = eina_stringshare_add(action);
- if (params) binding->params = eina_stringshare_add(params);
- edge_bindings = eina_list_append(edge_bindings, binding);
-
- e_zone_edge_new(edge);
-}
-
-EINTERN Eina_Bool
-e_bindings_edge_flippable_get(E_Zone_Edge edge)
-{
- E_Binding_Edge *binding;
- Eina_List *l;
-
- EINA_LIST_FOREACH(edge_bindings, l, binding)
- {
- if ((binding->edge == edge) && (binding->action))
- {
- if ((!strcmp(binding->action, "desk_flip_in_direction")) ||
- (!strcmp(binding->action, "desk_flip_by")))
- return EINA_TRUE;
- }
- }
- return EINA_FALSE;
-}
-
-EINTERN Eina_Bool
-e_bindings_edge_non_flippable_get(E_Zone_Edge edge)
-{
- E_Binding_Edge *binding;
- Eina_List *l;
-
- EINA_LIST_FOREACH(edge_bindings, l, binding)
- {
- if ((binding->edge == edge) && (binding->action))
- {
- if ((!strcmp(binding->action, "desk_flip_in_direction")) ||
- (!strcmp(binding->action, "desk_flip_by")))
- continue;
- return EINA_TRUE;
- }
- }
- return EINA_FALSE;
-}
-
-EINTERN E_Binding_Edge *
-e_bindings_edge_get(const char *action, E_Zone_Edge edge, int click)
-{
- E_Binding_Edge *binding;
- Eina_List *l;
-
- EINA_LIST_FOREACH(edge_bindings, l, binding)
- {
- if ((binding->edge == edge) &&
- ((click && (binding->delay == -1.0 * click))
- || (!click && (binding->delay >= 0.0))) &&
- (binding->action) && (action) &&
- (!strcmp(action, binding->action)))
- return binding;
- }
- return NULL;
-}
-
-EINTERN void
-e_bindings_edge_del(E_Binding_Context ctxt, E_Zone_Edge edge, Eina_Bool drag_only, E_Binding_Modifier mod, int any_mod, const char *action, const char *params, float delay)
-{
- E_Binding_Edge *binding;
- Eina_List *l, *ll;
- int ref_count = 0;
-
- EINA_LIST_FOREACH_SAFE(edge_bindings, l, ll, binding)
- {
- if (binding->edge == edge)
- {
- if ((binding->ctxt == ctxt) &&
- (binding->mod == mod) &&
- ((binding->delay * 1000) == (delay * 1000)) &&
- (binding->any_mod == any_mod) &&
- (binding->drag_only == drag_only) &&
- (((binding->action) && (action) && (!strcmp(binding->action, action))) ||
- ((!binding->action) && (!action))) &&
- (((binding->params) && (params) && (!strcmp(binding->params, params))) ||
- ((!binding->params) && (!params))))
- {
- _e_bindings_edge_free(binding);
- edge_bindings = eina_list_remove_list(edge_bindings, l);
- }
- else ref_count++;
- }
- }
-
- if (!ref_count)
- e_zone_edge_free(edge);
-}
-
-EINTERN E_Action *
-e_bindings_edge_in_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Zone_Edge *ev)
-{
- E_Binding_Modifier mod = 0;
- E_Binding_Edge *binding;
- E_Desk *current = NULL;
- E_Action *act = NULL;
- Eina_List *l;
-
- current = e_desk_at_xy_get(ev->zone, ev->zone->desk_x_current, ev->zone->desk_y_current);
- if (current->fullscreen_clients) return NULL;
-
- if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT;
- if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL;
- if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT) mod |= E_BINDING_MODIFIER_ALT;
- if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN) mod |= E_BINDING_MODIFIER_WIN;
- EINA_LIST_FOREACH(edge_bindings, l, binding)
- {
- /* A value of <= -1.0 for the delay indicates it as a mouse-click binding on that edge */
- if (((binding->edge == ev->edge)) && (binding->delay >= 0.0) &&
- ((binding->drag_only == ev->drag) || ev->drag) &&
- ((binding->any_mod) || (binding->mod == mod)))
- {
- if (_e_bindings_context_match(binding->ctxt, ctxt))
- {
- act = e_action_find(binding->action);
- if (act)
- {
- E_Binding_Edge_Data *ed = E_NEW(E_Binding_Edge_Data, 1);
- E_Event_Zone_Edge *ev2 = E_NEW(E_Event_Zone_Edge, 1);
- if (!ed || !ev2)
- {
- E_FREE(ed);
- E_FREE(ev2);
- continue;
- }
-
- /* The original event will be freed before it can be
- * used again */
- ev2->zone = ev->zone;
- ev2->edge = ev->edge;
- ev2->x = ev->x;
- ev2->y = ev->y;
-
- ed->bind = binding;
- ed->obj = obj;
- ed->act = act;
- ed->ev = ev2;
- binding->timer = ecore_timer_add(((double)binding->delay), _e_bindings_edge_cb_timer, ed);
- }
- }
- }
- }
- return act;
-}
-
-EINTERN E_Action *
-e_bindings_edge_out_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Zone_Edge *ev)
-{
- E_Binding_Modifier mod = 0;
- E_Binding_Edge *binding;
- E_Action *act = NULL;
- Eina_List *l;
-
- if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT;
- if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL;
- if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT) mod |= E_BINDING_MODIFIER_ALT;
- if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN) mod |= E_BINDING_MODIFIER_WIN;
- EINA_LIST_FOREACH(edge_bindings, l, binding)
- {
- /* A value of <= -1.0 for the delay indicates it as a mouse-click binding on that edge */
- if ((binding->edge == ev->edge) && (binding->delay >= 0.0) &&
- ((binding->any_mod) || (binding->mod == mod)))
- {
- if (_e_bindings_context_match(binding->ctxt, ctxt))
- {
- if (binding->timer)
- {
- E_Binding_Edge_Data *ed;
-
- ed = ecore_timer_del(binding->timer);
- if (ed)
- {
- E_FREE(ed->ev);
- E_FREE(ed);
- }
- }
- binding->timer = NULL;
-
- act = e_action_find(binding->action);
- if (act && act->func.end)
- act->func.end(obj, binding->params);
- }
- }
- }
- return act;
-}
-
-EINTERN E_Action *
-e_bindings_edge_down_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Zone_Edge *ev)
-{
- E_Binding_Modifier mod = 0;
- E_Binding_Edge *binding;
- E_Desk *current = NULL;
- E_Action *act = NULL;
- Eina_List *l;
-
- current = e_desk_at_xy_get(ev->zone, ev->zone->desk_x_current, ev->zone->desk_y_current);
- if (current->fullscreen_clients) return NULL;
-
- if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT;
- if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL;
- if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT) mod |= E_BINDING_MODIFIER_ALT;
- if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN) mod |= E_BINDING_MODIFIER_WIN;
- EINA_LIST_FOREACH(edge_bindings, l, binding)
- {
- if (((binding->edge == ev->edge)) && (binding->delay == -1.0 * ev->button) &&
- (!binding->drag_only) && ((binding->any_mod) || (binding->mod == mod)))
- {
- if (_e_bindings_context_match(binding->ctxt, ctxt))
- {
- act = e_action_find(binding->action);
- if (act)
- {
- if (act->func.go_edge)
- act->func.go_edge(obj, binding->params, ev);
- else if (act->func.go)
- act->func.go(obj, binding->params);
- }
- }
- }
- }
- return act;
-}
-
-EINTERN E_Action *
-e_bindings_edge_up_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Zone_Edge *ev)
-{
- E_Binding_Modifier mod = 0;
- E_Binding_Edge *binding;
- E_Action *act = NULL;
- Eina_List *l;
-
- if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT;
- if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL;
- if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT) mod |= E_BINDING_MODIFIER_ALT;
- if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN) mod |= E_BINDING_MODIFIER_WIN;
- EINA_LIST_FOREACH(edge_bindings, l, binding)
- {
- if (((binding->edge == ev->edge)) && (binding->delay == -1.0 * ev->button) &&
- ((binding->any_mod) || (binding->mod == mod)))
- {
- if (_e_bindings_context_match(binding->ctxt, ctxt))
- {
- act = e_action_find(binding->action);
- if (act && act->func.end)
- act->func.end(obj, binding->params);
- }
- }
- }
- return act;
-}
-
-EINTERN void
e_bindings_signal_add(E_Binding_Context ctxt, const char *sig, const char *src, E_Binding_Modifier mod, int any_mod, const char *action, const char *params)
{
E_Binding_Signal *binding;
}
static void
-_e_bindings_edge_free(E_Binding_Edge *binding)
-{
- if (binding->action) eina_stringshare_del(binding->action);
- if (binding->params) eina_stringshare_del(binding->params);
- if (binding->timer)
- {
- E_Binding_Edge_Data *ed;
-
- ed = ecore_timer_del(binding->timer);
- E_FREE(ed);
- }
- free(binding);
-}
-
-static void
_e_bindings_signal_free(E_Binding_Signal *binding)
{
if (binding->sig) eina_stringshare_del(binding->sig);
return mod;
}
-
-static Eina_Bool
-_e_bindings_edge_cb_timer(void *data)
-{
- E_Binding_Edge_Data *ed;
- E_Event_Zone_Edge *ev;
- E_Binding_Edge *binding;
- E_Action *act;
- E_Object *obj;
-
- ed = data;
- binding = ed->bind;
- act = ed->act;
- obj = ed->obj;
- ev = ed->ev;
-
- E_FREE(ed);
- binding->timer = NULL;
-
- if (act->func.go_edge)
- act->func.go_edge(obj, binding->params, ev);
- else if (act->func.go)
- act->func.go(obj, binding->params);
-
- /* Duplicate event */
- E_FREE(ev);
-
- return ECORE_CALLBACK_CANCEL;
-}
-
void *event_info);
static void _e_zone_event_generic_free(void *data, void *ev);
static void _e_zone_object_del_attach(void *o);
-static E_Zone_Edge _e_zone_detect_edge(E_Zone *zone, Evas_Object *obj);
-static void _e_zone_edge_move_resize(E_Zone *zone);
static void _e_zone_hooks_clean(void);
static Eina_Bool _e_zone_hook_call(E_Zone_Hook_Point hookpoint, E_Zone *zone);
E_API int E_EVENT_ZONE_MOVE_RESIZE = 0;
EINTERN int E_EVENT_ZONE_ADD = 0;
EINTERN int E_EVENT_ZONE_DEL = 0;
-EINTERN int E_EVENT_ZONE_EDGE_IN = 0;
-EINTERN int E_EVENT_ZONE_EDGE_OUT = 0;
-EINTERN int E_EVENT_ZONE_EDGE_MOVE = 0;
EINTERN int E_EVENT_ZONE_STOW = 0;
EINTERN int E_EVENT_ZONE_UNSTOW = 0;
#ifdef _F_ZONE_WINDOW_ROTATION_
E_EVENT_ZONE_MOVE_RESIZE = ecore_event_type_new();
E_EVENT_ZONE_ADD = ecore_event_type_new();
E_EVENT_ZONE_DEL = ecore_event_type_new();
- E_EVENT_ZONE_EDGE_IN = ecore_event_type_new();
- E_EVENT_ZONE_EDGE_OUT = ecore_event_type_new();
- E_EVENT_ZONE_EDGE_MOVE = ecore_event_type_new();
E_EVENT_ZONE_STOW = ecore_event_type_new();
E_EVENT_ZONE_UNSTOW = ecore_event_type_new();
#ifdef _F_ZONE_WINDOW_ROTATION_
E_API void
e_zone_all_edge_flip_eval(void)
{
- const Eina_List *l;
- E_Zone *zone;
-
- EINA_LIST_FOREACH(e_comp->zones, l, zone)
- e_zone_edge_flip_eval(zone);
-}
-
-static void
-_e_zone_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
-{
- Evas_Event_Mouse_In *ev = event_info;
- E_Event_Zone_Edge *zev;
- E_Zone_Edge edge;
- E_Zone *zone = data;
-
- edge = _e_zone_detect_edge(zone, obj);
- if (edge == E_ZONE_EDGE_NONE) return;
-
- zev = E_NEW(E_Event_Zone_Edge, 1);
- if (!zev) return;
- zev->zone = zone;
- zev->edge = edge;
- zev->x = ev->output.x;
- zev->y = ev->output.y;
- zev->modifiers = e_bindings_evas_modifiers_convert(ev->modifiers);
- zev->drag = !!evas_pointer_button_down_mask_get(e_comp->evas);
-
- ecore_event_add(E_EVENT_ZONE_EDGE_IN, zev, NULL, NULL);
- e_bindings_edge_in_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
-}
-
-static void
-_e_zone_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
-{
- Evas_Event_Mouse_Out *ev = event_info;
- E_Event_Zone_Edge *zev;
- E_Zone_Edge edge;
- E_Zone *zone = data;
-
- edge = _e_zone_detect_edge(zone, obj);
- if (edge == E_ZONE_EDGE_NONE) return;
-
- zev = E_NEW(E_Event_Zone_Edge, 1);
- if (!zev) return;
- zev->zone = zone;
- zev->edge = edge;
- zev->x = ev->output.x;
- zev->y = ev->output.y;
- zev->modifiers = e_bindings_evas_modifiers_convert(ev->modifiers);
- zev->drag = !!evas_pointer_button_down_mask_get(e_comp->evas);
-
- ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL);
- e_bindings_edge_out_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
-}
-
-static void
-_e_zone_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
-{
- Evas_Event_Mouse_Down *ev = event_info;
- E_Event_Zone_Edge *zev;
- E_Zone_Edge edge;
- E_Zone *zone = data;
-
- edge = _e_zone_detect_edge(zone, obj);
- if (edge == E_ZONE_EDGE_NONE) return;
-
- zev = E_NEW(E_Event_Zone_Edge, 1);
- if (!zev) return;
- zev->zone = zone;
- zev->edge = edge;
- zev->x = ev->output.x;
- zev->y = ev->output.y;
- zev->button = ev->button;
- zev->modifiers = e_bindings_evas_modifiers_convert(ev->modifiers);
- ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL);
- e_bindings_edge_down_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
-}
-
-static void
-_e_zone_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
-{
- Evas_Event_Mouse_Up *ev = event_info;
- E_Event_Zone_Edge *zev;
- E_Zone_Edge edge;
- E_Zone *zone = data;
-
- edge = _e_zone_detect_edge(zone, obj);
- if (edge == E_ZONE_EDGE_NONE) return;
-
- zev = E_NEW(E_Event_Zone_Edge, 1);
- if (!zev) return;
- zev->zone = zone;
- zev->edge = edge;
- zev->x = ev->output.x;
- zev->y = ev->output.y;
- zev->button = ev->button;
- zev->modifiers = e_bindings_evas_modifiers_convert(ev->modifiers);
- ecore_event_add(E_EVENT_ZONE_EDGE_OUT, zev, NULL, NULL);
- e_bindings_edge_up_event_handle(E_BINDING_CONTEXT_ZONE, E_OBJECT(zone), zev);
-}
-
-static void
-_e_zone_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
-{
- Evas_Event_Mouse_Move *ev = event_info;
- E_Event_Zone_Edge *zev;
- E_Zone_Edge edge;
- E_Zone *zone = data;
-
- edge = _e_zone_detect_edge(zone, obj);
- if (edge == E_ZONE_EDGE_NONE) return;
-
- zev = E_NEW(E_Event_Zone_Edge, 1);
- if (!zev) return;
- zev->zone = zone;
- zev->edge = edge;
- zev->x = ev->cur.output.x;
- zev->y = ev->cur.output.y;
- zev->modifiers = e_bindings_evas_modifiers_convert(ev->modifiers);
- ecore_event_add(E_EVENT_ZONE_EDGE_MOVE, zev, NULL, NULL);
+ // TODO: deprecated.
}
static void
ecore_event_add(E_EVENT_ZONE_MOVE_RESIZE, ev, _e_zone_event_generic_free, NULL);
}
- _e_zone_edge_move_resize(zone);
e_zone_bg_reconfigure(zone);
e_zone_reconfigure_clients(zone, dx, dy, 0, 0);
}
_e_zone_event_generic_free, NULL);
}
- _e_zone_edge_move_resize(zone);
e_zone_bg_reconfigure(zone);
e_zone_reconfigure_clients(zone, 0, 0, dw, dh);
}
_e_zone_event_generic_free, NULL);
}
- _e_zone_edge_move_resize(zone);
e_zone_bg_reconfigure(zone);
e_zone_reconfigure_clients(zone, dx, dy, dw, dh);
return EINA_TRUE;
starting = s;
}
- e_zone_edge_flip_eval(zone);
-
ev = E_NEW(E_Event_Zone_Desk_Count_Set, 1);
if (!ev) return;
ev->zone = zone;
dx = zone->desk_x_current + dx;
dy = zone->desk_y_current + dy;
e_zone_desk_flip_to(zone, dx, dy);
- e_zone_edge_flip_eval(zone);
}
EINTERN void
desk = e_desk_at_xy_get(zone, x, y);
if (!desk) return;
e_desk_show(desk);
- e_zone_edge_flip_eval(zone);
}
EINTERN void
}
EINTERN void
-e_zone_edge_enable(void)
-{
- const Eina_List *l;
- E_Zone *zone;
-
- EINA_LIST_FOREACH(e_comp->zones, l, zone)
- {
- if (zone->edge.left) evas_object_show(zone->edge.left);
- if (zone->edge.right) evas_object_show(zone->edge.right);
- if (zone->edge.top) evas_object_show(zone->edge.top);
- if (zone->edge.bottom) evas_object_show(zone->edge.bottom);
- if (zone->corner.left_top) evas_object_show(zone->corner.left_top);
- if (zone->corner.top_left) evas_object_show(zone->corner.top_left);
- if (zone->corner.top_right) evas_object_show(zone->corner.top_right);
- if (zone->corner.right_top) evas_object_show(zone->corner.right_top);
- if (zone->corner.right_bottom) evas_object_show(zone->corner.right_bottom);
- if (zone->corner.bottom_right) evas_object_show(zone->corner.bottom_right);
- if (zone->corner.bottom_left) evas_object_show(zone->corner.bottom_left);
- if (zone->corner.left_bottom) evas_object_show(zone->corner.left_bottom);
- e_zone_edge_flip_eval(zone);
- }
-}
-
-EINTERN void
-e_zone_edge_disable(void)
-{
- const Eina_List *l;
- E_Zone *zone;
-
- EINA_LIST_FOREACH(e_comp->zones, l, zone)
- {
- if (zone->edge.left) evas_object_hide(zone->edge.left);
- if (zone->edge.right) evas_object_hide(zone->edge.right);
- if (zone->edge.top) evas_object_hide(zone->edge.top);
- if (zone->edge.bottom) evas_object_hide(zone->edge.bottom);
- if (zone->corner.left_top) evas_object_hide(zone->corner.left_top);
- if (zone->corner.top_left) evas_object_hide(zone->corner.top_left);
- if (zone->corner.top_right) evas_object_hide(zone->corner.top_right);
- if (zone->corner.right_top) evas_object_hide(zone->corner.right_top);
- if (zone->corner.right_bottom) evas_object_hide(zone->corner.right_bottom);
- if (zone->corner.bottom_right) evas_object_hide(zone->corner.bottom_right);
- if (zone->corner.bottom_left) evas_object_hide(zone->corner.bottom_left);
- if (zone->corner.left_bottom) evas_object_hide(zone->corner.left_bottom);
- }
-}
-
-EINTERN void
-e_zone_edges_desk_flip_capable(E_Zone *zone, Eina_Bool l, Eina_Bool r, Eina_Bool t, Eina_Bool b)
-{
-#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, obj) \
- do { \
- if (v) { \
- if (NEED_FLIP_EDGE(ed)) { if (zone->edge.obj) evas_object_show(zone->edge.obj); } \
- else if (zone->edge.obj) \
- evas_object_hide(zone->edge.obj); \
- } \
- else { \
- if (NEED_EDGE(ed)) { if (zone->edge.obj) evas_object_show(zone->edge.obj); } \
- else if (zone->edge.obj) \
- evas_object_hide(zone->edge.obj); \
- } \
- } 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, obj1, obj2) \
- if ((!v1) && (!v2)) { \
- if (NEED_EDGE(ed)) { \
- if (zone->corner.obj1) evas_object_show(zone->corner.obj1); \
- if (zone->corner.obj2) evas_object_show(zone->corner.obj2); \
- } \
- else { \
- if (zone->corner.obj1) evas_object_hide(zone->corner.obj1); \
- if (zone->corner.obj2) evas_object_hide(zone->corner.obj2); \
- } \
- } \
- else { \
- if (NEED_FLIP_EDGE(ed)) { \
- if (zone->corner.obj1) evas_object_show(zone->corner.obj1); \
- if (zone->corner.obj2) evas_object_show(zone->corner.obj2); \
- } \
- else { \
- if (zone->corner.obj1) evas_object_hide(zone->corner.obj1); \
- if (zone->corner.obj2) evas_object_hide(zone->corner.obj2); \
- } \
- }
-
- 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);
-}
-
-EINTERN Eina_Bool
-e_zone_exists_direction(E_Zone *zone, E_Zone_Edge edge)
-{
- Eina_List *l;
- E_Zone *z2;
-
- EINA_LIST_FOREACH(e_comp->zones, l, z2)
- {
- if (zone == z2) continue;
-
- switch (edge)
- {
- case E_ZONE_EDGE_TOP_LEFT:
- if (((E_SPANS_COMMON(0, zone->x + zone->w, z2->x, z2->w)) &&
- (z2->y < zone->y)) ||
- ((E_SPANS_COMMON(0, zone->y + zone->h, z2->y, z2->h)) &&
- (z2->x < zone->x)))
- return EINA_TRUE;
- break;
-
- case E_ZONE_EDGE_TOP:
- if ((E_SPANS_COMMON(zone->x, zone->w, z2->x, z2->w)) &&
- (z2->y < zone->y))
- return EINA_TRUE;
- break;
-
- case E_ZONE_EDGE_TOP_RIGHT:
- if (((E_SPANS_COMMON(zone->x, 99999, z2->x, z2->w)) &&
- (z2->y < zone->y)) ||
- ((E_SPANS_COMMON(0, zone->y + zone->h, z2->y, z2->h)) &&
- (z2->x >= (zone->x + zone->w))))
- return EINA_TRUE;
- break;
-
- case E_ZONE_EDGE_LEFT:
- if ((E_SPANS_COMMON(zone->y, zone->h, z2->y, z2->h)) &&
- (z2->x < zone->x))
- return EINA_TRUE;
- break;
-
- case E_ZONE_EDGE_RIGHT:
- if ((E_SPANS_COMMON(zone->y, zone->h, z2->y, z2->h)) &&
- (z2->x >= (zone->x + zone->w)))
- return EINA_TRUE;
- break;
-
- case E_ZONE_EDGE_BOTTOM_LEFT:
- if (((E_SPANS_COMMON(0, zone->x + zone->w, z2->x, z2->w)) &&
- (z2->y >= (zone->y + zone->h))) ||
- ((E_SPANS_COMMON(zone->y, 99999, z2->y, z2->h)) &&
- (z2->x < zone->x)))
- return EINA_TRUE;
- break;
-
- case E_ZONE_EDGE_BOTTOM:
- if ((E_SPANS_COMMON(zone->x, zone->w, z2->x, z2->w)) &&
- (z2->y >= (zone->y + zone->h)))
- return EINA_TRUE;
- break;
-
- case E_ZONE_EDGE_BOTTOM_RIGHT:
- if (((E_SPANS_COMMON(zone->x, 99999, z2->x, z2->w)) &&
- (z2->y >= (zone->y + zone->h))) ||
- ((E_SPANS_COMMON(zone->y, 99999, z2->y, z2->h)) &&
- (z2->x < zone->x)))
- return EINA_TRUE;
- break;
-
- default:
- break;
- }
- }
-
- return EINA_FALSE;
-}
-
-EINTERN void
-e_zone_edge_flip_eval(E_Zone *zone)
-{
- Eina_Bool lf, rf, tf, bf;
-
- lf = rf = tf = bf = EINA_TRUE;
- if (zone->desk_x_count <= 1) lf = rf = EINA_FALSE;
- else
- {
- if (zone->desk_x_current == 0) lf = EINA_FALSE;
- if (zone->desk_x_current == (zone->desk_x_count - 1)) rf = EINA_FALSE;
- }
- if (zone->desk_y_count <= 1) tf = bf = EINA_FALSE;
- else
- {
- if (zone->desk_y_current == 0) tf = EINA_FALSE;
- if (zone->desk_y_current == (zone->desk_y_count - 1)) bf = EINA_FALSE;
- }
- e_zone_edges_desk_flip_capable(zone, lf, rf, tf, bf);
-}
-
-EINTERN void
-e_zone_edge_new(E_Zone_Edge edge)
-{
- const Eina_List *l;
- E_Zone *zone;
- int cw, ch;
-
- if (edge == E_ZONE_EDGE_NONE) return;
-
- EINA_LIST_FOREACH(e_comp->zones, l, zone)
- {
- // don't allow bindings on edges that are on the boundary
- // between zones
- if (e_zone_exists_direction(zone, edge)) continue;
- cw = zone->w * E_ZONE_CORNER_RATIO;
- ch = zone->h * E_ZONE_CORNER_RATIO;
- switch (edge)
- {
-#define EDGE_NEW(MEMBER, X, Y, W, H) do { \
- if (!zone->MEMBER) \
- { \
- zone->MEMBER = evas_object_rectangle_add(e_comp->evas); \
- evas_object_name_set(zone->MEMBER, #MEMBER); \
- evas_object_move(zone->MEMBER, (X), (Y)); \
- evas_object_resize(zone->MEMBER, (W), (H)); \
- evas_object_color_set(zone->MEMBER, 0, 0, 0, 0); \
- evas_object_event_callback_add(zone->MEMBER, EVAS_CALLBACK_MOUSE_MOVE, _e_zone_cb_mouse_move, zone); \
- evas_object_event_callback_add(zone->MEMBER, EVAS_CALLBACK_MOUSE_IN, _e_zone_cb_mouse_in, zone); \
- evas_object_event_callback_add(zone->MEMBER, EVAS_CALLBACK_MOUSE_OUT, _e_zone_cb_mouse_out, zone); \
- evas_object_event_callback_add(zone->MEMBER, EVAS_CALLBACK_MOUSE_DOWN, _e_zone_cb_mouse_down, zone); \
- evas_object_event_callback_add(zone->MEMBER, EVAS_CALLBACK_MOUSE_UP, _e_zone_cb_mouse_up, zone); \
- evas_object_show(zone->MEMBER); \
- } \
- } while (0)
-
- case E_ZONE_EDGE_LEFT:
- EDGE_NEW(edge.left, zone->x, zone->y + ch, 1, zone->h - 2 * ch);
- break;
- case E_ZONE_EDGE_RIGHT:
- EDGE_NEW(edge.right, zone->x + zone->w - 1, zone->y + ch, 1, zone->h - 2 * ch);
- break;
- case E_ZONE_EDGE_TOP:
- EDGE_NEW(edge.top, zone->x + 1 + cw, zone->y, zone->w - 2 * cw - 2, 1);
- break;
- case E_ZONE_EDGE_BOTTOM:
- EDGE_NEW(edge.bottom, zone->x + 1 + cw, zone->y + zone->h - 1, zone->w - 2 - 2 * cw, 1);
- break;
- case E_ZONE_EDGE_TOP_LEFT:
- EDGE_NEW(corner.left_top, zone->x, zone->y, 1, ch);
- EDGE_NEW(corner.top_left, zone->x + 1, zone->y, cw, 1);
- break;
- case E_ZONE_EDGE_TOP_RIGHT:
- EDGE_NEW(corner.top_right, zone->x + zone->w - cw - 2, zone->y, cw, 1);
- EDGE_NEW(corner.right_top, zone->x + zone->w - 1, zone->y, 1, ch);
- break;
- case E_ZONE_EDGE_BOTTOM_RIGHT:
- EDGE_NEW(corner.right_bottom, zone->x + zone->w - 1, zone->y + zone->h - ch, 1, ch);
- EDGE_NEW(corner.bottom_right, zone->x + zone->w - cw - 2, zone->y + zone->h - 1, cw, 1);
- break;
- case E_ZONE_EDGE_BOTTOM_LEFT:
- EDGE_NEW(corner.bottom_left, zone->x + 1, zone->y + zone->h - 1, cw, 1);
- EDGE_NEW(corner.left_bottom, zone->x, zone->y + zone->h - ch, 1, ch);
- break;
- default: continue;
- }
- e_zone_edge_win_layer_set(zone, E_LAYER_CLIENT_EDGE_FULLSCREEN);
- }
-}
-
-EINTERN void
-e_zone_edge_free(E_Zone_Edge edge)
-{
- const Eina_List *l;
- E_Zone *zone;
-
- if (edge == E_ZONE_EDGE_NONE) return;
- EINA_LIST_FOREACH(e_comp->zones, l, zone)
- {
- switch (edge)
- {
- case E_ZONE_EDGE_LEFT:
- E_FREE_FUNC(zone->edge.left, evas_object_del);
- break;
-
- case E_ZONE_EDGE_RIGHT:
- E_FREE_FUNC(zone->edge.right, evas_object_del);
- break;
-
- case E_ZONE_EDGE_TOP:
- E_FREE_FUNC(zone->edge.top, evas_object_del);
- break;
-
- case E_ZONE_EDGE_BOTTOM:
- E_FREE_FUNC(zone->edge.bottom, evas_object_del);
- break;
-
- case E_ZONE_EDGE_TOP_LEFT:
- E_FREE_FUNC(zone->corner.left_top, evas_object_del);
- E_FREE_FUNC(zone->corner.top_left, evas_object_del);
- break;
-
- case E_ZONE_EDGE_TOP_RIGHT:
- E_FREE_FUNC(zone->corner.top_right, evas_object_del);
- E_FREE_FUNC(zone->corner.right_top, evas_object_del);
- break;
-
- case E_ZONE_EDGE_BOTTOM_RIGHT:
- E_FREE_FUNC(zone->corner.right_bottom, evas_object_del);
- E_FREE_FUNC(zone->corner.bottom_right, evas_object_del);
- break;
-
- case E_ZONE_EDGE_BOTTOM_LEFT:
- E_FREE_FUNC(zone->corner.bottom_left, evas_object_del);
- E_FREE_FUNC(zone->corner.left_bottom, evas_object_del);
- break;
-
- default:
- break;
- }
- }
-}
-
-EINTERN void
-e_zone_edge_win_layer_set(E_Zone *zone, E_Layer layer)
-{
-#define EDGE_STACK(EDGE) do { \
- if (zone->EDGE) \
- { \
- evas_object_layer_set(zone->EDGE, layer); \
- evas_object_stack_below(zone->EDGE, e_comp->layers[e_comp_canvas_layer_map(layer)].obj); \
- } \
- } while (0)
-
- EDGE_STACK(corner.left_bottom);
- EDGE_STACK(corner.left_top);
- EDGE_STACK(corner.top_left);
- EDGE_STACK(corner.top_right);
- EDGE_STACK(corner.right_top);
- EDGE_STACK(corner.right_bottom);
- EDGE_STACK(corner.bottom_right);
- EDGE_STACK(corner.bottom_left);
-
- EDGE_STACK(edge.left);
- EDGE_STACK(edge.right);
- EDGE_STACK(edge.top);
- EDGE_STACK(edge.bottom);
-}
-
-EINTERN void
e_zone_fade_handle(E_Zone *zone, int out, double tim)
{
EINA_SAFETY_ON_NULL_RETURN(zone);
int x, y;
E_Zone_Obstacle *obs;
- //printf("@@@@@@@@@@ e_zone_free: %i %i | %i %i %ix%i = %p\n", zone->num, zone->id, zone->x, zone->y, zone->w, zone->h, zone);
- /* Delete the edge windows if they exist */
- E_FREE_FUNC(zone->edge.top, evas_object_del);
- E_FREE_FUNC(zone->edge.bottom, evas_object_del);
- E_FREE_FUNC(zone->edge.left, evas_object_del);
- E_FREE_FUNC(zone->edge.right, evas_object_del);
- E_FREE_FUNC(zone->corner.left_bottom, evas_object_del);
- E_FREE_FUNC(zone->corner.left_top, evas_object_del);
- E_FREE_FUNC(zone->corner.top_left, evas_object_del);
- E_FREE_FUNC(zone->corner.top_right, evas_object_del);
- E_FREE_FUNC(zone->corner.right_top, evas_object_del);
- E_FREE_FUNC(zone->corner.right_bottom, evas_object_del);
- E_FREE_FUNC(zone->corner.bottom_right, evas_object_del);
- E_FREE_FUNC(zone->corner.bottom_left, evas_object_del);
-
/* Delete the hooks */
E_FREE_FUNC(zone->hook.ec_del, e_client_hook_del);
wl_global_destroy(zone->global);
}
-static E_Zone_Edge
-_e_zone_detect_edge(E_Zone *zone, Evas_Object *obj)
-{
- E_Zone_Edge edge = E_ZONE_EDGE_NONE;
-
- if (obj == zone->edge.left)
- edge = E_ZONE_EDGE_LEFT;
- else if (obj == zone->edge.top)
- edge = E_ZONE_EDGE_TOP;
- else if (obj == zone->edge.right)
- edge = E_ZONE_EDGE_RIGHT;
- else if (obj == zone->edge.bottom)
- edge = E_ZONE_EDGE_BOTTOM;
- else if ((obj == zone->corner.left_top) ||
- (obj == zone->corner.top_left))
- edge = E_ZONE_EDGE_TOP_LEFT;
- else if ((obj == zone->corner.right_top) ||
- (obj == zone->corner.top_right))
- edge = E_ZONE_EDGE_TOP_RIGHT;
- else if ((obj == zone->corner.right_bottom) ||
- (obj == zone->corner.bottom_right))
- edge = E_ZONE_EDGE_BOTTOM_RIGHT;
- else if ((obj == zone->corner.left_bottom) ||
- (obj == zone->corner.bottom_left))
- edge = E_ZONE_EDGE_BOTTOM_LEFT;
- return edge;
-}
-
-static void
-_e_zone_edge_move_resize(E_Zone *zone)
-{
- int cw;
- int ch;
-
- cw = zone->w * E_ZONE_CORNER_RATIO;
- ch = zone->h * E_ZONE_CORNER_RATIO;
-
- evas_object_geometry_set(zone->corner.left_bottom,
- zone->x, zone->y + zone->h - ch, 1, ch);
- evas_object_geometry_set(zone->edge.left,
- zone->x, zone->y + ch, 1, zone->h - 2 * ch);
- evas_object_geometry_set(zone->corner.left_top,
- zone->x, zone->y, 1, ch);
-
- evas_object_geometry_set(zone->corner.top_left,
- zone->x + 1, zone->y, cw, 1);
- evas_object_geometry_set(zone->edge.top,
- zone->x + 1 + cw, zone->y, zone->w - 2 * cw - 2, 1);
- evas_object_geometry_set(zone->corner.top_right,
- zone->x + zone->w - cw - 2, zone->y, cw, 1);
-
- evas_object_geometry_set(zone->corner.right_top,
- zone->x + zone->w - 1, zone->y, 1, ch);
- evas_object_geometry_set(zone->edge.right,
- zone->x + zone->w - 1, zone->y + ch, 1, zone->h - 2 * ch);
- evas_object_geometry_set(zone->corner.right_bottom,
- zone->x + zone->w - 1, zone->y + zone->h - ch, 1, ch);
-
- evas_object_geometry_set(zone->corner.bottom_right,
- zone->x + 1, zone->y + zone->h - 1, cw, 1);
- evas_object_geometry_set(zone->edge.bottom,
- zone->x + 1 + cw, zone->y + zone->h - 1, zone->w - 2 - 2 * cw, 1);
- evas_object_geometry_set(zone->corner.bottom_left,
- zone->x + zone->w - cw - 2, zone->y + zone->h - 1, cw, 1);
-}
-
static void
_e_zone_hooks_clean(void)
{