hide edge event windows that are not used by any action

put the edge windows on the correct layers
allow edge click bindings
use actions for auto-hide shelves
toggling auto-hide will cause edge event windows to show/hide if necessary


SVN revision: 42864
This commit is contained in:
Viktor Kojouharov 2009-10-02 20:53:05 +00:00
parent a50c18222b
commit b6ec16d97e
11 changed files with 564 additions and 107 deletions

View File

@ -7124,7 +7124,7 @@ collections { /* begin the collection of edje groups that are in this file */
color: 255 255 0 150;
}
}
part { name: "e.swallow.slider";
part { name: "e.swallow.check";
type: SWALLOW;
description { state: "default" 0.0;
rel1 {
@ -7133,10 +7133,25 @@ collections { /* begin the collection of edje groups that are in this file */
to_x: "e.swallow.background";
to_y: "e.text.description";
}
rel2 {
relative: 1 1;
offset: -5 30;
to_y: "e.text.description";
}
}
}
part { name: "e.swallow.slider";
type: SWALLOW;
description { state: "default" 0.0;
rel1 {
relative: 1 1;
offset: 5 2;
to_x: "e.swallow.background";
to_y: "e.swallow.check";
}
rel2 {
relative: 1 1;
offset: -5 -5;
to_y: "e.swallow.background";
}
}
}

View File

@ -2205,6 +2205,65 @@ ACT_FN_GO(shelf_show)
}
}
/***************************************************************************/
#define ACT_SHELF_SHOW(params, es) \
if ((!params) || (params && (fnmatch(params, es->name, 0) == 0))) \
{ \
e_shelf_toggle(es, 1); \
e_shelf_toggle(es, 0); \
}
ACT_FN_GO_EDGE(shelf_show)
{
Eina_List *l;
E_Shelf *es;
if (params)
{
for (; *params != '\0'; params++)
if (!isspace(*params))
break;
if (*params == '\0')
params = NULL;
}
EINA_LIST_FOREACH(e_shelf_list(), l, es)
{
switch(ev->edge)
{
case E_ZONE_EDGE_LEFT:
if ((es->gadcon->orient == E_GADCON_ORIENT_LEFT ||
es->gadcon->orient == E_GADCON_ORIENT_CORNER_LT ||
es->gadcon->orient == E_GADCON_ORIENT_CORNER_LB) &&
(ev->y >= es->y) && (ev->y <= (es->y + es->h)))
ACT_SHELF_SHOW(params, es);
break;
case E_ZONE_EDGE_RIGHT:
if ((es->gadcon->orient == E_GADCON_ORIENT_RIGHT ||
es->gadcon->orient == E_GADCON_ORIENT_CORNER_RT ||
es->gadcon->orient == E_GADCON_ORIENT_CORNER_RB) &&
(ev->y >= es->y) && (ev->y <= (es->y + es->h)))
ACT_SHELF_SHOW(params, es);
break;
case E_ZONE_EDGE_TOP:
if ((es->gadcon->orient == E_GADCON_ORIENT_TOP ||
es->gadcon->orient == E_GADCON_ORIENT_CORNER_TL ||
es->gadcon->orient == E_GADCON_ORIENT_CORNER_TR) &&
(ev->x >= es->x) && (ev->x <= (es->x + es->w)))
ACT_SHELF_SHOW(params, es);
break;
case E_ZONE_EDGE_BOTTOM:
if ((es->gadcon->orient == E_GADCON_ORIENT_BOTTOM ||
es->gadcon->orient == E_GADCON_ORIENT_CORNER_BL ||
es->gadcon->orient == E_GADCON_ORIENT_CORNER_BR) &&
(ev->x >= es->x) && (ev->x <= (es->x + es->w)))
ACT_SHELF_SHOW(params, es);
break;
default:
break;
}
}
}
#undef ACT_SHELF_SHOW
/***************************************************************************/
typedef struct _Delayed_Action Delayed_Action;
@ -2581,6 +2640,7 @@ e_actions_init(void)
/* shelf_show */
ACT_GO(shelf_show);
ACT_GO_EDGE(shelf_show);
e_action_predef_name_set(_("Desktop"), _("Show The Shelf"), "shelf_show",
NULL, "shelf name glob: Shelf-* ", 1);

View File

@ -424,18 +424,23 @@ e_bindings_edge_add(E_Binding_Context ctxt, E_Zone_Edge edge, E_Binding_Modifier
if (action) bind->action = eina_stringshare_add(action);
if (params) bind->params = eina_stringshare_add(params);
edge_bindings = eina_list_append(edge_bindings, bind);
e_util_zone_edge_toggle(edge, 1);
}
EAPI E_Binding_Edge *
e_bindings_edge_get(const char *action, E_Zone_Edge edge)
e_bindings_edge_get(const char *action, E_Zone_Edge edge, Eina_Bool click)
{
E_Binding_Edge *bind;
Eina_List *l;
EINA_LIST_FOREACH(edge_bindings, l, bind)
{
if ((bind->edge == edge) && bind->action &&
action && !strcmp(action, bind->action))
if ((bind->edge == edge) &&
((click && (bind->delay == -1.0))
|| (!click && (bind->delay >= 0.0))) &&
bind->action && action &&
!strcmp(action, bind->action))
return bind;
}
return NULL;
@ -446,24 +451,30 @@ e_bindings_edge_del(E_Binding_Context ctxt, E_Zone_Edge edge, E_Binding_Modifier
{
E_Binding_Edge *bind;
Eina_List *l;
int ref_count = 0;
EINA_LIST_FOREACH(edge_bindings, l, bind)
{
if ((bind->ctxt == ctxt) &&
(bind->edge == edge) &&
(bind->mod == mod) &&
((bind->delay * 1000) == (delay * 1000)) &&
(bind->any_mod == any_mod) &&
(((bind->action) && (action) && (!strcmp(bind->action, action))) ||
((!bind->action) && (!action))) &&
(((bind->params) && (params) && (!strcmp(bind->params, params))) ||
((!bind->params) && (!params))))
if ((bind->edge == edge))
{
_e_bindings_edge_free(bind);
edge_bindings = eina_list_remove_list(edge_bindings, l);
break;
if ((bind->ctxt == ctxt) &&
(bind->mod == mod) &&
((bind->delay * 1000) == (delay * 1000)) &&
(bind->any_mod == any_mod) &&
(((bind->action) && (action) && (!strcmp(bind->action, action))) ||
((!bind->action) && (!action))) &&
(((bind->params) && (params) && (!strcmp(bind->params, params))) ||
((!bind->params) && (!params))))
{
_e_bindings_edge_free(bind);
edge_bindings = eina_list_remove_list(edge_bindings, l);
}
else ref_count++;
}
}
if (!ref_count)
e_util_zone_edge_toggle(edge, 0);
}
EAPI E_Action *
@ -484,7 +495,8 @@ e_bindings_edge_in_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Z
if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN) mod |= E_BINDING_MODIFIER_WIN;
EINA_LIST_FOREACH(edge_bindings, l, bind)
{
if (((bind->edge == ev->edge)) &&
/* A value of -1.0 for the delay indicates it as a mouse-click binding on that edge */
if (((bind->edge == ev->edge)) && (bind->delay >= 0.0) &&
((bind->any_mod) || (bind->mod == mod)))
{
if (_e_bindings_context_match(bind->ctxt, ctxt))
@ -528,7 +540,8 @@ e_bindings_edge_out_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_
if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN) mod |= E_BINDING_MODIFIER_WIN;
EINA_LIST_FOREACH(edge_bindings, l, bind)
{
if ((bind->edge == ev->edge) &&
/* A value of -1.0 for the delay indicates it as a mouse-click binding on that edge */
if ((bind->edge == ev->edge) && (bind->delay >= 0.0) &&
((bind->any_mod) || (bind->mod == mod)))
{
if (_e_bindings_context_match(bind->ctxt, ctxt))
@ -555,6 +568,71 @@ e_bindings_edge_out_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_
return act;
}
EAPI 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 *bind;
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_borders && (!e_config->fullscreen_flip)) 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, bind)
{
if (((bind->edge == ev->edge)) && (bind->delay == -1.0) &&
((bind->any_mod) || (bind->mod == mod)))
{
if (_e_bindings_context_match(bind->ctxt, ctxt))
{
act = e_action_find(bind->action);
if (act)
{
if (act->func.go_edge)
act->func.go_edge(obj, bind->params, ev);
else if (act->func.go)
act->func.go(obj, bind->params);
}
}
}
}
return act;
}
EAPI 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 *bind;
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, bind)
{
if ((bind->edge == ev->edge) && (bind->delay == -1.0) &&
((bind->any_mod) || (bind->mod == mod)))
{
if (_e_bindings_context_match(bind->ctxt, ctxt))
{
act = e_action_find(bind->action);
if (act && act->func.end)
act->func.end(obj, bind->params);
}
}
}
return act;
}
EAPI 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)
{

View File

@ -116,10 +116,12 @@ EAPI E_Action *e_bindings_key_down_event_handle(E_Binding_Context ctxt, E_Obje
EAPI E_Action *e_bindings_key_up_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_Event_Key *ev);
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 E_Binding_Edge *e_bindings_edge_get(const char *action, 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);
EAPI E_Action *e_bindings_edge_out_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Zone_Edge *ev);
EAPI E_Action *e_bindings_edge_down_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Zone_Edge *ev);
EAPI E_Action *e_bindings_edge_up_event_handle(E_Binding_Context ctxt, E_Object *obj, E_Event_Zone_Edge *ev);
EAPI 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);
EAPI void e_bindings_signal_del(E_Binding_Context ctxt, const char *sig, const char *src, E_Binding_Modifier mod, int any_mod, const char *action, const char *params);

View File

@ -11,6 +11,7 @@ static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Co
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static void _cb_disable_check_list(void *data, Evas_Object *obj);
static void _calibrate_binginds(void);
#define MODE_CUSTOM 0
#define MODE_BOTTOM_MIDDLE 1
@ -300,6 +301,7 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
e_shelf_populate(cfdata->es);
e_shelf_toggle(cfdata->es, 1);
e_shelf_show(cfdata->es);
_calibrate_binginds();
e_config_save_queue();
cfdata->es->config_dialog = cfd;
return 1; /* Apply was OK */
@ -482,6 +484,7 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
e_shelf_toggle(cfdata->es, 1);
e_zone_useful_geometry_dirty(cfdata->es->zone);
_calibrate_binginds();
e_config_save_queue();
cfdata->es->config_dialog = cfd;
return 1; /* Apply was OK */
@ -496,6 +499,68 @@ _cb_configure(void *data, void *data2)
if (!cfdata->es->gadcon->config_dialog)
e_int_gadcon_config_shelf(cfdata->es->gadcon);
}
static void
_calibrate_binginds(void)
{
E_Binding_Edge *bind;
Eina_List *l;
E_Shelf *es;
#define EDGE_BINDING_REMOVE(type, click, delay) \
bind = e_bindings_edge_get("shelf_show", type, click); \
if (bind) \
e_bindings_edge_del(E_BINDING_CONTEXT_ZONE, type, \
0, 1, "shelf_show", NULL, delay);
EDGE_BINDING_REMOVE(E_ZONE_EDGE_LEFT, 0, 0.0);
EDGE_BINDING_REMOVE(E_ZONE_EDGE_RIGHT, 0, 0.0);
EDGE_BINDING_REMOVE(E_ZONE_EDGE_TOP, 0, 0.0);
EDGE_BINDING_REMOVE(E_ZONE_EDGE_BOTTOM, 0, 0.0);
EDGE_BINDING_REMOVE(E_ZONE_EDGE_LEFT, 1, -1.0);
EDGE_BINDING_REMOVE(E_ZONE_EDGE_RIGHT, 1, -1.0);
EDGE_BINDING_REMOVE(E_ZONE_EDGE_TOP, 1, -1.0);
EDGE_BINDING_REMOVE(E_ZONE_EDGE_BOTTOM, 1, -1.0);
#undef EDGE_BINDING_REMOVE
#define EDGE_BINDING_ADD(es, type) \
if (es->cfg->autohide) \
{ \
if (es->cfg->autohide_show_action) \
e_bindings_edge_add(E_BINDING_CONTEXT_ZONE, type, \
0, 1, "shelf_show", NULL, -1.0); \
else \
e_bindings_edge_add(E_BINDING_CONTEXT_ZONE, type, \
0, 1, "shelf_show", NULL, 0.0); \
}
EINA_LIST_FOREACH(e_shelf_list(), l, es)
{
switch(es->gadcon->orient)
{
case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_CORNER_LT:
case E_GADCON_ORIENT_CORNER_LB:
EDGE_BINDING_ADD(es, E_ZONE_EDGE_LEFT)
break;
case E_GADCON_ORIENT_RIGHT:
case E_GADCON_ORIENT_CORNER_RT:
case E_GADCON_ORIENT_CORNER_RB:
EDGE_BINDING_ADD(es, E_ZONE_EDGE_RIGHT)
break;
case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR:
EDGE_BINDING_ADD(es, E_ZONE_EDGE_TOP)
break;
case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_BL:
case E_GADCON_ORIENT_CORNER_BR:
EDGE_BINDING_ADD(es, E_ZONE_EDGE_BOTTOM)
break;
}
}
#undef EDGE_BINDING_ADD
}
/**--GUI--**/
static Evas_Object *

View File

@ -130,14 +130,12 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i
evas_object_event_callback_add(es->o_event, EVAS_CALLBACK_MOUSE_DOWN, _e_shelf_cb_mouse_down, es);
/* TODO: We should have a mouse out on the evas object if we are on the desktop */
es->handlers = eina_list_append(es->handlers,
ecore_event_handler_add(E_EVENT_ZONE_EDGE_IN, _e_shelf_cb_mouse_in, es));
es->handlers = eina_list_append(es->handlers,
ecore_event_handler_add(E_EVENT_ZONE_EDGE_OUT, _e_shelf_cb_mouse_out, es));
es->handlers = eina_list_append(es->handlers,
ecore_event_handler_add(E_EVENT_ZONE_EDGE_MOVE, _e_shelf_cb_mouse_in, es));
es->handlers = eina_list_append(es->handlers,
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN, _e_shelf_cb_mouse_in, es));
es->handlers = eina_list_append(es->handlers,
ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _e_shelf_cb_mouse_in, es));
es->handlers = eina_list_append(es->handlers,
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT, _e_shelf_cb_mouse_out, es));
@ -1357,7 +1355,7 @@ _e_shelf_cb_mouse_in(void *data, int type, void *event)
es = data;
if (es->cfg->autohide_show_action) return 1;
if ((type == E_EVENT_ZONE_EDGE_IN) || (type == E_EVENT_ZONE_EDGE_MOVE))
if (type == E_EVENT_ZONE_EDGE_MOVE)
{
E_Event_Zone_Edge *ev;
int show = 0;
@ -1436,18 +1434,26 @@ _e_shelf_cb_mouse_in(void *data, int type, void *event)
}
else if (type == ECORE_X_EVENT_MOUSE_IN)
{
Ecore_X_Window win;
Ecore_X_Event_Mouse_In *ev;
ev = event;
/* If we are about to hide the shelf, interrupt on mouse in */
if (es->popup) win = es->popup->evas_win;
else win = es->zone->container->event_win;
if (ev->win == win)
if (!es->popup) return 1;
if (ev->win == es->popup->evas_win)
{
edje_object_signal_emit(es->o_base, "e,state,focused", "e");
if ((es->hide_animator) || (es->hide_timer) || (es->instant_timer))
e_shelf_toggle(es, 1);
e_shelf_toggle(es, 1);
}
}
else if (type == ECORE_EVENT_MOUSE_MOVE)
{
Ecore_Event_Mouse_Move *ev;
ev = event;
if (!es->popup) return 1;
if (ev->event_window == es->popup->evas_win)
{
edje_object_signal_emit(es->o_base, "e,state,focused", "e");
e_shelf_toggle(es, 1);
}
}
return 1;
@ -1461,45 +1467,7 @@ _e_shelf_cb_mouse_out(void *data, int type, void *event)
es = data;
if (type == E_EVENT_ZONE_EDGE_OUT)
{
E_Event_Zone_Edge *ev;
int show = 1;
ev = event;
if (es->zone != ev->zone) return 1;
switch (es->gadcon->orient)
{
case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_CORNER_LT:
case E_GADCON_ORIENT_CORNER_LB:
if ((ev->edge == E_ZONE_EDGE_LEFT) && (ev->x >= es->x + es->w))
show = 0;
break;
case E_GADCON_ORIENT_RIGHT:
case E_GADCON_ORIENT_CORNER_RT:
case E_GADCON_ORIENT_CORNER_RB:
if ((ev->edge == E_ZONE_EDGE_RIGHT) && (-ev->x > es->w))
show = 0;
break;
case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR:
if ((ev->edge == E_ZONE_EDGE_TOP) && (ev->y > es->y + es->h))
show = 0;
break;
case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_BL:
case E_GADCON_ORIENT_CORNER_BR:
if ((ev->edge == E_ZONE_EDGE_BOTTOM) && (-ev->y > es->h))
show = 0;
break;
default:
break;
}
if (!show) e_shelf_toggle(es, 0);
}
else if (type == ECORE_X_EVENT_MOUSE_OUT)
if (type == ECORE_X_EVENT_MOUSE_OUT)
{
Ecore_X_Event_Mouse_Out *ev;

View File

@ -1068,6 +1068,103 @@ e_util_win_auto_resize_fill(E_Win *win)
}
}
EAPI void
e_util_zone_edge_toggle(E_Zone_Edge edge, Eina_Bool show)
{
Eina_List *l, *ll, *lll;
Eina_List *mans, *cons;
E_Manager *man;
E_Container *con;
E_Zone *zone;
/* Update all zones to show the edge */
EINA_LIST_FOREACH(e_manager_list(), l, man)
{
EINA_LIST_FOREACH(man->containers, ll, con)
{
EINA_LIST_FOREACH(con->zones, lll, zone)
{
switch(edge)
{
case E_ZONE_EDGE_LEFT:
if (show)
ecore_x_window_show(zone->edge.left);
else
ecore_x_window_hide(zone->edge.left);
break;
case E_ZONE_EDGE_TOP:
if (show)
ecore_x_window_show(zone->edge.top);
else
ecore_x_window_hide(zone->edge.top);
break;
case E_ZONE_EDGE_RIGHT:
if (show)
ecore_x_window_show(zone->edge.right);
else
ecore_x_window_hide(zone->edge.right);
break;
case E_ZONE_EDGE_BOTTOM:
if (show)
ecore_x_window_show(zone->edge.bottom);
else
ecore_x_window_hide(zone->edge.bottom);
break;
case E_ZONE_EDGE_TOP_LEFT:
if (show)
{
ecore_x_window_show(zone->corner.top_left);
ecore_x_window_show(zone->corner.left_top);
}
else
{
ecore_x_window_hide(zone->corner.top_left);
ecore_x_window_hide(zone->corner.left_top);
}
break;
case E_ZONE_EDGE_TOP_RIGHT:
if (show)
{
ecore_x_window_show(zone->corner.top_right);
ecore_x_window_show(zone->corner.right_top);
}
else
{
ecore_x_window_hide(zone->corner.top_right);
ecore_x_window_hide(zone->corner.right_top);
}
break;
case E_ZONE_EDGE_BOTTOM_RIGHT:
if (show)
{
ecore_x_window_show(zone->corner.bottom_right);
ecore_x_window_show(zone->corner.right_bottom);
}
else
{
ecore_x_window_hide(zone->corner.bottom_right);
ecore_x_window_hide(zone->corner.right_bottom);
}
break;
case E_ZONE_EDGE_BOTTOM_LEFT:
if (show)
{
ecore_x_window_show(zone->corner.bottom_left);
ecore_x_window_show(zone->corner.left_bottom);
}
else
{
ecore_x_window_hide(zone->corner.bottom_left);
ecore_x_window_hide(zone->corner.left_bottom);
}
break;
}
}
}
}
}
/* local subsystem functions */
static int
_e_util_cb_delayed_del(void *data)

View File

@ -56,6 +56,7 @@ EAPI int e_util_dir_check(const char *dir);
EAPI void e_util_defer_object_del(E_Object *obj);
EAPI const char *e_util_winid_str_get(Ecore_X_Window win);
EAPI void e_util_win_auto_resize_fill(E_Win *win);
EAPI void e_util_zone_edge_toggle(E_Zone_Edge edge, Eina_Bool show);
#endif
#endif

View File

@ -13,6 +13,8 @@ static void _e_zone_cb_bg_mouse_up(void *data, Evas *evas, Evas_Object *obj, voi
static void _e_zone_event_zone_desk_count_set_free(void *data, void *ev);
static int _e_zone_cb_mouse_in(void *data, int type, void *event);
static int _e_zone_cb_mouse_out(void *data, int type, void *event);
static int _e_zone_cb_mouse_down(void *data, int type, void *event);
static int _e_zone_cb_mouse_up(void *data, int type, void *event);
static int _e_zone_cb_mouse_move(void *data, int type, void *event);
static int _e_zone_cb_desk_after_show(void *data, int type, void *event);
static int _e_zone_cb_edge_timer(void *data);
@ -110,32 +112,10 @@ e_zone_new(E_Container *con, int num, int id, int x, int y, int w, int h)
zone->corner.bottom_left = ecore_x_window_input_new(con->win,
zone->x + zone->w - cw - 2, zone->y + zone->h - 1, cw, 1);
e_container_window_raise(zone->container, zone->corner.left_bottom, 999);
e_container_window_raise(zone->container, zone->corner.left_top, 999);
e_container_window_raise(zone->container, zone->corner.top_left, 999);
e_container_window_raise(zone->container, zone->corner.top_right, 999);
e_container_window_raise(zone->container, zone->corner.right_top, 999);
e_container_window_raise(zone->container, zone->corner.right_bottom, 999);
e_container_window_raise(zone->container, zone->corner.bottom_right, 999);
e_container_window_raise(zone->container, zone->corner.bottom_left, 999);
e_container_window_raise(zone->container, zone->edge.left, 999);
e_container_window_raise(zone->container, zone->edge.right, 999);
e_container_window_raise(zone->container, zone->edge.top, 999);
e_container_window_raise(zone->container, zone->edge.bottom, 999);
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);
ecore_x_window_show(zone->corner.left_bottom);
ecore_x_window_show(zone->corner.left_top);
ecore_x_window_show(zone->corner.top_left);
ecore_x_window_show(zone->corner.top_right);
ecore_x_window_show(zone->corner.right_top);
ecore_x_window_show(zone->corner.right_bottom);
ecore_x_window_show(zone->corner.bottom_right);
ecore_x_window_show(zone->corner.bottom_left);
if(e_config->fullscreen_flip)
e_zone_edge_win_layer_set(zone, 250);
else
e_zone_edge_win_layer_set(zone, 200);
zone->handlers =
eina_list_append(zone->handlers,
@ -145,6 +125,14 @@ e_zone_new(E_Container *con, int num, int id, int x, int y, int w, int h)
eina_list_append(zone->handlers,
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT,
_e_zone_cb_mouse_out, zone));
zone->handlers =
eina_list_append(zone->handlers,
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
_e_zone_cb_mouse_down, zone));
zone->handlers =
eina_list_append(zone->handlers,
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
_e_zone_cb_mouse_up, zone));
zone->handlers =
eina_list_append(zone->handlers,
ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
@ -567,7 +555,7 @@ e_zone_flip_coords_handle(E_Zone *zone, int x, int y)
break;
}
if (!ok) return;
bind = e_bindings_edge_get("desk_flip_in_direction", edge);
bind = e_bindings_edge_get("desk_flip_in_direction", edge, 0);
if (bind)
{
zev = E_NEW(E_Event_Zone_Edge, 1);
@ -831,6 +819,24 @@ e_zone_flip_win_restore(void)
}
}
EAPI void
e_zone_edge_win_layer_set(E_Zone *zone, int layer)
{
e_container_window_raise(zone->container, zone->corner.left_bottom, layer);
e_container_window_raise(zone->container, zone->corner.left_top, layer);
e_container_window_raise(zone->container, zone->corner.top_left, layer);
e_container_window_raise(zone->container, zone->corner.top_right, layer);
e_container_window_raise(zone->container, zone->corner.right_top, layer);
e_container_window_raise(zone->container, zone->corner.right_bottom, layer);
e_container_window_raise(zone->container, zone->corner.bottom_right, layer);
e_container_window_raise(zone->container, zone->corner.bottom_left, layer);
e_container_window_raise(zone->container, zone->edge.left, layer);
e_container_window_raise(zone->container, zone->edge.right, layer);
e_container_window_raise(zone->container, zone->edge.top, layer);
e_container_window_raise(zone->container, zone->edge.bottom, layer);
}
static void
_e_zone_useful_geometry_calc(E_Zone *zone)
{
@ -1173,6 +1179,94 @@ _e_zone_cb_mouse_out(void *data, int type, void *event)
return 1;
}
static int
_e_zone_cb_mouse_down(void *data, int type, void *event)
{
Ecore_Event_Mouse_Button *ev;
E_Event_Zone_Edge *zev;
E_Zone_Edge edge;
E_Zone *zone;
ev = event;
zone = data;
if (ev->event_window == zone->edge.left)
edge = E_ZONE_EDGE_LEFT;
else if (ev->event_window == zone->edge.top)
edge = E_ZONE_EDGE_TOP;
else if (ev->event_window == zone->edge.right)
edge = E_ZONE_EDGE_RIGHT;
else if (ev->event_window == zone->edge.bottom)
edge = E_ZONE_EDGE_BOTTOM;
else if ((ev->event_window == zone->corner.left_top) ||
(ev->event_window == zone->corner.top_left))
edge = E_ZONE_EDGE_TOP_LEFT;
else if ((ev->event_window == zone->corner.right_top) ||
(ev->event_window == zone->corner.top_right))
edge = E_ZONE_EDGE_TOP_RIGHT;
else if ((ev->event_window == zone->corner.right_bottom) ||
(ev->event_window == zone->corner.bottom_right))
edge = E_ZONE_EDGE_BOTTOM_RIGHT;
else if ((ev->event_window == zone->corner.left_bottom) ||
(ev->event_window == zone->corner.bottom_left))
edge = E_ZONE_EDGE_BOTTOM_LEFT;
else return 1;
zev = E_NEW(E_Event_Zone_Edge, 1);
zev->zone = zone;
zev->edge = edge;
zev->x = ev->x;
zev->y = ev->y;
zev->modifiers = 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);
return 1;
}
static int
_e_zone_cb_mouse_up(void *data, int type, void *event)
{
Ecore_Event_Mouse_Button *ev;
E_Event_Zone_Edge *zev;
E_Zone_Edge edge;
E_Zone *zone;
ev = event;
zone = data;
if (ev->event_window == zone->edge.left)
edge = E_ZONE_EDGE_LEFT;
else if (ev->event_window == zone->edge.top)
edge = E_ZONE_EDGE_TOP;
else if (ev->event_window == zone->edge.right)
edge = E_ZONE_EDGE_RIGHT;
else if (ev->event_window == zone->edge.bottom)
edge = E_ZONE_EDGE_BOTTOM;
else if ((ev->event_window == zone->corner.left_top) ||
(ev->event_window == zone->corner.top_left))
edge = E_ZONE_EDGE_TOP_LEFT;
else if ((ev->event_window == zone->corner.right_top) ||
(ev->event_window == zone->corner.top_right))
edge = E_ZONE_EDGE_TOP_RIGHT;
else if ((ev->event_window == zone->corner.right_bottom) ||
(ev->event_window == zone->corner.bottom_right))
edge = E_ZONE_EDGE_BOTTOM_RIGHT;
else if ((ev->event_window == zone->corner.left_bottom) ||
(ev->event_window == zone->corner.bottom_left))
edge = E_ZONE_EDGE_BOTTOM_LEFT;
else return 1;
zev = E_NEW(E_Event_Zone_Edge, 1);
zev->zone = zone;
zev->edge = edge;
zev->x = ev->x;
zev->y = ev->y;
zev->modifiers = 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);
return 1;
}
static int
_e_zone_cb_mouse_move(void *data, int type, void *event)
{

View File

@ -143,6 +143,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_win_layer_set(E_Zone *zone, int layer);
EAPI void e_zone_useful_geometry_dirty(E_Zone *zone);
EAPI void e_zone_useful_geometry_get(E_Zone *zone, int *x, int *y, int *w, int *h);

View File

@ -6,7 +6,8 @@
#define TEXT_NONE_ACTION_EDGE _("<None>")
#define TEXT_PRESS_EDGE_SEQUENCE _("Please select an edge,<br>" \
"or click <hilight>Close</hilight> to abort.<br><br>" \
"To change the delay of this action,<br>use the slider:" \
"You can either specify a delay of this<br> action using " \
"the slider, or make it<br>respond to edge clicks:" \
)
#define TEXT_NO_PARAMS _("<None>")
@ -48,6 +49,7 @@ static void _edge_grab_wnd_show(E_Config_Dialog_Data *cfdata);
static void _edge_grab_wnd_cb_apply(void *data, E_Dialog *dia);
static void _edge_grab_wnd_cb_close(void *data, E_Dialog *dia);
static void _edge_grab_wnd_slider_changed_cb(void *data, Evas_Object *obj);
static void _edge_grab_wnd_check_changed_cb(void *data, Evas_Object *obj);
static void _edge_grab_wnd_selected_edge_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _edge_grab_wnd_selection_apply(E_Config_Dialog_Data *cfdata);
@ -64,6 +66,7 @@ struct _E_Config_Dialog_Data
char *params;
const char *cur;
double delay;
int click;
int cur_act, add;
E_Zone_Edge edge;
int modifiers;
@ -74,7 +77,7 @@ struct _E_Config_Dialog_Data
{
Evas_Object *o_add, *o_mod, *o_del, *o_del_all;
Evas_Object *o_binding_list, *o_action_list;
Evas_Object *o_params, *o_selector, *o_slider;
Evas_Object *o_params, *o_selector, *o_slider, *o_check;
} gui;
const char *params;
@ -123,6 +126,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
cfdata->locals.cur = NULL;
cfdata->locals.dia = NULL;
cfdata->locals.delay = 0.3;
cfdata->locals.click = 0;
cfdata->binding.edge = NULL;
EINA_LIST_FOREACH(e_config->edge_bindings, l, bi)
@ -180,15 +184,19 @@ _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
static int
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
Eina_List *l = NULL;
Eina_List *l, *ll, *lll;
E_Manager *man;
E_Container *con;
E_Zone *zone;
E_Config_Binding_Edge *bi, *bi2;
int layer;
_auto_apply_changes(cfdata);
EINA_LIST_FREE(e_config->edge_bindings, bi)
{
e_bindings_edge_del(bi->context, bi->edge, bi->modifiers, bi->any_mod,
bi->action, bi->params, bi->delay);
bi->action, bi->params, bi->delay);
eina_stringshare_del(bi->action);
eina_stringshare_del(bi->params);
E_FREE(bi);
@ -213,6 +221,24 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
e_bindings_edge_add(bi->context, bi->edge, bi->modifiers, bi->any_mod,
bi->action, bi->params, bi->delay);
}
if (cfdata->fullscreen_flip != e_config->fullscreen_flip)
{
if(cfdata->fullscreen_flip)
layer = 250;
else
layer = 200;
EINA_LIST_FOREACH(e_manager_list(), l, man)
{
EINA_LIST_FOREACH(man->containers, ll, con)
{
EINA_LIST_FOREACH(con->zones, lll, zone)
e_zone_edge_win_layer_set(zone, layer);
}
}
}
e_config->fullscreen_flip = cfdata->fullscreen_flip;
e_config_save_queue();
@ -356,6 +382,8 @@ _modify_edge_binding_cb(void *data, void *data2)
bi = eina_list_nth(cfdata->binding.edge, n);
cfdata->locals.edge = bi->edge;
cfdata->locals.delay = ((double) bi->delay);
if (bi->delay == -1.0) cfdata->locals.click = 1;
else cfdata->locals.click = 0;
cfdata->locals.modifiers = bi->modifiers;
}
else return;
@ -805,6 +833,7 @@ _edge_grab_wnd_show(E_Config_Dialog_Data *cfdata)
Evas_Coord minw, minh;
const char *bgfile;
int tw, th;
char *label = NULL;
if (cfdata->locals.dia != 0) return;
@ -830,11 +859,22 @@ _edge_grab_wnd_show(E_Config_Dialog_Data *cfdata)
e_widget_on_change_hook_set(os, _edge_grab_wnd_slider_changed_cb, cfdata);
evas_object_show(os);
cfdata->gui.o_check = os = e_widget_check_add(evas, _("Clickable edge"), &(cfdata->locals.click));
e_widget_size_min_resize(os);
edje_object_part_swallow(o, "e.swallow.check", os);
e_widget_on_change_hook_set(os, _edge_grab_wnd_check_changed_cb, cfdata);
evas_object_show(os);
if (cfdata->locals.click)
e_widget_disabled_set(cfdata->gui.o_slider, 1);
edje_object_part_text_set(o, "e.text.description", TEXT_PRESS_EDGE_SEQUENCE);
edje_object_size_min_get(o, &minw, &minh);
if (!minw || !minh)
edje_object_size_min_calc(o, &minw, &minh);
{
edje_object_calc_force(o);
edje_object_size_min_calc(o, &minw, &minh);
}
e_dialog_content_set(cfdata->locals.dia, o, minw, minh);
@ -848,6 +888,13 @@ _edge_grab_wnd_show(E_Config_Dialog_Data *cfdata)
e_thumb_icon_begin(obg);
evas_object_show(obg);
if (cfdata->locals.edge)
{
label = _edge_binding_text_get(cfdata->locals.edge, ((float) cfdata->locals.delay), cfdata->locals.modifiers);
edje_object_part_text_set(cfdata->gui.o_selector, "e.text.selection", label);
if (label) E_FREE(label);
}
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_edge_grab_wnd_selected_edge_cb, cfdata);
@ -884,8 +931,7 @@ _edge_grab_wnd_cb_close(void *data, E_Dialog *dia)
static void
_edge_grab_wnd_slider_changed_cb(void *data, Evas_Object *obj)
{
E_Config_Dialog_Data *cfdata;
cfdata = data;
E_Config_Dialog_Data *cfdata = data;
char *label = NULL;
if (!cfdata->locals.edge) return;
@ -894,6 +940,29 @@ _edge_grab_wnd_slider_changed_cb(void *data, Evas_Object *obj)
if (label) E_FREE(label);
}
static void
_edge_grab_wnd_check_changed_cb(void *data, Evas_Object *obj)
{
E_Config_Dialog_Data *cfdata = data;
char *label = NULL;
if (cfdata->locals.click)
{
if (cfdata->locals.edge)
label = _edge_binding_text_get(cfdata->locals.edge, -1.0, cfdata->locals.modifiers);
e_widget_disabled_set(cfdata->gui.o_slider, 1);
}
else
{
if (cfdata->locals.edge)
label = _edge_binding_text_get(cfdata->locals.edge, ((float) cfdata->locals.delay), cfdata->locals.modifiers);
e_widget_disabled_set(cfdata->gui.o_slider, 0);
}
edje_object_part_text_set(cfdata->gui.o_selector, "e.text.selection", label);
if (label) E_FREE(label);
}
static void
_edge_grab_wnd_selected_edge_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
@ -971,7 +1040,9 @@ stop:
if (evas_key_modifier_is_set(event->modifiers, "Win"))
cfdata->locals.modifiers |= E_BINDING_MODIFIER_WIN;
label = _edge_binding_text_get(cfdata->locals.edge, ((float) cfdata->locals.delay), cfdata->locals.modifiers);
label = _edge_binding_text_get(cfdata->locals.edge,
cfdata->locals.click ? -1.0 : ((float) cfdata->locals.delay),
cfdata->locals.modifiers);
edje_object_part_text_set(cfdata->gui.o_selector, "e.text.selection", label);
if (label) E_FREE(label);
}
@ -984,6 +1055,8 @@ _edge_grab_wnd_selection_apply(E_Config_Dialog_Data *cfdata)
char *label;
int found = 0, n = -1;
if (cfdata->locals.click) cfdata->locals.delay = -1.0;
if (cfdata->locals.add)
{
EINA_LIST_FOREACH(cfdata->binding.edge, l, bi)
@ -1297,7 +1370,10 @@ _edge_binding_text_get(E_Zone_Edge edge, float delay, int mod)
char buf[20];
if (b[0]) strcat(b, " ");
snprintf(buf, 20, "%.2fs", delay);
if (delay == -1.0)
snprintf(buf, 20, "(clickable)");
else
snprintf(buf, 20, "%.2fs", delay);
strcat(b, buf);
}