shelf - fixup initial layout with workaround fixup

this is complicated ... but a confluence of zoomap original geom vs
transformed geom etc. ... things go wrong. this does a fixup to ensure
they go right...

@fix
This commit is contained in:
Carsten Haitzler 2020-05-04 21:42:32 +01:00
parent 8489a96a23
commit 73a754a411
3 changed files with 26 additions and 6 deletions

View File

@ -276,6 +276,7 @@ e_shelf_zone_dummy_new(E_Zone *zone, Evas_Object *obj, int id)
return es;
}
static void
_e_shelf_hidden(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
@ -283,6 +284,20 @@ _e_shelf_hidden(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v
es->hiding = 0;
}
static Eina_Bool
_shelf_content_fix(void *data)
{
// I really don't know how it gets here but objects and thier geometry are
// wrong - something to do woith zoomap as well as geometry changing
// at the same time so things going weird with child size and thus
// position etc.
E_Shelf *es = data;
es->fix_timer = NULL;
e_shelf_resize(es, es->w + 1, es->h + 1);
e_shelf_resize(es, es->w, es->h);
return EINA_FALSE;
}
E_API E_Shelf *
e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, E_Layer layer, int id)
{
@ -311,6 +326,7 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, E_Layer laye
evas_object_event_callback_add(es->o_base, EVAS_CALLBACK_MOUSE_DOWN,
_e_shelf_cb_mouse_down, es);
es->name = eina_stringshare_add(name);
printf("SHELF1: %p z=%i name=[%s] %4i,%4i %4ix%4i\n", es, es->zone->num, es->name, es->x, es->y, es->w, es->h);
evas_object_resize(es->o_base, es->w, es->h);
e_shelf_style_set(es, style);
@ -379,6 +395,7 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, E_Layer laye
ecore_event_add(E_EVENT_SHELF_ADD, ev, NULL, NULL);
}
es->fix_timer = ecore_timer_add(0.1, _shelf_content_fix, es);
return es;
}
@ -596,8 +613,9 @@ e_shelf_move_resize(E_Shelf *es, int x, int y, int w, int h)
es->y = y;
es->w = w;
es->h = h;
evas_object_move(es->comp_object, es->zone->x + es->x, es->zone->y + es->y);
evas_object_resize(es->comp_object, es->w, es->h);
evas_object_geometry_set(es->comp_object,
es->zone->x + es->x, es->zone->y + es->y,
es->w, es->h);
_e_shelf_obstacles_update(es);
if (!es->hide_animator)
_e_shelf_remaximize(es);
@ -1218,6 +1236,7 @@ _e_shelf_free(E_Shelf *es)
E_FREE_FUNC(es->hide_timer, ecore_timer_del);
E_FREE_FUNC(es->instant_timer, ecore_timer_del);
E_FREE_FUNC(es->module_init_end_timer, ecore_timer_del);
E_FREE_FUNC(es->fix_timer, ecore_timer_del);
if (es->menu)
{
e_menu_post_deactivate_callback_set(es->menu, NULL, NULL);

View File

@ -39,6 +39,7 @@ struct _E_Shelf
Ecore_Timer *instant_timer;
Ecore_Timer *autohide_timer;
Ecore_Timer *module_init_end_timer;
Ecore_Timer *fix_timer;
Eina_List *handlers;
Ecore_Event_Handler *autohide;
Eina_List *zone_obstacles;

View File

@ -208,7 +208,7 @@ _e_zoomap_smart_reconfigure(E_Smart_Data *sd)
Evas *e = evas_object_evas_get(sd->child_obj);
Evas_Coord cx = 0, cy = 0;
int r = 0, g = 0, b = 0, a = 0;
evas_object_geometry_get(sd->child_obj, &cx, &cy, NULL, NULL);
if (sd->recurse != 1)
{
@ -227,7 +227,7 @@ _e_zoomap_smart_reconfigure(E_Smart_Data *sd)
}
evas_object_color_get(sd->child_obj, &r, &g, &b, &a);
m = evas_map_new(4);
evas_map_util_points_populate_from_geometry(m, sd->x, sd->y,
evas_map_util_points_populate_from_geometry(m, sd->x, sd->y,
sd->w, sd->h, 0);
evas_map_point_image_uv_set(m, 0, 0, 0);
evas_map_point_image_uv_set(m, 1, sd->child_w, 0);
@ -239,7 +239,7 @@ _e_zoomap_smart_reconfigure(E_Smart_Data *sd)
evas_map_point_color_set(m, 2, r, g, b, a);
evas_map_point_color_set(m, 3, r, g, b, a);
if (a >= 255) evas_map_alpha_set(m, !sd->solid);
else evas_map_alpha_set(m, EINA_TRUE);
else evas_map_alpha_set(m, EINA_TRUE);
evas_object_map_set(sd->child_obj, m);
evas_object_map_enable_set(sd->child_obj, EINA_TRUE);
evas_map_free(m);
@ -269,7 +269,7 @@ _e_zoomap_smart_del(Evas_Object *obj)
if (sd->child_obj)
{
Evas_Object *o = sd->child_obj;
sd->child_obj = NULL;
evas_object_event_callback_del(o, EVAS_CALLBACK_DEL,
_e_zoomap_smart_child_del_hook);