add an option to automatically re-maximize windows on shelf hide/show, and move away windows that are on top of the shelf away while the shelf is visible.

add more options to fine-tune the autohide in the shelf's config dialog. it needs some UI love though.


SVN revision: 29472
This commit is contained in:
Viktor Kojouharov 2007-04-11 15:37:04 +00:00
parent 560610403c
commit 1157a68929
7 changed files with 172 additions and 49 deletions

View File

@ -175,7 +175,7 @@ e_border_init(void)
handlers = evas_list_append(handlers, ecore_event_handler_add(EFREET_EVENT_DESKTOP_CHANGE, _e_border_cb_efreet_desktop_change, NULL));
handlers = evas_list_append(handlers, ecore_event_handler_add(E_EVENT_CONFIG_ICON_THEME, _e_border_cb_config_icon_theme, NULL));
E_EVENT_BORDER_ADD = ecore_event_type_new();
E_EVENT_BORDER_REMOVE = ecore_event_type_new();
E_EVENT_BORDER_DESK_SET = ecore_event_type_new();
@ -4743,6 +4743,9 @@ _e_border_cb_mouse_move(void *data, int type, void *event)
x, y, bd->w, bd->h,
&new_x, &new_y, &new_w, &new_h);
evas_list_free(skiplist);
bd->shelf_fix.x = 0;
bd->shelf_fix.y = 0;
bd->shelf_fix.modified = 0;
e_border_move(bd, new_x, new_y);
e_zone_flip_coords_handle(bd->zone, ev->root.x, ev->root.y);
}

View File

@ -408,6 +408,11 @@ struct _E_Border
Ecore_Animator *anim;
} shade;
struct {
int x, y;
int modified;
} shelf_fix;
Evas_List *stick_desks;
E_Menu *border_menu;
E_Config_Dialog *border_locks_dialog;
@ -636,7 +641,7 @@ EAPI int e_border_resizing_get(E_Border *bd);
EAPI void e_border_signal_resize_begin(E_Border *bd, const char *dir, const char *sig, const char *src);
EAPI void e_border_signal_resize_end(E_Border *bd, const char *dir, const char *sig, const char *src);
EAPI void e_border_resize_limit(E_Border *bd, int *w, int *h);
extern EAPI int E_EVENT_BORDER_RESIZE;
extern EAPI int E_EVENT_BORDER_MOVE;
extern EAPI int E_EVENT_BORDER_ADD;

View File

@ -126,6 +126,8 @@ e_config_init(void)
E_CONFIG_VAL(D, T, size, INT);
E_CONFIG_VAL(D, T, overlap, INT);
E_CONFIG_VAL(D, T, autohide, INT);
E_CONFIG_VAL(D, T, hide_timeout, FLOAT);
E_CONFIG_VAL(D, T, hide_duration, FLOAT);
_e_config_desktop_bg_edd = E_CONFIG_DD_NEW("E_Config_Desktop_Background", E_Config_Desktop_Background);
#undef T
@ -425,6 +427,7 @@ e_config_init(void)
E_CONFIG_VAL(D, T, winlist_pos_max_h, INT); /**/
E_CONFIG_VAL(D, T, maximize_policy, INT); /**/
E_CONFIG_VAL(D, T, allow_manip, INT); /**/
E_CONFIG_VAL(D, T, border_fix_on_shelf_toggle, INT); /**/
E_CONFIG_VAL(D, T, kill_if_close_not_possible, INT); /**/
E_CONFIG_VAL(D, T, kill_process, INT); /**/
E_CONFIG_VAL(D, T, kill_timer_wait, DOUBLE); /**/
@ -659,6 +662,7 @@ e_config_init(void)
e_config->winlist_pos_max_h = 320;
e_config->maximize_policy = E_MAXIMIZE_SMART | E_MAXIMIZE_BOTH;
e_config->allow_manip = 0;
e_config->border_fix_on_shelf_toggle = 0;
e_config->kill_if_close_not_possible = 1;
e_config->kill_process = 1;
e_config->kill_timer_wait = 10.0;
@ -1151,7 +1155,7 @@ e_config_init(void)
{
E_Config_Shelf *cf_es;
#define CFG_SHELF(_name, _con, _zone, _pop, _lay, _orient, _fita, _fits, _style, _size, _overlap, _autohide) \
#define CFG_SHELF(_name, _con, _zone, _pop, _lay, _orient, _fita, _fits, _style, _size, _overlap, _autohide, _hide_timeout, _hide_duration) \
cf_es = E_NEW(E_Config_Shelf, 1); \
cf_es->name = evas_stringshare_add(_name); \
cf_es->container = _con; \
@ -1165,30 +1169,32 @@ e_config_init(void)
cf_es->size = _size; \
cf_es->overlap = _overlap; \
cf_es->autohide = _autohide; \
cf_es->hide_timeout = _hide_timeout; \
cf_es->hide_duration = _hide_duration; \
e_config->shelves = evas_list_append(e_config->shelves, cf_es)
/* shelves for 4 zones on head 0 by default */
CFG_SHELF("shelf", 0, 0,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0);
1, 0, "default", 40, 0, 0, 1.0, 1.0);
CFG_SHELF("shelf", 0, 1,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0);
1, 0, "default", 40, 0, 0, 1.0, 1.0);
CFG_SHELF("shelf", 0, 2,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0);
1, 0, "default", 40, 0, 0, 1.0, 1.0);
CFG_SHELF("shelf", 0, 3,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0);
1, 0, "default", 40, 0, 0, 1.0, 1.0);
/* shelves for heada 1, 2, and 3 by default */
CFG_SHELF("shelf", 1, 0,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0);
1, 0, "default", 40, 0, 0, 1.0, 1.0);
CFG_SHELF("shelf", 2, 0,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0);
1, 0, "default", 40, 0, 0, 1.0, 1.0);
CFG_SHELF("shelf", 3, 0,
1, 200, E_GADCON_ORIENT_BOTTOM,
1, 0, "default", 40, 0, 0);
1, 0, "default", 40, 0, 0, 1.0, 1.0);
}
IFCFGEND;
@ -1433,6 +1439,7 @@ e_config_init(void)
E_CONFIG_LIMIT(e_config->winlist_pos_max_h, 8, 4000);
E_CONFIG_LIMIT(e_config->maximize_policy, E_MAXIMIZE_FULLSCREEN, E_MAXIMIZE_DIRECTION);
E_CONFIG_LIMIT(e_config->allow_manip, 0, 1);
E_CONFIG_LIMIT(e_config->border_fix_on_shelf_toggle, 0, 1);
E_CONFIG_LIMIT(e_config->kill_if_close_not_possible, 0, 1);
E_CONFIG_LIMIT(e_config->kill_process, 0, 1);
E_CONFIG_LIMIT(e_config->kill_timer_wait, 0.0, 120.0);

View File

@ -168,6 +168,7 @@ struct _E_Config
int winlist_pos_max_h; // GUI
int maximize_policy; // GUI
int allow_manip; // GUI
int border_fix_on_shelf_toggle; // GUI
int kill_if_close_not_possible;
int kill_process;
double kill_timer_wait;
@ -401,6 +402,8 @@ struct _E_Config_Shelf
int size;
int overlap;
int autohide;
float hide_timeout;
float hide_duration;
};
struct _E_Config_Mime_Icon

View File

@ -25,6 +25,7 @@ struct _E_Config_Dialog_Data
int window_resist;
int gadget_resist;
int allow_manip;
int border_fix_on_shelf_toggle;
int border_raise_on_mouse_action;
int border_raise_on_focus;
};
@ -71,6 +72,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
if (!cfdata->maximize_direction)
cfdata->maximize_direction = E_MAXIMIZE_BOTH;
cfdata->allow_manip = e_config->allow_manip;
cfdata->border_fix_on_shelf_toggle = e_config->border_fix_on_shelf_toggle;
cfdata->border_raise_on_mouse_action = e_config->border_raise_on_mouse_action;
cfdata->border_raise_on_focus = e_config->border_raise_on_focus;
}
@ -120,6 +122,7 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
e_config->gadget_resist = cfdata->gadget_resist;
e_config->maximize_policy = cfdata->maximize_policy | cfdata->maximize_direction;
e_config->allow_manip = cfdata->allow_manip;
e_config->border_fix_on_shelf_toggle = cfdata->border_fix_on_shelf_toggle;
e_config->border_raise_on_mouse_action = cfdata->border_raise_on_mouse_action;
e_config->border_raise_on_focus = cfdata->border_raise_on_focus;
e_config_save_queue();
@ -223,6 +226,8 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
ob = e_widget_check_add(evas, _("Allow window manipulation"), &(cfdata->allow_manip));
e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(evas, _("Automatically move/resize windows on shelf autohide"), &(cfdata->border_fix_on_shelf_toggle));
e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(ot, of, 1, 1, 1, 1, 1, 1, 1, 1);
e_widget_list_object_append(o, ot, 1, 1, 0.5);

View File

@ -36,6 +36,8 @@ struct _E_Config_Dialog_Data
int layering;
int overlapping;
int autohiding;
double hide_timeout;
double hide_duration;
};
/* a nice easy setup function that does the dirty work */
@ -117,6 +119,8 @@ _fill_data(E_Config_Dialog_Data *cfdata)
cfdata->size = cfdata->escfg->size;
cfdata->overlapping = cfdata->escfg->overlap;
cfdata->autohiding = cfdata->escfg->autohide;
cfdata->hide_timeout = cfdata->escfg->hide_timeout;
cfdata->hide_duration = cfdata->escfg->hide_duration;
if (cfdata->size <= 24)
cfdata->basic_size = 24;
else if (cfdata->size <= 32)
@ -337,7 +341,10 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
}
cfdata->escfg->overlap = cfdata->overlapping;
cfdata->escfg->autohide = cfdata->autohiding;
cfdata->escfg->hide_timeout = cfdata->hide_timeout;
cfdata->escfg->hide_duration = cfdata->hide_duration;
if (cfdata->escfg->autohide && !cfdata->es->hidden)
e_shelf_toggle(cfdata->es, 0);
else if (!cfdata->escfg->autohide && cfdata->es->hidden)
@ -453,8 +460,6 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(evas, _("Allow windows to overlap the shelf"), &(cfdata->overlapping));
e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(evas, _("Auto-hide the shelf"), &(cfdata->autohiding));
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o2, of, 1, 1, 0.5);
of = e_widget_frametable_add(evas, _("Layout"), 1);
@ -485,6 +490,19 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
e_widget_frametable_object_append(of, ob, 4, 3, 1, 1, 1, 1, 1, 1);
e_widget_list_object_append(o2, of, 1, 1, 0.5);
of = e_widget_framelist_add(evas, _("Autohide"), 0);
ob = e_widget_check_add(evas, _("Auto-hide the shelf"), &(cfdata->autohiding));
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Hide timeout"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%.1f seconds"), 0.2, 6.0, 0.2, 0, &(cfdata->hide_timeout), NULL, 100);
e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Hide duration"));
e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(evas, 1, 0, _("%.1f seconds"), 0.1, 2.0, 0.1, 0, &(cfdata->hide_duration), NULL, 100);
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o2, of, 1, 1, 0.5);
e_widget_list_object_append(o, o2, 1, 1, 0.5);
o2 = e_widget_list_add(evas, 0, 0);

View File

@ -8,6 +8,7 @@ static const char *_e_shelf_orient_string_get(E_Shelf *es);
static void _e_shelf_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
static void _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h);
static Evas_Object *_e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *style);
static void _e_shelf_toggle_border_fix(E_Shelf *es);
static void _e_shelf_cb_menu_config(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_shelf_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_shelf_cb_menu_contents(void *data, E_Menu *m, E_Menu_Item *mi);
@ -77,9 +78,12 @@ e_shelf_config_init(void)
cf_es->popup, cf_es->layer, -1);
if (es)
{
if (!cf_es->hide_timeout) cf_es->hide_timeout = 1.0;
if (!cf_es->hide_duration) cf_es->hide_duration = 1.0;
es->cfg = cf_es;
es->fit_along = cf_es->fit_along;
es->fit_size = cf_es->fit_size;
e_shelf_orient(es, cf_es->orient);
e_shelf_position_calc(es);
e_shelf_populate(es);
@ -269,30 +273,33 @@ e_shelf_toggle(E_Shelf *es, int show)
{
E_OBJECT_CHECK(es);
E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE);
if (show && es->hidden && !es->instant_timer)
{
es->hidden = 0;
edje_object_signal_emit(es->o_base, "e,state,visible", "e");
if (es->instant_delay >= 0.0)
{
if (!es->instant_timer)
_e_shelf_cb_instant_hide_timer(es);
}
else
{
if (!es->hide_animator)
es->hide_animator = ecore_animator_add(_e_shelf_cb_hide_animator, es);
}
if (show)
{
if (es->hide_timer)
{
ecore_timer_del(es->hide_timer);
es->hide_timer = NULL;
}
if (es->hidden && !es->instant_timer)
{
es->hidden = 0;
edje_object_signal_emit(es->o_base, "e,state,visible", "e");
if (es->instant_delay >= 0.0)
{
if (!es->instant_timer)
_e_shelf_cb_instant_hide_timer(es);
}
else
{
if(!es->hide_animator)
es->hide_animator = ecore_animator_add(_e_shelf_cb_hide_animator, es);
}
}
}
else if (!show && es->cfg->autohide && !es->hidden)
{
if (!es->hide_timer)
es->hide_timer = ecore_timer_add(1.0, _e_shelf_cb_hide_timer, es);
if(!es->hide_timer)
es->hide_timer = ecore_timer_add(es->cfg->hide_timeout, _e_shelf_cb_hide_timer, es);
}
}
@ -389,6 +396,8 @@ e_shelf_save(E_Shelf *es)
cf_es->fit_size = es->fit_size;
cf_es->overlap = 0;
cf_es->autohide = 0;
cf_es->hide_timeout = 1.0;
cf_es->hide_duration = 1.0;
es->cfg = cf_es;
}
e_config_save_queue();
@ -565,7 +574,6 @@ e_shelf_style_set(E_Shelf *es, const char *style)
else
es->instant_delay = -1.0;
es->hide_origin = -1;
e_gadcon_unpopulate(es->gadcon);
e_gadcon_populate(es->gadcon);
}
@ -898,6 +906,85 @@ _e_shelf_gadcon_frame_request(void *data, E_Gadcon_Client *gcc, const char *styl
return o;
}
static void
_e_shelf_toggle_border_fix(E_Shelf *es)
{
Evas_List *l;
if (es->cfg->overlap || !e_config->border_fix_on_shelf_toggle)
return;
for (l = e_border_client_list(); l; l = l->next)
{
E_Border *bd;
bd = l->data;
if ((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_NONE)
{
if (bd->lock_client_location)
continue;
if (es->hidden)
{
if (!bd->shelf_fix.modified)
continue;
if (!--bd->shelf_fix.modified)
{
e_border_move(bd, bd->shelf_fix.x, bd->shelf_fix.y);
continue;
}
}
if (!E_INTERSECTS(bd->x, bd->y, bd->w, bd->h,
es->x, es->y, es->w, es->h))
continue;
if (!es->hidden)
{
if (!bd->shelf_fix.modified++)
bd->shelf_fix.x = bd->x;
bd->shelf_fix.y = bd->y;
}
switch (es->gadcon->orient)
{
case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR:
if (!es->hidden)
e_border_move(bd, bd->x, bd->y + es->h);
break;
case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_BL:
case E_GADCON_ORIENT_CORNER_BR:
if (!es->hidden)
e_border_move(bd, bd->x, bd->y - es->h);
break;
case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_CORNER_LB:
case E_GADCON_ORIENT_CORNER_LT:
if (!es->hidden)
e_border_move(bd, bd->x + es->w, bd->y);
break;
case E_GADCON_ORIENT_RIGHT:
case E_GADCON_ORIENT_CORNER_RB:
case E_GADCON_ORIENT_CORNER_RT:
if (!es->hidden)
e_border_move(bd, bd->x - es->w, bd->y);
break;
default:
break;
}
}
else
{
E_Maximize max;
max = bd->maximized;
e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
e_border_maximize(bd, max);
}
}
}
static void
_e_shelf_menu_append(E_Shelf *es, E_Menu *mn)
{
@ -1110,13 +1197,9 @@ _e_shelf_cb_hide_timer(void *data)
if (!es->hide_animator)
es->hide_animator = ecore_animator_add(_e_shelf_cb_hide_animator, es);
}
if (es->hide_timer)
{
ecore_timer_del(es->hide_timer);
es->hide_timer = NULL;
}
es->hide_timer = NULL;
return 1;
return 0;
}
static int
@ -1132,8 +1215,8 @@ _e_shelf_cb_hide_animator(void *data)
case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR:
/* TODO: step coefficient needs to be configurable */
step = ((es->h - es->hidden_state_size) / e_config->framerate) * 2;
step = ((es->h - es->hidden_state_size) / e_config->framerate) / es->cfg->hide_duration;
if (!step) step = 1;
if (es->hidden)
{
if (es->hide_origin == -1) es->hide_origin = es->y;
@ -1175,7 +1258,8 @@ _e_shelf_cb_hide_animator(void *data)
case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_BL:
case E_GADCON_ORIENT_CORNER_BR:
step = ((es->h - es->hidden_state_size) / e_config->framerate) * 2;
step = ((es->h - es->hidden_state_size) / e_config->framerate) / es->cfg->hide_duration;
if (!step) step = 1;
if (es->hidden)
{
if (es->hide_origin == -1) es->hide_origin = es->y;
@ -1218,7 +1302,8 @@ _e_shelf_cb_hide_animator(void *data)
case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_CORNER_LB:
case E_GADCON_ORIENT_CORNER_LT:
step = ((es->w - es->hidden_state_size) / e_config->framerate) * 2;
step = ((es->w - es->hidden_state_size) / e_config->framerate) / es->cfg->hide_duration;
if (!step) step = 1;
if (es->hidden)
{
if (es->hide_origin == -1) es->hide_origin = es->x;
@ -1261,7 +1346,8 @@ _e_shelf_cb_hide_animator(void *data)
case E_GADCON_ORIENT_RIGHT:
case E_GADCON_ORIENT_CORNER_RB:
case E_GADCON_ORIENT_CORNER_RT:
step = ((es->w - es->hidden_state_size) / e_config->framerate) * 2;
step = ((es->w - es->hidden_state_size) / e_config->framerate) / es->cfg->hide_duration;
if (!step) step = 1;
if (es->hidden)
{
if (es->hide_origin == -1) es->hide_origin = es->x;
@ -1306,9 +1392,9 @@ _e_shelf_cb_hide_animator(void *data)
return 1;
end:
ecore_animator_del(es->hide_animator);
es->hide_animator = NULL;
return 1;
_e_shelf_toggle_border_fix(es);
return 0;
}
static int
@ -1323,7 +1409,6 @@ _e_shelf_cb_instant_hide_timer(void *data)
case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR:
/* TODO: step coefficient needs to be configurable */
if (es->hidden)
e_shelf_move(es, es->x, es->y - es->h + es->hidden_state_size);
else
@ -1356,12 +1441,9 @@ _e_shelf_cb_instant_hide_timer(void *data)
default:
break;
}
if (es->instant_timer)
{
ecore_timer_del(es->instant_timer);
es->instant_timer = NULL;
}
return 1;
es->instant_timer = NULL;
_e_shelf_toggle_border_fix(es);
return 0;
}
static void