Hi.

I added support for touchscreen scrolling to kdrive and tslib-based X
servers. With that patch, screen dragging can generate mousewheel
events instead of dragging events. This behavior directly conflicts with
those parts of e that try to implement that dragging-as-scrolling
functionality in the application instead of in the driver. I'm
attaching a patch to support mouse-wheel events in the illume keyboard.
For the patch to the xserver (haven't sent it upstream yet), see

http://lists.shr-project.org/pipermail/shr-devel/2009-July/000251.html

The new behavior is working very well for me, and I think this patch
should be included in the tree.

dima
Index: e/src/modules/illume/e_kbd_int.c
===================================================================
--- e/src/modules/illume/e_kbd_int.c	(revision 41283)
+++ e/src/modules/illume/e_kbd_int.c	(working copy)
@@ -832,6 +832,48 @@
    if (dir > 0) _e_kbd_int_stroke_handle(ki, dir);
 }
 
+static void
+_e_kbd_int_cb_mouse_wheel(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+   Evas_Event_Mouse_Wheel *ev;
+   E_Kbd_Int *ki;
+   int dir = -1;
+   static int lastEventTimeMS = 0;
+   static Evas_Coord lastEventX, lastEventY;
+   ev = event_info;
+
+   // If the scroll location didn't change (same scrolling motion) and not
+   // enough time elapsed since the last scroll command, do nothing
+   // FIXME: 400ms is a magic value
+   if( lastEventX==ev->canvas.x && lastEventY==ev->canvas.y &&
+       ev->timestamp - lastEventTimeMS < 400 )
+     return;
+
+   if (ev->direction == 0)
+     {
+       if (ev->z < 0)
+	 dir = 2;
+       else if (ev->z > 0)
+	 dir = 4;
+     }
+   else if(ev->direction == 1)
+     {
+       if (ev->z < 0)
+	 dir = 1;
+       else if (ev->z > 0)
+	 dir = 3;
+     }
+
+   ki = data;
+   if (dir > 0)
+     {
+       lastEventTimeMS = ev->timestamp;
+       lastEventX = ev->canvas.x;
+       lastEventY = ev->canvas.y;
+       _e_kbd_int_stroke_handle(ki, dir);
+     }
+}
+
 static E_Kbd_Int_Layout *
 _e_kbd_int_layouts_list_default_get(E_Kbd_Int *ki)
 {
@@ -1040,6 +1082,7 @@
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_kbd_int_cb_mouse_down, ki);
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _e_kbd_int_cb_mouse_up, ki);
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _e_kbd_int_cb_mouse_move, ki);
+   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, _e_kbd_int_cb_mouse_wheel, ki);
    evas_object_show(o);
    ki->event_obj = o;
    evas_event_thaw(ki->win->evas);
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to