[Pkg-e-commits] [SCM] Core abstraction layer for enlightenment DR 0.17 branch, upstream-vcs, updated. fbccf3b6cae3945e0db311041de91f346fccbae1
doursse
doursse at alioth.debian.org
Mon Jun 9 12:45:03 UTC 2008
The following commit has been merged in the upstream-vcs branch:
commit 30871094c65793fb175a9a5fd3ac0296e67fe212
Author: doursse <doursse>
Date: Tue Jun 3 17:09:44 2008 +0000
add stylus support
diff --git a/src/lib/ecore_wince/Ecore_WinCE.h b/src/lib/ecore_wince/Ecore_WinCE.h
index 87bdcae..e290810 100644
--- a/src/lib/ecore_wince/Ecore_WinCE.h
+++ b/src/lib/ecore_wince/Ecore_WinCE.h
@@ -44,6 +44,11 @@ typedef void Ecore_WinCE_Window;
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 @@ struct _Ecore_WinCE_Event_Key_Up
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 @@ struct _Ecore_WinCE_Event_Window_Delete_Request
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;
diff --git a/src/lib/ecore_wince/ecore_wince.c b/src/lib/ecore_wince/ecore_wince.c
index 5b6dbb6..d68a023 100644
--- a/src/lib/ecore_wince/ecore_wince.c
+++ b/src/lib/ecore_wince/ecore_wince.c
@@ -16,20 +16,26 @@
/***** Global declarations *****/
+double _ecore_wince_double_click_time = 0.25;
double _ecore_wince_event_last_time = 0.0;
-
-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;
+Ecore_WinCE_Window *_ecore_wince_event_last_window = NULL;
+HINSTANCE _ecore_wince_instance = NULL;
+
+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_init()
{
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()
_ecore_wince_init_count++;
+ printf ("ecore_wince : instance + class bon\n");
+
return _ecore_wince_init_count;
}
@@ -113,6 +124,44 @@ ecore_wince_shutdown()
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 @@ _ecore_wince_window_procedure(HWND window,
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 @@ _ecore_wince_window_procedure(HWND window,
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:
diff --git a/src/lib/ecore_wince/ecore_wince_event.c b/src/lib/ecore_wince/ecore_wince_event.c
index bda26a3..cea9799 100644
--- a/src/lib/ecore_wince/ecore_wince_event.c
+++ b/src/lib/ecore_wince/ecore_wince_event.c
@@ -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);
@@ -96,6 +104,241 @@ _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)
+{
+ 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
_ecore_wince_event_handle_focus_in(Ecore_WinCE_Callback_Data *msg)
{
Ecore_WinCE_Event_Window_Focus_In *e;
diff --git a/src/lib/ecore_wince/ecore_wince_private.h b/src/lib/ecore_wince/ecore_wince_private.h
index 2a2a156..0405033 100644
--- a/src/lib/ecore_wince/ecore_wince_private.h
+++ b/src/lib/ecore_wince/ecore_wince_private.h
@@ -34,15 +34,24 @@ struct _Ecore_WinCE_Window
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);
diff --git a/src/lib/ecore_wince/ecore_wince_window.c b/src/lib/ecore_wince/ecore_wince_window.c
index 33ca92b..e1df612 100644
--- a/src/lib/ecore_wince/ecore_wince_window.c
+++ b/src/lib/ecore_wince/ecore_wince_window.c
@@ -99,6 +99,8 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent,
return NULL;
}
+ w->pointer_is_in = 0;
+
return w;
}
--
Core abstraction layer for enlightenment DR 0.17
More information about the Pkg-e-commits
mailing list