propagate sandboxed gadget tooltip sizes as aspects

xdg_popup does not have min size hints, so instead we can proxy aspect through
to mimic this behavior
This commit is contained in:
Mike Blumenkrantz 2018-01-11 16:23:05 -05:00
parent 94270ffd93
commit b95e28fd91
2 changed files with 22 additions and 0 deletions

View File

@ -273,6 +273,15 @@ win_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *eve
tooltips = eina_list_remove(tooltips, obj);
}
static void
_tooltip_resize(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
int w, h;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
evas_object_size_hint_aspect_set(obj, EVAS_ASPECT_CONTROL_BOTH, w, h);
}
static Evas_Object *
win_add(Evas_Object *win)
{
@ -284,6 +293,7 @@ win_add(Evas_Object *win)
if (elm_win_type_get(win) == ELM_WIN_TOOLTIP)
{
tooltips = eina_list_append(tooltips, win);
evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _tooltip_resize, d);
if (eina_hash_population(gadget_globals))
{
struct e_gadget *gadget_global = eina_hash_find(gadget_globals, &d);

View File

@ -638,6 +638,14 @@ tooltip_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info
tt->tooltip_surface = NULL;
}
static void
tooltip_hints(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
int w, h;
evas_object_size_hint_aspect_get(obj, NULL, &w, &h);
evas_object_size_hint_min_set(obj, w, h);
}
static Evas_Object *
tooltip_content_cb(void *data, Evas_Object *obj EINA_UNUSED, Evas_Object *tooltip)
{
@ -685,11 +693,15 @@ popup_added(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
tt = &inst->base;
if (tt)
{
int w, h;
tt->tooltip_surface = surface;
tt->tooltip_content = event_info;
evas_object_data_set(event_info, "instance", inst);
evas_object_pass_events_set(event_info, 1);
E_FILL(event_info);
tooltip_hints(NULL, NULL, event_info, NULL);
evas_object_event_callback_add(event_info, EVAS_CALLBACK_DEL, tooltip_del, tt);
evas_object_event_callback_add(event_info, EVAS_CALLBACK_CHANGED_SIZE_HINTS, tooltip_hints, tt);
elm_object_tooltip_content_cb_set(tt->obj, tooltip_content_cb, tt, NULL);
}
else