Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_x
Modified Files:
Tag: SPLIT
Ecore_X.h ecore_x.c ecore_x_events.c ecore_x_private.h
Log Message:
give me events!
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Attic/Ecore_X.h,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -3 -r1.1.2.5 -r1.1.2.6
--- Ecore_X.h 23 Jan 2003 01:18:16 -0000 1.1.2.5
+++ Ecore_X.h 23 Jan 2003 11:12:18 -0000 1.1.2.6
@@ -23,6 +23,7 @@
typedef struct _Ecore_X_Event_Mouse_Button_Up Ecore_X_Event_Mouse_Button_Up;
typedef struct _Ecore_X_Event_Mouse_Move Ecore_X_Event_Mouse_Move;
typedef struct _Ecore_X_Event_Mouse_In Ecore_X_Event_Mouse_In;
+typedef struct _Ecore_X_Event_Mouse_Out Ecore_X_Event_Mouse_Out;
typedef struct _Ecore_X_Event_Window_Focus_In Ecore_X_Event_Window_Focus_In;
typedef struct _Ecore_X_Event_Window_Focus_Out Ecore_X_Event_Window_Focus_Out;
typedef struct _Ecore_X_Event_Window_Damage Ecore_X_Event_Window_Damage;
@@ -67,30 +68,71 @@
struct _Ecore_X_Event_Mouse_Button_Down
{
- Window win;
int button;
+ int modifiers;
+ int x, y;
+ Window win;
+ Window subwin;
+ Time time;
+ int double_click : 1;
+ int triple_click : 1;
};
struct _Ecore_X_Event_Mouse_Button_Up
{
- Window win;
int button;
+ int modifiers;
+ int x, y;
+ Window win;
+ Window subwin;
+ Time time;
};
struct _Ecore_X_Event_Mouse_Move
{
- Window win;
+ int modifiers;
int x, y;
+ Window win;
+ Window subwin;
+ Time time;
};
struct _Ecore_X_Event_Mouse_In
{
+ int modifiers;
+ int x, y;
Window win;
+ Window subwin;
+ struct {
+ int grab : 1;
+ int ungrab : 1;
+ } mode;
+ struct {
+ int parent : 1;
+ int child : 1;
+ int virt : 1;
+ int non_linear : 1;
+ } notify;
+ Time time;
};
struct _Ecore_X_Event_Mouse_Out
{
+ int modifiers;
+ int x, y;
Window win;
+ Window subwin;
+ struct {
+ int grab : 1;
+ int ungrab : 1;
+ } mode;
+ struct {
+ int parent : 1;
+ int child : 1;
+ int virt : 1;
+ int non_linear : 1;
+ } notify;
+ Time time;
};
struct _Ecore_X_Event_Window_Focus_In
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Attic/ecore_x.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -3 -r1.1.2.4 -r1.1.2.5
--- ecore_x.c 23 Jan 2003 01:08:35 -0000 1.1.2.4
+++ ecore_x.c 23 Jan 2003 11:12:18 -0000 1.1.2.5
@@ -12,6 +12,7 @@
static void (**_ecore_x_event_handlers) (XEvent * event) = NULL;
Display *_ecore_x_disp = NULL;
+double _ecore_x_double_click_time = 0.25;
int ECORE_EVENT_X_KEY_DOWN = 0;
int ECORE_EVENT_X_KEY_UP = 0;
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Attic/ecore_x_events.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -3 -r1.1.2.2 -r1.1.2.3
--- ecore_x_events.c 23 Jan 2003 01:08:36 -0000 1.1.2.2
+++ ecore_x_events.c 23 Jan 2003 11:12:18 -0000 1.1.2.3
@@ -4,6 +4,11 @@
static void _ecore_x_event_handle_key_press_free(void *ev, void *data);
static void _ecore_x_event_handle_key_release_free(void *ev, void *data);
+static void _ecore_x_event_handle_button_press_free(void *ev, void *data);
+static void _ecore_x_event_handle_button_release_free(void *ev, void *data);
+static void _ecore_x_event_handle_motion_notify_free(void *ev, void *data);
+static void _ecore_x_event_handle_enter_notify_free(void *ev, void *data);
+static void _ecore_x_event_handle_leave_notify_free(void *ev, void *data);
static void
_ecore_x_event_handle_key_press_free(void *ev, void *data)
@@ -99,29 +104,280 @@
_ecore_x_event_handle_key_release_free, NULL);
}
+static void
+_ecore_x_event_handle_button_press_free(void *ev, void *data)
+{
+ Ecore_X_Event_Mouse_Button_Down *e;
+
+ e = ev;
+ free(e);
+}
+
void
_ecore_x_event_handle_button_press(XEvent *xevent)
{
+ static Time last_time = 0;
+ static Time last_last_time = 0;
+ int did_triple = 0;
+
+ if (xevent->xbutton.button >= 4)
+ {
+ /* FIXME: wheel events */
+ }
+ else
+ {
+ {
+ Ecore_X_Event_Mouse_Move *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move));
+ if (!e) return;
+ e->modifiers = xevent->xbutton.state;
+ e->x = xevent->xbutton.x;
+ e->y = xevent->xbutton.y;
+ e->win = xevent->xbutton.window;
+ e->subwin = xevent->xbutton.subwindow;
+ e->time = xevent->xbutton.time;
+ ecore_event_add(ECORE_EVENT_X_MOUSE_MOVE, e,
+ _ecore_x_event_handle_motion_notify_free, NULL);
+ }
+ {
+ Ecore_X_Event_Mouse_Button_Down *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Mouse_Button_Down));
+ if (!e) return;
+ e->button = xevent->xbutton.button;
+ e->modifiers = xevent->xbutton.state;
+ e->x = xevent->xbutton.x;
+ e->y = xevent->xbutton.y;
+ e->win = xevent->xbutton.window;
+ e->subwin = xevent->xbutton.subwindow;
+ e->time = xevent->xbutton.time;
+ if ((e->time - last_time) <=
+ (int)(1000 * _ecore_x_double_click_time))
+ e->double_click = 1;
+ if ((e->time - last_last_time) <=
+ (int)(2 * 1000 * _ecore_x_double_click_time))
+ {
+ did_triple = 1;
+ e->triple_click = 1;
+ }
+ ecore_event_add(ECORE_EVENT_X_MOUSE_BUTTON_DOWN, e,
+ _ecore_x_event_handle_button_press_free, NULL);
+ }
+ if (did_triple)
+ {
+ last_time = 0;
+ last_last_time = 0;
+ }
+ else
+ {
+ last_last_time = last_time;
+ last_time = xevent->xbutton.time;
+ }
+ }
+}
+
+static void
+_ecore_x_event_handle_button_release_free(void *ev, void *data)
+{
+ Ecore_X_Event_Mouse_Button_Up *e;
+
+ e = ev;
+ free(e);
}
void
_ecore_x_event_handle_button_release(XEvent *xevent)
{
+ /* filter out wheel buttons */
+ if (xevent->xbutton.button <= 3)
+ {
+ {
+ Ecore_X_Event_Mouse_Move *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move));
+ if (!e) return;
+ e->modifiers = xevent->xbutton.state;
+ e->x = xevent->xbutton.x;
+ e->y = xevent->xbutton.y;
+ e->win = xevent->xbutton.window;
+ e->subwin = xevent->xbutton.subwindow;
+ e->time = xevent->xbutton.time;
+ ecore_event_add(ECORE_EVENT_X_MOUSE_MOVE, e,
+ _ecore_x_event_handle_motion_notify_free, NULL);
+ }
+ {
+ Ecore_X_Event_Mouse_Button_Up *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Mouse_Button_Up));
+ if (!e) return;
+ e->button = xevent->xbutton.button;
+ e->modifiers = xevent->xbutton.state;
+ e->x = xevent->xbutton.x;
+ e->y = xevent->xbutton.y;
+ e->win = xevent->xbutton.window;
+ e->subwin = xevent->xbutton.subwindow;
+ e->time = xevent->xbutton.time;
+ ecore_event_add(ECORE_EVENT_X_MOUSE_BUTTON_UP, e,
+ _ecore_x_event_handle_button_release_free, NULL);
+ }
+ }
+}
+
+static void
+_ecore_x_event_handle_motion_notify_free(void *ev, void *data)
+{
+ Ecore_X_Event_Mouse_Move *e;
+
+ e = ev;
+ free(e);
}
void
_ecore_x_event_handle_motion_notify(XEvent *xevent)
{
+ Ecore_X_Event_Mouse_Move *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move));
+ if (!e) return;
+ e->modifiers = xevent->xmotion.state;
+ e->x = xevent->xmotion.x;
+ e->y = xevent->xmotion.y;
+ e->win = xevent->xmotion.window;
+ e->subwin = xevent->xmotion.subwindow;
+ e->time = xevent->xmotion.time;
+ ecore_event_add(ECORE_EVENT_X_MOUSE_MOVE, e,
+ _ecore_x_event_handle_motion_notify_free, NULL);
+}
+
+static void
+_ecore_x_event_handle_enter_notify_free(void *ev, void *data)
+{
+ Ecore_X_Event_Mouse_In *e;
+
+ e = ev;
+ free(e);
}
void
_ecore_x_event_handle_enter_notify(XEvent *xevent)
{
+ {
+ Ecore_X_Event_Mouse_Move *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move));
+ if (!e) return;
+ e->modifiers = xevent->xcrossing.state;
+ e->x = xevent->xcrossing.x;
+ e->y = xevent->xcrossing.y;
+ e->win = xevent->xcrossing.window;
+ e->subwin = xevent->xcrossing.subwindow;
+ e->time = xevent->xcrossing.time;
+ ecore_event_add(ECORE_EVENT_X_MOUSE_MOVE, e,
+ _ecore_x_event_handle_motion_notify_free, NULL);
+ }
+ {
+ Ecore_X_Event_Mouse_In *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Mouse_In));
+ if (!e) return;
+ e->modifiers = xevent->xcrossing.state;
+ e->x = xevent->xcrossing.x;
+ e->y = xevent->xcrossing.y;
+ e->win = xevent->xcrossing.window;
+ e->subwin = xevent->xcrossing.subwindow;
+ if (xevent->xcrossing.mode == NotifyGrab) e->mode.grab = 1;
+ else if (xevent->xcrossing.mode == NotifyUngrab) e->mode.ungrab = 1;
+ if (xevent->xcrossing.detail == NotifyAncestor)
+ {
+ e->notify.parent = 1;
+ }
+ else if (xevent->xcrossing.detail == NotifyVirtual)
+ {
+ e->notify.virt = 1;
+ }
+ else if (xevent->xcrossing.detail == NotifyInferior)
+ {
+ e->notify.child = 1;
+ }
+ else if (xevent->xcrossing.detail == NotifyNonlinear)
+ {
+ e->notify.non_linear = 1;
+ }
+ else if (xevent->xcrossing.detail == NotifyNonlinearVirtual)
+ {
+ e->notify.virt = 1;
+ e->notify.non_linear = 1;
+ }
+ e->time = xevent->xcrossing.time;
+ ecore_event_add(ECORE_EVENT_X_MOUSE_IN, e,
+ _ecore_x_event_handle_enter_notify_free, NULL);
+ }
+}
+
+static void
+_ecore_x_event_handle_leave_notify_free(void *ev, void *data)
+{
+ Ecore_X_Event_Mouse_Out *e;
+
+ e = ev;
+ free(e);
}
void
_ecore_x_event_handle_leave_notify(XEvent *xevent)
{
+ {
+ Ecore_X_Event_Mouse_Move *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Mouse_Move));
+ if (!e) return;
+ e->modifiers = xevent->xcrossing.state;
+ e->x = xevent->xcrossing.x;
+ e->y = xevent->xcrossing.y;
+ e->win = xevent->xcrossing.window;
+ e->subwin = xevent->xcrossing.subwindow;
+ e->time = xevent->xcrossing.time;
+ ecore_event_add(ECORE_EVENT_X_MOUSE_MOVE, e,
+ _ecore_x_event_handle_motion_notify_free, NULL);
+ }
+ {
+ Ecore_X_Event_Mouse_Out *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out));
+ if (!e) return;
+ e->modifiers = xevent->xcrossing.state;
+ e->x = xevent->xcrossing.x;
+ e->y = xevent->xcrossing.y;
+ e->win = xevent->xcrossing.window;
+ e->subwin = xevent->xcrossing.subwindow;
+ if (xevent->xcrossing.mode == NotifyGrab) e->mode.grab = 1;
+ else if (xevent->xcrossing.mode == NotifyUngrab) e->mode.ungrab = 1;
+ if (xevent->xcrossing.detail == NotifyAncestor)
+ {
+ e->notify.parent = 1;
+ }
+ else if (xevent->xcrossing.detail == NotifyVirtual)
+ {
+ e->notify.virt = 1;
+ }
+ else if (xevent->xcrossing.detail == NotifyInferior)
+ {
+ e->notify.child = 1;
+ }
+ else if (xevent->xcrossing.detail == NotifyNonlinear)
+ {
+ e->notify.non_linear = 1;
+ }
+ else if (xevent->xcrossing.detail == NotifyNonlinearVirtual)
+ {
+ e->notify.virt = 1;
+ e->notify.non_linear = 1;
+ }
+ e->time = xevent->xcrossing.time;
+ ecore_event_add(ECORE_EVENT_X_MOUSE_OUT, e,
+ _ecore_x_event_handle_leave_notify_free, NULL);
+ }
}
void
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Attic/ecore_x_private.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -3 -r1.1.2.2 -r1.1.2.3
--- ecore_x_private.h 21 Jan 2003 01:22:45 -0000 1.1.2.2
+++ ecore_x_private.h 23 Jan 2003 11:12:18 -0000 1.1.2.3
@@ -11,6 +11,7 @@
#include <X11/extensions/shape.h>
extern Display *_ecore_x_disp;
+extern double _ecore_x_double_click_time;
void _ecore_x_error_handler_init(void);
void _ecore_x_event_handle_key_press(XEvent *xevent);
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs