Ecore_Win32: Fix AltGr detection on Windows XP (discard additional Ctrl left)

API break (no problem if you don't use timestamps directly from Ecore_Win32)

SVN revision: 65673
This commit is contained in:
Vincent Torri 2011-11-29 06:58:55 +00:00
parent 4363b3ea19
commit 1c43e16493
7 changed files with 134 additions and 79 deletions

View File

@ -350,3 +350,7 @@
2011-11-27 Vincent Torri 2011-11-27 Vincent Torri
* Fix and improve key management on Windows XP * Fix and improve key management on Windows XP
2011-11-29 Vincent Torri
* Discard left Ctrl when AltGr is pressed (Windows XP)

View File

@ -75,7 +75,7 @@ Fixes:
* NULL pointer dereference in ecore_x selection notification code * NULL pointer dereference in ecore_x selection notification code
* sync GNUTLS thread activation with eina changes * sync GNUTLS thread activation with eina changes
* ecore_ipc compilation on Windows * ecore_ipc compilation on Windows
* fix Shift, Control and Alt keys detection on Windows * fix Shift, Control, Alt and AltGr keys detection on Windows XP
* "mouse-down inside and mouse-up outside" issue on Windows * "mouse-down inside and mouse-up outside" issue on Windows
* ecore_x shadow tree search fixed to respect shape input of windows * ecore_x shadow tree search fixed to respect shape input of windows
* fd handlers fixed when idler callbacks add jobs or events * fd handlers fixed when idler callbacks add jobs or events

View File

@ -147,9 +147,9 @@ _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, voi
if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
/* FIXME to do */ /* FIXME to do */
/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
evas_event_feed_mouse_in(ee->evas, e->time, NULL); evas_event_feed_mouse_in(ee->evas, e->timestamp, NULL);
evas_focus_in(ee->evas); evas_focus_in(ee->evas);
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp);
return 1; return 1;
} }
@ -169,9 +169,9 @@ _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, vo
/* FIXME to do */ /* FIXME to do */
/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp);
evas_event_feed_mouse_out(ee->evas, e->time, NULL); evas_event_feed_mouse_out(ee->evas, e->timestamp, NULL);
if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);

View File

@ -221,7 +221,7 @@ struct _Ecore_Win32_Event_Mouse_In
Ecore_Win32_Window *window; /**< The window that received the event */ Ecore_Win32_Window *window; /**< The window that received the event */
int x; /**< The x coordinate where the mouse leaved */ int x; /**< The x coordinate where the mouse leaved */
int y; /**< The y coordinate where the mouse entered */ int y; /**< The y coordinate where the mouse entered */
long time; /**< The time the event occurred */ unsigned long timestamp; /**< The time the event occurred */
}; };
/** /**
@ -233,7 +233,7 @@ struct _Ecore_Win32_Event_Mouse_Out
Ecore_Win32_Window *window; /**< The window that received the event */ Ecore_Win32_Window *window; /**< The window that received the event */
int x; /**< The x coordinate where the mouse leaved */ int x; /**< The x coordinate where the mouse leaved */
int y; /**< The y coordinate where the mouse leaved */ int y; /**< The y coordinate where the mouse leaved */
long time; /**< The time the event occurred */ unsigned long timestamp; /**< The time the event occurred */
}; };
/** /**
@ -243,7 +243,7 @@ struct _Ecore_Win32_Event_Mouse_Out
struct _Ecore_Win32_Event_Window_Focus_In struct _Ecore_Win32_Event_Window_Focus_In
{ {
Ecore_Win32_Window *window; /**< The window that received the event */ Ecore_Win32_Window *window; /**< The window that received the event */
long long time; /**< The time the event occurred */ unsigned long timestamp; /**< The time the event occurred */
}; };
/** /**
@ -253,7 +253,7 @@ struct _Ecore_Win32_Event_Window_Focus_In
struct _Ecore_Win32_Event_Window_Focus_Out struct _Ecore_Win32_Event_Window_Focus_Out
{ {
Ecore_Win32_Window *window; /**< The window that received the event */ Ecore_Win32_Window *window; /**< The window that received the event */
long time; /**< The time the event occurred */ unsigned long timestamp; /**< The time the event occurred */
}; };
/** /**
@ -267,7 +267,7 @@ struct _Ecore_Win32_Event_Window_Damage
int y; /**< The y coordinate of the top left corner of the damaged region */ int y; /**< The y coordinate of the top left corner of the damaged region */
int width; /**< The width of the damaged region */ int width; /**< The width of the damaged region */
int height; /**< The time the event occurred */ int height; /**< The time the event occurred */
long time; /**< The time the event occurred */ unsigned long timestamp; /**< The time the event occurred */
}; };
/** /**
@ -277,7 +277,7 @@ struct _Ecore_Win32_Event_Window_Damage
struct _Ecore_Win32_Event_Window_Create struct _Ecore_Win32_Event_Window_Create
{ {
Ecore_Win32_Window *window; /**< The window that received the event */ Ecore_Win32_Window *window; /**< The window that received the event */
long time; /**< The time the event occurred */ unsigned long timestamp; /**< The time the event occurred */
}; };
/** /**
@ -287,7 +287,7 @@ struct _Ecore_Win32_Event_Window_Create
struct _Ecore_Win32_Event_Window_Destroy struct _Ecore_Win32_Event_Window_Destroy
{ {
Ecore_Win32_Window *window; /**< The window that received the event */ Ecore_Win32_Window *window; /**< The window that received the event */
long time; /**< The time the event occurred */ unsigned long timestamp; /**< The time the event occurred */
}; };
/** /**
@ -297,7 +297,7 @@ struct _Ecore_Win32_Event_Window_Destroy
struct _Ecore_Win32_Event_Window_Hide struct _Ecore_Win32_Event_Window_Hide
{ {
Ecore_Win32_Window *window; /**< The window that received the event */ Ecore_Win32_Window *window; /**< The window that received the event */
long time; /**< The time the event occurred */ unsigned long timestamp; /**< The time the event occurred */
}; };
/** /**
@ -307,7 +307,7 @@ struct _Ecore_Win32_Event_Window_Hide
struct _Ecore_Win32_Event_Window_Show struct _Ecore_Win32_Event_Window_Show
{ {
Ecore_Win32_Window *window; /**< The window that received the event */ Ecore_Win32_Window *window; /**< The window that received the event */
long time; /**< The time the event occurred */ unsigned long timestamp; /**< The time the event occurred */
}; };
/** /**
@ -322,7 +322,7 @@ struct _Ecore_Win32_Event_Window_Configure
int y; /**< The new y coordinate of the top left corner */ int y; /**< The new y coordinate of the top left corner */
int width; /**< The new width */ int width; /**< The new width */
int height; /**< The new height */ int height; /**< The new height */
long time; /**< The time the event occurred */ unsigned long timestamp; /**< The time the event occurred */
}; };
/** /**
@ -334,7 +334,7 @@ struct _Ecore_Win32_Event_Window_Resize
Ecore_Win32_Window *window; /**< The window that received the event */ Ecore_Win32_Window *window; /**< The window that received the event */
int width; /**< The new width */ int width; /**< The new width */
int height; /**< The new height */ int height; /**< The new height */
long time; /**< The time the event occurred */ unsigned long timestamp; /**< The time the event occurred */
}; };
/** /**
@ -344,7 +344,7 @@ struct _Ecore_Win32_Event_Window_Resize
struct _Ecore_Win32_Event_Window_Delete_Request struct _Ecore_Win32_Event_Window_Delete_Request
{ {
Ecore_Win32_Window *window; /**< The window that received the event */ Ecore_Win32_Window *window; /**< The window that received the event */
long time; /**< The time the event occurred */ unsigned long timestamp; /**< The time the event occurred */
}; };
/** /**
@ -369,12 +369,12 @@ EAPI extern int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST; /**< Ecore_Event for th
/* Core */ /* Core */
EAPI int ecore_win32_init(); EAPI int ecore_win32_init();
EAPI int ecore_win32_shutdown(); EAPI int ecore_win32_shutdown();
EAPI int ecore_win32_screen_depth_get(); EAPI int ecore_win32_screen_depth_get();
EAPI void ecore_win32_double_click_time_set(double t); EAPI void ecore_win32_double_click_time_set(double t);
EAPI double ecore_win32_double_click_time_get(void); EAPI double ecore_win32_double_click_time_get(void);
EAPI long ecore_win32_current_time_get(void); EAPI unsigned long ecore_win32_current_time_get(void);
/* Window */ /* Window */

View File

@ -73,18 +73,44 @@ _ecore_win32_window_procedure(HWND window,
data->message = message; data->message = message;
data->window_param = window_param; data->window_param = window_param;
data->data_param = data_param; data->data_param = data_param;
data->time = GetMessageTime(); data->timestamp = GetMessageTime();
coord = GetMessagePos(); coord = GetMessagePos();
point = MAKEPOINTS(coord); point = MAKEPOINTS(coord);
data->x = point.x; data->x = point.x;
data->y = point.y; data->y = point.y;
data->discard_ctrl = EINA_FALSE;
switch (data->message) switch (data->message)
{ {
/* Keyboard input notifications */ /* Keyboard input notifications */
case WM_KEYDOWN: case WM_KEYDOWN:
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
INF("keydown message"); if ((data->message == WM_KEYDOWN) &&
(data->window_param == VK_CONTROL) &&
((HIWORD(data->data_param) & KF_EXTENDED) == 0))
{
/* Ctrl left key is pressed */
BOOL res;
MSG next_msg;
/*
* we check if the next message
* - is a WM_KEYDOWN
* - has the same timestamp than the Ctrl one
* - is the key press of the right Alt key
*/
res = PeekMessage(&next_msg, data->window,
WM_KEYDOWN, WM_KEYDOWN,
PM_NOREMOVE);
if (res &&
(next_msg.wParam == VK_MENU) &&
(next_msg.time == data->timestamp) &&
(HIWORD(next_msg.lParam) & KF_EXTENDED))
{
INF("discard left Ctrl key press (sent by AltGr key press)");
data->discard_ctrl = EINA_TRUE;
}
}
_ecore_win32_event_handle_key_press(data, 1); _ecore_win32_event_handle_key_press(data, 1);
return 0; return 0;
case WM_CHAR: case WM_CHAR:
@ -95,6 +121,33 @@ _ecore_win32_window_procedure(HWND window,
case WM_KEYUP: case WM_KEYUP:
case WM_SYSKEYUP: case WM_SYSKEYUP:
INF("keyup message"); INF("keyup message");
if ((data->window_param == VK_CONTROL) &&
((HIWORD(data->data_param) & KF_EXTENDED) == 0))
{
/* Ctrl left key is pressed */
BOOL res;
MSG next_msg;
/*
* we check if the next message
* - is a WM_KEYUP or WM_SYSKEYUP
* - has the same timestamp than the Ctrl one
* - is the key press of the right Alt key
*/
res = PeekMessage(&next_msg, data->window,
WM_KEYUP, WM_SYSKEYUP,
PM_NOREMOVE);
if (res &&
((next_msg.message == WM_KEYUP) ||
(next_msg.message == WM_SYSKEYUP)) &&
(next_msg.wParam == VK_MENU) &&
(next_msg.time == data->timestamp) &&
(HIWORD(next_msg.lParam) & KF_EXTENDED))
{
INF("discard left Ctrl key release (sent by AltGr key release)");
data->discard_ctrl = EINA_TRUE;
}
}
_ecore_win32_event_handle_key_release(data); _ecore_win32_event_handle_key_release(data);
return 0; return 0;
case WM_SETFOCUS: case WM_SETFOCUS:
@ -492,7 +545,7 @@ _ecore_win32_window_procedure(HWND window,
HINSTANCE _ecore_win32_instance = NULL; HINSTANCE _ecore_win32_instance = NULL;
double _ecore_win32_double_click_time = 0.25; double _ecore_win32_double_click_time = 0.25;
long _ecore_win32_event_last_time = 0; unsigned long _ecore_win32_event_last_time = 0;
Ecore_Win32_Window *_ecore_win32_event_last_window = NULL; Ecore_Win32_Window *_ecore_win32_event_last_window = NULL;
int _ecore_win32_log_dom_global = -1; int _ecore_win32_log_dom_global = -1;
@ -777,7 +830,7 @@ ecore_win32_double_click_time_get(void)
* *
* This function returns the last event time. * This function returns the last event time.
*/ */
EAPI long EAPI unsigned long
ecore_win32_current_time_get(void) ecore_win32_current_time_get(void)
{ {
return _ecore_win32_event_last_time; return _ecore_win32_event_last_time;

View File

@ -45,8 +45,7 @@ static void _ecore_win32_event_free_key_down(void *data,
static void _ecore_win32_event_free_key_up(void *data, static void _ecore_win32_event_free_key_up(void *data,
void *ev); void *ev);
static int _ecore_win32_event_keystroke_get(int key, static int _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
int is_extended,
Eina_Bool is_down, Eina_Bool is_down,
char **keyname, char **keyname,
char **keysymbol, char **keysymbol,
@ -74,8 +73,7 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg,
if (is_keystroke) if (is_keystroke)
{ {
if (!_ecore_win32_event_keystroke_get(msg->window_param, if (!_ecore_win32_event_keystroke_get(msg,
msg->data_param & 0x01000000,
EINA_TRUE, EINA_TRUE,
(char **)&e->keyname, (char **)&e->keyname,
(char **)&e->key, (char **)&e->key,
@ -105,7 +103,7 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg,
return; return;
} }
e->event_window = e->window; e->event_window = e->window;
e->timestamp = msg->time; e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp; _ecore_win32_event_last_time = e->timestamp;
@ -122,15 +120,15 @@ _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg)
e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key)); e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key));
if (!e) return; if (!e) return;
if (!_ecore_win32_event_keystroke_get(LOWORD(msg->window_param), if (!_ecore_win32_event_keystroke_get(msg,
msg->data_param & 0x01000000,
EINA_FALSE, EINA_FALSE,
(char **)&e->keyname, (char **)&e->keyname,
(char **)&e->key, (char **)&e->key,
(char **)&e->string, (char **)&e->string,
&e->modifiers)) &e->modifiers))
{ {
if (!_ecore_win32_event_char_get(LOWORD(msg->window_param), if (msg->discard_ctrl ||
!_ecore_win32_event_char_get(LOWORD(msg->window_param),
(char **)&e->keyname, (char **)&e->keyname,
(char **)&e->key, (char **)&e->key,
(char **)&e->string)) (char **)&e->string))
@ -147,7 +145,7 @@ _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg)
return; return;
} }
e->event_window = e->window; e->event_window = e->window;
e->timestamp = msg->time; e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp; _ecore_win32_event_last_time = e->timestamp;
@ -178,7 +176,7 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? -1 : 1; e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? -1 : 1;
e->x = GET_X_LPARAM(msg->data_param); e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param);
e->timestamp = msg->time; e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp; _ecore_win32_event_last_time = e->timestamp;
_ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
@ -197,7 +195,7 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
e->event_window = e->window; e->event_window = e->window;
e->x = GET_X_LPARAM(msg->data_param); e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param);
e->timestamp = msg->time; e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp; _ecore_win32_event_last_time = e->timestamp;
_ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
@ -224,7 +222,7 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
e->buttons = button; e->buttons = button;
e->x = GET_X_LPARAM(msg->data_param); e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param);
e->timestamp = msg->time; e->timestamp = msg->timestamp;
if (((e->timestamp - _ecore_win32_mouse_down_last_time) <= (unsigned long)(1000 * _ecore_win32_double_click_time)) && if (((e->timestamp - _ecore_win32_mouse_down_last_time) <= (unsigned long)(1000 * _ecore_win32_double_click_time)) &&
(e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window)) (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window))
@ -279,7 +277,7 @@ _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg,
e->event_window = e->window; e->event_window = e->window;
e->x = GET_X_LPARAM(msg->data_param); e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param);
e->timestamp = msg->time; e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp; _ecore_win32_event_last_time = e->timestamp;
_ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
@ -298,7 +296,7 @@ _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg,
e->buttons = button; e->buttons = button;
e->x = GET_X_LPARAM(msg->data_param); e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param);
e->timestamp = msg->time; e->timestamp = msg->timestamp;
_ecore_win32_mouse_up_count++; _ecore_win32_mouse_up_count++;
@ -334,7 +332,7 @@ _ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg)
e->event_window = e->window; e->event_window = e->window;
e->x = GET_X_LPARAM(msg->data_param); e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param);
e->timestamp = msg->time; e->timestamp = msg->timestamp;
ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
} }
@ -354,7 +352,7 @@ _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg)
e->event_window = e->window; e->event_window = e->window;
e->x = msg->x; e->x = msg->x;
e->y = msg->y; e->y = msg->y;
e->timestamp = msg->time; e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp; _ecore_win32_event_last_time = e->timestamp;
_ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
@ -371,9 +369,9 @@ _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg)
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->x = msg->x; e->x = msg->x;
e->y = msg->y; e->y = msg->y;
e->time = msg->time ; e->timestamp = msg->timestamp ;
_ecore_win32_event_last_time = e->time; _ecore_win32_event_last_time = e->timestamp;
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_IN, e, NULL, NULL); ecore_event_add(ECORE_WIN32_EVENT_MOUSE_IN, e, NULL, NULL);
} }
@ -394,7 +392,7 @@ _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg)
e->event_window = e->window; e->event_window = e->window;
e->x = msg->x; e->x = msg->x;
e->y = msg->y; e->y = msg->y;
e->timestamp = msg->time; e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->timestamp; _ecore_win32_event_last_time = e->timestamp;
_ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window;
@ -411,9 +409,9 @@ _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg)
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->x = msg->x; e->x = msg->x;
e->y = msg->y; e->y = msg->y;
e->time = msg->time; e->timestamp = msg->timestamp;
_ecore_win32_event_last_time = e->time; _ecore_win32_event_last_time = e->timestamp;
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_OUT, e, NULL, NULL); ecore_event_add(ECORE_WIN32_EVENT_MOUSE_OUT, e, NULL, NULL);
} }
@ -431,8 +429,8 @@ _ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg)
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->time = _ecore_win32_event_last_time; e->timestamp = _ecore_win32_event_last_time;
_ecore_win32_event_last_time = e->time; _ecore_win32_event_last_time = e->timestamp;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL);
} }
@ -449,8 +447,8 @@ _ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg)
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->time = _ecore_win32_event_last_time; e->timestamp = _ecore_win32_event_last_time;
_ecore_win32_event_last_time = e->time; _ecore_win32_event_last_time = e->timestamp;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL);
} }
@ -472,7 +470,7 @@ _ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg)
e->width = msg->update.right - msg->update.left; e->width = msg->update.right - msg->update.left;
e->height = msg->update.bottom - msg->update.top; e->height = msg->update.bottom - msg->update.top;
e->time = _ecore_win32_event_last_time; e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, e, NULL, NULL); ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
} }
@ -489,7 +487,7 @@ _ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg)
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->time = _ecore_win32_event_last_time; e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CREATE, e, NULL, NULL); ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CREATE, e, NULL, NULL);
} }
@ -506,7 +504,7 @@ _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg)
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->time = _ecore_win32_event_last_time; e->timestamp = _ecore_win32_event_last_time;
if (e->window == _ecore_win32_event_last_window) _ecore_win32_event_last_window = NULL; if (e->window == _ecore_win32_event_last_window) _ecore_win32_event_last_window = NULL;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, e, NULL, NULL); ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, e, NULL, NULL);
@ -524,7 +522,7 @@ _ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg)
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->time = _ecore_win32_event_last_time; e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_SHOW, e, NULL, NULL); ecore_event_add(ECORE_WIN32_EVENT_WINDOW_SHOW, e, NULL, NULL);
} }
@ -541,7 +539,7 @@ _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg)
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->time = _ecore_win32_event_last_time; e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_HIDE, e, NULL, NULL); ecore_event_add(ECORE_WIN32_EVENT_WINDOW_HIDE, e, NULL, NULL);
} }
@ -572,7 +570,7 @@ _ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg)
e->y = wi.rcClient.top; e->y = wi.rcClient.top;
e->width = wi.rcClient.right - wi.rcClient.left; e->width = wi.rcClient.right - wi.rcClient.left;
e->height = wi.rcClient.bottom - wi.rcClient.top; e->height = wi.rcClient.bottom - wi.rcClient.top;
e->time = _ecore_win32_event_last_time; e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, e, NULL, NULL); ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);
} }
@ -594,7 +592,7 @@ _ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg)
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->width = rect.right - rect.left; e->width = rect.right - rect.left;
e->height = rect.bottom - rect.top; e->height = rect.bottom - rect.top;
e->time = _ecore_win32_event_last_time; e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_RESIZE, e, NULL, NULL); ecore_event_add(ECORE_WIN32_EVENT_WINDOW_RESIZE, e, NULL, NULL);
} }
@ -610,7 +608,7 @@ _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg)
if (!e) return; if (!e) return;
e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
e->time = _ecore_win32_event_last_time; e->timestamp = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
} }
@ -645,8 +643,7 @@ _ecore_win32_event_free_key_up(void *data __UNUSED__,
} }
static int static int
_ecore_win32_event_keystroke_get(int key, _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
int is_extended,
Eina_Bool is_down, Eina_Bool is_down,
char **keyname, char **keyname,
char **keysymbol, char **keysymbol,
@ -656,13 +653,16 @@ _ecore_win32_event_keystroke_get(int key,
char *kn = NULL; char *kn = NULL;
char *ks = NULL; char *ks = NULL;
char *kc = NULL; char *kc = NULL;
int key;
int is_extended;
key = msg->window_param;
is_extended = msg->data_param & 0x01000000;
*keyname = NULL; *keyname = NULL;
*keysymbol = NULL; *keysymbol = NULL;
*keycompose = NULL; *keycompose = NULL;
printf("vk key 0x%x\n", key);
switch (key) switch (key)
{ {
/* Keystroke */ /* Keystroke */
@ -751,7 +751,6 @@ _ecore_win32_event_keystroke_get(int key,
} }
break; break;
case VK_RIGHT: case VK_RIGHT:
printf("vk val 0x%x (right)\n", VK_RIGHT);
if (is_extended) if (is_extended)
{ {
kn = "Right"; kn = "Right";
@ -860,6 +859,9 @@ _ecore_win32_event_keystroke_get(int key,
{ {
SHORT res; SHORT res;
if (msg->discard_ctrl)
return 0;
if (is_down) if (is_down)
{ {
res = GetKeyState(VK_LCONTROL); res = GetKeyState(VK_LCONTROL);
@ -1117,7 +1119,6 @@ _ecore_win32_event_keystroke_get(int key,
return 0; return 0;
} }
printf("sortie...\n");
*keyname = strdup(kn); *keyname = strdup(kn);
if (!*keyname) return 0; if (!*keyname) return 0;
*keysymbol = strdup(ks); *keysymbol = strdup(ks);
@ -1141,7 +1142,6 @@ _ecore_win32_event_keystroke_get(int key,
return 0; return 0;
} }
} }
printf("sortie 2 ...\n");
return 1; return 1;
} }
@ -1161,8 +1161,6 @@ _ecore_win32_event_char_get(int key,
*keysymbol = NULL; *keysymbol = NULL;
*keycompose = NULL; *keycompose = NULL;
printf("char key 0x%x\n", key);
switch (key) switch (key)
{ {
case VK_PROCESSKEY: case VK_PROCESSKEY:
@ -1200,7 +1198,6 @@ _ecore_win32_event_char_get(int key,
break; break;
default: default:
/* displayable characters */ /* displayable characters */
printf (" * key : %d\n", key);
buf[0] = key; buf[0] = key;
buf[1] = '\0'; buf[1] = '\0';
kn = buf; kn = buf;

View File

@ -49,14 +49,15 @@ typedef struct _Ecore_Win32_Callback_Data Ecore_Win32_Callback_Data;
struct _Ecore_Win32_Callback_Data struct _Ecore_Win32_Callback_Data
{ {
RECT update; RECT update;
HWND window; HWND window;
unsigned int message; unsigned int message;
WPARAM window_param; WPARAM window_param;
LPARAM data_param; LPARAM data_param;
long time; unsigned long timestamp;
int x; int x;
int y; int y;
Eina_Bool discard_ctrl;
}; };
struct _Ecore_Win32_Window struct _Ecore_Win32_Window
@ -130,7 +131,7 @@ struct _Ecore_Win32_Window
extern HINSTANCE _ecore_win32_instance; extern HINSTANCE _ecore_win32_instance;
extern double _ecore_win32_double_click_time; extern double _ecore_win32_double_click_time;
extern long _ecore_win32_event_last_time; extern unsigned long _ecore_win32_event_last_time;
extern Ecore_Win32_Window *_ecore_win32_event_last_window; extern Ecore_Win32_Window *_ecore_win32_event_last_window;