This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository entice.
View the commit online.
commit a438470be943ba4cad45e09427c38449aa41713c
Author: Alastair Poole <[email protected]>
AuthorDate: Sat Nov 28 00:53:03 2026 +0000
entice_image: fix sizing on first-open.
Think this is what you meant vtorri.
---
src/bin/entice_image.c | 65 ++++++++++++++------------------------------------
1 file changed, 18 insertions(+), 47 deletions(-)
diff --git a/src/bin/entice_image.c b/src/bin/entice_image.c
index a4d641a..00fed2d 100644
--- a/src/bin/entice_image.c
+++ b/src/bin/entice_image.c
@@ -26,6 +26,8 @@ struct Img_
Evas_Object *img;
Ecore_Timer *timer_anim;
int zoom;
+ Evas_Coord display_w;
+ Evas_Coord display_h;
Entice_Zoom_Mode zoom_mode;
int frame;
int frame_count;
@@ -210,16 +212,9 @@ _smart_del(Evas_Object *obj)
}
static void
-_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
+_smart_resize(Evas_Object *obj, Evas_Coord w EINA_UNUSED, Evas_Coord h EINA_UNUSED)
{
- Img *sd;
-
- INF(" * %s", __FUNCTION__);
-
- sd = evas_object_smart_data_get(obj);
- EINA_SAFETY_ON_NULL_RETURN(sd);
-
- evas_object_resize(sd->img, w, h);
+ evas_object_smart_changed(obj);
}
static void
@@ -265,8 +260,9 @@ _smart_calculate(Evas_Object *obj)
evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
- evas_object_move(sd->img, ox, oy);
- evas_object_resize(sd->img, ow, oh);
+ evas_object_move(sd->img, ox + (ow - sd->display_w) / 2,
+ oy + (oh - sd->display_h) / 2);
+ evas_object_resize(sd->img, sd->display_w, sd->display_h);
}
static void
@@ -289,33 +285,13 @@ _smart_init(void)
_smart = evas_smart_class_new(&sc);
}
-static void
-_entice_image_size_zoom_get(int zoom, int in_w, int in_h, int img_w, int img_h,
- int *out_x, int *out_y, int *out_w, int *out_h)
-{
- *out_w = (zoom * img_w) / 100;
- *out_h = (zoom * img_h) / 100;
-
- if (*out_w >= in_w)
- *out_x = 0;
- else
- *out_x = ((in_w - *out_w) / 2);
-
- if (*out_h >= in_h)
- *out_y = 0;
- else
- *out_y = ((in_h - *out_h) / 2);
-}
-
static void
_entice_image_size_fit_get(int in_w, int in_h, int img_w, int img_h,
- int *out_x, int *out_y, int *out_w, int *out_h,
+ int *out_w, int *out_h,
int *zoom)
{
if ((img_w <= 0) || (img_h <= 0))
{
- *out_x = 0;
- *out_y = 0;
*out_w = 0;
*out_h = 0;
*zoom = 100;
@@ -335,9 +311,6 @@ _entice_image_size_fit_get(int in_w, int in_h, int img_w, int img_h,
*out_h = (img_h * in_w) / img_w;
*zoom = (100 * *out_h) / img_h;
}
-
- *out_x = ((in_w - *out_w) / 2.0);
- *out_y = ((in_h - *out_h) / 2.0);
}
/*============================================================================*
@@ -363,6 +336,7 @@ entice_image_add(Evas_Object *win)
if (!_smart) _smart_init();
obj = evas_object_smart_add(evas, _smart);
+ evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_data_set(obj, "win", win);
@@ -435,12 +409,12 @@ entice_image_file_set(Evas_Object *obj, Eina_List *image)
return;
}
- sd->loading = EINA_TRUE;
- evas_object_image_preload(sd->img, EINA_FALSE);
-
if (entice->config->best_fit_startup)
sd->zoom_mode = ENTICE_ZOOM_MODE_FIT;
+ sd->loading = EINA_TRUE;
+ evas_object_image_preload(sd->img, EINA_FALSE);
+
/* if (entice->config->play_animated) */
/* _entice_image_anim_handle(sd); */
}
@@ -651,8 +625,6 @@ entice_image_update(Evas_Object *obj)
Evas_Coord win_h;
Evas_Coord img_w;
Evas_Coord img_h;
- Evas_Coord out_x = 0;
- Evas_Coord out_y = 0;
Evas_Coord out_w = 0;
Evas_Coord out_h = 0;
@@ -665,8 +637,8 @@ entice_image_update(Evas_Object *obj)
{
case ENTICE_ZOOM_MODE_NORMAL:
{
- _entice_image_size_zoom_get(sd->zoom, win_w, win_h, img_w, img_h,
- &out_x, &out_y, &out_w, &out_h);
+ out_w = (sd->zoom * img_w) / 100;
+ out_h = (sd->zoom * img_h) / 100;
elm_scroller_policy_set(entice->scroller,
ELM_SCROLLER_POLICY_AUTO,
ELM_SCROLLER_POLICY_AUTO);
@@ -677,7 +649,7 @@ entice_image_update(Evas_Object *obj)
int zoom;
_entice_image_size_fit_get(win_w, win_h, img_w, img_h,
- &out_x, &out_y, &out_w, &out_h, &zoom);
+ &out_w, &out_h, &zoom);
sd->zoom = zoom;
elm_scroller_policy_set(entice->scroller,
ELM_SCROLLER_POLICY_OFF,
@@ -693,11 +665,10 @@ entice_image_update(Evas_Object *obj)
INF("zoom %d", sd->zoom);
- evas_object_resize(obj, out_w, out_h);
- evas_object_size_hint_max_set(obj, out_w, out_h);
+ sd->display_w = out_w;
+ sd->display_h = out_h;
evas_object_size_hint_min_set(obj, out_w, out_h);
-
- evas_object_move(sd->img, out_x, out_y);
+ evas_object_smart_changed(obj);
entice_win_title_update(win);
entice_controls_update(win);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.