Hello,

I have refined and attached the patch.
It has ECORE_EVENT_MODIFIER_SHIFT/CTRL/ALT
and does NOT have TCHAR.

TGIF!! :-)

2011/11/24 Kim Shinwoo <kimcinoo....@gmail.com>

> Thanks for your response!
>
> I'll refine with ECORE_EVENT_MODIFIER_*.
> And TCHAR is already there.. Anyhow, I'll remove it.
> Thank you~ :)
>
>
> 2011/11/23 Vincent Torri <vto...@univ-evry.fr>
>
>>
>> Hey
>>
>> On Wed, 23 Nov 2011, cnook wrote:
>>
>> > Dear All, Hello~
>> >
>> > There are some issues as following
>> >
>> > 1) Key combination like Ctrl + a, Alt +a does not work properly.
>> > 2) event->keyname: should be lower case
>> > 3) event->modifiers: should be handled -> This is used on the Entry of
>> > elementary_test. EX: Ctrl+A should work for selecting all
>> > 4) ecore_win32_event_char_get(); is not called when key is released,
>> > So, the event ECORE_EVENT_KEY_UP with character does not occur.
>> > 5) "Tab" key does not work properly on the Entry of elementary_test.
>> > 6) Improper Null check in _ecore_win32_event_char_get(); It returns 1
>> > always.. Maybe there is a better solution than my patch.
>> > 7) VK_PROCESSKY was not handled. When you click button the VK_PROCESSKY
>> comes.
>> >
>> > I think attached patch would be resolved these issues.
>> > Please check the patch and give any feedbacks. Thanks
>>
>> looking at the code (i'm at work right now) :
>>
>> ECORE_EVENT_MODIFIER_* (in Ecore_Input.h) values must be used.
>>
>> declare variables at the beginning of the scope
>>
>> I think that the modifier must be set when the key is pressed.
>>
>> TCHAR is useless, i'm working in ANSI, not UNICODE for windows.
>>
>> strcmp(*keyname, "") : **keyname == '\0'
>>
>> anyway, i'll have to check that
>>
>> thanks
>>
>> Vincent
>>
>>
>> ------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure
>> contains a definitive record of customers, application performance,
>> security threats, fraudulent activity, and more. Splunk takes this
>> data and makes sense of it. IT sense. And common sense.
>> http://p.sf.net/sfu/splunk-novd2d
>> _______________________________________________
>> enlightenment-devel mailing list
>> enlightenment-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>>
>
>
Index: src/lib/ecore_win32/ecore_win32_private.h
===================================================================
--- src/lib/ecore_win32/ecore_win32_private.h	(revision 65569)
+++ src/lib/ecore_win32/ecore_win32_private.h	(working copy)
@@ -135,7 +135,7 @@ extern Ecore_Win32_Window *_ecore_win32_event_last
 
 
 void  _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, int is_keystroke);
-void  _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg, int is_keystroke);
+void  _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg);
 void  _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, int button);
 void  _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, int button);
 void  _ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg);
Index: src/lib/ecore_win32/ecore_win32.c
===================================================================
--- src/lib/ecore_win32/ecore_win32.c	(revision 65569)
+++ src/lib/ecore_win32/ecore_win32.c	(working copy)
@@ -88,13 +88,14 @@ _ecore_win32_window_procedure(HWND   window,
        _ecore_win32_event_handle_key_press(data, 1);
        return 0;
      case WM_CHAR:
+     case WM_SYSCHAR:
        INF("char message");
        _ecore_win32_event_handle_key_press(data, 0);
        return 0;
      case WM_KEYUP:
      case WM_SYSKEYUP:
        INF("keyup message");
-       _ecore_win32_event_handle_key_release(data, 1);
+       _ecore_win32_event_handle_key_release(data);
        return 0;
      case WM_SETFOCUS:
        INF("setfocus message");
Index: src/lib/ecore_win32/ecore_win32_event.c
===================================================================
--- src/lib/ecore_win32/ecore_win32_event.c	(revision 65569)
+++ src/lib/ecore_win32/ecore_win32_event.c	(working copy)
@@ -4,6 +4,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>   /* for printf */
+#include <ctype.h>   /* for tolower */
 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
@@ -107,12 +108,19 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Ca
 
    _ecore_win32_event_last_time = e->timestamp;
 
+   SHORT res;
+   res = GetKeyState(VK_SHIFT);
+   if (res & 0x8000) e->modifiers = ECORE_EVENT_MODIFIER_SHIFT;
+   res = GetKeyState(VK_CONTROL);
+   if (res & 0x8000) e->modifiers = ECORE_EVENT_MODIFIER_CTRL;
+   res = GetKeyState(VK_MENU);
+   if (res & 0x8000) e->modifiers = ECORE_EVENT_MODIFIER_ALT;
+
    ecore_event_add(ECORE_EVENT_KEY_DOWN, e, _ecore_win32_event_free_key_down, NULL);
 }
 
 void
-_ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg,
-                                      int                        is_keystroke)
+_ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg)
 {
    Ecore_Event_Key *e;
 
@@ -121,22 +129,14 @@ void
    e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key));
    if (!e) return;
 
-   if (is_keystroke)
+   if (!_ecore_win32_event_keystroke_get(LOWORD(msg->window_param),
+			   msg->data_param & 0x01000000,
+			   EINA_FALSE,
+			   (char **)&e->keyname,
+			   (char **)&e->key,
+			   (char **)&e->string))
      {
-        if (!_ecore_win32_event_keystroke_get(LOWORD(msg->window_param),
-                                              msg->data_param & 0x01000000,
-                                              EINA_FALSE,
-                                              (char **)&e->keyname,
-                                              (char **)&e->key,
-                                              (char **)&e->string))
-          {
-             free(e);
-             return;
-          }
-     }
-   else
-     {
-        if (!_ecore_win32_event_char_get(LOWORD(msg->window_param),
+        if(!_ecore_win32_event_char_get(LOWORD(msg->window_param),
                                          (char **)&e->keyname,
                                          (char **)&e->key,
                                          (char **)&e->string))
@@ -157,7 +157,16 @@ void
 
    _ecore_win32_event_last_time = e->timestamp;
 
+   SHORT res;
+   res = GetKeyState(VK_SHIFT);
+   if (res & 0x8000) e->modifiers = ECORE_EVENT_MODIFIER_SHIFT;
+   res = GetKeyState(VK_CONTROL);
+   if (res & 0x8000) e->modifiers = ECORE_EVENT_MODIFIER_CTRL;
+   res = GetKeyState(VK_MENU);
+   if (res & 0x8000) e->modifiers = ECORE_EVENT_MODIFIER_ALT;
+
    ecore_event_add(ECORE_EVENT_KEY_UP, e, _ecore_win32_event_free_key_up, NULL);
+
 }
 
 void
@@ -658,9 +667,9 @@ _ecore_win32_event_keystroke_get(int    key,
                                  char **keysymbol,
                                  char **keycompose)
 {
-  char *kn;
-  char *ks;
-  char *kc;
+  char *kn = NULL;
+  char *ks = NULL;
+  char *kc = NULL;
 
   *keyname = NULL;
   *keysymbol = NULL;
@@ -1115,6 +1124,8 @@ _ecore_win32_event_char_get(int    key,
 
    switch (key)
      {
+     case VK_PROCESSKEY:
+      break;
      case VK_BACK:
        strncpy(kn, "BackSpace", 32);
        strncpy(ks, "BackSpace", 32);
@@ -1122,7 +1133,7 @@ _ecore_win32_event_char_get(int    key,
        break;
      case VK_TAB:
        strncpy(kn, "Tab", 32);
-       strncpy(ks, "ISO_Left_Tab", 32);
+       strncpy(ks, "Tab", 32);
        strncpy(kc, "Tab", 32);
        break;
      case 0x0a:
@@ -1148,26 +1159,28 @@ _ecore_win32_event_char_get(int    key,
        break;
      default:
        /* displayable characters */
+       // check control character
+       if ((key > 0) && (key < 27) && (GetKeyState(VK_CONTROL) & 0x8000)) key += 96;
        printf (" * key : %d\n", key);
-       kn[0] = (TCHAR)key;
+       kn[0] = tolower(key);
        kn[1] = '\0';
-       ks[0] = (TCHAR)key;
+       ks[0] = key;
        ks[1] = '\0';
-       kc[0] = (TCHAR)key;
+       kc[0] = key;
        kc[1] = '\0';
        break;
      }
    *keyname = strdup(kn);
-   if (!*keyname) return 0;
+   if (!strcmp(*keyname, "")) return 0;
    *keysymbol = strdup(ks);
-   if (!*keysymbol)
+   if (!strcmp(*keysymbol, ""))
      {
         free(*keyname);
         *keyname = NULL;
         return 0;
      }
    *keycompose = strdup(kc);
-   if (!*keycompose)
+   if (!strcmp(*keycompose, ""))
      {
         free(*keyname);
         free(*keysymbol);
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to