summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2013-06-07 15:32:19 +0100
committerChris Michael <cp.michael@samsung.com>2013-06-07 15:42:53 +0100
commit92a649e35bba30eca7d27e8ae3d345df4bafa5f5 (patch)
tree247ed13d44d744ef7c7cb98fa3171a413f0e9ea6
parentff73dd600b4fb2e02e9b9f49bff77f63bdbad7de (diff)
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>
-rw-r--r--src/lib/ecore_wayland/ecore_wl_input.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl_input.c b/src/lib/ecore_wayland/ecore_wl_input.c
index 47aa84fdba..e07804a805 100644
--- a/src/lib/ecore_wayland/ecore_wl_input.c
+++ b/src/lib/ecore_wayland/ecore_wl_input.c
@@ -590,7 +590,6 @@ _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard EINA_UN
590 unsigned int code, num; 590 unsigned int code, num;
591 const xkb_keysym_t *syms; 591 const xkb_keysym_t *syms;
592 xkb_keysym_t sym = XKB_KEY_NoSymbol; 592 xkb_keysym_t sym = XKB_KEY_NoSymbol;
593 xkb_mod_mask_t mask;
594 char string[32], key[32], keyname[32];// compose[32]; 593 char string[32], key[32], keyname[32];// compose[32];
595 Ecore_Event_Key *e; 594 Ecore_Event_Key *e;
596 struct itimerspec ts; 595 struct itimerspec ts;
@@ -608,20 +607,9 @@ _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard EINA_UN
608 if ((!win) || (win->keyboard_device != input) || (!input->xkb.state)) 607 if ((!win) || (win->keyboard_device != input) || (!input->xkb.state))
609 return; 608 return;
610 609
611 mask = xkb_state_serialize_mods(input->xkb.state,
612 XKB_STATE_DEPRESSED | XKB_STATE_LATCHED);
613
614 input->modifiers = 0;
615
616 /* The Ecore_Event_Modifiers don't quite match the X mask bits */
617 if (mask & input->xkb.control_mask)
618 input->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
619 if (mask & input->xkb.alt_mask)
620 input->modifiers |= ECORE_EVENT_MODIFIER_ALT;
621 if (mask & input->xkb.shift_mask)
622 input->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
623
624 num = xkb_key_get_syms(input->xkb.state, code, &syms); 610 num = xkb_key_get_syms(input->xkb.state, code, &syms);
611
612 sym = XKB_KEY_NoSymbol;
625 if (num == 1) sym = syms[0]; 613 if (num == 1) sym = syms[0];
626 614
627 memset(key, 0, sizeof(key)); 615 memset(key, 0, sizeof(key));
@@ -639,6 +627,14 @@ _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard EINA_UN
639 * non-printable characters */ 627 * non-printable characters */
640 if ((sym == XKB_KEY_Tab) || (sym == XKB_KEY_ISO_Left_Tab)) 628 if ((sym == XKB_KEY_Tab) || (sym == XKB_KEY_ISO_Left_Tab))
641 string[len++] = '\t'; 629 string[len++] = '\t';
630 /* else if ((sym == XKB_KEY_Control_L) || (sym == XKB_KEY_Control_R)) */
631 /* string[len++] = '\'; */
632 else
633 {
634 printf("Non Printable Key\n");
635 printf("\tKey: %s\n", key);
636 printf("\tKeyname: %s\n", keyname);
637 }
642 } 638 }
643 639
644 /* FIXME: NB: Start hacking on compose key support */ 640 /* 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
685 681
686 timerfd_settime(input->repeat.timerfd, 0, &ts, NULL); 682 timerfd_settime(input->repeat.timerfd, 0, &ts, NULL);
687 } 683 }
688 else if ((state) && 684 else if ((state)) //&&
689 ((!input->repeat.key) || 685 /* ((!input->repeat.key) || */
690 ((keycode) && (keycode != input->repeat.key)))) 686 /* ((keycode) && (keycode != input->repeat.key)))) */
691 { 687 {
692 input->repeat.sym = sym; 688 input->repeat.sym = sym;
693 input->repeat.key = keycode; 689 input->repeat.key = keycode;
@@ -709,12 +705,26 @@ static void
709_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) 705_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)
710{ 706{
711 Ecore_Wl_Input *input; 707 Ecore_Wl_Input *input;
708 xkb_mod_mask_t mask;
712 709
713 LOGFN(__FILE__, __LINE__, __FUNCTION__); 710 LOGFN(__FILE__, __LINE__, __FUNCTION__);
714 711
715 if (!(input = data)) return; 712 if (!(input = data)) return;
713
716 xkb_state_update_mask(input->xkb.state, depressed, latched, 714 xkb_state_update_mask(input->xkb.state, depressed, latched,
717 locked, 0, 0, group); 715 locked, 0, 0, group);
716
717 mask = xkb_state_serialize_mods(input->xkb.state,
718 XKB_STATE_DEPRESSED | XKB_STATE_LATCHED);
719
720 input->modifiers = 0;
721 /* The Ecore_Event_Modifiers don't quite match the X mask bits */
722 if (mask & input->xkb.control_mask)
723 input->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
724 if (mask & input->xkb.alt_mask)
725 input->modifiers |= ECORE_EVENT_MODIFIER_ALT;
726 if (mask & input->xkb.shift_mask)
727 input->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
718} 728}
719 729
720static Eina_Bool 730static Eina_Bool