forked from enlightenment/enlightenment
From: P Purkayastha <ppurka@gmail.com>
Subject: [E-devel] [Patch] Change backlight on mouse scroll I am just attaching a small patch, mostly taken from mixer module, which allows one to change the backlight via mouse scroll on the gadget. SVN revision: 60516
This commit is contained in:
parent
63eb051e7a
commit
fbed2ecbf5
|
@ -326,6 +326,46 @@ _backlight_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __U
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_backlight_level_decrease(Instance *inst)
|
||||||
|
{
|
||||||
|
double v = inst->val - 0.1;
|
||||||
|
if (v < 0.0) v = 0.0;
|
||||||
|
e_backlight_level_set(inst->gcc->gadcon->zone, v, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_backlight_level_increase(Instance *inst)
|
||||||
|
{
|
||||||
|
double v = inst->val + 0.1;
|
||||||
|
if (v > 1.0) v = 1.0;
|
||||||
|
e_backlight_level_set(inst->gcc->gadcon->zone, v, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_backlight_cb_mouse_wheel(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event)
|
||||||
|
{
|
||||||
|
Eina_List *l;
|
||||||
|
Evas_Event_Mouse_Wheel *ev = event;
|
||||||
|
double v;
|
||||||
|
Instance *inst = data;
|
||||||
|
|
||||||
|
e_backlight_update();
|
||||||
|
inst->val = e_backlight_level_get(inst->gcc->gadcon->zone);
|
||||||
|
if (ev->z > 0)
|
||||||
|
_backlight_level_decrease(inst);
|
||||||
|
else if (ev->z < 0)
|
||||||
|
_backlight_level_increase(inst);
|
||||||
|
|
||||||
|
v = inst->val;
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(backlight_instances, l, inst)
|
||||||
|
{
|
||||||
|
inst->val = v;
|
||||||
|
_backlight_gadget_update(inst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static E_Gadcon_Client *
|
static E_Gadcon_Client *
|
||||||
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
{
|
{
|
||||||
|
@ -354,6 +394,10 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
EVAS_CALLBACK_MOUSE_DOWN,
|
EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
_backlight_cb_mouse_down,
|
_backlight_cb_mouse_down,
|
||||||
inst);
|
inst);
|
||||||
|
evas_object_event_callback_add(inst->o_backlight,
|
||||||
|
EVAS_CALLBACK_MOUSE_WHEEL,
|
||||||
|
_backlight_cb_mouse_wheel,
|
||||||
|
inst);
|
||||||
|
|
||||||
e_gadcon_client_util_menu_attach(gcc);
|
e_gadcon_client_util_menu_attach(gcc);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue