Enlightenment CVS committal
Author : doursse
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_wince
Modified Files:
Ecore_WinCE.h ecore_wince.c ecore_wince_event.c
ecore_wince_private.h ecore_wince_window.c
Log Message:
add stylus support
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_wince/Ecore_WinCE.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Ecore_WinCE.h 31 May 2008 05:05:01 -0000 1.1
+++ Ecore_WinCE.h 3 Jun 2008 17:09:44 -0000 1.2
@@ -44,6 +44,11 @@
typedef struct _Ecore_WinCE_Event_Key_Down
Ecore_WinCE_Event_Key_Down;
typedef struct _Ecore_WinCE_Event_Key_Up
Ecore_WinCE_Event_Key_Up;
+typedef struct _Ecore_WinCE_Event_Mouse_Button_Down
Ecore_WinCE_Event_Mouse_Button_Down;
+typedef struct _Ecore_WinCE_Event_Mouse_Button_Up
Ecore_WinCE_Event_Mouse_Button_Up;
+typedef struct _Ecore_WinCE_Event_Mouse_Move
Ecore_WinCE_Event_Mouse_Move;
+typedef struct _Ecore_WinCE_Event_Mouse_In
Ecore_WinCE_Event_Mouse_In;
+typedef struct _Ecore_WinCE_Event_Mouse_Out
Ecore_WinCE_Event_Mouse_Out;
typedef struct _Ecore_WinCE_Event_Window_Focus_In
Ecore_WinCE_Event_Window_Focus_In;
typedef struct _Ecore_WinCE_Event_Window_Focus_Out
Ecore_WinCE_Event_Window_Focus_Out;
typedef struct _Ecore_WinCE_Event_Window_Damage
Ecore_WinCE_Event_Window_Damage;
@@ -71,6 +76,52 @@
double time;
};
+struct _Ecore_WinCE_Event_Mouse_Button_Down
+{
+ Ecore_WinCE_Window *window;
+ int button;
+ int x;
+ int y;
+ double time;
+ unsigned int double_click : 1;
+ unsigned int triple_click : 1;
+};
+
+struct _Ecore_WinCE_Event_Mouse_Button_Up
+{
+ Ecore_WinCE_Window *window;
+ int button;
+ int x;
+ int y;
+ double time;
+ unsigned int double_click : 1;
+ unsigned int triple_click : 1;
+};
+
+struct _Ecore_WinCE_Event_Mouse_Move
+{
+ Ecore_WinCE_Window *window;
+ int x;
+ int y;
+ double time;
+};
+
+struct _Ecore_WinCE_Event_Mouse_In
+{
+ Ecore_WinCE_Window *window;
+ int x;
+ int y;
+ double time;
+};
+
+struct _Ecore_WinCE_Event_Mouse_Out
+{
+ Ecore_WinCE_Window *window;
+ int x;
+ int y;
+ double time;
+};
+
struct _Ecore_WinCE_Event_Window_Focus_In
{
Ecore_WinCE_Window *window;
@@ -126,6 +177,11 @@
EAPI extern int ECORE_WINCE_EVENT_KEY_DOWN;
EAPI extern int ECORE_WINCE_EVENT_KEY_UP;
+EAPI extern int ECORE_WINCE_EVENT_MOUSE_BUTTON_DOWN;
+EAPI extern int ECORE_WINCE_EVENT_MOUSE_BUTTON_UP;
+EAPI extern int ECORE_WINCE_EVENT_MOUSE_MOVE;
+EAPI extern int ECORE_WINCE_EVENT_MOUSE_IN;
+EAPI extern int ECORE_WINCE_EVENT_MOUSE_OUT;
EAPI extern int ECORE_WINCE_EVENT_WINDOW_FOCUS_IN;
EAPI extern int ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT;
EAPI extern int ECORE_WINCE_EVENT_WINDOW_DAMAGE;
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_wince/ecore_wince.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_wince.c 31 May 2008 05:05:01 -0000 1.1
+++ ecore_wince.c 3 Jun 2008 17:09:44 -0000 1.2
@@ -16,20 +16,26 @@
/***** Global declarations *****/
+double _ecore_wince_double_click_time = 0.25;
double _ecore_wince_event_last_time = 0.0;
+Ecore_WinCE_Window *_ecore_wince_event_last_window = NULL;
+HINSTANCE _ecore_wince_instance = NULL;
-HINSTANCE _ecore_wince_instance = NULL;
-
-EAPI int ECORE_WINCE_EVENT_KEY_DOWN = 0;
-EAPI int ECORE_WINCE_EVENT_KEY_UP = 0;
-EAPI int ECORE_WINCE_EVENT_WINDOW_FOCUS_IN = 0;
-EAPI int ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT = 0;
-EAPI int ECORE_WINCE_EVENT_WINDOW_DAMAGE = 0;
-EAPI int ECORE_WINCE_EVENT_WINDOW_CREATE = 0;
-EAPI int ECORE_WINCE_EVENT_WINDOW_DESTROY = 0;
-EAPI int ECORE_WINCE_EVENT_WINDOW_SHOW = 0;
-EAPI int ECORE_WINCE_EVENT_WINDOW_HIDE = 0;
-EAPI int ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = 0;
+int ECORE_WINCE_EVENT_KEY_DOWN = 0;
+int ECORE_WINCE_EVENT_KEY_UP = 0;
+int ECORE_WINCE_EVENT_MOUSE_BUTTON_DOWN = 0;
+int ECORE_WINCE_EVENT_MOUSE_BUTTON_UP = 0;
+int ECORE_WINCE_EVENT_MOUSE_MOVE = 0;
+int ECORE_WINCE_EVENT_MOUSE_IN = 0;
+int ECORE_WINCE_EVENT_MOUSE_OUT = 0;
+int ECORE_WINCE_EVENT_WINDOW_FOCUS_IN = 0;
+int ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT = 0;
+int ECORE_WINCE_EVENT_WINDOW_DAMAGE = 0;
+int ECORE_WINCE_EVENT_WINDOW_CREATE = 0;
+int ECORE_WINCE_EVENT_WINDOW_DESTROY = 0;
+int ECORE_WINCE_EVENT_WINDOW_SHOW = 0;
+int ECORE_WINCE_EVENT_WINDOW_HIDE = 0;
+int ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = 0;
/***** Private declarations *****/
@@ -82,6 +88,9 @@
{
ECORE_WINCE_EVENT_KEY_DOWN = ecore_event_type_new();
ECORE_WINCE_EVENT_KEY_UP = ecore_event_type_new();
+ ECORE_WINCE_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
+ ECORE_WINCE_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
+ ECORE_WINCE_EVENT_MOUSE_MOVE = ecore_event_type_new();
ECORE_WINCE_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new();
ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
ECORE_WINCE_EVENT_WINDOW_DAMAGE = ecore_event_type_new();
@@ -94,6 +103,8 @@
_ecore_wince_init_count++;
+ printf ("ecore_wince : instance + class bon\n");
+
return _ecore_wince_init_count;
}
@@ -113,6 +124,44 @@
return _ecore_wince_init_count;
}
+/**
+ * Sets the timeout for a double and triple clicks to be flagged.
+ *
+ * This sets the time between clicks before the double_click flag is
+ * set in a button down event. If 3 clicks occur within double this
+ * time, the triple_click flag is also set.
+ *
+ * @param t The time in seconds
+ */
+EAPI void
+ecore_wince_double_click_time_set(double t)
+{
+ if (t < 0.0) t = 0.0;
+ _ecore_wince_double_click_time = t;
+}
+
+/**
+ * Retrieves the double and triple click flag timeout.
+ *
+ * See @ref ecore_wince_double_click_time_set for more information.
+ *
+ * @return The timeout for double clicks in seconds.
+ */
+EAPI double
+ecore_wince_double_click_time_get(void)
+{
+ return _ecore_wince_double_click_time;
+}
+
+/**
+ * Return the last event time
+ */
+EAPI double
+ecore_wince_current_time_get(void)
+{
+ return _ecore_wince_event_last_time;
+}
+
/***** Private functions definitions *****/
@@ -162,6 +211,50 @@
printf (" * ecore message : focus out\n");
_ecore_wince_event_handle_focus_out(data);
return 0;
+ /* Mouse input notifications */
+ case WM_LBUTTONDOWN:
+ printf (" * ecore message : lbuttondown\n");
+ _ecore_wince_event_handle_button_press(data, 1);
+ return 0;
+ case WM_LBUTTONUP:
+ printf (" * ecore message : lbuttonup\n");
+ _ecore_wince_event_handle_button_release(data, 1);
+ return 0;
+ case WM_MOUSEMOVE:
+ {
+ RECT rect;
+ struct _Ecore_WinCE_Window *w = NULL;
+
+ w = (struct _Ecore_WinCE_Window *)GetWindowLong(window,
GWL_USERDATA);
+
+ if (GetClientRect(window, &rect))
+ {
+ POINT pt;
+
+ pt.x = LOWORD(data_param);
+ pt.y = HIWORD(data_param);
+ if (!PtInRect(&rect, pt))
+ {
+ if (w->pointer_is_in)
+ {
+ w->pointer_is_in = 0;
+ _ecore_wince_event_handle_leave_notify(data);
+ }
+ }
+ else
+ {
+ if (!w->pointer_is_in)
+ {
+ w->pointer_is_in = 1;
+ _ecore_wince_event_handle_enter_notify(data);
+ }
+
+ }
+ }
+ _ecore_wince_event_handle_motion_notify(data);
+
+ return 0;
+ }
/* Window notifications */
case WM_CREATE:
{
@@ -201,13 +294,22 @@
case WM_PAINT:
{
RECT rect;
+ PAINTSTRUCT paint;
- ValidateRect(window, NULL);
- if (GetUpdateRect(window, &rect, FALSE))
+ printf (" * ecore message : paint\n");
+ if (BeginPaint(window, &paint))
{
- data->update = rect;
+ printf (" * ecore message : painting...\n");
+ data->update = paint.rcPaint;
_ecore_wince_event_handle_expose(data);
+ EndPaint(window, &paint);
}
+/* if (GetUpdateRect(window, &rect, FALSE)) */
+/* { */
+/* printf (" * ecore message : painting...\n"); */
+/* data->update = rect; */
+/* _ecore_wince_event_handle_expose(data); */
+/* } */
return 0;
}
default:
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_wince/ecore_wince_event.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_wince_event.c 31 May 2008 05:05:01 -0000 1.1
+++ ecore_wince_event.c 3 Jun 2008 17:09:44 -0000 1.2
@@ -16,6 +16,14 @@
/***** Private declarations *****/
+static Ecore_WinCE_Window *_ecore_wince_mouse_down_last_window = NULL;
+static Ecore_WinCE_Window *_ecore_wince_mouse_down_last_last_window = NULL;
+static double _ecore_wince_mouse_down_last_time = 0;
+static double _ecore_wince_mouse_down_last_last_time = 0;
+static int _ecore_wince_mouse_down_did_triple = 0;
+static int _ecore_wince_mouse_up_count = 0;
+
+
static void _ecore_wince_event_free_key_down(void *data,
void *ev);
@@ -93,6 +101,241 @@
_ecore_wince_event_last_time = e->time;
ecore_event_add(ECORE_WINCE_EVENT_KEY_UP, e,
_ecore_wince_event_free_key_up, NULL);
+}
+
+void
+_ecore_wince_event_handle_button_press(Ecore_WinCE_Callback_Data *msg,
+ int button)
+{
+ Ecore_WinCE_Window *window;
+
+ window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
+
+ {
+ Ecore_WinCE_Event_Mouse_Move *e;
+
+ e = (Ecore_WinCE_Event_Mouse_Move *)calloc(1,
sizeof(Ecore_WinCE_Event_Mouse_Move));
+ if (!e) return;
+
+ e->window = window;
+ e->x = LOWORD(msg->data_param);
+ e->y = HIWORD(msg->data_param);
+ e->time = (double)msg->time / 1000.0;
+
+ _ecore_wince_event_last_time = e->time;
+ _ecore_wince_event_last_window = e->window;
+
+ ecore_event_add(ECORE_WINCE_EVENT_MOUSE_MOVE, e, NULL, NULL);
+ }
+
+ {
+ Ecore_WinCE_Event_Mouse_Button_Down *e;
+
+ if (_ecore_wince_mouse_down_did_triple)
+ {
+ _ecore_wince_mouse_down_last_window = NULL;
+ _ecore_wince_mouse_down_last_last_window = NULL;
+ _ecore_wince_mouse_down_last_time = 0.0;
+ _ecore_wince_mouse_down_last_last_time = 0.0;
+ }
+
+ e = (Ecore_WinCE_Event_Mouse_Button_Down *)calloc(1,
sizeof(Ecore_WinCE_Event_Mouse_Button_Down));
+ if (!e) return;
+
+ e->window = window;
+ e->button = button;
+ e->x = LOWORD(msg->data_param);
+ e->y = HIWORD(msg->data_param);
+ e->time = (double)msg->time / 1000.0;
+
+ if (((e->time - _ecore_wince_mouse_down_last_time) <=
_ecore_wince_double_click_time) &&
+ (e->window == _ecore_wince_mouse_down_last_window))
+ e->double_click = 1;
+
+ if (((e->time - _ecore_wince_mouse_down_last_last_time) <= (2.0 *
_ecore_wince_double_click_time)) &&
+ (e->window == _ecore_wince_mouse_down_last_window) &&
+ (e->window == _ecore_wince_mouse_down_last_last_window))
+ {
+ e->triple_click = 1;
+ _ecore_wince_mouse_down_did_triple = 1;
+ }
+ else
+ _ecore_wince_mouse_down_did_triple = 0;
+
+ if (!e->double_click && !e->triple_click)
+ _ecore_wince_mouse_up_count = 0;
+
+ _ecore_wince_event_last_time = e->time;
+ _ecore_wince_event_last_window = e->window;
+
+ if (!_ecore_wince_mouse_down_did_triple)
+ {
+ _ecore_wince_mouse_down_last_last_window =
_ecore_wince_mouse_down_last_window;
+ _ecore_wince_mouse_down_last_window = e->window;
+ _ecore_wince_mouse_down_last_last_time =
_ecore_wince_mouse_down_last_time;
+ _ecore_wince_mouse_down_last_time = e->time;
+ }
+
+ ecore_event_add(ECORE_WINCE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
+ }
+ printf (" * ecore event button press\n");
+}
+
+void
+_ecore_wince_event_handle_button_release(Ecore_WinCE_Callback_Data *msg,
+ int button)
+{
+ Ecore_WinCE_Window *window;
+
+ window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
+
+ {
+ Ecore_WinCE_Event_Mouse_Move *e;
+
+ e = (Ecore_WinCE_Event_Mouse_Move *)calloc(1,
sizeof(Ecore_WinCE_Event_Mouse_Move));
+ if (!e) return;
+
+ e->window = window;
+ e->x = LOWORD(msg->data_param);
+ e->y = HIWORD(msg->data_param);
+ e->time = (double)msg->time / 1000.0;
+
+ _ecore_wince_event_last_time = e->time;
+ _ecore_wince_event_last_window = e->window;
+
+ ecore_event_add(ECORE_WINCE_EVENT_MOUSE_MOVE, e, NULL, NULL);
+ }
+
+ {
+ Ecore_WinCE_Event_Mouse_Button_Up *e;
+
+ e = (Ecore_WinCE_Event_Mouse_Button_Up *)calloc(1,
sizeof(Ecore_WinCE_Event_Mouse_Button_Up));
+ if (!e) return;
+
+ e->window = window;
+ e->button = button;
+ e->x = LOWORD(msg->data_param);
+ e->y = HIWORD(msg->data_param);
+ e->time = (double)msg->time / 1000.0;
+
+ _ecore_wince_mouse_up_count++;
+
+ if ((_ecore_wince_mouse_up_count >= 2) &&
+ ((e->time - _ecore_wince_mouse_down_last_time) <=
_ecore_wince_double_click_time) &&
+ (e->window == _ecore_wince_mouse_down_last_window))
+ e->double_click = 1;
+
+ if ((_ecore_wince_mouse_up_count >= 3) &&
+ ((e->time - _ecore_wince_mouse_down_last_last_time) <= (2.0 *
_ecore_wince_double_click_time)) &&
+ (e->window == _ecore_wince_mouse_down_last_window) &&
+ (e->window == _ecore_wince_mouse_down_last_last_window))
+ e->triple_click = 1;
+
+ _ecore_wince_event_last_time = e->time;
+ _ecore_wince_event_last_window = e->window;
+
+ ecore_event_add(ECORE_WINCE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
+ }
+
+ printf (" * ecore event button release\n");
+}
+
+void
+_ecore_wince_event_handle_motion_notify(Ecore_WinCE_Callback_Data *msg)
+{
+ Ecore_WinCE_Event_Mouse_Move *e;
+
+ e = (Ecore_WinCE_Event_Mouse_Move *)calloc(1,
sizeof(Ecore_WinCE_Event_Mouse_Move));
+ if (!e) return;
+
+ e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
+ e->x = LOWORD(msg->data_param);
+ e->y = HIWORD(msg->data_param);
+ e->time = (double)msg->time / 1000.0;
+
+ ecore_event_add(ECORE_WINCE_EVENT_MOUSE_MOVE, e, NULL, NULL);
+}
+
+void
+_ecore_wince_event_handle_enter_notify(Ecore_WinCE_Callback_Data *msg)
+{
+ Ecore_WinCE_Window *window;
+
+ window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
+
+ {
+ Ecore_WinCE_Event_Mouse_Move *e;
+
+ e = (Ecore_WinCE_Event_Mouse_Move *)calloc(1,
sizeof(Ecore_WinCE_Event_Mouse_Move));
+ if (!e) return;
+
+ e->window = window;
+ e->x = msg->x;
+ e->y = msg->y;
+ e->time = (double)msg->time / 1000.0;
+
+ _ecore_wince_event_last_time = e->time;
+ _ecore_wince_event_last_window = e->window;
+
+ ecore_event_add(ECORE_WINCE_EVENT_MOUSE_MOVE, e, NULL, NULL);
+ }
+
+ {
+ Ecore_WinCE_Event_Mouse_In *e;
+
+ e = (Ecore_WinCE_Event_Mouse_In *)calloc(1,
sizeof(Ecore_WinCE_Event_Mouse_In));
+ if (!e) return;
+
+ e->window = window;
+ e->x = msg->x;
+ e->y = msg->y;
+ e->time = (double)msg->time / 1000.0;
+
+ _ecore_wince_event_last_time = e->time;
+
+ ecore_event_add(ECORE_WINCE_EVENT_MOUSE_IN, e, NULL, NULL);
+ }
+}
+
+void
+_ecore_wince_event_handle_leave_notify(Ecore_WinCE_Callback_Data *msg)
+{
+ Ecore_WinCE_Window *window;
+
+ window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
+
+ {
+ Ecore_WinCE_Event_Mouse_Move *e;
+
+ e = (Ecore_WinCE_Event_Mouse_Move *)calloc(1,
sizeof(Ecore_WinCE_Event_Mouse_Move));
+ if (!e) return;
+
+ e->window = window;
+ e->x = msg->x;
+ e->y = msg->y;
+ e->time = (double)msg->time / 1000.0;
+
+ _ecore_wince_event_last_time = e->time;
+ _ecore_wince_event_last_window = e->window;
+
+ ecore_event_add(ECORE_WINCE_EVENT_MOUSE_MOVE, e, NULL, NULL);
+ }
+
+ {
+ Ecore_WinCE_Event_Mouse_Out *e;
+
+ e = (Ecore_WinCE_Event_Mouse_Out *)calloc(1,
sizeof(Ecore_WinCE_Event_Mouse_Out));
+ if (!e) return;
+
+ e->window = window;
+ e->x = msg->x;
+ e->y = msg->y;
+ e->time = (double)msg->time / 1000.0;
+
+ _ecore_wince_event_last_time = e->time;
+
+ ecore_event_add(ECORE_WINCE_EVENT_MOUSE_OUT, e, NULL, NULL);
+ }
}
void
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_wince/ecore_wince_private.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ecore_wince_private.h 31 May 2008 05:05:01 -0000 1.1
+++ ecore_wince_private.h 3 Jun 2008 17:09:44 -0000 1.2
@@ -34,15 +34,24 @@
ecore_wince_suspend suspend;
ecore_wince_resume resume;
+
+ unsigned int pointer_is_in : 1;
};
+extern double _ecore_wince_double_click_time;
extern double _ecore_wince_event_last_time;
+extern Ecore_WinCE_Window *_ecore_wince_event_last_window;
-extern HINSTANCE _ecore_wince_instance;
+extern HINSTANCE _ecore_wince_instance;
void _ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg);
void _ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg);
+void _ecore_wince_event_handle_button_press(Ecore_WinCE_Callback_Data *msg,
int button);
+void _ecore_wince_event_handle_button_release(Ecore_WinCE_Callback_Data *msg,
int button);
+void _ecore_wince_event_handle_motion_notify(Ecore_WinCE_Callback_Data *msg);
+void _ecore_wince_event_handle_enter_notify(Ecore_WinCE_Callback_Data *msg);
+void _ecore_wince_event_handle_leave_notify(Ecore_WinCE_Callback_Data *msg);
void _ecore_wince_event_handle_focus_in(Ecore_WinCE_Callback_Data *msg);
void _ecore_wince_event_handle_focus_out(Ecore_WinCE_Callback_Data *msg);
void _ecore_wince_event_handle_expose(Ecore_WinCE_Callback_Data *msg);
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_wince/ecore_wince_window.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ecore_wince_window.c 3 Jun 2008 05:13:17 -0000 1.2
+++ ecore_wince_window.c 3 Jun 2008 17:09:44 -0000 1.3
@@ -99,6 +99,8 @@
return NULL;
}
+ w->pointer_is_in = 0;
+
return w;
}
-------------------------------------------------------------------------
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