EAPI extern int ECORE_EVENT_DEVICE_ADD;
EAPI extern int ECORE_EVENT_DEVICE_DEL;
//
+ // TIZEN_ONLY(20180917): ecore/evas_device: update device info if subclas is changed
+ EAPI extern int ECORE_EVENT_DEVICE_SUBCLASS_UPDATE;
+ //
#define ECORE_EVENT_MODIFIER_SHIFT 0x0001
#define ECORE_EVENT_MODIFIER_CTRL 0x0002
// TIZEN_ONLY(20171206): add dummy functions for ecore_device API
typedef struct _Ecore_Event_Device_Info Ecore_Event_Device_Info;
//
+ // TIZEN_ONLY(20180917): ecore/evas_device: update device info if subclas is changed
+ typedef struct _Ecore_Event_Device_Update Ecore_Event_Device_Update;
+ //
/**
* @typedef Ecore_Event_Modifier
Ecore_Device_Subclass subclas;
};
//
+ // TIZEN_ONLY(20180917): ecore/evas_device: update device info if subclas is changed
+ struct _Ecore_Event_Device_Update
+ {
+ Ecore_Window window;
+ Ecore_Device *dev;
+ };
+ //
/**
* @struct _Ecore_Event_Joystic_Button
// TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
EAPI int ECORE_EVENT_DETENT_ROTATE = 0;
//
+// TIZEN_ONLY(20180917): ecore/evas_device: update device info if subclas is changed
+EAPI int ECORE_EVENT_DEVICE_SUBCLASS_UPDATE = 0;
+//
static int _ecore_event_init_count = 0;
ECORE_EVENT_DEVICE_ADD = ecore_event_type_new();
ECORE_EVENT_DEVICE_DEL = ecore_event_type_new();
//
+ // TIZEN_ONLY(20180917): ecore/evas_device: update device info if subclas is changed
+ ECORE_EVENT_DEVICE_SUBCLASS_UPDATE = ecore_event_type_new();
+ //
//TIZEN_ONLY(20170307) Remove warning message
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
//
// TIZEN_ONLY(20180118): support a Ecore_Device
ECORE_EVENT_DEVICE_ADD,
- ECORE_EVENT_DEVICE_DEL
+ ECORE_EVENT_DEVICE_DEL,
+ //
+ // TIZEN_ONLY(20180917): ecore/evas_device: update device info if subclas is changed
+ ECORE_EVENT_DEVICE_SUBCLASS_UPDATE
//
);
//TIZEN_ONLY(20170307) Remove warning message
};
static int _ecore_event_evas_init_count = 0;
-static Ecore_Event_Handler *ecore_event_evas_handlers[10];
+static Ecore_Event_Handler *ecore_event_evas_handlers[11];
static Eina_Hash *_window_hash = NULL;
static Eina_List *_last_events = NULL;
return ECORE_CALLBACK_PASS_ON;
}
+// TIZEN_ONLY(20180917): ecore/evas_device: update device info if subclas is changed
+static void
+_ecore_event_evas_device_update(Evas *e, const char *name EINA_UNUSED, const char *identifier, Ecore_Device_Class clas, Ecore_Device_Subclass subclas)
+{
+ const Eina_List *dev_list = NULL;
+ const Eina_List *l;
+ Evas_Device *edev = NULL;
+ char *edev_identifier;
+
+ dev_list = evas_device_list(e, NULL);
+ if (dev_list)
+ {
+ EINA_LIST_FOREACH(dev_list, l, edev)
+ {
+ edev_identifier = (char *)evas_device_description_get(edev);
+ if (!edev_identifier) continue;
+ if ((evas_device_class_get(edev) == (Evas_Device_Class)clas) &&
+ _ecore_event_evas_strcmp(edev_identifier, identifier))
+ {
+ evas_device_subclass_set(edev, (Evas_Device_Subclass)subclas);
+ break;
+ }
+ }
+ }
+}
+
+
+EAPI Eina_Bool
+ecore_event_evas_device_update(void *data EINA_UNUSED, int type, void *event)
+{
+ Ecore_Event_Device_Update *e = (Ecore_Event_Device_Update *)event;
+ Ecore_Input_Window *lookup;
+
+ lookup = _ecore_event_window_match(e->window);
+ if (!lookup) return ECORE_CALLBACK_PASS_ON;
+
+ if (type == ECORE_EVENT_DEVICE_SUBCLASS_UPDATE)
+ {
+ _ecore_event_evas_device_update(lookup->evas,
+ ecore_device_name_get(e->dev),
+ ecore_device_identifier_get(e->dev),
+ ecore_device_class_get(e->dev),
+ ecore_device_subclass_get(e->dev));
+ }
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+//
+
EAPI int
ecore_event_evas_init(void)
{
ecore_event_evas_handlers[9] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL,
ecore_event_evas_mouse_button_cancel,
NULL);
+ // TIZEN_ONLY(20180917): ecore/evas_device: update device info if subclas is changed
+ ecore_event_evas_handlers[10] = ecore_event_handler_add(ECORE_EVENT_DEVICE_SUBCLASS_UPDATE,
+ ecore_event_evas_device_update,
+ NULL);
+ //
_window_hash = eina_hash_pointer_new(free);
ecore_event_add(ECORE_EVENT_DEVICE_DEL, e, _ecore_wl2_input_device_info_free, NULL);
}
+// TIZEN_ONLY(20180917): ecore/evas_device: update device info if subclas is changed
+static void
+_ecore_wl2_input_device_update_send(Ecore_Window win, Ecore_Device *dev)
+{
+ Ecore_Event_Device_Update *ev;
+
+ ev = (Ecore_Event_Device_Update *)calloc(sizeof(Ecore_Event_Device_Update), 1);
+ EINA_SAFETY_ON_NULL_RETURN(ev);
+
+ ev->window = win;
+ ev->dev = dev;
+ ecore_event_add(ECORE_EVENT_DEVICE_SUBCLASS_UPDATE, ev, NULL, NULL);
+}
+
+
+static void
+_ecore_wl2_input_device_ecore_device_update(Ecore_Device *dev, Ecore_Device_Subclass subclas)
+{
+ Eina_Hash *windows;
+ Eina_Iterator *itr;
+ Ecore_Wl2_Window *win = NULL;
+ void *data;
+ Eina_Bool has_win = EINA_FALSE;
+
+ ecore_device_subclass_set(dev, subclas);
+
+ windows = _ecore_wl2_window_hash_get();
+ if (windows)
+ {
+ itr = eina_hash_iterator_data_new(windows);
+ while (eina_iterator_next(itr, &data))
+ {
+ win = data;
+ has_win = EINA_TRUE;
+ _ecore_wl2_input_device_update_send(win->id, dev);
+ }
+
+ eina_iterator_free(itr);
+ }
+ if (!has_win)
+ {
+ _ecore_wl2_input_device_update_send((uintptr_t)NULL, dev);
+ }
+}
+//
+
static Eina_Bool
_ecore_wl2_input_device_ecore_device_add(Ecore_Wl2_Tizen_Input_Device *dev)
{
ecdev_name = ecore_device_identifier_get(ecdev);
if (!ecdev_name) continue;
if ((ecore_device_class_get(ecdev) == dev->clas) && (!strcmp(ecdev_name, dev->identifier)))
- return EINA_FALSE;
+ {
+ // TIZEN_ONLY(20180917): ecore/evas_device: update device info if subclas is changed
+ _ecore_wl2_input_device_ecore_device_update(ecdev, dev->subclas);
+ //
+ return EINA_FALSE;
+ }
}
ecdev = ecore_device_add();