forked from enlightenment/efl
evas: Remove device "parent", "name" and "description" properties
Those are now merged with Efl.Object parent, name and comment. The reasoning is that only seats can be parent devices; And name and description are not only name clashes but also not extremely useful anyway. Tested with VNC. Fixes T5540
This commit is contained in:
parent
67295ed747
commit
83d18617b4
|
@ -56,11 +56,11 @@ _mouse_pos_print(void *data)
|
|||
if (!seat)
|
||||
{
|
||||
fprintf(stderr, "Could not fetch the seat from mouse '%s'\n",
|
||||
efl_input_device_name_get(pointer));
|
||||
efl_name_get(pointer));
|
||||
continue;
|
||||
}
|
||||
printf("Mouse from seat '%s' is at (%d, %d)\n",
|
||||
efl_input_device_name_get(seat), x, y);
|
||||
efl_name_get(seat), x, y);
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -109,14 +109,14 @@ _seat_children_print(Efl_Input_Device *seat)
|
|||
Efl_Input_Device *child;
|
||||
Eina_Iterator *it;
|
||||
|
||||
printf("Children of seat: %s (%s, seat id: %d)\n", efl_input_device_name_get(seat),
|
||||
printf("Children of seat: %s (%s, seat id: %d)\n", efl_name_get(seat),
|
||||
_device_type_to_string(efl_input_device_type_get(seat)),
|
||||
efl_input_device_seat_id_get(seat));
|
||||
|
||||
it = efl_input_device_children_iterate(seat);
|
||||
EINA_ITERATOR_FOREACH(it, child)
|
||||
{
|
||||
printf(" - Sub device: %s (%s, seat id: %d)\n", efl_input_device_name_get(child),
|
||||
printf(" - Sub device: %s (%s, seat id: %d)\n", efl_name_get(child),
|
||||
_device_type_to_string(efl_input_device_type_get(child)),
|
||||
efl_input_device_seat_id_get(seat));
|
||||
}
|
||||
|
@ -135,10 +135,10 @@ _device_added(void *data, const Efl_Event *event)
|
|||
if (!seat)
|
||||
{
|
||||
fprintf(stderr, "Could not fetch the seat from pointer '%s'\n",
|
||||
efl_input_device_name_get(pointer));
|
||||
efl_name_get(pointer));
|
||||
return;
|
||||
}
|
||||
printf("Setting cursor image at seat '%s'\n", efl_input_device_name_get(seat));
|
||||
printf("Setting cursor image at seat '%s'\n", efl_name_get(seat));
|
||||
_cursor_set(data, pointer);
|
||||
_seat_children_print(seat);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ _keyboard_event(void *data EINA_UNUSED, int type, void *event)
|
|||
seat = efl_input_device_seat_get(e->dev);
|
||||
|
||||
printf("The keyboard on seat '%s' %s the key '%s'\n", seat ?
|
||||
efl_input_device_name_get(seat) : "default",
|
||||
efl_name_get(seat) : "default",
|
||||
type == ECORE_EVENT_KEY_DOWN ? "pressed" : "released",
|
||||
e->keyname);
|
||||
|
||||
|
@ -98,7 +98,7 @@ _mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|||
seat = efl_input_device_seat_get(e->dev);
|
||||
|
||||
printf("The mouse on seat '%s' is at X: %d Y:%d\n",
|
||||
seat ? efl_input_device_name_get(seat) : "default", e->x, e->y);
|
||||
seat ? efl_name_get(seat) : "default", e->x, e->y);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ _mouse_button(void *data EINA_UNUSED, int type, void *event)
|
|||
seat = efl_input_device_seat_get(e->dev);
|
||||
|
||||
printf("The mouse on seat '%s' %s the following button '%d'\n",
|
||||
seat ? efl_input_device_name_get(seat) : "default",
|
||||
seat ? efl_name_get(seat) : "default",
|
||||
type == ECORE_EVENT_MOUSE_BUTTON_DOWN ? "pressed" : "released",
|
||||
e->buttons);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
@ -128,7 +128,7 @@ _mouse_wheel(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|||
seat = efl_input_device_seat_get(e->dev);
|
||||
|
||||
printf("The mouse on seat '%s' moved the wheel '%s'\n",
|
||||
seat ? efl_input_device_name_get(seat) : "default",
|
||||
seat ? efl_name_get(seat) : "default",
|
||||
e->z < 0 ? "up" : "down");
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
@ -165,14 +165,14 @@ _seat_children_print(Efl_Input_Device *seat)
|
|||
Efl_Input_Device *child;
|
||||
Eina_Iterator *it;
|
||||
|
||||
printf("Children of seat: %s (%s, seat id: %d)\n", efl_input_device_name_get(seat),
|
||||
printf("Children of seat: %s (%s, seat id: %d)\n", efl_name_get(seat),
|
||||
_device_type_to_string(efl_input_device_type_get(seat)),
|
||||
efl_input_device_seat_id_get(seat));
|
||||
|
||||
it = efl_input_device_children_iterate(seat);
|
||||
EINA_ITERATOR_FOREACH(it, child)
|
||||
{
|
||||
printf(" - Sub device: %s (%s, seat id: %d)\n", efl_input_device_name_get(child),
|
||||
printf(" - Sub device: %s (%s, seat id: %d)\n", efl_name_get(child),
|
||||
_device_type_to_string(efl_input_device_type_get(child)),
|
||||
efl_input_device_seat_id_get(seat));
|
||||
}
|
||||
|
@ -185,9 +185,9 @@ _dev_added_or_removed(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
Efl_Input_Device *dev = event->info;
|
||||
|
||||
printf("The device '%s' - class: '%s' - description: '%s' was '%s'\n",
|
||||
efl_input_device_name_get(dev),
|
||||
efl_name_get(dev),
|
||||
_device_type_to_string(efl_input_device_type_get(dev)),
|
||||
efl_input_device_description_get(dev),
|
||||
efl_comment_get(dev),
|
||||
event->desc == EFL_CANVAS_EVENT_DEVICE_ADDED ? "added" : "removed");
|
||||
|
||||
if (efl_input_device_type_get(dev) == EFL_INPUT_DEVICE_CLASS_SEAT)
|
||||
|
|
|
@ -19,7 +19,7 @@ _keyboard_event(void *data EINA_UNUSED, int type, void *event)
|
|||
seat = efl_input_device_seat_get(e->dev);
|
||||
|
||||
printf("The keyboard on seat '%s' %s the key '%s'\n", seat ?
|
||||
efl_input_device_name_get(seat) : "unknown",
|
||||
efl_name_get(seat) : "unknown",
|
||||
type == ECORE_EVENT_KEY_DOWN ? "pressed" : "released",
|
||||
e->keyname);
|
||||
|
||||
|
@ -36,7 +36,7 @@ _mouse_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|||
seat = efl_input_device_seat_get(e->dev);
|
||||
|
||||
printf("The mouse on seat '%s' is at X: %d Y:%d\n",
|
||||
seat ? efl_input_device_name_get(seat) : "unknown", e->x, e->y);
|
||||
seat ? efl_name_get(seat) : "unknown", e->x, e->y);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ _mouse_button(void *data EINA_UNUSED, int type, void *event)
|
|||
seat = efl_input_device_seat_get(e->dev);
|
||||
|
||||
printf("The mouse on seat '%s' %s the following button '%d'\n",
|
||||
seat ? efl_input_device_name_get(seat) : "unknown",
|
||||
seat ? efl_name_get(seat) : "unknown",
|
||||
type == ECORE_EVENT_MOUSE_BUTTON_DOWN ? "pressed" : "released",
|
||||
e->buttons);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
@ -66,7 +66,7 @@ _mouse_wheel(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
|||
seat = efl_input_device_seat_get(e->dev);
|
||||
|
||||
printf("The mouse on seat '%s' moved the wheel '%s'\n",
|
||||
seat ? efl_input_device_name_get(seat) : "unknown",
|
||||
seat ? efl_name_get(seat) : "unknown",
|
||||
e->z < 0 ? "up" : "down");
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ _dev_added_or_removed(void *data, const Efl_Event *event)
|
|||
Efl_Input_Device *dev = event->info;
|
||||
|
||||
printf("The device %p '%s' - class: '%s' - desc: '%s' was '%s' on ee %p\n",
|
||||
dev, efl_input_device_name_get(dev),
|
||||
dev, efl_name_get(dev),
|
||||
_device_type_to_string(efl_input_device_type_get(dev)),
|
||||
efl_input_device_description_get(dev),
|
||||
efl_comment_get(dev),
|
||||
event->desc == EFL_CANVAS_EVENT_DEVICE_ADDED ? "added" : "removed",
|
||||
data);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ _dev_changed(void *data, const Efl_Event *event)
|
|||
Efl_Input_Device *dev = event->info;
|
||||
|
||||
printf("The device %p '%s' - class: '%s' was changed on ee %p\n",
|
||||
dev, efl_input_device_name_get(dev),
|
||||
dev, efl_name_get(dev),
|
||||
_device_type_to_string(efl_input_device_type_get(dev)), data);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ _focus_obj_in_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
/* it always will print the default seat name, since FOCUS_OBJECT
|
||||
isn't setting a specific seat */
|
||||
printf("Focus set to object %s (seat %s)\n", evas_object_name_get(rect),
|
||||
efl_input_device_name_get(efl_input_device_get(ev)));
|
||||
efl_name_get(efl_input_device_get(ev)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -75,7 +75,7 @@ _focus_obj_out_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
Efl_Input_Focus *ev = event->info;
|
||||
Evas_Object *rect = event->object;
|
||||
printf("Focus unset to object %s (seat %s)\n", evas_object_name_get(rect),
|
||||
efl_input_device_name_get(efl_input_device_get(ev)));
|
||||
efl_name_get(efl_input_device_get(ev)));
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -52,13 +52,13 @@ _device_rename(Efl_Input_Device *dev)
|
|||
{
|
||||
if (!default_seat) {
|
||||
default_seat = dev;
|
||||
efl_input_device_name_set(dev, "default");
|
||||
efl_name_set(dev, "default");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!secondary_seat) {
|
||||
secondary_seat = dev;
|
||||
efl_input_device_name_set(dev, "secondary");
|
||||
efl_name_set(dev, "secondary");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,9 +78,9 @@ _device_changed(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
Efl_Input_Device *dev = event->info;
|
||||
|
||||
if (dev == default_seat)
|
||||
efl_input_device_name_set(dev, "default");
|
||||
efl_name_set(dev, "default");
|
||||
else if (dev == secondary_seat)
|
||||
efl_input_device_name_set(dev, "secondary");
|
||||
efl_name_set(dev, "secondary");
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -72,7 +72,7 @@ _on_rect_focus_in(void *data, const Efl_Event *event)
|
|||
name = edje_obj_seat_name_get(edje_obj, seat);
|
||||
|
||||
printf("Seat %s (%s) focused the rect object\n",
|
||||
efl_input_device_name_get(seat), name);
|
||||
efl_name_get(seat), name);
|
||||
|
||||
if (!strcmp(name, "seat1"))
|
||||
evas_object_color_set(rect, 200, 0, 0, 255);
|
||||
|
@ -97,7 +97,7 @@ _on_rect_focus_out(void *data, const Efl_Event *event)
|
|||
name = edje_obj_seat_name_get(edje_obj, seat);
|
||||
|
||||
printf("Seat %s (%s) unfocused the rect object\n",
|
||||
efl_input_device_name_get(seat), name);
|
||||
efl_name_get(seat), name);
|
||||
evas_object_color_set(rect, 200, 200, 200, 255);
|
||||
|
||||
efl_canvas_object_seat_focus_add(edje_obj, seat);
|
||||
|
@ -112,7 +112,7 @@ _on_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o, void *event_info)
|
|||
Evas *evas = data;
|
||||
|
||||
seat = efl_input_device_seat_get(ev->dev);
|
||||
printf("Seat %s (%s) pressed key %s\n", efl_input_device_name_get(seat),
|
||||
printf("Seat %s (%s) pressed key %s\n", efl_name_get(seat),
|
||||
edje_obj_seat_name_get(o, seat), ev->key);
|
||||
|
||||
mods = evas_key_modifier_get(evas);
|
||||
|
@ -141,7 +141,7 @@ _on_drag_started(void *data EINA_UNUSED, Evas_Object *o, const char *emission, c
|
|||
seat_name_str = emission + strlen("drag,start,");
|
||||
seat_name = eina_stringshare_add(seat_name_str);
|
||||
seat = edje_obj_seat_get(o, seat_name);
|
||||
printf("Seat %s (%s) started drag %s\n", efl_input_device_name_get(seat),
|
||||
printf("Seat %s (%s) started drag %s\n", efl_name_get(seat),
|
||||
seat_name, source);
|
||||
eina_stringshare_del(seat_name);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ _allowed_seat_get(Evas_Object *filtered_obj,
|
|||
{
|
||||
printf("The '%s' shall only receive events from seat '%s'\n",
|
||||
evas_object_name_get(filtered_obj),
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
allowed_seat_changed = EINA_TRUE;
|
||||
*allowed_seat = seat;
|
||||
efl_input_seat_event_filter_set(filtered_obj, seat, EINA_TRUE);
|
||||
|
@ -78,7 +78,7 @@ _allowed_seat_get(Evas_Object *filtered_obj,
|
|||
{
|
||||
fprintf(stderr, "ERROR: The '%s' could not be focused by the seat '%s'\n",
|
||||
evas_object_name_get(filtered_obj),
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
return EINA_FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ _allowed_seat_get(Evas_Object *filtered_obj,
|
|||
{
|
||||
fprintf(stderr, "ERROR: The '%s' should not be focused by the seat '%s'\n",
|
||||
evas_object_name_get(filtered_obj),
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
return EINA_FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -138,13 +138,13 @@ _obj_events_cb(void *data, const Efl_Event *event)
|
|||
fprintf(stderr, "ERROR: The object '%s' should not receive the event"
|
||||
"'%s' from the seat '%s'\n",
|
||||
evas_object_name_get(event->object), event_name,
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
ecore_main_loop_quit();
|
||||
}
|
||||
else
|
||||
printf("The object '%s' recevied a '%s' event from seat '%s'\n",
|
||||
evas_object_name_get(event->object), event_name,
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -40,7 +40,7 @@ _canvas_focus_in_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
|
||||
printf("Object %s was focused by seat %s\n",
|
||||
evas_object_name_get(focused),
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -55,7 +55,7 @@ _hold_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
printf("Hold %s at object %s from seat %s\n",
|
||||
efl_input_hold_get(ev) ? "on" : "off",
|
||||
evas_object_name_get(event->object),
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -70,7 +70,7 @@ _focus_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
printf("Focus %s at object %s from seat %s\n",
|
||||
event->desc == EFL_EVENT_FOCUS_IN ? "in" : "out",
|
||||
evas_object_name_get(event->object),
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -85,7 +85,7 @@ _pointer_in_out_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
printf("Pointer %s at object %s from seat %s\n",
|
||||
event->desc == EFL_EVENT_POINTER_IN ? "in" : "out",
|
||||
evas_object_name_get(event->object),
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -115,7 +115,7 @@ _pointer_down_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
|
||||
printf("%s at object %s from seat %s\n", buf,
|
||||
evas_object_name_get(event->object),
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -130,7 +130,7 @@ _pointer_up_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
printf("Pointer button %i up at object %s from seat %s\n",
|
||||
efl_input_pointer_button_get(ev),
|
||||
evas_object_name_get(event->object),
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -146,7 +146,7 @@ _pointer_move_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
efl_input_pointer_value_get(ev, EFL_INPUT_VALUE_X),
|
||||
efl_input_pointer_value_get(ev, EFL_INPUT_VALUE_Y),
|
||||
evas_object_name_get(event->object),
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -162,7 +162,7 @@ _pointer_wheel_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
efl_input_pointer_wheel_direction_get(ev),
|
||||
efl_input_pointer_wheel_delta_get(ev),
|
||||
evas_object_name_get(event->object),
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -179,11 +179,11 @@ _key_down_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
printf("Key down: '%s' on object %s from seat %s\n",
|
||||
efl_input_key_name_get(ev),
|
||||
evas_object_name_get(event->object),
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
|
||||
if (evas_seat_key_modifier_is_set(mods, "Control", seat))
|
||||
printf("Ctrl is pressed by seat %s\n",
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -198,7 +198,7 @@ _key_up_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
printf("Key up: '%s' on object %s from seat %s\n",
|
||||
efl_input_key_name_get(ev),
|
||||
evas_object_name_get(event->object),
|
||||
efl_input_device_name_get(seat));
|
||||
efl_name_get(seat));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -210,8 +210,8 @@ _dev_added_or_removed(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
return;
|
||||
|
||||
printf("The seat '%s' - description: '%s' was '%s'\n",
|
||||
efl_input_device_name_get(dev),
|
||||
efl_input_device_description_get(dev),
|
||||
efl_name_get(dev),
|
||||
efl_comment_get(dev),
|
||||
event->desc == EFL_CANVAS_EVENT_DEVICE_ADDED ? "added" : "removed");
|
||||
}
|
||||
|
||||
|
@ -283,8 +283,8 @@ main(void)
|
|||
{
|
||||
if (efl_input_device_type_get(dev) == EFL_INPUT_DEVICE_CLASS_SEAT)
|
||||
printf("The seat '%s' - description: '%s' was 'added'\n",
|
||||
efl_input_device_name_get(dev),
|
||||
efl_input_device_description_get(dev));
|
||||
efl_name_get(dev),
|
||||
efl_comment_get(dev));
|
||||
}
|
||||
|
||||
ecore_evas_show(ee);
|
||||
|
|
|
@ -172,7 +172,7 @@ _edje_focus_in(Edje *ed, Efl_Input_Device *seat)
|
|||
|
||||
_edje_seat_emit(ed, seat, "focus,in", "");
|
||||
#ifdef HAVE_ECORE_IMF
|
||||
rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
|
||||
rp = _edje_focused_part_get(ed, efl_name_get(seat));
|
||||
if (!rp) return;
|
||||
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
||||
(!rp->typedata.text)) return;
|
||||
|
@ -207,7 +207,7 @@ _edje_focus_out(Edje *ed, Efl_Input_Device *seat)
|
|||
_edje_seat_emit(ed, seat, "focus,out", "");
|
||||
|
||||
#ifdef HAVE_ECORE_IMF
|
||||
rp = _edje_focused_part_get(ed, efl_input_device_name_get(seat));
|
||||
rp = _edje_focused_part_get(ed, efl_name_get(seat));
|
||||
if (!rp) return;
|
||||
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
|
||||
(!rp->typedata.text)) return;
|
||||
|
|
|
@ -593,7 +593,7 @@ _edje_device_add(Edje *ed, Efl_Input_Device *dev)
|
|||
Eina_List *l;
|
||||
|
||||
if (ed->collection && ed->collection->use_custom_seat_names)
|
||||
name = eina_stringshare_add(efl_input_device_name_get(dev));
|
||||
name = eina_stringshare_add(efl_name_get(dev));
|
||||
else
|
||||
{
|
||||
ed->seats_count++;
|
||||
|
@ -619,7 +619,7 @@ _edje_device_add(Edje *ed, Efl_Input_Device *dev)
|
|||
|
||||
seat->device = dev;
|
||||
snprintf(sig, sizeof(sig), "seat,added,%s,%s", seat->name,
|
||||
efl_input_device_name_get(dev));
|
||||
efl_name_get(dev));
|
||||
_edje_emit(ed, sig, "");
|
||||
_edje_seat_event_filter_apply(ed, seat);
|
||||
|
||||
|
@ -692,7 +692,7 @@ _edje_device_changed_cb(void *data, const Efl_Event *event)
|
|||
if (!seat)
|
||||
return;
|
||||
|
||||
name = efl_input_device_name_get(dev);
|
||||
name = efl_name_get(dev);
|
||||
if (!name)
|
||||
return;
|
||||
|
||||
|
|
|
@ -90,11 +90,8 @@ struct _Efl_Input_Device_Data
|
|||
{
|
||||
Eo *eo;
|
||||
Eo *evas; /* Evas */
|
||||
Efl_Input_Device *parent; /* no ref */
|
||||
Efl_Input_Device *source; /* ref */
|
||||
Eina_List *children; /* ref */
|
||||
Eina_Stringshare *name;
|
||||
Eina_Stringshare *desc;
|
||||
Eina_List *children; /* ref'ed by efl_parent, not by this list */
|
||||
unsigned int id;
|
||||
Efl_Input_Device_Class klass;
|
||||
Efl_Input_Device_Sub_Class subclass;
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#define EFL_INTERNAL_UNSTABLE
|
||||
#include "efl_common_internal.h"
|
||||
|
||||
#define MY_CLASS EFL_INPUT_DEVICE_CLASS
|
||||
|
||||
/* Efl Input Device = Evas Device */
|
||||
|
||||
typedef struct _Child_Device_Iterator Child_Device_Iterator;
|
||||
|
@ -38,7 +40,7 @@ _seat_pointers_update(Efl_Input_Device_Data *seat, Efl_Input_Device_Data *dev)
|
|||
EOLIAN static Efl_Object *
|
||||
_efl_input_device_efl_object_constructor(Eo *obj, Efl_Input_Device_Data *pd)
|
||||
{
|
||||
obj = efl_constructor(efl_super(obj, EFL_INPUT_DEVICE_CLASS));
|
||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||
pd->eo = obj;
|
||||
return obj;
|
||||
}
|
||||
|
@ -46,34 +48,69 @@ _efl_input_device_efl_object_constructor(Eo *obj, Efl_Input_Device_Data *pd)
|
|||
EOLIAN static void
|
||||
_efl_input_device_efl_object_destructor(Eo *obj, Efl_Input_Device_Data *pd)
|
||||
{
|
||||
Eo *eo_child;
|
||||
pd->children = eina_list_free(pd->children);
|
||||
if (pd->klass != EFL_INPUT_DEVICE_CLASS_SEAT)
|
||||
{
|
||||
Efl_Input_Device_Data *p;
|
||||
Eo *seat;
|
||||
|
||||
eina_stringshare_del(pd->name);
|
||||
eina_stringshare_del(pd->desc);
|
||||
EINA_LIST_FREE(pd->children, eo_child)
|
||||
{
|
||||
Efl_Input_Device_Data *child = efl_data_scope_get(eo_child, EFL_INPUT_DEVICE_CLASS);
|
||||
child->parent = NULL;
|
||||
}
|
||||
if (pd->parent)
|
||||
{
|
||||
Efl_Input_Device_Data *p = efl_data_scope_get(pd->parent, EFL_INPUT_DEVICE_CLASS);
|
||||
p->children = eina_list_remove(p->children, obj);
|
||||
if (_is_pointer(pd))
|
||||
p->pointer_count--;
|
||||
seat = efl_input_device_seat_get(obj);
|
||||
p = efl_data_scope_get(seat, MY_CLASS);
|
||||
if (p) p->children = eina_list_remove(p->children, obj);
|
||||
}
|
||||
efl_unref(pd->source);
|
||||
|
||||
return efl_destructor(efl_super(obj, EFL_INPUT_DEVICE_CLASS));
|
||||
return efl_destructor(efl_super(obj, MY_CLASS));
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_input_device_device_type_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, Efl_Input_Device_Class klass)
|
||||
_efl_input_device_efl_object_parent_set(Eo *obj, Efl_Input_Device_Data *pd EINA_UNUSED, Eo *parent)
|
||||
{
|
||||
Efl_Input_Device_Data *p;
|
||||
|
||||
if (parent)
|
||||
{
|
||||
if (efl_isa(parent, MY_CLASS))
|
||||
{
|
||||
p = efl_data_scope_get(parent, MY_CLASS);
|
||||
EINA_SAFETY_ON_FALSE_RETURN(p->klass == EFL_INPUT_DEVICE_CLASS_SEAT);
|
||||
if (!eina_list_data_find(p->children, obj))
|
||||
{
|
||||
p->children = eina_list_append(p->children, obj);
|
||||
_seat_pointers_update(p, pd);
|
||||
}
|
||||
}
|
||||
else if(!efl_isa(parent, EFL_CANVAS_INTERFACE))
|
||||
{
|
||||
EINA_SAFETY_ERROR("The parent of a device must be a seat or the canvas");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Eo *old_parent = efl_parent_get(obj);
|
||||
if (old_parent && efl_isa(old_parent, MY_CLASS))
|
||||
{
|
||||
p = efl_data_scope_get(old_parent, MY_CLASS);
|
||||
p->children = eina_list_remove(p->children, obj);
|
||||
if (_is_pointer(pd))
|
||||
p->pointer_count--;
|
||||
}
|
||||
}
|
||||
|
||||
efl_parent_set(efl_super(obj, MY_CLASS), parent);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_input_device_device_type_set(Eo *obj, Efl_Input_Device_Data *pd, Efl_Input_Device_Class klass)
|
||||
{
|
||||
EINA_SAFETY_ON_TRUE_RETURN(pd->klass);
|
||||
pd->klass = klass;
|
||||
if (klass != EFL_INPUT_DEVICE_CLASS_SEAT)
|
||||
_seat_pointers_update(efl_data_scope_get(pd->parent, EFL_INPUT_DEVICE_CLASS), pd);
|
||||
{
|
||||
Efl_Input_Device_Data *seat = efl_data_scope_get(efl_input_device_seat_get(obj), MY_CLASS);
|
||||
_seat_pointers_update(seat, pd);
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Input_Device_Class
|
||||
|
@ -108,30 +145,6 @@ _efl_input_device_source_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
|
|||
return pd->source;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_input_device_name_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, const char *name)
|
||||
{
|
||||
eina_stringshare_replace(&pd->name, name);
|
||||
}
|
||||
|
||||
EOLIAN static const char *
|
||||
_efl_input_device_name_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
|
||||
{
|
||||
return pd->name;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_input_device_description_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, const char *desc)
|
||||
{
|
||||
eina_stringshare_replace(&pd->desc, desc);
|
||||
}
|
||||
|
||||
EOLIAN static const char *
|
||||
_efl_input_device_description_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
|
||||
{
|
||||
return pd->desc;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_input_device_seat_id_set(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd, unsigned int id)
|
||||
{
|
||||
|
@ -148,46 +161,20 @@ _efl_input_device_seat_id_get(Eo *obj, Efl_Input_Device_Data *pd)
|
|||
}
|
||||
|
||||
EOLIAN static Efl_Input_Device *
|
||||
_efl_input_device_seat_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
|
||||
_efl_input_device_seat_get(Eo *obj, Efl_Input_Device_Data *pd)
|
||||
{
|
||||
while (1)
|
||||
for (; obj; obj = efl_parent_get(obj))
|
||||
{
|
||||
if (pd->klass == EFL_INPUT_DEVICE_CLASS_SEAT)
|
||||
return pd->eo;
|
||||
|
||||
if (!pd->parent)
|
||||
break;
|
||||
|
||||
pd = efl_data_scope_get(pd->parent, EFL_INPUT_DEVICE_CLASS);
|
||||
if (!efl_isa(obj, MY_CLASS)) break;
|
||||
pd = efl_data_scope_get(obj, MY_CLASS);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Input_Device *
|
||||
_efl_input_device_parent_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd)
|
||||
{
|
||||
return pd->parent;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_input_device_parent_set(Eo *obj, Efl_Input_Device_Data *pd, Efl_Input_Device *parent)
|
||||
{
|
||||
if (pd->parent == parent) return;
|
||||
if (pd->parent)
|
||||
{
|
||||
Efl_Input_Device_Data *p = efl_data_scope_get(pd->parent, EFL_INPUT_DEVICE_CLASS);
|
||||
p->children = eina_list_remove(p->children, obj);
|
||||
}
|
||||
pd->parent = parent;
|
||||
if (parent)
|
||||
{
|
||||
Efl_Input_Device_Data *p = efl_data_scope_get(parent, EFL_INPUT_DEVICE_CLASS);
|
||||
p->children = eina_list_append(p->children, obj);
|
||||
_seat_pointers_update(p, pd);
|
||||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_child_device_iterator_next(Child_Device_Iterator *it, void **data)
|
||||
{
|
||||
|
|
|
@ -67,24 +67,6 @@ class Efl.Input.Device (Efl.Object)
|
|||
src: Efl.Input.Device; [[Input device]]
|
||||
}
|
||||
}
|
||||
@property name {
|
||||
[[device name property]]
|
||||
values {
|
||||
name: string; [[Input device name]]
|
||||
}
|
||||
}
|
||||
@property description {
|
||||
[[device description property]]
|
||||
values {
|
||||
desc: string; [[Input device description]]
|
||||
}
|
||||
}
|
||||
@property parent {
|
||||
[[Device parent property]]
|
||||
values {
|
||||
parent: Efl.Input.Device; [[Parent input device]]
|
||||
}
|
||||
}
|
||||
@property seat {
|
||||
[[Get the @Efl.Input.Device that represents a seat.
|
||||
|
||||
|
@ -113,7 +95,7 @@ class Efl.Input.Device (Efl.Object)
|
|||
children_iterate {
|
||||
[[Lists the children attached to this device.
|
||||
|
||||
This is mostly meaningful with seat devices, as they are groups of
|
||||
This is only meaningful with seat devices, as they are groups of
|
||||
real input devices.
|
||||
|
||||
@since 1.20
|
||||
|
@ -135,5 +117,6 @@ class Efl.Input.Device (Efl.Object)
|
|||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Object.destructor;
|
||||
Efl.Object.parent { set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ _new_default_device_find(Evas_Public_Data *e, Evas_Device *old_dev)
|
|||
|
||||
if (e->cleanup) return NULL;
|
||||
old_class = efl_input_device_type_get(old_dev);
|
||||
old_parent = efl_input_device_parent_get(old_dev);
|
||||
old_parent = efl_parent_get(old_dev);
|
||||
def = NULL;
|
||||
|
||||
EINA_LIST_FOREACH(e->devices, l, dev)
|
||||
|
@ -55,7 +55,7 @@ _new_default_device_find(Evas_Public_Data *e, Evas_Device *old_dev)
|
|||
|
||||
def = dev;
|
||||
//Prefer devices with the same parent.
|
||||
if (efl_input_device_parent_get(dev) == old_parent)
|
||||
if (efl_parent_get(dev) == old_parent)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ evas_device_get(Evas *eo_e, const char *name)
|
|||
|
||||
EINA_LIST_FOREACH(e->devices, l, dev)
|
||||
{
|
||||
dev_name = efl_input_device_name_get(dev);
|
||||
dev_name = efl_name_get(dev);
|
||||
|
||||
if (eina_streq(dev_name, name))
|
||||
return dev;
|
||||
|
@ -163,13 +163,12 @@ evas_device_add_full(Evas *eo_e, const char *name, const char *desc,
|
|||
|
||||
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
|
||||
|
||||
dev = efl_add(EFL_INPUT_DEVICE_CLASS, eo_e,
|
||||
efl_input_device_name_set(efl_added, name),
|
||||
efl_input_device_description_set(efl_added, desc),
|
||||
dev = efl_add(EFL_INPUT_DEVICE_CLASS, parent_dev ?: eo_e,
|
||||
efl_name_set(efl_added, name),
|
||||
efl_comment_set(efl_added, desc),
|
||||
efl_input_device_type_set(efl_added, clas),
|
||||
efl_input_device_subtype_set(efl_added, sub_clas),
|
||||
efl_input_device_source_set(efl_added, emulation_dev),
|
||||
efl_input_device_parent_set(efl_added, parent_dev));
|
||||
efl_input_device_source_set(efl_added, emulation_dev));
|
||||
|
||||
d = efl_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
|
||||
d->evas = eo_e;
|
||||
|
@ -281,14 +280,14 @@ evas_device_name_set(Evas_Device *dev, const char *name)
|
|||
|
||||
Efl_Input_Device_Data *d = efl_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
|
||||
|
||||
efl_input_device_name_set(dev, name);
|
||||
efl_name_set(dev, name);
|
||||
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
evas_device_name_get(const Evas_Device *dev)
|
||||
{
|
||||
return efl_input_device_name_get(dev);
|
||||
return efl_name_get(dev);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -296,7 +295,7 @@ evas_device_description_set(Evas_Device *dev, const char *desc)
|
|||
{
|
||||
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
|
||||
|
||||
efl_input_device_description_set(dev, desc);
|
||||
efl_comment_set(dev, desc);
|
||||
|
||||
Efl_Input_Device_Data *d = efl_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
|
||||
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
|
||||
|
@ -305,12 +304,16 @@ evas_device_description_set(Evas_Device *dev, const char *desc)
|
|||
EAPI const char *
|
||||
evas_device_description_get(const Evas_Device *dev)
|
||||
{
|
||||
return efl_input_device_description_get(dev);
|
||||
return efl_comment_get(dev);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
evas_device_parent_set(Evas_Device *dev, Evas_Device *parent)
|
||||
{
|
||||
// Note: This function should be deprecated. parent_set doesn't make sense
|
||||
// unless the parent is a seat device. Parent shouldn't be changed after
|
||||
// creation.
|
||||
|
||||
SAFETY_CHECK(dev, EFL_INPUT_DEVICE_CLASS);
|
||||
|
||||
Efl_Input_Device_Data *d = efl_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
|
||||
|
@ -318,15 +321,24 @@ evas_device_parent_set(Evas_Device *dev, Evas_Device *parent)
|
|||
{
|
||||
SAFETY_CHECK(parent, EFL_INPUT_DEVICE_CLASS);
|
||||
}
|
||||
else if (efl_parent_get(dev))
|
||||
{
|
||||
efl_ref(dev);
|
||||
}
|
||||
|
||||
efl_input_device_parent_set(dev, parent);
|
||||
efl_parent_set(dev, parent);
|
||||
evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev);
|
||||
}
|
||||
|
||||
EAPI const Evas_Device *
|
||||
evas_device_parent_get(const Evas_Device *dev)
|
||||
{
|
||||
return efl_input_device_parent_get(dev);
|
||||
Eo *parent = efl_parent_get(dev);
|
||||
|
||||
if (!efl_isa(parent, EFL_INPUT_DEVICE_CLASS))
|
||||
return NULL;
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
|
@ -3138,7 +3138,7 @@ _key_event_dispatch(Evas_Public_Data *e, void *event_info,
|
|||
device = e->default_seat;
|
||||
else
|
||||
{
|
||||
const char *name = efl_input_device_name_get(device);
|
||||
const char *name = efl_name_get(device);
|
||||
|
||||
device = efl_input_device_seat_get(device);
|
||||
if (!device)
|
||||
|
|
Loading…
Reference in New Issue