Another discussion, this time about events. During my test of SDL engine, I
did like the key repeat functionnality of SDL, but it wasn't possible to
easily expose it to evas. So I just added a EVAS_CALLBACK_KEY_REPEAT with the
corresponding 'evas_event_feed_key_repeat'. It seems quite logic and work.
See evas_key_repeat.diff.
I don't know what is the policy for adding new events, but SDL could
also
expose some Joystick events:
SDL_JoyAxisEvent -- Joystick axis motion event structure
SDL_JoyButtonEvent -- Joystick button event structure
SDL_JoyHatEvent -- Joystick hat position change event structure
SDL_JoyBallEvent -- Joystick trackball motion event structure
Would people object if I come up with some evas event for this also ? This
would be nice, if an Ecore SDL was able to directly feed them to evas. But I
will understand that it's not the primary usage/goal of evas.
On the same subject, it would also be nice if we could handle multiple
device
easily in evas. From what I see, the only thing that is needed is a 'char*
device' in all struct _Evas_Event and breaking all evas_event_feed functions
prototype by adding a device parameter. The device could be set to NULL, so
all existing code will still work with very few modification (mainly in
ecore).
Would people be interested/object to this kind of patch ?
Cedric
diff -Nrau -x '*.lo' -x '*.la' -x doc -x Makefile -x Makefile.in -x CVS -x autom4te.cache -x '*.o' -x 'config.*' -x configure -x .deps -x .libs e17-main/libs/evas/src/lib/canvas/evas_events.c e17-dev/libs/evas/src/lib/canvas/evas_events.c
--- e17-main/libs/evas/src/lib/canvas/evas_events.c 2006-12-26 11:57:37.000000000 +0100
+++ e17-dev/libs/evas/src/lib/canvas/evas_events.c 2007-03-13 11:42:53.000000000 +0100
@@ -518,6 +518,7 @@
else
outs = evas_list_append(outs, obj);
}
+
if (copy) copy = evas_list_free(copy);
while (outs)
{
@@ -857,6 +858,90 @@
*
*/
EAPI void
+evas_event_feed_key_repeat(Evas *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data)
+{
+ MAGIC_CHECK(e, Evas, MAGIC_EVAS);
+ return;
+ MAGIC_CHECK_END();
+ if (!keyname) return;
+ if (e->events_frozen > 0) return;
+ e->last_timestamp = timestamp;
+ {
+ Evas_Event_Key_Repeat ev;
+ int exclusive;
+
+ exclusive = 0;
+ ev.keyname = (char *)keyname;
+ ev.data = (void *)data;
+ ev.modifiers = &(e->modifiers);
+ ev.locks = &(e->locks);
+ ev.key = key;
+ ev.string = string;
+ ev.compose = compose;
+ ev.timestamp = timestamp;
+ if (e->grabs)
+ {
+ Evas_List *l;
+
+ e->walking_grabs++;
+ for (l = e->grabs; l; l= l->next)
+ {
+ Evas_Key_Grab *g;
+
+ g = l->data;
+ if (g->just_added)
+ {
+ g->just_added = 0;
+ continue;
+ }
+ if (g->delete_me) continue;
+ if (((e->modifiers.mask & g->modifiers) ||
+ (g->modifiers == e->modifiers.mask)) &&
+ (!strcmp(keyname, g->keyname)))
+ {
+ if (!(e->modifiers.mask & g->not_modifiers))
+ {
+ if (e->events_frozen <= 0)
+ evas_object_event_callback_call(g->object, EVAS_CALLBACK_KEY_REPEAT, &ev);
+ if (g->exclusive) exclusive = 1;
+ }
+ }
+ }
+ e->walking_grabs--;
+ if (e->walking_grabs <= 0)
+ {
+ while (e->delete_grabs > 0)
+ {
+ Evas_List *l;
+
+ e->delete_grabs--;
+ for (l = e->grabs; l;)
+ {
+ Evas_Key_Grab *g;
+
+ g = l->data;
+ l = l->next;
+ if (g->delete_me)
+ evas_key_grab_free(g->object, g->keyname, g->modifiers, g->not_modifiers);
+ }
+ }
+ }
+ }
+ if ((e->focused) && (!exclusive))
+ {
+ if (e->events_frozen <= 0)
+ evas_object_event_callback_call(e->focused, EVAS_CALLBACK_KEY_REPEAT, &ev);
+ }
+ }
+}
+
+/**
+ * To be documented.
+ *
+ * FIXME: To be fixed.
+ *
+ */
+EAPI void
evas_event_feed_key_up(Evas *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data)
{
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
diff -Nrau -x '*.lo' -x '*.la' -x doc -x Makefile -x Makefile.in -x CVS -x autom4te.cache -x '*.o' -x 'config.*' -x configure -x .deps -x .libs
e17-main/libs/evas/src/lib/Evas.h e17-dev/libs/evas/src/lib/Evas.h
--- e17-main/libs/evas/src/lib/Evas.h 2007-03-19 23:49:59.000000000 +0100
+++ e17-dev/libs/evas/src/lib/Evas.h 2007-03-19 19:00:39.000000000 +0100
@@ -37,6 +37,7 @@
EVAS_CALLBACK_MOUSE_WHEEL, /**< Mouse Wheel Event */
EVAS_CALLBACK_FREE, /**< Object Being Freed */
EVAS_CALLBACK_KEY_DOWN, /**< Key Press Event */
+ EVAS_CALLBACK_KEY_REPEAT, /**< Key Repeat Event */
EVAS_CALLBACK_KEY_UP, /**< Key Release Event */
EVAS_CALLBACK_FOCUS_IN, /**< Focus In Event */
EVAS_CALLBACK_FOCUS_OUT, /**< Focus Out Event */
@@ -133,6 +134,7 @@
typedef struct _Evas_Event_Mouse_Move Evas_Event_Mouse_Move; /**< Event structure for #EVAS_CALLBACK_MOUSE_MOVE event callbacks */
typedef struct _Evas_Event_Mouse_Wheel Evas_Event_Mouse_Wheel; /**< Event structure for #EVAS_CALLBACK_MOUSE_WHEEL event callbacks */
typedef struct _Evas_Event_Key_Down Evas_Event_Key_Down; /**< Event structure for #EVAS_CALLBACK_KEY_DOWN event callbacks */
+typedef struct _Evas_Event_Key_Repeat Evas_Event_Key_Repeat; /**< Event structure for #EVAS_CALLBACK_KEY_REPEAT event callbacks */
typedef struct _Evas_Event_Key_Up Evas_Event_Key_Up; /**< Event structure for #EVAS_CALLBACK_KEY_UP event callbacks */
#define EVAS_LOAD_ERROR_NONE 0 /**< No error on load */
@@ -316,6 +318,19 @@
unsigned int timestamp;
};
+struct _Evas_Event_Key_Repeat /** Key repeat event */
+{
+ char *keyname; /**< The string name of the repeated key */
+ void *data;
+ Evas_Modifier *modifiers;
+ Evas_Lock *locks;
+
+ const char *key; /**< The logical key : (eg shift+1 == exclamation) */
+ const char *string; /**< A UTF8 string if this keystroke has produced a visible string to be ADDED */
+ const char *compose; /**< A UTF8 string if this keystroke has modified a string in the middle of being composed - this string replaces the previous one */
+ unsigned int timestamp;
+};
+
struct _Evas_Event_Key_Up /** Key release event */
{
char *keyname; /**< The string name of the key released */
@@ -729,6 +753,7 @@
EAPI void evas_event_feed_mouse_out (Evas *e, unsigned int timestamp, const void *data);
EAPI void evas_event_feed_mouse_wheel (Evas *e, int direction, int z, unsigned int timestamp, const void *data);
EAPI void evas_event_feed_key_down (Evas *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data);
+ EAPI void evas_event_feed_key_repeat (Evas *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data);
EAPI void evas_event_feed_key_up (Evas *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data);
EAPI void evas_object_focus_set (Evas_Object *obj, Evas_Bool focus);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel