{
if (!e_input_thread_mode_get())
{
- e_comp_input_key->kbd.num_devices++;
- e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
+ e_seat_keyboard_enabled_set(seat, EINA_TRUE);
+ e_seat_keyboard_device_count_increase(seat);
}
}
else if (e->clas == ECORE_DEVICE_CLASS_TOUCH)
{
Eina_List *resources;
Eina_List *focused;
- Eina_Bool enabled : 1;
xkb_mod_index_t mod_shift, mod_caps;
xkb_mod_index_t mod_ctrl, mod_alt;
xkb_mod_index_t mod_super;
int mod_changed;
atomic_int repeat_delay;
atomic_int repeat_rate;
- unsigned int num_devices;
GRecMutex resources_mutex;
GRecMutex focused_mutex;
} kbd;
return e_input->use_thread;
}
+static void
+e_input_init_seat_caps_async_cb(void *data)
+{
+ unsigned int seat_caps = *(unsigned int *)data;
+ e_comp_wl_input_seat_caps_set(seat_caps);
+}
+
EINTERN int
e_input_init(Ecore_Evas *ee)
{
{
/* Enable some of keyboard, touch devices temporarily */
/* FIXME : get seat caps from e_input configuration or env */
+ EINA_LOG_INFO("This system uses udev backend and select to skip udev enumeration");
seat_caps = E_INPUT_SEAT_KEYBOARD | E_INPUT_SEAT_TOUCH;
- e_comp_wl_input_seat_caps_set(seat_caps);
+ ecore_main_loop_thread_safe_call_async(e_input_init_seat_caps_async_cb, (void *)seat_caps);
}
E_LIST_HANDLER_APPEND(e_input->handlers, E_EVENT_SCREEN_CHANGE, _e_input_cb_screen_change, NULL);
e_input_event_add(input_event_source, flag ? ECORE_EVENT_DEVICE_ADD : ECORE_EVENT_DEVICE_DEL, ecore_dev_info, _e_input_ecore_device_info_free, NULL);
}
+static void
+_e_input_add_ecore_device_keyboard_async_cb(void *data)
+{
+ E_Seat *seat;
+ const char *seatname = data;
+
+ seat = e_seat_find(seatname);
+ if (!seat) return;
+ e_seat_keyboard_device_count_increase(seat);
+ e_seat_keyboard_enabled_set(seat, EINA_TRUE);
+}
+
static Eina_Bool
_e_input_add_ecore_device(E_Input_Evdev *evdev, Ecore_Device_Class clas, Ecore_Device_Subclass subclas)
{
const GList *device_list = e_device_list_get();
const gchar *device_identifier;
- const char *seat_name = NULL;
+ const char *seat_name = e_input_seat_name_get(evdev->seat);
for (GList *list = g_list_first((GList *)device_list); list; list = list->next)
{
e_device_identifier_set(e_dev, evdev->path);
e_device_class_set(e_dev, clas);
e_device_subclass_set(e_dev, subclas);
- e_device_seatname_set(e_dev, e_input_evdev_seatname_get(evdev));
+ e_device_seatname_set(e_dev, seat_name);
if (e_input_thread_mode_get())
{
if (clas == ECORE_DEVICE_CLASS_KEYBOARD)
{
- e_comp_input_key->kbd.num_devices++;
- e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
+ ecore_main_loop_thread_safe_call_async(_e_input_add_ecore_device_keyboard_async_cb, (void *)seat_name);
}
}
INF("[Add Device] device name(%s), identifier(%s), class(%s), subclass(%d), seatname(%s)", e_device_name_get(e_dev), evdev->path, _e_input_ecore_device_class_to_string(clas), subclas, e_device_seatname_get(e_dev));
- _e_input_device_event_add(evdev->name, evdev->path, e_input_seat_name_get(evdev->seat), clas, subclas, EINA_TRUE);
+ _e_input_device_event_add(evdev->name, evdev->path, seat_name, clas, subclas, EINA_TRUE);
dev_info = E_NEW(E_Device_Info, 1);
EINA_SAFETY_ON_NULL_RETURN_VAL(dev_info, EINA_FALSE);
dev_info->evdev = evdev;
dev_info->clas = clas;
dev_info->subclas = subclas;
- seat_name = e_device_seatname_get(e_dev);
dev_info->seatname = seat_name ? strdup(seat_name) : NULL;
ecore_main_loop_thread_safe_call_async(_e_input_add_ecore_device_async_cb, dev_info);
E_FREE(dev_info);
}
+
+static void
+_e_input_remove_ecore_device_keyboard_async_cb(void *data)
+{
+ E_Seat *seat;
+ const char *seatname = data;
+
+ seat = e_seat_find(seatname);
+ if (!seat) return;
+ e_seat_keyboard_device_count_decrease(seat);
+ if (e_seat_keyboard_device_count(seat) == 0)
+ e_seat_keyboard_enabled_set(seat, EINA_FALSE);
+}
+
static Eina_Bool
_e_input_remove_ecore_device(E_Input_Evdev *evdev, Ecore_Device_Class clas)
{
const gchar *device_identifier;
const char *device_remove_log = NULL;
E_Device_Info *dev_info = NULL;
+ const char *seat_name = e_input_seat_name_get(evdev->seat);
e_dev_list = e_device_list_get();
if (!e_dev_list)
{
if (clas == ECORE_DEVICE_CLASS_KEYBOARD)
{
- e_comp_input_key->kbd.num_devices--;
- if (e_comp_input_key->kbd.num_devices == 0)
- e_comp_wl_input_keyboard_enabled_set(EINA_FALSE);
+ ecore_main_loop_thread_safe_call_async(_e_input_remove_ecore_device_keyboard_async_cb, (void *)seat_name);
}
device_remove_log = eina_stringshare_printf("[Remove Device] device name(%s), identifier(%s), class(%s), subclass(%d), seatname(%s)",
e_device_subclass_get(device),
e_device_seatname_get(device));
- _e_input_device_event_add(e_device_name_get(device), device_identifier, e_input_seat_name_get(evdev->seat), clas, e_device_subclass_get(device), EINA_FALSE);
+ _e_input_device_event_add(e_device_name_get(device), device_identifier, seat_name, clas, e_device_subclass_get(device), EINA_FALSE);
if (evdev->e_dev)
{
comp_wl = e_comp_wl_get();
- if (e_comp_input_key->kbd.enabled)
+ if (e_seat_keyboard_enabled_get(NULL))
focus = e_comp_input_key->kbd.focus;
if (focus)
comp_wl->clipboard.xwl_owner = NULL;
comp_wl->selection.serial = serial;
- if (e_comp_input_key->kbd.enabled)
+ if (e_seat_keyboard_enabled_get(NULL))
focus = e_comp_input_key->kbd.focus;
//if source is from cbhm_client do not create data offer for cbhm
E_Comp_Wl_Data_Source *source;
E_Comp_Wl_Data *comp_wl;
- if (!e_comp_input_key->kbd.enabled)
+ if (e_seat_keyboard_enabled_get(NULL))
{
ERR("Keyboard not enabled");
return;
e_comp_wl_input_keyboard_modifiers_update();
}
-static void
-_e_comp_wl_input_thread_cb_keyboard_enabled_set(void *data)
-{
- Eina_Bool enabled;
- EINA_SAFETY_ON_NULL_RETURN(data);
-
- enabled = *(Eina_Bool *)data;
-
- e_comp_input_key->kbd.enabled = !!enabled;
-}
-
-EINTERN void
-e_comp_wl_input_keyboard_enabled_set(Eina_Bool enabled)
-{
- E_Comp_Wl_Data *comp_wl = e_comp_wl_get();
- /* check for valid compositor data */
- if (!comp_wl)
- {
- ERR("No compositor data");
- return;
- }
-
- e_input_backend_thread_safe_call(_e_comp_wl_input_thread_cb_keyboard_enabled_set, &enabled, sizeof(Eina_Bool));
- e_seat_update_seat_caps(NULL, NULL);
-}
-
E_API Eina_Bool
e_comp_wl_input_keymap_cache_file_use_get(void)
{
}
if (caps & E_INPUT_SEAT_KEYBOARD)
- e_comp_input_key->kbd.enabled = need_update = EINA_TRUE;
+ {
+ need_update = EINA_TRUE;
+ e_seat_keyboard_enabled_set(seat, need_update);
+ }
if (caps & E_INPUT_SEAT_TOUCH)
{
unsigned int num_devices;
} touch;
+ struct
+ {
+ Eina_Bool enabled : 1;
+ unsigned int num_devices;
+ } kbd;
E_Zone *zone;
};
if (seat->ptr.enabled)
caps |= WL_SEAT_CAPABILITY_POINTER;
- if (e_comp_input_key->kbd.enabled)
+ if (seat->kbd.enabled)
caps |= WL_SEAT_CAPABILITY_KEYBOARD;
if (seat->touch.enabled)
caps |= WL_SEAT_CAPABILITY_TOUCH;
seat->ptr.num_devices--;
}
+EINTERN void
+e_seat_keyboard_enabled_set(E_Seat *seat, Eina_Bool enabled)
+{
+ if (!seat) return;
+
+ seat->kbd.enabled = !!enabled;
+ e_seat_update_seat_caps(seat, NULL);
+}
+
+EINTERN Eina_Bool
+e_seat_keyboard_enabled_get(E_Seat *seat)
+{
+ E_Seat *s;
+
+ if (!seat) s = _current_seat;
+ else s = seat;
+
+ if (s->kbd.enabled) return EINA_TRUE;
+
+ return EINA_FALSE;
+}
+
+EINTERN unsigned int
+e_seat_keyboard_device_count(E_Seat *seat)
+{
+ return seat->kbd.num_devices;
+}
+
+EINTERN void
+e_seat_keyboard_device_count_increase(E_Seat *seat)
+{
+ seat->kbd.num_devices++;
+}
+
+EINTERN void
+e_seat_keyboard_device_count_decrease(E_Seat *seat)
+{
+ seat->kbd.num_devices--;
+}
+
EINTERN Eina_Bool
e_seat_keyboard_check(struct wl_resource *res)
{
EINTERN void e_seat_pointer_device_count_increase(E_Seat *seat);
EINTERN void e_seat_pointer_device_count_decrease(E_Seat *seat);
+EINTERN void e_seat_keyboard_enabled_set(E_Seat *seat, Eina_Bool enabled);
+EINTERN Eina_Bool e_seat_keyboard_enabled_get(E_Seat *seat);
EINTERN Eina_Bool e_seat_keyboard_check(struct wl_resource *res);
+EINTERN unsigned int e_seat_keyboard_device_count(E_Seat *seat);
+EINTERN void e_seat_keyboard_device_count_increase(E_Seat *seat);
+EINTERN void e_seat_keyboard_device_count_decrease(E_Seat *seat);
EINTERN Eina_List *e_seat_resources_get(E_Seat *seat);
EINTERN void e_seat_current_set(E_Seat *seat);