This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository evisum.
View the commit online.
commit 86ba293f48b4f8319ca50da2f2dffda7e8bd20ed
Author: Alastair Poole <[email protected]>
AuthorDate: Sat Mar 28 13:25:43 2026 +0000
about: fix sizing and scrolling..
Keep track of ticks to scroll smoothly. Fix alignment and event
issues.
---
src/bin/ui/evisum_ui_util.c | 184 +++++++++++++++++++++++++++++++-------------
1 file changed, 131 insertions(+), 53 deletions(-)
diff --git a/src/bin/ui/evisum_ui_util.c b/src/bin/ui/evisum_ui_util.c
index 5dd1313..c7ebf51 100644
--- a/src/bin/ui/evisum_ui_util.c
+++ b/src/bin/ui/evisum_ui_util.c
@@ -9,6 +9,44 @@
#define EVISUM_ABOUT_BG_WIDTH 560
#define EVISUM_ABOUT_BG_HEIGHT 540
+static const char *about_msg[] = { "The greatest of all time...",
+ "Remember to take your medication!",
+ "Choose love!",
+ "Schizophrenia!!!",
+ "I endorse this message!",
+ "Hack the planet!",
+ "Remember what you need to carry!",
+ "Take a break, have a shit chat!",
+ "Well done my son." };
+
+static const char *about_text_fmt = "<font color=#ffffff>"
+ "<align=center>"
+ "<b>"
+ "Copyright © 2019-2021, 2024-2026. Alastair Poole <[email protected]><br>"
+ "<br>"
+ "</b>"
+ "</>"
+ "Permission to use, copy, modify, and distribute this software "
+ "for any purpose with or without fee is hereby granted, provided "
+ "that the above copyright notice and this permission notice appear "
+ "in all copies.<br>"
+ "<br>"
+ "THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL "
+ "WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED "
+ "WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL "
+ "THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR "
+ "CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING "
+ "FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF "
+ "CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT "
+ "OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS "
+ "SOFTWARE.<br><br><br><br><br><br><br><br><br><br><br>"
+ "<align=center>%s</></></>";
+
+static inline const char *
+_about_random_msg(void) {
+ return about_msg[rand() % ARRAY_SIZE(about_msg)];
+}
+
Evas_Object *
evisum_ui_tab_add(Evas_Object *parent, Evas_Object **alias, const char *text, Evas_Smart_Cb clicked_cb, void *data) {
Evas_Object *tb, *rect, *btn, *lb;
@@ -270,11 +308,16 @@ evisum_ui_textblock_font_size_get(Evas_Object *tb) {
typedef struct {
Evisum_Ui *ui;
Evas_Object *obj;
+ Evas_Object *clip;
Evas_Object *win;
Evas_Object *bg;
Evas_Object *im;
+ Evas_Object *lb;
Ecore_Animator *animator;
double pos;
+ double speed;
+ double last_tick;
+ int reset_hide_frames;
int w;
int h;
} Animate_Data;
@@ -288,6 +331,7 @@ _win_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
ui = ad->ui;
if (ad->animator) ecore_animator_del(ad->animator);
+ if (ad->clip) evas_object_del(ad->clip);
free(ad);
@@ -319,26 +363,58 @@ _about_resize_cb(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_
static Eina_Bool
about_anim(void *data) {
Animate_Data *ad;
- Evas_Coord w, h, oh;
+ double now, dt;
+ Evas_Coord bx, by, bw, bh, ox, oy, ow, oh;
ad = data;
- evas_object_geometry_get(ad->bg, NULL, NULL, &w, &h);
- if (w <= 0 || h <= 0) return 1;
- evas_object_geometry_get(ad->obj, NULL, NULL, NULL, &oh);
- evas_object_move(ad->obj, 0, ad->pos);
- if (ad->pos <= h) evas_object_show(ad->obj);
+ evas_object_geometry_get(ad->bg, &bx, &by, &bw, &bh);
+ evas_object_geometry_get(ad->obj, NULL, NULL, &ow, &oh);
+ if (bw <= 0 || bh <= 0 || ow <= 0 || oh <= 0) {
+ evas_object_hide(ad->obj);
+ return 1;
+ }
+ if (ad->clip) {
+ evas_object_move(ad->clip, bx, by);
+ evas_object_resize(ad->clip, bw, bh);
+ }
if (ad->im) {
- evas_object_move(ad->im, ELM_SCALE_SIZE(4), h - ELM_SCALE_SIZE(64));
+ evas_object_move(ad->im, ELM_SCALE_SIZE(4), bh - ELM_SCALE_SIZE(64));
evas_object_show(ad->im);
}
- ad->pos -= 0.5;
+ now = ecore_loop_time_get();
+ if (ad->last_tick <= 0.0) ad->last_tick = now;
+ dt = now - ad->last_tick;
+ ad->last_tick = now;
+
+ /* Clamp long stalls so resume doesn't jump harshly. */
+ if (dt < 0.0) dt = 0.0;
+ if (dt > 0.1) dt = 0.1;
+
+ if (ad->reset_hide_frames > 0) {
+ ad->reset_hide_frames--;
+ evas_object_move(ad->obj, bx, by + ad->pos);
+ evas_object_hide(ad->obj);
+ return 1;
+ }
+
+ ad->pos -= (ad->speed * dt);
if (ad->pos <= -oh) {
- ad->pos = h;
+ ad->pos = bh + ELM_SCALE_SIZE(2);
+ if (ad->lb) elm_object_text_set(ad->lb, eina_slstr_printf(about_text_fmt, _about_random_msg()));
+ ad->reset_hide_frames = 1;
+ evas_object_move(ad->obj, bx, by + ad->pos);
+ evas_object_hide(ad->obj);
+ return 1;
}
+ evas_object_move(ad->obj, bx, by + ad->pos);
+ evas_object_geometry_get(ad->obj, &ox, &oy, &ow, &oh);
+ if ((ox < (bx + bw)) && ((ox + ow) > bx) && (oy < (by + bh)) && ((oy + oh) > by)) evas_object_show(ad->obj);
+ else evas_object_hide(ad->obj);
+
return 1;
}
@@ -360,44 +436,17 @@ evisum_about_window_show(void *data) {
Evisum_Ui *ui;
Animate_Data *about;
Evas_Object *win, *bg, *tb, *version, *lb, *btn;
- Evas_Object *hbx, *rec, *pad, *pad_left, *pad_right;
+ Evas_Object *hbx, *rec, *pad, *pad_left, *pad_right, *clip;
+ Evas_Object *hdr_vbx, *pad_top;
Evas_Object *hdr_bg;
- int about_w, about_h, bg_w, bg_h, hdr_h;
- const char *msg[] = { "The greatest of all time...",
- "Remember to take your medication!",
- "Choose love!",
- "Schizophrenia!!!",
- "I endorse this message!",
- "Hack the planet!",
- "Remember what you need to carry!",
- "Well done my son." };
- const char *copyright = "<font color=#ffffff>"
- "<align=center>"
- "<b>"
- "Copyright © 2019-2021, 2024-2026. Alastair Poole <[email protected]><br>"
- "<br>"
- "</b>"
- "</>"
- "Permission to use, copy, modify, and distribute this software "
- "for any purpose with or without fee is hereby granted, provided "
- "that the above copyright notice and this permission notice appear "
- "in all copies.<br>"
- "<br>"
- "THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL "
- "WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED "
- "WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL "
- "THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR "
- "CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING "
- "FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF "
- "CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT "
- "OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS "
- "SOFTWARE.<br><br><br><br><br><br><br><br><br><br><br>"
- "<align=center>%s</></></>";
+ int about_w, about_h, bg_w, bg_h, hdr_h, about_pad, btn_h;
ui = data;
about_w = EVISUM_ABOUT_BG_WIDTH;
about_h = EVISUM_ABOUT_BG_HEIGHT;
- hdr_h = ELM_SCALE_SIZE(BTN_HEIGHT + 16);
+ about_pad = ELM_SCALE_SIZE(16);
+ btn_h = ELM_SCALE_SIZE(BTN_HEIGHT);
+ hdr_h = btn_h + about_pad;
if (ui->win_about) {
elm_win_raise(ui->win_about);
@@ -437,8 +486,9 @@ evisum_about_window_show(void *data) {
elm_table_align_set(tb, 0, 0);
pad = elm_frame_add(win);
- evas_object_size_hint_weight_set(pad, EXPAND, EXPAND);
- evas_object_size_hint_weight_set(pad, FILL, FILL);
+ evas_object_size_hint_weight_set(pad, 0.0, 0.0);
+ evas_object_size_hint_align_set(pad, FILL, 0.0);
+ evas_object_pass_events_set(pad, EINA_TRUE);
elm_object_style_set(pad, "pad_medium");
lb = elm_entry_add(win);
@@ -449,17 +499,29 @@ evisum_about_window_show(void *data) {
elm_entry_scrollable_set(lb, 0);
elm_entry_editable_set(lb, 0);
elm_entry_select_allow_set(lb, 0);
+ evas_object_pass_events_set(lb, EINA_TRUE);
evas_object_size_hint_weight_set(lb, 0, 0);
srand(time(NULL));
- elm_object_text_set(lb, eina_slstr_printf(copyright, msg[rand() % ARRAY_SIZE(msg)]));
+ elm_object_text_set(lb, eina_slstr_printf(about_text_fmt, _about_random_msg()));
evas_object_show(lb);
elm_object_content_set(pad, lb);
+ evas_object_show(pad);
+
+ clip = evas_object_rectangle_add(evas_object_evas_get(win));
+ evas_object_pass_events_set(clip, EINA_TRUE);
+ evas_object_hide(clip);
+ evas_object_clip_set(pad, clip);
about = malloc(sizeof(Animate_Data));
about->win = win;
about->bg = bg;
about->obj = pad;
+ about->clip = clip;
+ about->lb = lb;
about->pos = ELM_SCALE_SIZE(400);
+ about->speed = ELM_SCALE_SIZE(48);
+ about->last_tick = 0.0;
+ about->reset_hide_frames = 0;
about->ui = ui;
about->im = NULL;
about->w = about_w;
@@ -472,11 +534,17 @@ evisum_about_window_show(void *data) {
hbx = elm_box_add(win);
elm_box_horizontal_set(hbx, 1);
- evas_object_size_hint_align_set(hbx, FILL, 0.0);
+ evas_object_size_hint_align_set(hbx, FILL, FILL);
evas_object_size_hint_weight_set(hbx, EXPAND, 0);
- evas_object_size_hint_min_set(hbx, about_w, hdr_h);
+ evas_object_size_hint_min_set(hbx, about_w, btn_h);
evas_object_show(hbx);
+ hdr_vbx = elm_box_add(win);
+ evas_object_size_hint_align_set(hdr_vbx, FILL, 0.0);
+ evas_object_size_hint_weight_set(hdr_vbx, EXPAND, 0);
+ evas_object_size_hint_min_set(hdr_vbx, about_w, hdr_h);
+ evas_object_show(hdr_vbx);
+
version = elm_label_add(win);
evas_object_size_hint_weight_set(version, 0, 0);
evas_object_size_hint_align_set(version, 0.0, 0.5);
@@ -486,7 +554,7 @@ evisum_about_window_show(void *data) {
btn = elm_button_add(win);
evas_object_size_hint_weight_set(btn, 0, 0);
evas_object_size_hint_align_set(btn, 1.0, 0.5);
- evas_object_size_hint_min_set(btn, ELM_SCALE_SIZE(BTN_WIDTH), ELM_SCALE_SIZE(BTN_HEIGHT));
+ evas_object_size_hint_min_set(btn, ELM_SCALE_SIZE(BTN_WIDTH), btn_h);
elm_object_text_set(btn, _("Close"));
evas_object_show(btn);
@@ -499,14 +567,14 @@ evisum_about_window_show(void *data) {
pad_left = evas_object_rectangle_add(evas_object_evas_get(win));
evas_object_size_hint_align_set(pad_left, FILL, FILL);
evas_object_size_hint_weight_set(pad_left, 0, EXPAND);
- evas_object_size_hint_min_set(pad_left, ELM_SCALE_SIZE(8), 1);
+ evas_object_size_hint_min_set(pad_left, about_pad, 1);
evas_object_color_set(pad_left, 0, 0, 0, 0);
evas_object_show(pad_left);
pad_right = evas_object_rectangle_add(evas_object_evas_get(win));
evas_object_size_hint_align_set(pad_right, FILL, FILL);
evas_object_size_hint_weight_set(pad_right, 0, EXPAND);
- evas_object_size_hint_min_set(pad_right, ELM_SCALE_SIZE(8), 1);
+ evas_object_size_hint_min_set(pad_right, about_pad, 1);
evas_object_color_set(pad_right, 0, 0, 0, 0);
evas_object_show(pad_right);
@@ -516,19 +584,29 @@ evisum_about_window_show(void *data) {
elm_box_pack_end(hbx, btn);
elm_box_pack_end(hbx, pad_right);
+ pad_top = evas_object_rectangle_add(evas_object_evas_get(win));
+ evas_object_size_hint_align_set(pad_top, FILL, FILL);
+ evas_object_size_hint_weight_set(pad_top, EXPAND, 0);
+ evas_object_size_hint_min_set(pad_top, about_w, about_pad);
+ evas_object_color_set(pad_top, 0, 0, 0, 0);
+ evas_object_show(pad_top);
+
+ elm_box_pack_end(hdr_vbx, pad_top);
+ elm_box_pack_end(hdr_vbx, hbx);
+
hdr_bg = evas_object_rectangle_add(evas_object_evas_get(win));
evas_object_size_hint_align_set(hdr_bg, FILL, 0.0);
evas_object_size_hint_weight_set(hdr_bg, EXPAND, 0);
evas_object_size_hint_min_set(hdr_bg, about_w, 1); // hdr_h * 2);
- evas_object_color_set(hdr_bg, 0, 0, 0, 128);
+ evas_object_color_set(hdr_bg, 0, 0, 0, 77);
evas_object_show(hdr_bg);
evas_object_smart_callback_add(btn, "clicked", _btn_close_cb, about);
- elm_object_part_content_set(bg, "elm.swallow.content", pad);
elm_table_pack(tb, bg, 0, 0, 1, 1);
+ elm_table_pack(tb, pad, 0, 0, 1, 1);
elm_table_pack(tb, hdr_bg, 0, 0, 1, 1);
- elm_table_pack(tb, hbx, 0, 0, 1, 1);
+ elm_table_pack(tb, hdr_vbx, 0, 0, 1, 1);
elm_object_content_set(win, tb);
evas_object_event_callback_add(tb, EVAS_CALLBACK_KEY_DOWN, _win_key_down_cb, about);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.