add more keyboard support on Windows CE

SVN revision: 39238
This commit is contained in:
Vincent Torri 2009-02-26 07:24:50 +00:00
parent 648fa70e12
commit 5ea28a9f21
3 changed files with 62 additions and 17 deletions

View File

@ -232,14 +232,19 @@ _ecore_wince_window_procedure(HWND window,
switch (data->message)
{
/* Keyboard input notifications */
case WM_CHAR:
_ecore_wince_event_handle_key_press(data, 0);
break;
case WM_HOTKEY:
_ecore_wince_event_handle_key_press(data);
_ecore_wince_event_handle_key_press(data, 1);
break;
case WM_KEYDOWN:
_ecore_wince_event_handle_key_press(data);
case WM_SYSKEYDOWN:
_ecore_wince_event_handle_key_press(data, 1);
break;
case WM_KEYUP:
_ecore_wince_event_handle_key_release(data);
case WM_SYSKEYUP:
_ecore_wince_event_handle_key_release(data, 1);
break;
case WM_SETFOCUS:
_ecore_wince_event_handle_focus_in(data);

View File

@ -49,7 +49,8 @@ static int _ecore_wince_event_char_get(int key,
/***** Global functions *****/
void
_ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg)
_ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg,
int is_keystroke)
{
Ecore_WinCE_Event_Key_Down *e;
@ -58,13 +59,27 @@ _ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg)
e = (Ecore_WinCE_Event_Key_Down *)malloc(sizeof(Ecore_WinCE_Event_Key_Down));
if (!e) return;
if (!_ecore_wince_event_keystroke_get(LOWORD(msg->window_param),
if (is_keystroke)
{
if (!_ecore_wince_event_keystroke_get(LOWORD(msg->window_param),
&e->keyname,
&e->keysymbol,
&e->keycompose))
{
free(e);
return;
}
}
else
{
if (!_ecore_wince_event_char_get(LOWORD(msg->window_param),
&e->keyname,
&e->keysymbol,
&e->keycompose))
{
free(e);
return;
{
free(e);
return;
}
}
e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
@ -81,7 +96,8 @@ _ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg)
}
void
_ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg)
_ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg,
int is_keystroke)
{
Ecore_WinCE_Event_Key_Up *e;
@ -90,13 +106,27 @@ _ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg)
e = (Ecore_WinCE_Event_Key_Up *)calloc(1, sizeof(Ecore_WinCE_Event_Key_Up));
if (!e) return;
if (!_ecore_wince_event_keystroke_get(LOWORD(msg->window_param),
if (is_keystroke)
{
if (!_ecore_wince_event_keystroke_get(LOWORD(msg->window_param),
&e->keyname,
&e->keysymbol,
&e->keycompose))
{
free(e);
return;
}
}
else
{
if (!_ecore_wince_event_char_get(LOWORD(msg->window_param),
&e->keyname,
&e->keysymbol,
&e->keycompose))
{
free(e);
return;
{
free(e);
return;
}
}
e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
@ -554,7 +584,7 @@ _ecore_wince_event_handle_delete_request(Ecore_WinCE_Callback_Data *msg)
/***** Private functions definitions *****/
static void
_ecore_wince_event_free_key_down(void *data,
_ecore_wince_event_free_key_down(void *data __UNUSED__,
void *ev)
{
Ecore_WinCE_Event_Key_Down *e;
@ -567,7 +597,7 @@ _ecore_wince_event_free_key_down(void *data,
}
static void
_ecore_wince_event_free_key_up(void *data,
_ecore_wince_event_free_key_up(void *data __UNUSED__,
void *ev)
{
Ecore_WinCE_Event_Key_Up *e;
@ -766,6 +796,16 @@ _ecore_wince_event_keystroke_get(int key,
ks = "F24";
kc = "";
break;
case VK_APPS:
kn = "Application";
ks = "Application";
kc = "";
break;
case VK_MENU:
kn = "Menu";
ks = "Menu";
kc = "";
break;
default:
/* other non keystroke characters */
return 0;

View File

@ -49,8 +49,8 @@ extern Ecore_WinCE_Window *_ecore_wince_event_last_window;
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_key_press(Ecore_WinCE_Callback_Data *msg, int is_keystroke);
void _ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg, int is_keystroke);
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);