summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/elput/Elput.h8
-rw-r--r--src/lib/elput/elput_evdev.c77
-rw-r--r--src/lib/elput/elput_private.h3
3 files changed, 0 insertions, 88 deletions
diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
index c434a12859..b5145d7f81 100644
--- a/src/lib/elput/Elput.h
+++ b/src/lib/elput/Elput.h
@@ -73,13 +73,6 @@ typedef struct _Elput_Event_Seat_Frame
73 Elput_Seat *seat; 73 Elput_Seat *seat;
74} Elput_Event_Seat_Frame; 74} Elput_Event_Seat_Frame;
75 75
76/* structure to represent event for seat keymap changes */
77typedef struct _Elput_Event_Keymap_Send
78{
79 int fd, format;
80 size_t size;
81} Elput_Event_Keymap_Send;
82
83/* structure to represent event for seat modifiers changes */ 76/* structure to represent event for seat modifiers changes */
84typedef struct _Elput_Event_Modifiers_Send 77typedef struct _Elput_Event_Modifiers_Send
85{ 78{
@@ -122,7 +115,6 @@ typedef struct Elput_Event_Pointer_Motion
122 115
123EAPI extern int ELPUT_EVENT_SEAT_CAPS; 116EAPI extern int ELPUT_EVENT_SEAT_CAPS;
124EAPI extern int ELPUT_EVENT_SEAT_FRAME; 117EAPI extern int ELPUT_EVENT_SEAT_FRAME;
125EAPI extern int ELPUT_EVENT_KEYMAP_SEND;
126EAPI extern int ELPUT_EVENT_MODIFIERS_SEND; 118EAPI extern int ELPUT_EVENT_MODIFIERS_SEND;
127EAPI extern int ELPUT_EVENT_DEVICE_CHANGE; 119EAPI extern int ELPUT_EVENT_DEVICE_CHANGE;
128EAPI extern int ELPUT_EVENT_SESSION_ACTIVE; 120EAPI extern int ELPUT_EVENT_SESSION_ACTIVE;
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index 4364d48c75..a03ec914e0 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -65,42 +65,10 @@ _keyboard_modifiers_update(Elput_Keyboard *kbd, Elput_Seat *seat)
65 seat->modifiers |= ECORE_EVENT_MODIFIER_ALTGR; 65 seat->modifiers |= ECORE_EVENT_MODIFIER_ALTGR;
66} 66}
67 67
68static int
69_keyboard_fd_get(off_t size)
70{
71 Eina_Tmpstr *fullname;
72 int fd = 0;
73 Efl_Vpath_File *file_obj;
74
75 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
76 "(:run:)/elput-keymap-XXXXXX");
77 fd = eina_file_mkstemp(efl_vpath_file_result_get(file_obj), &fullname);
78 efl_del(file_obj);
79
80 if (fd < 0) return -1;
81
82 if (!eina_file_close_on_exec(fd, EINA_TRUE))
83 {
84 close(fd);
85 return -1;
86 }
87
88 if (ftruncate(fd, size) < 0)
89 {
90 close(fd);
91 return -1;
92 }
93
94 unlink(fullname);
95 eina_tmpstr_del(fullname);
96 return fd;
97}
98
99static Elput_Keyboard_Info * 68static Elput_Keyboard_Info *
100_keyboard_info_create(struct xkb_keymap *keymap) 69_keyboard_info_create(struct xkb_keymap *keymap)
101{ 70{
102 Elput_Keyboard_Info *info; 71 Elput_Keyboard_Info *info;
103 char *str;
104 72
105 info = calloc(1, sizeof(Elput_Keyboard_Info)); 73 info = calloc(1, sizeof(Elput_Keyboard_Info));
106 if (!info) return NULL; 74 if (!info) return NULL;
@@ -121,32 +89,7 @@ _keyboard_info_create(struct xkb_keymap *keymap)
121 info->mods.altgr = 89 info->mods.altgr =
122 1 << xkb_keymap_mod_get_index(info->keymap.map, "ISO_Level3_Shift"); 90 1 << xkb_keymap_mod_get_index(info->keymap.map, "ISO_Level3_Shift");
123 91
124 str = xkb_keymap_get_as_string(info->keymap.map, XKB_KEYMAP_FORMAT_TEXT_V1);
125 if (!str) goto err;
126
127 info->keymap.size = strlen(str) + 1;
128
129 info->keymap.fd = _keyboard_fd_get(info->keymap.size);
130 if (info->keymap.fd < 0) goto err_fd;
131
132 info->keymap.area =
133 mmap(NULL, info->keymap.size, PROT_READ | PROT_WRITE,
134 MAP_SHARED, info->keymap.fd, 0);
135 if (info->keymap.area == MAP_FAILED) goto err_map;
136
137 strcpy(info->keymap.area, str);
138 free(str);
139
140 return info; 92 return info;
141
142err_map:
143 close(info->keymap.fd);
144err_fd:
145 free(str);
146err:
147 xkb_keymap_unref(info->keymap.map);
148 free(info);
149 return NULL;
150} 93}
151 94
152static void 95static void
@@ -156,9 +99,6 @@ _keyboard_info_destroy(Elput_Keyboard_Info *info)
156 99
157 xkb_keymap_unref(info->keymap.map); 100 xkb_keymap_unref(info->keymap.map);
158 101
159 if (info->keymap.area) munmap(info->keymap.area, info->keymap.size);
160 if (info->keymap.fd >= 0) close(info->keymap.fd);
161
162 free(info); 102 free(info);
163} 103}
164 104
@@ -353,21 +293,6 @@ _keyboard_key_send(Elput_Device *dev, enum libinput_key_state state, const char
353} 293}
354 294
355static void 295static void
356_keyboard_keymap_send(Elput_Keyboard_Info *info)
357{
358 Elput_Event_Keymap_Send *ev;
359
360 ev = calloc(1, sizeof(Elput_Event_Keymap_Send));
361 if (!ev) return;
362
363 ev->fd = info->keymap.fd;
364 ev->size = info->keymap.size;
365 ev->format = XKB_KEYMAP_FORMAT_TEXT_V1;
366
367 ecore_event_add(ELPUT_EVENT_KEYMAP_SEND, ev, NULL, NULL);
368}
369
370static void
371_keyboard_modifiers_send(Elput_Keyboard *kbd) 296_keyboard_modifiers_send(Elput_Keyboard *kbd)
372{ 297{
373 Elput_Event_Modifiers_Send *ev; 298 Elput_Event_Modifiers_Send *ev;
@@ -453,7 +378,6 @@ _keyboard_keymap_update(Elput_Seat *seat)
453 _keyboard_compose_init(kbd); 378 _keyboard_compose_init(kbd);
454 379
455 _keyboard_modifiers_update(kbd, seat); 380 _keyboard_modifiers_update(kbd, seat);
456 _keyboard_keymap_send(kbd->info);
457 381
458 if ((!latched) && (!locked)) return; 382 if ((!latched) && (!locked)) return;
459 383
@@ -475,7 +399,6 @@ _keyboard_group_update(Elput_Seat *seat)
475 _keyboard_compose_init(kbd); 399 _keyboard_compose_init(kbd);
476 400
477 _keyboard_modifiers_update(kbd, seat); 401 _keyboard_modifiers_update(kbd, seat);
478 _keyboard_keymap_send(kbd->info);
479 402
480 if ((!latched) && (!locked)) return; 403 if ((!latched) && (!locked)) return;
481 404
diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h
index 6b253d2fae..54ef2c2ba0 100644
--- a/src/lib/elput/elput_private.h
+++ b/src/lib/elput/elput_private.h
@@ -92,9 +92,6 @@ typedef struct _Elput_Keyboard_Info
92 92
93 struct 93 struct
94 { 94 {
95 int fd;
96 size_t size;
97 char *area;
98 struct xkb_keymap *map; 95 struct xkb_keymap *map;
99 } keymap; 96 } keymap;
100 97