elput: remove keymap mmap+event

this was originally intended to allow some code to be moved out of the
compositor, but the idea turned out to be unfeasible since multiple
display backends need to be supported and not all related components
will provide similar functionality
This commit is contained in:
Mike Blumenkrantz 2017-06-16 15:03:09 -04:00
parent cad9d8fb55
commit ad0aae8f8d
3 changed files with 0 additions and 88 deletions

View File

@ -73,13 +73,6 @@ typedef struct _Elput_Event_Seat_Frame
Elput_Seat *seat;
} Elput_Event_Seat_Frame;
/* structure to represent event for seat keymap changes */
typedef struct _Elput_Event_Keymap_Send
{
int fd, format;
size_t size;
} Elput_Event_Keymap_Send;
/* structure to represent event for seat modifiers changes */
typedef struct _Elput_Event_Modifiers_Send
{
@ -122,7 +115,6 @@ typedef struct Elput_Event_Pointer_Motion
EAPI extern int ELPUT_EVENT_SEAT_CAPS;
EAPI extern int ELPUT_EVENT_SEAT_FRAME;
EAPI extern int ELPUT_EVENT_KEYMAP_SEND;
EAPI extern int ELPUT_EVENT_MODIFIERS_SEND;
EAPI extern int ELPUT_EVENT_DEVICE_CHANGE;
EAPI extern int ELPUT_EVENT_SESSION_ACTIVE;

View File

@ -65,42 +65,10 @@ _keyboard_modifiers_update(Elput_Keyboard *kbd, Elput_Seat *seat)
seat->modifiers |= ECORE_EVENT_MODIFIER_ALTGR;
}
static int
_keyboard_fd_get(off_t size)
{
Eina_Tmpstr *fullname;
int fd = 0;
Efl_Vpath_File *file_obj;
file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS,
"(:run:)/elput-keymap-XXXXXX");
fd = eina_file_mkstemp(efl_vpath_file_result_get(file_obj), &fullname);
efl_del(file_obj);
if (fd < 0) return -1;
if (!eina_file_close_on_exec(fd, EINA_TRUE))
{
close(fd);
return -1;
}
if (ftruncate(fd, size) < 0)
{
close(fd);
return -1;
}
unlink(fullname);
eina_tmpstr_del(fullname);
return fd;
}
static Elput_Keyboard_Info *
_keyboard_info_create(struct xkb_keymap *keymap)
{
Elput_Keyboard_Info *info;
char *str;
info = calloc(1, sizeof(Elput_Keyboard_Info));
if (!info) return NULL;
@ -121,32 +89,7 @@ _keyboard_info_create(struct xkb_keymap *keymap)
info->mods.altgr =
1 << xkb_keymap_mod_get_index(info->keymap.map, "ISO_Level3_Shift");
str = xkb_keymap_get_as_string(info->keymap.map, XKB_KEYMAP_FORMAT_TEXT_V1);
if (!str) goto err;
info->keymap.size = strlen(str) + 1;
info->keymap.fd = _keyboard_fd_get(info->keymap.size);
if (info->keymap.fd < 0) goto err_fd;
info->keymap.area =
mmap(NULL, info->keymap.size, PROT_READ | PROT_WRITE,
MAP_SHARED, info->keymap.fd, 0);
if (info->keymap.area == MAP_FAILED) goto err_map;
strcpy(info->keymap.area, str);
free(str);
return info;
err_map:
close(info->keymap.fd);
err_fd:
free(str);
err:
xkb_keymap_unref(info->keymap.map);
free(info);
return NULL;
}
static void
@ -156,9 +99,6 @@ _keyboard_info_destroy(Elput_Keyboard_Info *info)
xkb_keymap_unref(info->keymap.map);
if (info->keymap.area) munmap(info->keymap.area, info->keymap.size);
if (info->keymap.fd >= 0) close(info->keymap.fd);
free(info);
}
@ -352,21 +292,6 @@ _keyboard_key_send(Elput_Device *dev, enum libinput_key_state state, const char
ecore_event_add(ECORE_EVENT_KEY_UP, ev, _event_free, ev->dev);
}
static void
_keyboard_keymap_send(Elput_Keyboard_Info *info)
{
Elput_Event_Keymap_Send *ev;
ev = calloc(1, sizeof(Elput_Event_Keymap_Send));
if (!ev) return;
ev->fd = info->keymap.fd;
ev->size = info->keymap.size;
ev->format = XKB_KEYMAP_FORMAT_TEXT_V1;
ecore_event_add(ELPUT_EVENT_KEYMAP_SEND, ev, NULL, NULL);
}
static void
_keyboard_modifiers_send(Elput_Keyboard *kbd)
{
@ -453,7 +378,6 @@ _keyboard_keymap_update(Elput_Seat *seat)
_keyboard_compose_init(kbd);
_keyboard_modifiers_update(kbd, seat);
_keyboard_keymap_send(kbd->info);
if ((!latched) && (!locked)) return;
@ -475,7 +399,6 @@ _keyboard_group_update(Elput_Seat *seat)
_keyboard_compose_init(kbd);
_keyboard_modifiers_update(kbd, seat);
_keyboard_keymap_send(kbd->info);
if ((!latched) && (!locked)) return;

View File

@ -92,9 +92,6 @@ typedef struct _Elput_Keyboard_Info
struct
{
int fd;
size_t size;
char *area;
struct xkb_keymap *map;
} keymap;