This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository exclaim.
View the commit online.
commit e5807b158ff61aae5a0dfe65770862fea04820dd
Author: Nekobit <m...@ow.nekobit.net>
AuthorDate: Fri Sep 22 20:45:37 2023 -0400
Use hoversel instead to workaround performance issue
---
src/main.c | 65 ++++++++++++++++++++++++++++++++++++++----------------------
src/status.c | 54 ++++++++++++++++++++++++++++++++------------------
2 files changed, 76 insertions(+), 43 deletions(-)
diff --git a/src/main.c b/src/main.c
index a6ee708..2f6a22f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4,15 +4,35 @@
#include "etc.h"
#include "status.h"
-Evas_Object* sidebar, *sidebar_root, *sidebar_content;
+Evas_Object* sideview, *sideview_root, *sideview_content;
+Ecore_Animator* sb_anime = NULL;
+long sideview_show = 0;
void
explode_win_enable(Evas_Object* win);
+static Eina_Bool
+sideview_toggle_anime_cb(void *data EINA_UNUSED, double pos)
+{
+ long should_show = (long)data;
+ double v = ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0);
+
+ if (!should_show)
+ v = 1.0 - v;
+
+ if ((v * 80.0) >= 68) sb_anime = NULL;
+ const float size = should_show ? 400.0 : 400.0;
+ evas_object_move(sideview_root, (v * size) - (int)size + 68, 0);
+
+ //if (pos >= 1.0) sb_anime = NULL;
+ return EINA_TRUE;
+}
+
void
toggle_sideview()
{
-
+ sideview_show = !sideview_show;
+ sb_anime = ecore_animator_timeline_add(0.4, sideview_toggle_anime_cb, (void*)(long)sideview_show);
}
static void
@@ -20,32 +40,29 @@ win_move(void* data EINA_UNUSED, Evas* e EINA_UNUSED, Evas_Object* obj, void* ev
{
Evas_Coord w, h;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
- evas_object_resize(sidebar_root, 300, h);
-
- printf("test\n");
+ evas_object_resize(sideview_root, 300, h);
}
-void
+Evas_Object*
create_sideview(Evas_Object* parent)
{
- sidebar_root = E_SHOW(elm_frame_add(parent));
- E_BEGIN(sidebar_root);
- elm_widget_style_set(sidebar_root, "outline");
- sidebar = E_SHOW(elm_scroller_add(parent));
- //evas_object_resize(sidebar, 400, 400);
- E_BEGIN(sidebar);
- sidebar_content = E_SHOW(elm_box_add(sidebar_root));
- //evas_object_resize(sidebar, 400, 400);
- E_BEGIN(sidebar_content);
- elm_object_content_set(sidebar, sidebar_content);
- E_END(sidebar_content);
- E_END(sidebar);
- elm_object_content_set(sidebar_root, sidebar);
- E_END(sidebar_root);
+ sideview_root = E_SHOW(elm_frame_add(parent));
+ E_BEGIN(sideview_root);
+ elm_widget_style_set(sideview_root, "outline");
+ sideview = E_SHOW(elm_scroller_add(parent));
+ E_BEGIN(sideview);
+ //sideview_content = E_SHOW(elm_box_add(sideview_root));
+ E_BEGIN(sideview_content);
+ //elm_object_content_set(sideview, sideview_content);
+ E_END(sideview_content);
+ E_END(sideview);
+ elm_object_content_set(sideview_root, sideview);
+ E_END(sideview_root);
- evas_object_resize(sidebar_root, 300, 0);
- evas_object_move(sidebar_root, 68, 0);
+ evas_object_resize(sideview_root, 300, 0);
+ evas_object_move(sideview_root, 68, 0);
+ return sideview_root;
}
static void
@@ -53,7 +70,6 @@ _cb_toggle_sideview(void* data,
Evas_Object* obj EINA_UNUSED,
void* ev_info EINA_UNUSED)
{
- printf("%s\n", "test");
toggle_sideview();
}
@@ -140,7 +156,8 @@ elm_main(int argc, char** argv)
E_END(root);
E_END(win);
- create_sideview(win);
+ //???
+ evas_object_stack_above(sidebar, create_sideview(win));
elm_run();
return EXIT_SUCCESS;
diff --git a/src/status.c b/src/status.c
index dc0aaaa..3115189 100644
--- a/src/status.c
+++ b/src/status.c
@@ -5,6 +5,15 @@
#define PFP_ICON_SIZE 48
#define INTERACT_ICON_SIZE 18
+/* So... due to a some strange issue, elm_hover is noticably slowing down
+ * the event loop (or just in general), and I can't exactly pinpoint why.
+ *
+ * As a workaround, I'm using the "original" approach for how I implemented the
+ * the menus. It looks fine, but not as pretty :^)
+ */
+#define USE_HOVER_MENU 0
+
+#if USE_HOVER_MENU == 1
static void
hover_btn_show(void* data, Evas_Object* obj EINA_UNUSED, void* ev_info EINA_UNUSED)
{
@@ -12,6 +21,7 @@ hover_btn_show(void* data, Evas_Object* obj EINA_UNUSED, void* ev_info EINA_UNUS
evas_object_show(hover);
}
+#endif
Evas_Object*
exc_status_add(Evas_Object* parent, struct exc_status status)
@@ -146,7 +156,7 @@ exc_status_add(Evas_Object* parent, struct exc_status status)
elm_box_horizontal_set(st_interact, EINA_TRUE);
evas_object_fullsize(st_interact);
evas_object_size_hint_align_set(st_interact, 0, 0);
-
+
o = E_SHOW(elm_button_add(st_interact));
E_BEGIN(o) // Reply
//elm_object_text_set(o, "Reply");
@@ -197,26 +207,32 @@ exc_status_add(Evas_Object* parent, struct exc_status status)
elm_box_pack_end(st_interact_root, st_interact);
E_END(st_interact);
-
+
Evas_Object* st_interact_rt = E_SHOW(elm_box_add(st_box));
E_BEGIN(st_interact);
elm_box_horizontal_set(st_interact_rt, EINA_TRUE);
evas_object_fullsize(st_interact_rt);
evas_object_size_hint_align_set(st_interact_rt, 0.90, 0);
+#if USE_HOVER_MENU == 1
o = E_SHOW(elm_button_add(st_interact_rt));
E_BEGIN(o) // Reply
Evas_Object* hover = elm_hover_add(st_interact_rt);
+#else
+ o = E_SHOW(elm_hoversel_add(st_interact_rt));
+ elm_hoversel_hover_parent_set(o, parent);
+#endif
elm_object_style_set(o, "blank");
- ico = E_SHOW(elm_icon_add(st_interact_rt));
+ ico = elm_icon_add(st_interact_rt);
elm_icon_standard_set(ico, "view-list-compact");
evas_object_size_hint_min_set(ico, INTERACT_ICON_SIZE, INTERACT_ICON_SIZE);
elm_object_content_set(o, ico);
- evas_object_smart_callback_add(o, "clicked", hover_btn_show, hover);
elm_box_pack_end(st_interact_rt, o);
- // End button...
+#if USE_HOVER_MENU == 1
+ evas_object_smart_callback_add(o, "clicked", hover_btn_show, hover);
+ // End button...
// ...Start hover
Evas_Object* p, * q, *r;
elm_object_style_set(hover, "popout");
@@ -230,9 +246,8 @@ exc_status_add(Evas_Object* parent, struct exc_status status)
// END CREATE
elm_hover_target_set(hover, o);
elm_object_part_content_set(hover, "middle", p);
-
p = elm_button_add(st_interact_rt);
- q = E_SHOW(elm_icon_add(st_interact_rt));
+ q = elm_icon_add(st_interact_rt);
//elm_icon_standard_set(q, "mail-mark-junk");
elm_icon_standard_set(q, "audio-volume-muted");
evas_object_size_hint_min_set(q, 16, 16);
@@ -241,14 +256,14 @@ exc_status_add(Evas_Object* parent, struct exc_status status)
elm_object_part_content_set(hover, "bottom", p);
p = elm_button_add(st_interact_rt);
- q = E_SHOW(elm_icon_add(st_interact_rt));
+ q = elm_icon_add(st_interact_rt);
elm_icon_standard_set(q, "edit-delete");
evas_object_size_hint_min_set(q, 16, 16);
elm_object_content_set(p, q);
elm_object_part_content_set(hover, "right", p);
p = elm_button_add(st_interact_rt);
- q = E_SHOW(elm_icon_add(st_interact_rt));
+ q = elm_icon_add(st_interact_rt);
elm_icon_standard_set(q, "user-bookmarks");
evas_object_size_hint_min_set(q, 16, 16);
elm_object_content_set(p, q);
@@ -257,7 +272,7 @@ exc_status_add(Evas_Object* parent, struct exc_status status)
p = elm_box_add(st_interact_rt);
q = E_SHOW(elm_button_add(st_interact_rt));
//elm_object_text_set(q, "Report");
- r = E_SHOW(elm_icon_add(st_interact_rt));
+ r = elm_icon_add(st_interact_rt);
elm_icon_standard_set(r, "emblem-important");
evas_object_size_hint_min_set(r, 16, 16);
elm_object_content_set(q, r);
@@ -267,27 +282,28 @@ exc_status_add(Evas_Object* parent, struct exc_status status)
elm_box_pack_end(p, q);
q = E_SHOW(elm_button_add(st_interact_rt));
//elm_object_text_set(q, "Copy Link");
- r = E_SHOW(elm_icon_add(st_interact_rt));
+ r = elm_icon_add(st_interact_rt);
elm_icon_standard_set(r, "emblem-shared");
evas_object_size_hint_min_set(r, 16, 16);
elm_object_content_set(q, r);
elm_box_pack_end(p, q);
elm_object_part_content_set(hover, "top", p);
+#else
// BEGIN items
- //elm_hoversel_item_add(o, "Mute Conversation", NULL, ELM_ICON_NONE, NULL, NULL);
- //elm_hoversel_item_add(o, "Pin on Profile", NULL, ELM_ICON_NONE, NULL, NULL);
- //elm_hoversel_item_add(o, "Bookmark", NULL, ELM_ICON_NONE, NULL, NULL);
- //elm_hoversel_item_add(o, "Delete Status", NULL, ELM_ICON_NONE, NULL, NULL);
- //elm_hoversel_item_add(o, "Copy link", NULL, ELM_ICON_NONE, NULL, NULL);
- //elm_hoversel_item_add(o, "Report", NULL, ELM_ICON_NONE, NULL, NULL);
+ elm_hoversel_item_add(o, "Mute Conversation", NULL, ELM_ICON_NONE, NULL, NULL);
+ elm_hoversel_item_add(o, "Pin on Profile", NULL, ELM_ICON_NONE, NULL, NULL);
+ elm_hoversel_item_add(o, "Bookmark", NULL, ELM_ICON_NONE, NULL, NULL);
+ elm_hoversel_item_add(o, "Delete Status", NULL, ELM_ICON_NONE, NULL, NULL);
+ elm_hoversel_item_add(o, "Copy link", NULL, ELM_ICON_NONE, NULL, NULL);
+ elm_hoversel_item_add(o, "Report", NULL, ELM_ICON_NONE, NULL, NULL);
// END items
+#endif
E_END(o)
elm_box_pack_end(st_interact_root, st_interact_rt);
E_END(st_interact_rt);
-
- elm_box_pack_end(st_box_rt, st_interact_root);
+ elm_box_pack_end(st_box_rt, st_interact_root);
elm_box_pack_end(st_box, st_box_rt);
E_BEGIN(st_box_rt);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.