summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c148
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c3
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h1
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c5
4 files changed, 147 insertions, 10 deletions
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
index 7643a09..593e82c 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
@@ -14,9 +14,10 @@ typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data;
14struct _EE_Wl_Smart_Data 14struct _EE_Wl_Smart_Data
15{ 15{
16 Evas_Object_Smart_Clipped_Data base; 16 Evas_Object_Smart_Clipped_Data base;
17 Evas_Object *frame;
18 Evas_Object *text; 17 Evas_Object *text;
19 Evas_Coord x, y, w, h; 18 Evas_Coord x, y, w, h;
19 Evas_Object *border[4]; // 0 = top, 1 = bottom, 2 = left, 3 = right
20 Evas_Coord border_size[4]; // same as border
20}; 21};
21 22
22static const Evas_Smart_Cb_Description _smart_callbacks[] = 23static const Evas_Smart_Cb_Description _smart_callbacks[] =
@@ -454,11 +455,66 @@ _ecore_evas_wl_common_move(Ecore_Evas *ee, int x, int y)
454 } 455 }
455} 456}
456 457
458/* Frame border:
459 *
460 * |------------------------------------------|
461 * | top border |
462 * |------------------------------------------|
463 * | | | |
464 * | | | |
465 * | | | |
466 * | | | |
467 * |left | | right |
468 * |border | | border |
469 * | | | |
470 * | | | |
471 * | | | |
472 * |------------------------------------------|
473 * | bottom border |
474 * |------------------------------------------|
475 */
476static void
477_border_size_eval(Evas_Object *obj EINA_UNUSED, EE_Wl_Smart_Data *sd)
478{
479
480 /* top border */
481 if (sd->border[0])
482 {
483 evas_object_move(sd->border[0], sd->x, sd->y);
484 evas_object_resize(sd->border[0], sd->w, sd->border_size[0]);
485 }
486
487 /* bottom border */
488 if (sd->border[1])
489 {
490 evas_object_move(sd->border[1], sd->x, sd->y + sd->h - sd->border_size[1]);
491 evas_object_resize(sd->border[1], sd->w, sd->border_size[1]);
492 }
493
494 /* left border */
495 if (sd->border[2])
496 {
497 evas_object_move(sd->border[2], sd->x, sd->y + sd->border_size[0]);
498 evas_object_resize(sd->border[2], sd->border_size[2],
499 sd->h - sd->border_size[0] - sd->border_size[1]);
500 }
501
502 /* right border */
503 if (sd->border[3])
504 {
505 evas_object_move(sd->border[3], sd->x + sd->w - sd->border_size[3],
506 sd->y + sd->border_size[0]);
507 evas_object_resize(sd->border[3], sd->border_size[3],
508 sd->h - sd->border_size[0] - sd->border_size[1]);
509 }
510}
511
457static void 512static void
458_ecore_evas_wl_common_smart_add(Evas_Object *obj) 513_ecore_evas_wl_common_smart_add(Evas_Object *obj)
459{ 514{
460 EE_Wl_Smart_Data *sd; 515 EE_Wl_Smart_Data *sd;
461 Evas *evas; 516 Evas *evas;
517 int i;
462 518
463 LOGFN(__FILE__, __LINE__, __FUNCTION__); 519 LOGFN(__FILE__, __LINE__, __FUNCTION__);
464 520
@@ -475,10 +531,11 @@ _ecore_evas_wl_common_smart_add(Evas_Object *obj)
475 sd->w = 1; 531 sd->w = 1;
476 sd->h = 1; 532 sd->h = 1;
477 533
478 sd->frame = evas_object_rectangle_add(evas); 534 for (i = 0; i < 4; i++)
479 evas_object_color_set(sd->frame, 249, 249, 249, 255); 535 {
480 evas_object_show(sd->frame); 536 sd->border[i] = NULL;
481 evas_object_smart_member_add(sd->frame, obj); 537 sd->border_size[i] = 0;
538 }
482 539
483 sd->text = evas_object_text_add(evas); 540 sd->text = evas_object_text_add(evas);
484 evas_object_color_set(sd->text, 0, 0, 0, 255); 541 evas_object_color_set(sd->text, 0, 0, 0, 255);
@@ -493,16 +550,37 @@ static void
493_ecore_evas_wl_common_smart_del(Evas_Object *obj) 550_ecore_evas_wl_common_smart_del(Evas_Object *obj)
494{ 551{
495 EE_Wl_Smart_Data *sd; 552 EE_Wl_Smart_Data *sd;
553 int i;
496 554
497 LOGFN(__FILE__, __LINE__, __FUNCTION__); 555 LOGFN(__FILE__, __LINE__, __FUNCTION__);
498 556
499 if (!(sd = evas_object_smart_data_get(obj))) return; 557 if (!(sd = evas_object_smart_data_get(obj))) return;
500 evas_object_del(sd->text); 558 evas_object_del(sd->text);
501 evas_object_del(sd->frame); 559 for (i = 0; i < 4; i++)
560 {
561 evas_object_del(sd->border[i]);
562 }
502 _ecore_evas_wl_frame_parent_sc->del(obj); 563 _ecore_evas_wl_frame_parent_sc->del(obj);
503} 564}
504 565
505static void 566static void
567_ecore_evas_wl_common_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
568{
569 EE_Wl_Smart_Data *sd;
570
571 LOGFN(__FILE__, __LINE__, __FUNCTION__);
572
573 _ecore_evas_wl_frame_parent_sc->move(obj, x, y);
574
575 if (!(sd = evas_object_smart_data_get(obj))) return;
576 if ((sd->x == x) && (sd->y == y)) return;
577 sd->x = x;
578 sd->y = y;
579
580 evas_object_smart_changed(obj);
581}
582
583static void
506_ecore_evas_wl_common_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) 584_ecore_evas_wl_common_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
507{ 585{
508 EE_Wl_Smart_Data *sd; 586 EE_Wl_Smart_Data *sd;
@@ -513,7 +591,20 @@ _ecore_evas_wl_common_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
513 if ((sd->w == w) && (sd->h == h)) return; 591 if ((sd->w == w) && (sd->h == h)) return;
514 sd->w = w; 592 sd->w = w;
515 sd->h = h; 593 sd->h = h;
516 evas_object_resize(sd->frame, w, h); 594
595 evas_object_smart_changed(obj);
596}
597
598void
599_ecore_evas_wl_common_smart_calculate(Evas_Object *obj)
600{
601 EE_Wl_Smart_Data *sd;
602
603 LOGFN(__FILE__, __LINE__, __FUNCTION__);
604
605 if (!(sd = evas_object_smart_data_get(obj))) return;
606
607 _border_size_eval(obj, sd);
517} 608}
518 609
519static void 610static void
@@ -521,7 +612,9 @@ _ecore_evas_wl_frame_smart_set_user(Evas_Smart_Class *sc)
521{ 612{
522 sc->add = _ecore_evas_wl_common_smart_add; 613 sc->add = _ecore_evas_wl_common_smart_add;
523 sc->del = _ecore_evas_wl_common_smart_del; 614 sc->del = _ecore_evas_wl_common_smart_del;
615 sc->move = _ecore_evas_wl_common_smart_move;
524 sc->resize = _ecore_evas_wl_common_smart_resize; 616 sc->resize = _ecore_evas_wl_common_smart_resize;
617 sc->calculate = _ecore_evas_wl_common_smart_calculate;
525} 618}
526 619
527Evas_Object * 620Evas_Object *
@@ -532,6 +625,47 @@ _ecore_evas_wl_common_frame_add(Evas *evas)
532 return evas_object_smart_add(evas, _ecore_evas_wl_frame_smart_class_new()); 625 return evas_object_smart_add(evas, _ecore_evas_wl_frame_smart_class_new());
533} 626}
534 627
628/*
629 * Size is received in the same format as it is used to set the framespace
630 * offset size.
631 */
632void
633_ecore_evas_wl_common_frame_border_size_set(Evas_Object *obj, int fx, int fy, int fw, int fh)
634{
635 EE_Wl_Smart_Data *sd;
636 Evas *e;
637 int i;
638
639 LOGFN(__FILE__, __LINE__, __FUNCTION__);
640
641 if (!(sd = evas_object_smart_data_get(obj))) return;
642
643 e = evas_object_evas_get(obj);
644
645 sd->border_size[0] = fy;
646 sd->border_size[1] = fh - fy;
647 sd->border_size[2] = fx;
648 sd->border_size[3] = fw - fx;
649
650 for (i = 0; i < 4; i++)
651 {
652 if ((sd->border_size[i] <= 0) && (sd->border[i]))
653 {
654 evas_object_del(sd->border[i]);
655 sd->border[i] = NULL;
656 }
657 else if ((sd->border_size[i] > 0) && (!sd->border[i]))
658 {
659 sd->border[i] = evas_object_rectangle_add(e);
660 evas_object_is_frame_object_set(sd->border[i], EINA_TRUE);
661 evas_object_color_set(sd->border[i], 249, 249, 249, 255);
662 evas_object_show(sd->border[i]);
663 evas_object_smart_member_add(sd->border[i], obj);
664 }
665 }
666 evas_object_raise(sd->text);
667}
668
535void 669void
536_ecore_evas_wl_common_raise(Ecore_Evas *ee) 670_ecore_evas_wl_common_raise(Ecore_Evas *ee)
537{ 671{
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
index 90e0746..cbad243 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
@@ -207,9 +207,10 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name, unsigned int parent,
207 if (ee->prop.draw_frame) 207 if (ee->prop.draw_frame)
208 { 208 {
209 wdata->frame = _ecore_evas_wl_common_frame_add(ee->evas); 209 wdata->frame = _ecore_evas_wl_common_frame_add(ee->evas);
210 _ecore_evas_wl_common_frame_border_size_set(wdata->frame, fx, fy, fw, fh);
210 evas_object_is_frame_object_set(wdata->frame, EINA_TRUE); 211 evas_object_is_frame_object_set(wdata->frame, EINA_TRUE);
211 evas_object_move(wdata->frame, 0, 0); 212 evas_object_move(wdata->frame, 0, 0);
212 evas_object_layer_set(wdata->frame, EVAS_LAYER_MIN); 213 evas_object_layer_set(wdata->frame, EVAS_LAYER_MAX - 1);
213 } 214 }
214 215
215 _ecore_evas_register(ee); 216 _ecore_evas_register(ee);
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
index dabd6ce..7ecb098 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
@@ -70,6 +70,7 @@ void _ecore_evas_wl_common_state_change(void *data);
70void _ecore_evas_wl_common_render_updates(void *data, Evas *evas, void *event); 70void _ecore_evas_wl_common_render_updates(void *data, Evas *evas, void *event);
71 71
72Evas_Object * _ecore_evas_wl_common_frame_add(Evas *evas); 72Evas_Object * _ecore_evas_wl_common_frame_add(Evas *evas);
73void _ecore_evas_wl_common_frame_border_size_set(Evas_Object *obj, int fx, int fy, int fw, int fh);
73 74
74#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM 75#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
75void _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location); 76void _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location);
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
index 4a62a12..384c710 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
@@ -209,12 +209,13 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name, unsigned int parent,
209 209
210 ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_common_pre_free); 210 ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_common_pre_free);
211 211
212 if (ee->prop.draw_frame) 212 if (ee->prop.draw_frame)
213 { 213 {
214 wdata->frame = _ecore_evas_wl_common_frame_add(ee->evas); 214 wdata->frame = _ecore_evas_wl_common_frame_add(ee->evas);
215 _ecore_evas_wl_common_frame_border_size_set(wdata->frame, fx, fy, fw, fh);
215 evas_object_is_frame_object_set(wdata->frame, EINA_TRUE); 216 evas_object_is_frame_object_set(wdata->frame, EINA_TRUE);
216 evas_object_move(wdata->frame, 0, 0); 217 evas_object_move(wdata->frame, 0, 0);
217 evas_object_layer_set(wdata->frame, EVAS_LAYER_MIN); 218 evas_object_layer_set(wdata->frame, EVAS_LAYER_MAX - 1);
218 } 219 }
219 220
220 ee->engine.func->fn_render = _ecore_evas_wl_common_render; 221 ee->engine.func->fn_render = _ecore_evas_wl_common_render;