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>
* 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:
* ecore:
- most allocations moved to mempools
* ecore_win32:
- fix modifiers value on Windows XP
Ecore 1.1.0

View File

@ -46,16 +46,17 @@ static void _ecore_win32_event_free_key_up(void *data,
void *ev);
static int _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
Eina_Bool is_down,
char **keyname,
char **keysymbol,
char **keycompose,
unsigned int *modifiers);
Eina_Bool is_down,
char **keyname,
char **keysymbol,
char **keycompose,
unsigned int *modifiers);
static int _ecore_win32_event_char_get(int key,
char **keyname,
char **keysymbol,
char **keycompose);
static int _ecore_win32_event_char_get(int key,
char **keyname,
char **keysymbol,
char **keycompose,
unsigned int *modifiers);
/***** 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),
(char **)&e->keyname,
(char **)&e->key,
(char **)&e->string))
(char **)&e->string,
&e->modifiers))
{
free(e);
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),
(char **)&e->keyname,
(char **)&e->key,
(char **)&e->string))
(char **)&e->string,
&e->modifiers))
{
free(e);
return;
@ -830,7 +833,7 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
ks = "Shift_R";
kc = "";
}
*modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
*modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT;
}
else /* is_up */
{
@ -852,7 +855,7 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
kc = "";
_ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RSHIFT;
}
*modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT;
*modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
}
break;
}
@ -1138,6 +1141,25 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
kn = (char *)buf;
ks = (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;
}
return 0;
@ -1172,15 +1194,17 @@ _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg,
}
static int
_ecore_win32_event_char_get(int key,
char **keyname,
char **keysymbol,
char **keycompose)
_ecore_win32_event_char_get(int key,
char **keyname,
char **keysymbol,
char **keycompose,
unsigned int *modifiers)
{
char *kn = NULL;
char *ks = NULL;
char *kc = NULL;
char buf[2];
SHORT res;
*keyname = NULL;
*keysymbol = NULL;
@ -1249,5 +1273,23 @@ _ecore_win32_event_char_get(int key,
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;
}