On Tue, 16 Dec 2008 16:32:59 +0100 [email protected] (Lars Munch) babbled:

ok - if it still uses tslib if there - good. its not much extra code int he
patch - though  a lot of changes - and in many ways the style of the code looks
odd. i.e.:

if (x) {
 something;
}

instead of
if (x)
 something;

or
if (x)
{
 something;
}

can you clear that up?

> On Tue, Dec 16, 2008 at 02:59:59PM +0100, Michael 'Mickey' Lauer wrote:
> > Am Tuesday 16 December 2008 11:23:37 schrieb Lars Munch:
> > > On Mon, Dec 15, 2008 at 08:56:18PM +0100, Michael 'Mickey' Lauer wrote:
> > > > Am Monday 15 December 2008 11:24:07 schrieb Lars Munch:
> > > > > This patch adds absolute coordinate support to ecore_fb, e.g.
> > > > > touchscreen support. There is no calibration support yet, it just uses
> > > > > the values it gets from the kernel.
> > > >
> > > > Why don't you use tslib?
> > >
> > > One less dependency and if the touchscreen driver is already calibrated
> > > then it "just works".
> > 
> > I don't think that justifies adding that code to ecore_fb. Everyone and
> > their brother is using tslib these days. Anyways, if you want that patch to
> > go in, keep the tslib functionality around and only add on top.
> 
> Apparently not everyone :-)
> 
> Yes, we should definitely keep the tslib functionality! my intension was
> not to replace it but apparently I was missing a HAVE_TSLIB guard in
> ecore_evas_fb.c. Now it will use TSLIB lib if you have it installed and
> fallback to ecore_fb_li if not.
> 
> Updated patch below.
> 
> ---
> 
> Index: src/lib/ecore_fb/ecore_fb_private.h
> ===================================================================
> --- src/lib/ecore_fb/ecore_fb_private.h       (revision 38149)
> +++ src/lib/ecore_fb/ecore_fb_private.h       (working copy)
> @@ -19,8 +19,8 @@
>   #define kernel_ulong_t unsigned long 
>   #define BITS_PER_LONG 32
>   #include <linux/input.h>
> - #undef kernel_ulong_t <-added
> - #undef BITS_PER_LONG <-added
> + #undef kernel_ulong_t
> + #undef BITS_PER_LONG
>  #else
>   #include <linux/input.h>
>  #endif
> @@ -52,7 +52,7 @@
>               /* absolute axis */
>               int min_w, min_h;
>               double rel_w, rel_h;
> -
> +             int event;
>       } mouse;
>       struct
>       {
> Index: src/lib/ecore_fb/ecore_fb_li.c
> ===================================================================
> --- src/lib/ecore_fb/ecore_fb_li.c    (revision 38149)
> +++ src/lib/ecore_fb/ecore_fb_li.c    (working copy)
> @@ -250,52 +250,110 @@
>  static void
>  _ecore_fb_li_device_event_abs(Ecore_Fb_Input_Device *dev, struct input_event
> *iev) {
> +     static int prev_x = 0, prev_y = 0, prev_pressure = 0;
> +     int v = 0;
> +     int pressure;
> +     int num;
> +     char *ptr;
> +     double t;
> +
>       if(!dev->listen)
>               return;
> +
>       switch(iev->code)
>       {
>               case ABS_X:
> -             case ABS_Y:
> -             {
> -                     Ecore_Fb_Event_Mouse_Move *ev;
> -                     if((iev->code == ABS_X) && (dev->mouse.w != 0))
> +                     if(dev->mouse.w != 0)
>                       {
>                               int tmp;
>  
>                               tmp = (int)((double)(iev->value -
> dev->mouse.min_w) / dev->mouse.rel_w);
> -                             if(tmp < 0)
> +                             if(tmp < 0) {
>                                       dev->mouse.x = 0;
> -                             else if(tmp > dev->mouse.w)
> +                             }
> +                             else if(tmp > dev->mouse.w) {
>                                       dev->mouse.x = dev->mouse.w;
> -                             else
> +                             }
> +                             else {
>                                       dev->mouse.x = tmp;
> +                             }
> +                             dev->mouse.event = ECORE_FB_EVENT_MOUSE_MOVE;
>                       }
> -                     else if((iev->code == ABS_Y) && (dev->mouse.h != 0))
> +                     break;
> +
> +             case ABS_Y:
> +                     if(dev->mouse.h != 0)
>                       {
>                               int tmp;
>  
>                               tmp = (int)((double)(iev->value -
> dev->mouse.min_h) / dev->mouse.rel_h);
> -                             if(tmp < 0)
> +                             if(tmp < 0) {
>                                       dev->mouse.y = 0;
> -                             else if(tmp > dev->mouse.h)
> +                             }
> +                             else if(tmp > dev->mouse.h) {
>                                       dev->mouse.y = dev->mouse.h;
> -                             else
> +                             }
> +                             else {
>                                       dev->mouse.y = tmp;
> +                             }
> +                             dev->mouse.event = ECORE_FB_EVENT_MOUSE_MOVE;
>                       }
> -                     ev = calloc(1,sizeof(Ecore_Fb_Event_Mouse_Move));
> -                     ev->x = dev->mouse.x;
> -                     ev->y = dev->mouse.y;
> -                     ev->dev = dev;
> +                     break;
>  
> -                     ecore_event_add(ECORE_FB_EVENT_MOUSE_MOVE, ev, NULL,
> NULL);
> -                     break;
> -             }
>               case ABS_PRESSURE:
> -                     /* TODO emulate a button press */
> +                     pressure = iev->value;
> +                     if ((pressure) && (!prev_pressure))
> +                     {
> +                             /* DOWN: mouse is down, but was not now */
> +                             dev->mouse.event =
> ECORE_FB_EVENT_MOUSE_BUTTON_DOWN;
> +                     }
> +                     else if ((!pressure) && (prev_pressure))
> +                     {
> +                             /* UP: mouse was down, but is not now */
> +                             dev->mouse.event =
> ECORE_FB_EVENT_MOUSE_BUTTON_UP;
> +                     }
> +
> +                     prev_pressure = pressure;
> +
>                       break;
>       }
>  }
>  
> +static void
> +_ecore_fb_li_device_event_syn(Ecore_Fb_Input_Device *dev, struct input_event
> *iev) +{
> +     if(!dev->listen)
> +             return;
> +
> +     if(dev->mouse.event == ECORE_FB_EVENT_MOUSE_MOVE)
> +     {
> +             Ecore_Fb_Event_Mouse_Move *ev;
> +             ev = calloc(1,sizeof(Ecore_Fb_Event_Mouse_Move));
> +             ev->x = dev->mouse.x;
> +             ev->y = dev->mouse.y;
> +             ev->dev = dev;
> +             ecore_event_add(ECORE_FB_EVENT_MOUSE_MOVE, ev, NULL, NULL);
> +     }
> +     else if(dev->mouse.event == ECORE_FB_EVENT_MOUSE_BUTTON_DOWN)
> +     {
> +             Ecore_Fb_Event_Mouse_Button_Down *ev;
> +             ev = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Down));
> +             ev->x = dev->mouse.x;
> +             ev->y = dev->mouse.y;
> +             ev->button = 1;
> +             ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, ev, NULL,
> NULL);
> +     }
> +     else if(dev->mouse.event == ECORE_FB_EVENT_MOUSE_BUTTON_UP)
> +     {
> +             Ecore_Fb_Event_Mouse_Button_Up *ev;
> +             ev = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Up));
> +             ev->x = dev->mouse.x;
> +             ev->y = dev->mouse.y;
> +             ev->button = 1;
> +             ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, ev, NULL,
> NULL);
> +     }
> +}
> +
>  static int
>  _ecore_fb_li_device_fd_callback(void *data, Ecore_Fd_Handler *fdh)
>  {
> @@ -312,6 +370,9 @@
>       {
>               switch(ev[i].type)
>               {
> +                     case EV_SYN:
> +                             _ecore_fb_li_device_event_syn(dev, &ev[i]);
> +                             break;
>                       case EV_ABS:
>                               _ecore_fb_li_device_event_abs(dev, &ev[i]);
>                               break;
> Index: src/lib/ecore_evas/ecore_evas_fb.c
> ===================================================================
> --- src/lib/ecore_evas/ecore_evas_fb.c        (revision 38149)
> +++ src/lib/ecore_evas/ecore_evas_fb.c        (working copy)
> @@ -284,7 +284,11 @@
>       if (ecore_evas_input_devices)
>         {
>            /* Mouse */
> +#ifdef HAVE_TSLIB
>            if (caps & ECORE_FB_INPUT_DEVICE_CAP_RELATIVE)
> +#else
> +             if ((caps & ECORE_FB_INPUT_DEVICE_CAP_RELATIVE) || (caps &
> ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE)) +#endif
>              {
>                 ecore_fb_input_device_axis_size_set(device, w, h);
>                 ecore_fb_input_device_listen(device,1);
> 
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> enlightenment-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    [email protected]


------------------------------------------------------------------------------
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to