Ecore_Win32: Fix the modifiers value

SVN revision: 65856
This commit is contained in:
Vincent Torri 2011-12-03 22:06:43 +00:00
parent 8b6899154c
commit a3970d1f96
3 changed files with 65 additions and 17 deletions

View File

@ -368,3 +368,7 @@
2011-12-02 Term <term@twistedpath.org> 2011-12-02 Term <term@twistedpath.org>
* added ecore_x_randr_output_backlight_available() * added ecore_x_randr_output_backlight_available()
2011-12-03 Vincent Torri
* Fix the modifiers value (Windows XP)

View File

@ -10,6 +10,8 @@ Additions:
Improvements: Improvements:
* ecore: * ecore:
- most allocations moved to mempools - most allocations moved to mempools
* ecore_win32:
- fix modifiers value on Windows XP
Ecore 1.1.0 Ecore 1.1.0

View File

@ -55,7 +55,8 @@ static int _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
static int _ecore_win32_event_char_get(int key, static int _ecore_win32_event_char_get(int key,
char **keyname, char **keyname,
char **keysymbol, char **keysymbol,
char **keycompose); char **keycompose,
unsigned int *modifiers);
/***** Global functions definitions *****/ /***** Global functions definitions *****/
@ -89,7 +90,8 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg,
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->keyname,
(char **)&e->key, (char **)&e->key,
(char **)&e->string)) (char **)&e->string,
&e->modifiers))
{ {
free(e); free(e);
return; return;
@ -131,7 +133,8 @@ _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg)
!_ecore_win32_event_char_get(LOWORD(msg->window_param), !_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,
&e->modifiers))
{ {
free(e); free(e);
return; return;
@ -830,7 +833,7 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
ks = "Shift_R"; ks = "Shift_R";
kc = ""; kc = "";
} }
*modifiers |= ECORE_EVENT_MODIFIER_SHIFT; *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT;
} }
else /* is_up */ else /* is_up */
{ {
@ -852,7 +855,7 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
kc = ""; kc = "";
_ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RSHIFT; _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RSHIFT;
} }
*modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT; *modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
} }
break; break;
} }
@ -1138,6 +1141,25 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
kn = (char *)buf; kn = (char *)buf;
ks = (char *)buf; ks = (char *)buf;
kc = (char *)buf; kc = (char *)buf;
res = GetAsyncKeyState(VK_SHIFT);
if (res & 0x8000)
*modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
else
*modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT;
res = GetKeyState(VK_CONTROL);
if (res & 0x8000)
*modifiers |= ECORE_EVENT_MODIFIER_CTRL;
else
*modifiers &= ~ECORE_EVENT_MODIFIER_CTRL;
res = GetKeyState(VK_MENU);
if (res & 0x8000)
*modifiers |= ECORE_EVENT_MODIFIER_ALT;
else
*modifiers &= ~ECORE_EVENT_MODIFIER_ALT;
break; break;
} }
return 0; return 0;
@ -1175,12 +1197,14 @@ static int
_ecore_win32_event_char_get(int key, _ecore_win32_event_char_get(int key,
char **keyname, char **keyname,
char **keysymbol, char **keysymbol,
char **keycompose) char **keycompose,
unsigned int *modifiers)
{ {
char *kn = NULL; char *kn = NULL;
char *ks = NULL; char *ks = NULL;
char *kc = NULL; char *kc = NULL;
char buf[2]; char buf[2];
SHORT res;
*keyname = NULL; *keyname = NULL;
*keysymbol = NULL; *keysymbol = NULL;
@ -1249,5 +1273,23 @@ _ecore_win32_event_char_get(int key,
return 0; return 0;
} }
res = GetAsyncKeyState(VK_SHIFT);
if (res & 0x8000)
*modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
else
*modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT;
res = GetKeyState(VK_CONTROL);
if (res & 0x8000)
*modifiers |= ECORE_EVENT_MODIFIER_CTRL;
else
*modifiers &= ~ECORE_EVENT_MODIFIER_CTRL;
res = GetKeyState(VK_MENU);
if (res & 0x8000)
*modifiers |= ECORE_EVENT_MODIFIER_ALT;
else
*modifiers &= ~ECORE_EVENT_MODIFIER_ALT;
return 1; return 1;
} }