Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_fb
Modified Files:
Ecore_Fb.h Makefile.am ecore_fb_private.h ecore_fb_ts.c
Log Message:
tslib supprot back from tobias.
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_fb/Ecore_Fb.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- Ecore_Fb.h 15 Mar 2007 22:21:27 -0000 1.12
+++ Ecore_Fb.h 24 Jan 2008 02:23:14 -0000 1.13
@@ -43,16 +43,15 @@
extern "C" {
#endif
-
typedef struct _Ecore_Fb_Input_Device Ecore_Fb_Input_Device; /* an input
device handler */
/* device capabilities */
enum _Ecore_Fb_Input_Device_Cap
{
- ECORE_FB_INPUT_DEVICE_CAP_NONE = 0x00000000,
- ECORE_FB_INPUT_DEVICE_CAP_RELATIVE = 0x00000001,
- ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE = 0x00000002,
- ECORE_FB_INPUT_DEVICE_CAP_KEYS_OR_BUTTONS = 0x00000004
+ ECORE_FB_INPUT_DEVICE_CAP_NONE = 0x00000000,
+ ECORE_FB_INPUT_DEVICE_CAP_RELATIVE = 0x00000001,
+ ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE = 0x00000002,
+ ECORE_FB_INPUT_DEVICE_CAP_KEYS_OR_BUTTONS = 0x00000004
};
typedef enum _Ecore_Fb_Input_Device_Cap Ecore_Fb_Input_Device_Cap;
@@ -72,52 +71,53 @@
struct _Ecore_Fb_Event_Key_Down /** FB Key Down event */
{
- Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
- char *keyname; /**< The name of the key that was pressed */
- char *keysymbol; /**< The logical symbol of the key that was pressed
*/
- char *key_compose; /**< The UTF-8 string conversion if any */
+ Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
+ char *keyname; /**< The name of the key that was pressed */
+ char *keysymbol; /**< The logical symbol of the key that was pressed */
+ char *key_compose; /**< The UTF-8 string conversion if any */
};
struct _Ecore_Fb_Event_Key_Up /** FB Key Up event */
{
- Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
- char *keyname; /**< The name of the key that was released */
- char *keysymbol; /**< The logical symbol of the key that was pressed
*/
- char *key_compose; /**< The UTF-8 string conversion if any */
+ Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
+ char *keyname; /**< The name of the key that was released */
+ char *keysymbol; /**< The logical symbol of the key that was pressed */
+ char *key_compose; /**< The UTF-8 string conversion if any */
};
struct _Ecore_Fb_Event_Mouse_Button_Down /** FB Mouse Down event */
{
- Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
- int button; /**< Mouse button that was pressed (1 - 32) */
- int x; /**< Mouse co-ordinates when mouse button was pressed */
- int y; /**< Mouse co-ordinates when mouse button was pressed */
- int double_click : 1; /**< Set if click was a double click */
- int triple_click : 1; /**< Set if click was a triple click */
+ Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
+ int button; /**< Mouse button that was pressed (1 - 32) */
+ int x; /**< Mouse co-ordinates when mouse button was pressed */
+ int y; /**< Mouse co-ordinates when mouse button was pressed */
+ int double_click : 1; /**< Set if click was a double click */
+ int triple_click : 1; /**< Set if click was a triple click */
};
struct _Ecore_Fb_Event_Mouse_Button_Up /** FB Mouse Up event */
{
- Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
- int button; /**< Mouse button that was released (1 - 32) */
- int x; /**< Mouse co-ordinates when mouse button was raised */
- int y; /**< Mouse co-ordinates when mouse button was raised */
+ Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
+ int button; /**< Mouse button that was released (1 - 32) */
+ int x; /**< Mouse co-ordinates when mouse button was raised */
+ int y; /**< Mouse co-ordinates when mouse button was raised */
};
struct _Ecore_Fb_Event_Mouse_Move /** FB Mouse Move event */
{
- Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
- int x; /**< Mouse co-ordinates where the mouse cursor moved to */
- int y; /**< Mouse co-ordinates where the mouse cursor moved to */
+ Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
+ int x; /**< Mouse co-ordinates where the mouse cursor moved to */
+ int y; /**< Mouse co-ordinates where the mouse cursor moved to */
};
-
+
struct _Ecore_Fb_Event_Mouse_Wheel /** FB Mouse Wheel event */
{
- Ecore_Fb_Input_Device *dev;
- int x,y;
- int direction; /* 0 = vertical, 1 = horizontal */
- int wheel; /* value 1 (left/up), -1 (right/down) */
+ Ecore_Fb_Input_Device *dev;
+ int x,y;
+ int direction; /* 0 = vertical, 1 = horizontal */
+ int wheel; /* value 1 (left/up), -1 (right/down) */
};
+
/* ecore_fb_vt.c */
EAPI void ecore_fb_callback_gain_set(void (*func) (void *data), void *data);
EAPI void ecore_fb_callback_lose_set(void (*func) (void *data), void *data);
@@ -134,27 +134,10 @@
EAPI int ecore_fb_init(const char *name);
EAPI int ecore_fb_shutdown(void);
EAPI void ecore_fb_size_get(int *w, int *h);
-
-/* DEPRECATED */
-#if 0
+
EAPI void ecore_fb_touch_screen_calibrate_set(int xscale, int xtrans, int
yscale, int ytrans, int xyswap);
EAPI void ecore_fb_touch_screen_calibrate_get(int *xscale, int *xtrans, int
*yscale, int *ytrans, int *xyswap);
-
-EAPI void ecore_fb_backlight_set(int on);
-EAPI int ecore_fb_backlight_get(void);
-
-EAPI void ecore_fb_backlight_brightness_set(double br);
-EAPI double ecore_fb_backlight_brightness_get(void);
-
-EAPI void ecore_fb_led_set(int on);
-EAPI void ecore_fb_led_blink_set(double speed);
-
-EAPI void ecore_fb_contrast_set(double cr);
-EAPI double ecore_fb_contrast_get(void);
-
-EAPI double ecore_fb_light_sensor_get(void);
-#endif
-
+
#ifdef __cplusplus
}
#endif
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_fb/Makefile.am,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- Makefile.am 4 Nov 2007 09:29:18 -0000 1.11
+++ Makefile.am 24 Jan 2008 02:23:14 -0000 1.12
@@ -14,9 +14,9 @@
ecore_fb.c \
ecore_fb_vt.c \
ecore_fb_li.c \
+ecore_fb_ts.c \
ecore_fb_private.h
# deprecated sources (might not compile):
-# ecore_fb_ts.c
# ecore_fb_kbd.c
# ecore_fb_ps2.c
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_fb/ecore_fb_private.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ecore_fb_private.h 17 Aug 2006 19:38:30 -0000 1.5
+++ ecore_fb_private.h 24 Jan 2008 02:23:14 -0000 1.6
@@ -63,11 +63,14 @@
} keyboard;
};
+/* ecore_fb_ts.c */
+EAPI int ecore_fb_ts_init(void);
+EAPI void ecore_fb_ts_shutdown(void);
+
/* ecore_fb_vt.c */
int ecore_fb_vt_init(void);
void ecore_fb_vt_shutdown(void);
-#if 0
/* hacks to stop people NEEDING #include <linux/h3600_ts.h> */
#ifndef TS_SET_CAL
#define TS_SET_CAL 0x4014660b
@@ -75,24 +78,5 @@
#ifndef TS_GET_CAL
#define TS_GET_CAL 0x8014660a
#endif
-#ifndef TS_SET_BACKLIGHT
-#define TS_SET_BACKLIGHT 0x40086614
-#endif
-#ifndef TS_GET_BACKLIGHT
-#define TS_GET_BACKLIGHT 0x80086614
-#endif
-#ifndef LED_ON
-#define LED_ON 0x40046605
-#endif
-#ifndef TS_SET_CONTRAST
-#define TS_SET_CONTRAST 0x40046615
-#endif
-#ifndef TS_GET_CONTRAST
-#define TS_GET_CONTRAST 0x80046615
-#endif
-#ifndef FLITE_ON
-#define FLITE_ON 0x40046607
-#endif
-#endif
-
+
#endif
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_fb/ecore_fb_ts.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_fb_ts.c 31 Jul 2006 04:13:51 -0000 1.1
+++ ecore_fb_ts.c 24 Jan 2008 02:23:14 -0000 1.2
@@ -1,3 +1,6 @@
+#include "Ecore_Fb.h"
+#include "ecore_fb_private.h"
+#include "config.h"
#ifdef HAVE_TSLIB
#include <tslib.h>
#include <errno.h>
@@ -15,7 +18,6 @@
static int _ecore_fb_ts_event_byte_count = 0;
static int _ecore_fb_ts_apply_cal = 0;
static Ecore_Fb_Ts_Event _ecore_fb_ts_event;
-static Ecore_Fb_Ts_Calibrate _ecore_fb_ts_cal = {1,1,0,0,0};
static Ecore_Fd_Handler *_ecore_fb_ts_fd_handler_handle = NULL;
#ifdef HAVE_TSLIB
@@ -23,7 +25,7 @@
struct ts_sample _ecore_fb_tslib_event;
#endif
-
+static double _ecore_fb_double_click_time = 0.25;
struct _Ecore_Fb_Ts_Event
{
@@ -68,10 +70,10 @@
unsigned char brightness;
};
-
-int
+EAPI int
ecore_fb_ts_init(void)
{
+ int prev_flags;
#ifdef HAVE_TSLIB
char *tslib_tsdevice = NULL;
if ( ( tslib_tsdevice = getenv("TSLIB_TSDEVICE") ) != NULL )
@@ -119,7 +121,7 @@
return 0;
}
-void
+EAPI void
ecore_fb_ts_shutdown(void)
{
if (_ecore_fb_ts_fd >= 0) close(_ecore_fb_ts_fd);
@@ -134,8 +136,8 @@
*
* Functions that calibrate the screen.
*/
-
-
+
+
/**
* Calibrates the touschreen using the given parameters.
* @param xscale X scaling, where 256 = 1.0
@@ -160,6 +162,7 @@
{
_ecore_fb_ts_cal = cal;
_ecore_fb_ts_apply_cal = 1;
+
}
}
@@ -183,6 +186,7 @@
{
if (ioctl(_ecore_fb_ts_fd, TS_GET_CAL, (void *)&cal))
_ecore_fb_ts_cal = cal;
+
}
else
cal = _ecore_fb_ts_cal;
@@ -193,179 +197,6 @@
if (xyswap) *xyswap = cal.xyswap;
}
-/**
- * @defgroup Ecore_FB_Backlight_Group Framebuffer Backlight Functions
- *
- * Functions that deal with the backlight of a framebuffer's screen.
- */
-
-/**
- * Turns on or off the backlight.
- * @param on @c 1 to turn the backlight on. @c 0 to turn it off.
- * @ingroup Ecore_FB_Backlight_Group
- */
-EAPI void
-ecore_fb_backlight_set(int on)
-{
- Ecore_Fb_Ts_Backlight bl;
-
- if (_ecore_fb_ts_fd < 0) return;
- ioctl(_ecore_fb_ts_fd, TS_GET_BACKLIGHT, &bl);
- bl.on = on;
- ioctl(_ecore_fb_ts_fd, TS_SET_BACKLIGHT, &bl);
-}
-
-/**
- * Retrieves the backlight state.
- * @return Whether the backlight is on.
- * @ingroup Ecore_FB_Backlight_Group
- */
-EAPI int
-ecore_fb_backlight_get(void)
-{
- Ecore_Fb_Ts_Backlight bl;
-
- if (_ecore_fb_ts_fd < 0) return 1;
- ioctl(_ecore_fb_ts_fd, TS_GET_BACKLIGHT, &bl);
- return bl.on;
-}
-
-/**
- * Sets the backlight brightness.
- * @param br Brightness between 0.0 to 1.0, where 0.0 is darkest and 1.0
- * is brightest.
- * @ingroup Ecore_FB_Backlight_Group
- */
-EAPI void
-ecore_fb_backlight_brightness_set(double br)
-{
- Ecore_Fb_Ts_Backlight bl;
- int val;
-
- if (br < 0) br = 0;
- if (br > 1) br = 1;
- val = (int)(255.0 * br);
- ioctl(_ecore_fb_ts_fd, TS_GET_BACKLIGHT, &bl);
- bl.brightness = val;
- ioctl(_ecore_fb_ts_fd, TS_SET_BACKLIGHT, &bl);
-}
-
-/**
- * Retrieves the backlight brightness.
- * @return The current backlight brigntess, where 0.0 is the darkest and
- * 1.0 is the brightest.
- * @ingroup Ecore_FB_Backlight_Group
- */
-EAPI double
-ecore_fb_backlight_brightness_get(void)
-{
- Ecore_Fb_Ts_Backlight bl;
-
- if (_ecore_fb_ts_fd < 0) return 1.0;
- ioctl(_ecore_fb_ts_fd, TS_GET_BACKLIGHT, &bl);
- return (double)bl.brightness / 255.0;
-}
-
-/**
- * @defgroup Ecore_FB_LED_Group Framebuffer LED Functions
- *
- * Functions that deal with the light emitting diode connected to the
- * current framebuffer.
- */
-
-/**
- * Sets whether the current framebuffer's LED to the given state.
- * @param on @c 1 to indicate the LED should be on, @c 0 if it should be off.
- * @ingroup Ecore_FB_LED_Group
- */
-EAPI void
-ecore_fb_led_set(int on)
-{
- Ecore_Fb_Ts_Led led;
-
- if (_ecore_fb_ts_fd < 0) return;
- if (on) led.on = 1;
- else led.on = 0;
- ioctl(_ecore_fb_ts_fd, LED_ON, &led);
-}
-
-/**
- * Makes the LED of the current framebuffer blink.
- * @param speed Number to give the speed on the blink.
- * @ingroup Ecore_FB_LED_Group
- * @todo Documentation: Work out what speed the units are in.
- */
-EAPI void
-ecore_fb_led_blink_set(double speed)
-{
- Ecore_Fb_Ts_Led led;
-
- if (_ecore_fb_ts_fd < 0) return;
- led.on = 1;
- led.on_time = (unsigned char)(speed * 10);
- led.off_time = (unsigned char)(speed * 10);
- led.blink_time = 255;
- ioctl(_ecore_fb_ts_fd, LED_ON, &led);
-}
-
-/**
- * @defgroup Ecore_FB_Contrast_Group Framebuffer Contrast Functions
- *
- * Values that set and retrieve the contrast of a framebuffer screen.
- */
-
-/**
- * Sets the contrast used by the framebuffer screen.
- * @param cr Value between 0 and 1 that gives the new contrast of the screen.
- * @ingroup Ecore_FB_Contrast_Group
- */
-EAPI void
-ecore_fb_contrast_set(double cr)
-{
- Ecore_Fb_Ts_Contrast ct;
- int val;
-
- if (cr < 0) cr = 0;
- if (cr > 1) cr = 1;
- val = (int)(255.0 * cr);
- ct.contrast = val;
- ioctl(_ecore_fb_ts_fd, TS_SET_CONTRAST, &ct);
-}
-
-/**
- * Retrieves the contrast currently being used by the framebuffer screen.
- * @return A value between 0 and 1 that represents the current contrast of the
- * screen.
- * @ingroup Ecore_FB_Contrast_Group
- */
-EAPI double
-ecore_fb_contrast_get(void)
-{
- Ecore_Fb_Ts_Contrast ct;
-
- if (_ecore_fb_ts_fd < 0) return 1.0;
- ioctl(_ecore_fb_ts_fd, TS_GET_CONTRAST, &ct);
- return (double)ct.contrast / 255.0;
-}
-
-/**
- * To be documented.
- *
- * FIXME: To be fixed.
- */
-EAPI double
-ecore_fb_light_sensor_get(void)
-{
- Ecore_Fb_Ts_Flite fl;
-
- if (_ecore_fb_ts_fd < 0) return 0.0;
- fl.mode = 3;
- fl.brightness = 0;
- ioctl(_ecore_fb_ts_fd, FLITE_ON, &fl);
- return (double)fl.brightness / 255.0;
-}
-
-
static int
_ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler
__UNUSED__)
{
@@ -383,18 +214,16 @@
int did_triple = 0;
#ifdef HAVE_TSLIB
- if ( _ecore_fb_ts_apply_cal )
- num = ts_read_raw( _ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1 );
- else
- num = ts_read( _ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1 );
- if ( num != 1 )
- {
- return 1; /* no more samples at this time */
- }
- x = _ecore_fb_tslib_event.x;
- y = _ecore_fb_tslib_event.y;
- pressure = _ecore_fb_tslib_event.pressure;
- v = 1; /* loop, there might be more samples */
+ if (_ecore_fb_ts_apply_cal)
+ num = ts_read_raw(_ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1);
+ else
+ num = ts_read(_ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1);
+ if (num != 1) return 1; /* no more samples at this time */
+ x = _ecore_fb_tslib_event.x;
+ y = _ecore_fb_tslib_event.y;
+ pressure = _ecore_fb_tslib_event.pressure;
+ v = 1; /* loop, there might be more samples */
+ t = ecore_time_get();
#else
ptr = (char *)&(_ecore_fb_ts_event);
ptr += _ecore_fb_ts_event_byte_count;
@@ -403,9 +232,8 @@
if (v < 0) return 1;
_ecore_fb_ts_event_byte_count += v;
if (v < num) return 1;
- t = ecore_time_get();
_ecore_fb_ts_event_byte_count = 0;
- if (_ecore_fb_ts_apply_cal)
+ if (_ecore_fb_ts_apply_cal)
{
x = ((_ecore_fb_ts_cal.xscale * _ecore_fb_ts_event.x) >> 8) +
_ecore_fb_ts_cal.xtrans;
y = ((_ecore_fb_ts_cal.yscale * _ecore_fb_ts_event.y) >> 8) +
_ecore_fb_ts_cal.ytrans;
@@ -440,7 +268,7 @@
e->x = x;
e->y = y;
e->button = 1;
- if ((t - last_time) <= _ecore_fb_double_click_time)
+ if ((t - last_time) <= _ecore_fb_double_click_time)
e->double_click = 1;
if ((t - last_last_time) <= (2 * _ecore_fb_double_click_time))
{
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs