summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_fb/ecore_fb.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2005-09-15 04:19:45 +0000
committerCarsten Haitzler <raster@rasterman.com>2005-09-15 04:19:45 +0000
commita0caf8afa16d7fcb18ead501c64acde106b42065 (patch)
tree62d8f5cb49578cac6185474aaef540ecea70a9ae /legacy/ecore/src/lib/ecore_fb/ecore_fb.c
parent6691ae8d1490b9b0a53ee62a5fb1bb1b70076285 (diff)
tslib patch :)
SVN revision: 16723
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore_fb/ecore_fb.c57
1 files changed, 55 insertions, 2 deletions
diff --git a/legacy/ecore/src/lib/ecore_fb/ecore_fb.c b/legacy/ecore/src/lib/ecore_fb/ecore_fb.c
index a87617c605..c22320a551 100644
--- a/legacy/ecore/src/lib/ecore_fb/ecore_fb.c
+++ b/legacy/ecore/src/lib/ecore_fb/ecore_fb.c
@@ -1,9 +1,13 @@
1
2#include "ecore_private.h" 1#include "ecore_private.h"
3#include "Ecore.h" 2#include "Ecore.h"
4#include "ecore_fb_private.h" 3#include "ecore_fb_private.h"
5#include "Ecore_Fb.h" 4#include "Ecore_Fb.h"
6 5
6#ifdef HAVE_TSLIB
7#include <tslib.h>
8#include <errno.h>
9#endif
10
7#include <termios.h> 11#include <termios.h>
8#include <sys/types.h> 12#include <sys/types.h>
9#include <sys/stat.h> 13#include <sys/stat.h>
@@ -73,6 +77,11 @@ struct _Ecore_Fb_Ps2_Event
73 unsigned char z; 77 unsigned char z;
74}; 78};
75 79
80#ifdef HAVE_TSLIB
81struct tsdev *_ecore_fb_tslib_tsdev = NULL;
82struct ts_sample _ecore_fb_tslib_event;
83#endif
84
76static void _ecore_fb_size_get(int *w, int *h); 85static void _ecore_fb_size_get(int *w, int *h);
77static int _ecore_fb_ts_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); 86static int _ecore_fb_ts_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
78static int _ecore_fb_kbd_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); 87static int _ecore_fb_kbd_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
@@ -265,10 +274,39 @@ int
265ecore_fb_init(const char *name __UNUSED__) 274ecore_fb_init(const char *name __UNUSED__)
266{ 275{
267 int prev_flags; 276 int prev_flags;
277#ifdef HAVE_TSLIB
278 char *tslib_tsdevice = NULL;
279#endif
268 280
269 _ecore_fb_init_count++; 281 _ecore_fb_init_count++;
270 if (_ecore_fb_init_count > 1) return _ecore_fb_init_count; 282 if (_ecore_fb_init_count > 1) return _ecore_fb_init_count;
283#ifdef HAVE_TSLIB
284 if ( ( tslib_tsdevice = getenv("TSLIB_TSDEVICE") ) != NULL )
285 {
286 printf( "ECORE_FB: TSLIB_TSDEVICE = '%s'\n", tslib_tsdevice );
287 _ecore_fb_tslib_tsdev = ts_open( tslib_tsdevice, 1 ); /* 1 = nonblocking, 0 = blocking */
288
289 if ( !_ecore_fb_tslib_tsdev )
290 {
291 printf( "ECORE_FB: Can't ts_open (%s)\n", strerror( errno ) );
292 return 0;
293 }
294
295 if ( ts_config( _ecore_fb_tslib_tsdev ) )
296 {
297 printf( "ECORE_FB: Can't ts_config (%s)\n", strerror( errno ) );
298 return 0;
299 }
300 _ecore_fb_ts_fd = ts_fd( _ecore_fb_tslib_tsdev );
301 if ( _ecore_fb_ts_fd < 0 )
302 {
303 printf( "ECORE_FB: Can't open touchscreen (%s)\n", strerror( errno ) );
304 return 0;
305 }
306 }
307#else
271 _ecore_fb_ts_fd = open("/dev/touchscreen/0", O_RDONLY); 308 _ecore_fb_ts_fd = open("/dev/touchscreen/0", O_RDONLY);
309#endif
272 if (_ecore_fb_ts_fd >= 0) 310 if (_ecore_fb_ts_fd >= 0)
273 { 311 {
274 prev_flags = fcntl(_ecore_fb_ts_fd, F_GETFL); 312 prev_flags = fcntl(_ecore_fb_ts_fd, F_GETFL);
@@ -786,7 +824,21 @@ _ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UN
786 char *ptr; 824 char *ptr;
787 double t; 825 double t;
788 int did_triple = 0; 826 int did_triple = 0;
789 827
828#ifdef HAVE_TSLIB
829 if ( _ecore_fb_ts_apply_cal )
830 num = ts_read_raw( _ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1 );
831 else
832 num = ts_read( _ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1 );
833 if ( num != 1 )
834 {
835 return 1; /* no more samples at this time */
836 }
837 x = _ecore_fb_tslib_event.x;
838 y = _ecore_fb_tslib_event.y;
839 pressure = _ecore_fb_tslib_event.pressure;
840 v = 1; /* loop, there might be more samples */
841#else
790 ptr = (char *)&(_ecore_fb_ts_event); 842 ptr = (char *)&(_ecore_fb_ts_event);
791 ptr += _ecore_fb_ts_event_byte_count; 843 ptr += _ecore_fb_ts_event_byte_count;
792 num = sizeof(Ecore_Fb_Ts_Event) - _ecore_fb_ts_event_byte_count; 844 num = sizeof(Ecore_Fb_Ts_Event) - _ecore_fb_ts_event_byte_count;
@@ -807,6 +859,7 @@ _ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UN
807 y = _ecore_fb_ts_event.y; 859 y = _ecore_fb_ts_event.y;
808 } 860 }
809 pressure = _ecore_fb_ts_event.pressure; 861 pressure = _ecore_fb_ts_event.pressure;
862#endif
810 /* add event to queue */ 863 /* add event to queue */
811 /* always add a move event */ 864 /* always add a move event */
812 if ((pressure) || (prev_pressure)) 865 if ((pressure) || (prev_pressure))