Modify ecore_wl_input keypress code to handle modifiers Not on every

keypress, but rather Only on they actual modifier event.

Add some printf debugging for Non-Printables like Ctrl, etc

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-06-07 15:32:19 +01:00
parent ff73dd600b
commit 92a649e35b
1 changed files with 27 additions and 17 deletions

View File

@ -590,7 +590,6 @@ _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard EINA_UN
unsigned int code, num;
const xkb_keysym_t *syms;
xkb_keysym_t sym = XKB_KEY_NoSymbol;
xkb_mod_mask_t mask;
char string[32], key[32], keyname[32];// compose[32];
Ecore_Event_Key *e;
struct itimerspec ts;
@ -608,20 +607,9 @@ _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard EINA_UN
if ((!win) || (win->keyboard_device != input) || (!input->xkb.state))
return;
mask = xkb_state_serialize_mods(input->xkb.state,
XKB_STATE_DEPRESSED | XKB_STATE_LATCHED);
input->modifiers = 0;
/* The Ecore_Event_Modifiers don't quite match the X mask bits */
if (mask & input->xkb.control_mask)
input->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
if (mask & input->xkb.alt_mask)
input->modifiers |= ECORE_EVENT_MODIFIER_ALT;
if (mask & input->xkb.shift_mask)
input->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
num = xkb_key_get_syms(input->xkb.state, code, &syms);
sym = XKB_KEY_NoSymbol;
if (num == 1) sym = syms[0];
memset(key, 0, sizeof(key));
@ -639,6 +627,14 @@ _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard EINA_UN
* non-printable characters */
if ((sym == XKB_KEY_Tab) || (sym == XKB_KEY_ISO_Left_Tab))
string[len++] = '\t';
/* else if ((sym == XKB_KEY_Control_L) || (sym == XKB_KEY_Control_R)) */
/* string[len++] = '\'; */
else
{
printf("Non Printable Key\n");
printf("\tKey: %s\n", key);
printf("\tKeyname: %s\n", keyname);
}
}
/* FIXME: NB: Start hacking on compose key support */
@ -685,9 +681,9 @@ _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard EINA_UN
timerfd_settime(input->repeat.timerfd, 0, &ts, NULL);
}
else if ((state) &&
((!input->repeat.key) ||
((keycode) && (keycode != input->repeat.key))))
else if ((state)) //&&
/* ((!input->repeat.key) || */
/* ((keycode) && (keycode != input->repeat.key)))) */
{
input->repeat.sym = sym;
input->repeat.key = keycode;
@ -709,12 +705,26 @@ static void
_ecore_wl_input_cb_keyboard_modifiers(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int serial EINA_UNUSED, unsigned int depressed, unsigned int latched, unsigned int locked, unsigned int group)
{
Ecore_Wl_Input *input;
xkb_mod_mask_t mask;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(input = data)) return;
xkb_state_update_mask(input->xkb.state, depressed, latched,
locked, 0, 0, group);
mask = xkb_state_serialize_mods(input->xkb.state,
XKB_STATE_DEPRESSED | XKB_STATE_LATCHED);
input->modifiers = 0;
/* The Ecore_Event_Modifiers don't quite match the X mask bits */
if (mask & input->xkb.control_mask)
input->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
if (mask & input->xkb.alt_mask)
input->modifiers |= ECORE_EVENT_MODIFIER_ALT;
if (mask & input->xkb.shift_mask)
input->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
}
static Eina_Bool