summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-10-19 14:45:18 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-10-19 14:45:18 -0400
commitfb2b5c67725454f3136ded042fb00a929bc492ad (patch)
tree0171159ded47c06c787b79407922bc6c7cf1dd06
parent74bbda465777abc62aa1c594ae20dd98b7936ccf (diff)
handle weight hints on sandbox gadget popup surfaces
-rw-r--r--src/runner.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/runner.c b/src/runner.c
index ee14166..2a24be2 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -533,9 +533,15 @@ static void
533popup_added(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) 533popup_added(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
534{ 534{
535 Instance *inst = data; 535 Instance *inst = data;
536 Evas_Object *bx; 536 Evas_Object *bx, *tb, *r;
537 E_Zone *zone;
538 double w, h;
537 539
538 if (!efl_wl_surface_extract(event_info)) return; 540 if (!efl_wl_surface_extract(event_info)) return;
541 zone = e_zone_current_get();
542 evas_object_size_hint_weight_get(event_info, &w, &h);
543 w = E_CLAMP(w, 0, 0.5);
544 h = E_CLAMP(h, 0, 0.5);
539 inst->extracted = eina_list_append(inst->extracted, event_info); 545 inst->extracted = eina_list_append(inst->extracted, event_info);
540 546
541 inst->ctxpopup = elm_ctxpopup_add(inst->box); 547 inst->ctxpopup = elm_ctxpopup_add(inst->box);
@@ -543,13 +549,29 @@ popup_added(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
543 evas_object_smart_callback_add(inst->ctxpopup, "dismissed", popup_dismissed, inst); 549 evas_object_smart_callback_add(inst->ctxpopup, "dismissed", popup_dismissed, inst);
544 evas_object_event_callback_add(event_info, EVAS_CALLBACK_DEL, popup_hide, inst); 550 evas_object_event_callback_add(event_info, EVAS_CALLBACK_DEL, popup_hide, inst);
545 551
552 tb = elm_table_add(inst->ctxpopup);
553 evas_object_show(tb);
554
546 bx = elm_box_add(inst->ctxpopup); 555 bx = elm_box_add(inst->ctxpopup);
556 elm_table_pack(tb, bx, 0, 0, 1, 1);
557 if (w > 0)
558 {
559 r = evas_object_rectangle_add(e_comp->evas);
560 evas_object_size_hint_min_set(r, w * zone->w, 0);
561 elm_table_pack(tb, bx, 0, 1, 2, 1);
562 }
563 if (h > 0)
564 {
565 r = evas_object_rectangle_add(e_comp->evas);
566 evas_object_size_hint_min_set(r, 0, h * zone->h);
567 elm_table_pack(tb, bx, 1, 0, 1, 2);
568 }
547 elm_box_homogeneous_set(bx, 1); 569 elm_box_homogeneous_set(bx, 1);
548 evas_object_show(bx); 570 evas_object_show(bx);
549 elm_box_pack_end(bx, event_info); 571 elm_box_pack_end(bx, event_info);
550 evas_object_data_set(bx, "extracted", event_info); 572 evas_object_data_set(bx, "extracted", event_info);
551 evas_object_event_callback_add(bx, EVAS_CALLBACK_DEL, popup_del, inst); 573 evas_object_event_callback_add(bx, EVAS_CALLBACK_DEL, popup_del, inst);
552 elm_object_content_set(inst->ctxpopup, bx); 574 elm_object_content_set(inst->ctxpopup, tb);
553 575
554 e_gadget_util_ctxpopup_place(inst->box, inst->ctxpopup, NULL); 576 e_gadget_util_ctxpopup_place(inst->box, inst->ctxpopup, NULL);
555 evas_object_show(inst->ctxpopup); 577 evas_object_show(inst->ctxpopup);