proclist: handle mouse wheel ourselves.

This can be too much...
This commit is contained in:
Alastair Poole 2021-03-26 16:57:38 +00:00
parent 82f22e6e49
commit 734662b86e
1 changed files with 23 additions and 0 deletions

View File

@ -1456,6 +1456,26 @@ _glist_scroll_stopped_cb(void *data, Evas_Object *obj EINA_UNUSED,
prev_oy = oy;
}
static void
_glist_mouse_wheel_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info)
{
Evas_Event_Mouse_Wheel *ev;
Data *pd;
Evas_Coord x, y, w, h;
Evas_Coord movement = 0;
pd = data;
ev = event_info;
elm_scroller_region_get(pd->glist, &x, &y, &w, &h);
if (ev->z == 1) movement = (h / 2);
else if (ev->z == -1) movement = -(h / 2);
elm_scroller_region_bring_in(pd->glist, x, y + movement, w, h);
}
static Eina_Bool
_main_menu_timer_cb(void *data)
{
@ -1719,6 +1739,7 @@ _content_add(Data *pd, Evas_Object *parent)
pd->glist = glist = elm_genlist_add(parent);
elm_genlist_homogeneous_set(glist, 1);
elm_scroller_gravity_set(glist, 0.0, 1.0);
elm_scroller_wheel_disabled_set(glist, 1);
elm_object_focus_allow_set(glist, 1);
elm_scroller_policy_set(glist, ELM_SCROLLER_POLICY_AUTO,
(ui->proc.show_scroller ?
@ -1746,6 +1767,8 @@ _content_add(Data *pd, Evas_Object *parent)
_glist_scroll_stopped_cb, pd);
evas_object_smart_callback_add(glist, "scroll,drag,stop",
_glist_scroll_stopped_cb, pd);
evas_object_event_callback_add(glist, EVAS_CALLBACK_MOUSE_WHEEL,
_glist_mouse_wheel_cb, pd);
pd->summary.fr = fr = elm_frame_add(parent);
elm_object_style_set(fr, "pad_small");