Hi,

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.

( Hope the attachment doesn't get stripped off :S )
--- src/modules/backlight/e_mod_main.c.old      2011-06-18 09:58:28.065248818 
+0800
+++ src/modules/backlight/e_mod_main.c  2011-06-19 16:58:21.016998672 +0800
@@ -326,6 +326,46 @@
      }
 }
 
+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 *
 _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
 {
@@ -354,6 +394,10 @@
                                   EVAS_CALLBACK_MOUSE_DOWN,
                                   _backlight_cb_mouse_down,
                                   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);
 
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to