]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/efl/ecore/add-tslib-support.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / efl / ecore / add-tslib-support.patch
1
2 #
3 # tslib support for ecore, (C) Michael 'Mickey' Lauer <mickey@Vanille.de>
4 #
5
6 --- ecore/src/lib/ecore_fb/ecore_fb.c~add-tslib-support.patch
7 +++ ecore/src/lib/ecore_fb/ecore_fb.c
8 @@ -4,6 +4,13 @@
9  #include "Ecore_Fb.h"
10  #include "ecore_private.h"
11  
12 +
13 +#ifdef HAVE_TSLIB
14 +#include <tslib.h>
15 +#include <errno.h>
16 +#endif
17 +
18 +
19  #include <fcntl.h>
20  #include <unistd.h>
21  #include <stdio.h>
22 @@ -77,6 +84,11 @@
23     unsigned char z;
24  };
25  
26 +#ifdef HAVE_TSLIB
27 +struct tsdev *_ecore_fb_tslib_tsdev = NULL;
28 +struct ts_sample _ecore_fb_tslib_event;
29 +#endif
30 +
31  static void _ecore_fb_size_get(int *w, int *h);
32  static int _ecore_fb_ts_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
33  static int _ecore_fb_kbd_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
34 @@ -269,10 +281,39 @@
35  ecore_fb_init(const char *name __UNUSED__)
36  {
37     int prev_flags;
38 +#ifdef HAVE_TSLIB
39 +   char *tslib_tsdevice = NULL;
40 +#endif
41  
42     _ecore_fb_init_count++;
43     if (_ecore_fb_init_count > 1) return _ecore_fb_init_count;
44 +#ifdef HAVE_TSLIB
45 +    if ( ( tslib_tsdevice = getenv("TSLIB_TSDEVICE") ) != NULL )
46 +    {
47 +        printf( "ECORE_FB: TSLIB_TSDEVICE = '%s'\n", tslib_tsdevice );
48 +        _ecore_fb_tslib_tsdev = ts_open( tslib_tsdevice, 1 ); /* 1 = nonblocking, 0 = blocking */
49 +
50 +        if ( !_ecore_fb_tslib_tsdev )
51 +        {
52 +            printf( "ECORE_FB: Can't ts_open (%s)\n", strerror( errno ) );
53 +            return 0;
54 +        }
55 +
56 +        if ( ts_config( _ecore_fb_tslib_tsdev ) )
57 +        {
58 +            printf( "ECORE_FB: Can't ts_config (%s)\n", strerror( errno ) );
59 +            return 0;
60 +        }
61 +        _ecore_fb_ts_fd = ts_fd( _ecore_fb_tslib_tsdev );
62 +        if ( _ecore_fb_ts_fd < 0 )
63 +        {
64 +            printf( "ECORE_FB: Can't open touchscreen (%s)\n", strerror( errno ) );
65 +            return 0;
66 +        }
67 +    }
68 +#else
69     _ecore_fb_ts_fd = open("/dev/touchscreen/0", O_RDONLY);
70 +#endif
71     if (_ecore_fb_ts_fd >= 0)
72       {
73         prev_flags = fcntl(_ecore_fb_ts_fd, F_GETFL);
74 @@ -790,7 +831,21 @@
75         char *ptr;
76         double t;
77         int did_triple = 0;
78 -       
79 +
80 +#ifdef HAVE_TSLIB
81 +    if ( _ecore_fb_ts_apply_cal )
82 +        num = ts_read_raw( _ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1 );
83 +    else
84 +        num = ts_read( _ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1 );
85 +    if ( num != 1 )
86 +    {
87 +        return 1; /* no more samples at this time */
88 +    }
89 +    x = _ecore_fb_tslib_event.x;
90 +    y = _ecore_fb_tslib_event.y;
91 +    pressure = _ecore_fb_tslib_event.pressure;
92 +    v = 1; /* loop, there might be more samples */
93 +#else
94         ptr = (char *)&(_ecore_fb_ts_event);
95         ptr += _ecore_fb_ts_event_byte_count;
96         num = sizeof(Ecore_Fb_Ts_Event) - _ecore_fb_ts_event_byte_count;
97 @@ -811,6 +866,7 @@
98              y = _ecore_fb_ts_event.y;
99           }
100         pressure = _ecore_fb_ts_event.pressure;
101 +#endif   
102         /* add event to queue */
103         /* always add a move event */
104         if ((pressure) || (prev_pressure))