summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm/ecore_drm_evdev.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2015-02-26 21:51:00 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-02-26 21:51:00 -0500
commita57df757a8031bb92b35edca602f7e1c212059ca (patch)
tree80aeb45b7f0f9697331d8e327aa6e4b7ffd21b74 /src/lib/ecore_drm/ecore_drm_evdev.c
parent6d5b2b32a0d1e2d7f2c7b46d4a0adc09d5c35ef6 (diff)
ecore-drm modifier updating is now functional
when dealing with non-kbd devices, the seat can be iterated to locate a keyboard this may or may not accurately set depressed, latched, locked, group values
Diffstat (limited to '')
-rw-r--r--src/lib/ecore_drm/ecore_drm_evdev.c73
1 files changed, 41 insertions, 32 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c b/src/lib/ecore_drm/ecore_drm_evdev.c
index 2358a8d35b..8320c30ed9 100644
--- a/src/lib/ecore_drm/ecore_drm_evdev.c
+++ b/src/lib/ecore_drm/ecore_drm_evdev.c
@@ -181,43 +181,62 @@ _device_keysym_translate(xkb_keysym_t keysym, unsigned int modifiers, char *buff
181 return 1; 181 return 1;
182} 182}
183 183
184static void 184static void
185_device_modifiers_update(Ecore_Drm_Evdev *edev) 185_device_modifiers_update_device(Ecore_Drm_Evdev *edev, Ecore_Drm_Evdev *from)
186{ 186{
187 xkb_mod_mask_t mask; 187 xkb_mod_mask_t mask;
188 188
189 edev->xkb.modifiers = 0;
190
191 edev->xkb.depressed = 189 edev->xkb.depressed =
192 xkb_state_serialize_mods(edev->xkb.state, XKB_STATE_DEPRESSED); 190 xkb_state_serialize_mods(from->xkb.state, XKB_STATE_DEPRESSED);
193 edev->xkb.latched = 191 edev->xkb.latched =
194 xkb_state_serialize_mods(edev->xkb.state, XKB_STATE_LATCHED); 192 xkb_state_serialize_mods(from->xkb.state, XKB_STATE_LATCHED);
195 edev->xkb.locked = 193 edev->xkb.locked =
196 xkb_state_serialize_mods(edev->xkb.state, XKB_STATE_LOCKED); 194 xkb_state_serialize_mods(from->xkb.state, XKB_STATE_LOCKED);
197 edev->xkb.group = 195 edev->xkb.group =
198 xkb_state_serialize_mods(edev->xkb.state, XKB_STATE_EFFECTIVE); 196 xkb_state_serialize_mods(from->xkb.state, XKB_STATE_EFFECTIVE);
199 197
200 mask = (edev->xkb.depressed | edev->xkb.latched); 198 mask = (edev->xkb.depressed | edev->xkb.latched);
201 199
202 if (mask & edev->xkb.ctrl_mask) 200 if (mask & from->xkb.ctrl_mask)
203 edev->xkb.modifiers |= ECORE_EVENT_MODIFIER_CTRL; 201 edev->xkb.modifiers |= ECORE_EVENT_MODIFIER_CTRL;
204 if (mask & edev->xkb.alt_mask) 202 if (mask & from->xkb.alt_mask)
205 edev->xkb.modifiers |= ECORE_EVENT_MODIFIER_ALT; 203 edev->xkb.modifiers |= ECORE_EVENT_MODIFIER_ALT;
206 if (mask & edev->xkb.shift_mask) 204 if (mask & from->xkb.shift_mask)
207 edev->xkb.modifiers |= ECORE_EVENT_MODIFIER_SHIFT; 205 edev->xkb.modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
208 if (mask & edev->xkb.win_mask) 206 if (mask & from->xkb.win_mask)
209 edev->xkb.modifiers |= ECORE_EVENT_MODIFIER_WIN; 207 edev->xkb.modifiers |= ECORE_EVENT_MODIFIER_WIN;
210 if (mask & edev->xkb.scroll_mask) 208 if (mask & from->xkb.scroll_mask)
211 edev->xkb.modifiers |= ECORE_EVENT_LOCK_SCROLL; 209 edev->xkb.modifiers |= ECORE_EVENT_LOCK_SCROLL;
212 if (mask & edev->xkb.num_mask) 210 if (mask & from->xkb.num_mask)
213 edev->xkb.modifiers |= ECORE_EVENT_LOCK_NUM; 211 edev->xkb.modifiers |= ECORE_EVENT_LOCK_NUM;
214 if (mask & edev->xkb.caps_mask) 212 if (mask & from->xkb.caps_mask)
215 edev->xkb.modifiers |= ECORE_EVENT_LOCK_CAPS; 213 edev->xkb.modifiers |= ECORE_EVENT_LOCK_CAPS;
216 if (mask & edev->xkb.altgr_mask) 214 if (mask & from->xkb.altgr_mask)
217 edev->xkb.modifiers |= ECORE_EVENT_MODIFIER_ALTGR; 215 edev->xkb.modifiers |= ECORE_EVENT_MODIFIER_ALTGR;
218} 216}
219 217
220static void 218static void
219_device_modifiers_update(Ecore_Drm_Evdev *edev)
220{
221 edev->xkb.modifiers = 0;
222
223 if (edev->seat_caps & EVDEV_SEAT_KEYBOARD)
224 _device_modifiers_update_device(edev, edev);
225 else
226 {
227 Eina_List *l;
228 Ecore_Drm_Evdev *ed;
229
230 EINA_LIST_FOREACH(edev->seat->devices, l, ed)
231 {
232 if (!(ed->seat_caps & EVDEV_SEAT_KEYBOARD)) continue;
233 _device_modifiers_update_device(edev, ed);
234 }
235 }
236
237}
238
239static void
221_device_handle_key(struct libinput_device *device, struct libinput_event_keyboard *event) 240_device_handle_key(struct libinput_device *device, struct libinput_event_keyboard *event)
222{ 241{
223 Ecore_Drm_Evdev *edev; 242 Ecore_Drm_Evdev *edev;
@@ -345,9 +364,7 @@ _device_pointer_motion(Ecore_Drm_Evdev *edev, struct libinput_event_pointer *eve
345 ev->timestamp = libinput_event_pointer_get_time(event); 364 ev->timestamp = libinput_event_pointer_get_time(event);
346 ev->same_screen = 1; 365 ev->same_screen = 1;
347 366
348 /* NB: Commented out. This borks mouse movement if no key has been 367 _device_modifiers_update(edev);
349 * pressed yet due to 'state' not being set */
350// _device_modifiers_update(dev);
351 ev->modifiers = edev->xkb.modifiers; 368 ev->modifiers = edev->xkb.modifiers;
352 369
353 ev->x = edev->mouse.x; 370 ev->x = edev->mouse.x;
@@ -427,9 +444,7 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin
427 ev->timestamp = timestamp; 444 ev->timestamp = timestamp;
428 ev->same_screen = 1; 445 ev->same_screen = 1;
429 446
430 /* NB: Commented out. This borks mouse button if no key has been 447 _device_modifiers_update(edev);
431 * pressed yet due to 'state' not being set */
432// _device_modifiers_update(dev);
433 ev->modifiers = edev->xkb.modifiers; 448 ev->modifiers = edev->xkb.modifiers;
434 449
435 ev->x = edev->mouse.x; 450 ev->x = edev->mouse.x;
@@ -511,9 +526,7 @@ _device_handle_axis(struct libinput_device *device, struct libinput_event_pointe
511 ev->timestamp = timestamp; 526 ev->timestamp = timestamp;
512 ev->same_screen = 1; 527 ev->same_screen = 1;
513 528
514 /* NB: Commented out. This borks mouse wheel if no key has been 529 _device_modifiers_update(edev);
515 * pressed yet due to 'state' not being set */
516// _device_modifiers_update(dev);
517 ev->modifiers = edev->xkb.modifiers; 530 ev->modifiers = edev->xkb.modifiers;
518 531
519 ev->x = edev->mouse.x; 532 ev->x = edev->mouse.x;
@@ -624,9 +637,7 @@ _device_handle_touch_event(Ecore_Drm_Evdev *edev, struct libinput_event_touch *e
624 ev->timestamp = timestamp; 637 ev->timestamp = timestamp;
625 ev->same_screen = 1; 638 ev->same_screen = 1;
626 639
627 /* NB: Commented out. This borks mouse button if no key has been 640 _device_modifiers_update(edev);
628 * pressed yet due to 'state' not being set */
629// _device_modifiers_update(dev);
630 ev->modifiers = edev->xkb.modifiers; 641 ev->modifiers = edev->xkb.modifiers;
631 642
632 ev->x = edev->mouse.x; 643 ev->x = edev->mouse.x;
@@ -725,10 +736,8 @@ _device_handle_touch_motion(struct libinput_device *device, struct libinput_even
725 ev->timestamp = libinput_event_touch_get_time(event); 736 ev->timestamp = libinput_event_touch_get_time(event);
726 ev->same_screen = 1; 737 ev->same_screen = 1;
727 738
728 /* NB: Commented out. This borks mouse movement if no key has been 739 _device_modifiers_update(edev);
729 * pressed yet due to 'state' not being set */ 740 ev->modifiers = edev->xkb.modifiers;
730// _device_modifiers_update(dev);
731// ev->modifiers = edev->xkb.modifiers;
732 ev->modifiers = 0; 741 ev->modifiers = 0;
733 742
734 ev->x = edev->mouse.x; 743 ev->x = edev->mouse.x;