add more keyboard support on Windows CE
authorcaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 26 Feb 2009 07:24:50 +0000 (07:24 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 26 Feb 2009 07:24:50 +0000 (07:24 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@39238 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore_wince/ecore_wince.c
src/lib/ecore_wince/ecore_wince_event.c
src/lib/ecore_wince/ecore_wince_private.h

index 4a3d59e..02966d9 100644 (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);
index 8f2e97a..7d8b198 100644 (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;
index 85ad0f7..eedab27 100644 (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);