aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Antognolli <rafael.antognolli@intel.com>2013-04-22 16:44:43 -0300
committerRafael Antognolli <rafael.antognolli@intel.com>2013-04-23 18:52:35 -0300
commitdba2fc5aa5a8546367faa6c4a8e7c07beda2c29f (patch)
tree6fa96244f2490ff4ee695e85ff5b4c2eafd65502
parentecore/wayland: Add support for engine animated cursor. (diff)
downloadefl-dba2fc5aa5a8546367faa6c4a8e7c07beda2c29f.tar.gz
ecore_evas/wayland: Change the default frame smart object.
Add 4 rectangles to be used as border of the window, instead of a single rectangle under the framespace. This allows to move the frame object to the top layer, instead of staying on the lowest layer. With the frame over the other objects, there's no need of framespace clipper object, which causes several bugs.
-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 7643a09216..593e82cda9 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;
struct _EE_Wl_Smart_Data
{
Evas_Object_Smart_Clipped_Data base;
- Evas_Object *frame;
Evas_Object *text;
Evas_Coord x, y, w, h;
+ Evas_Object *border[4]; // 0 = top, 1 = bottom, 2 = left, 3 = right
+ Evas_Coord border_size[4]; // same as border
};
static const Evas_Smart_Cb_Description _smart_callbacks[] =
@@ -454,11 +455,66 @@ _ecore_evas_wl_common_move(Ecore_Evas *ee, int x, int y)
}
}
+/* Frame border:
+ *
+ * |------------------------------------------|
+ * | top border |
+ * |------------------------------------------|
+ * | | | |
+ * | | | |
+ * | | | |
+ * | | | |
+ * |left | | right |
+ * |border | | border |
+ * | | | |
+ * | | | |
+ * | | | |
+ * |------------------------------------------|
+ * | bottom border |
+ * |------------------------------------------|
+ */
+static void
+_border_size_eval(Evas_Object *obj EINA_UNUSED, EE_Wl_Smart_Data *sd)
+{
+
+ /* top border */
+ if (sd->border[0])
+ {
+ evas_object_move(sd->border[0], sd->x, sd->y);
+ evas_object_resize(sd->border[0], sd->w, sd->border_size[0]);
+ }
+
+ /* bottom border */
+ if (sd->border[1])
+ {
+ evas_object_move(sd->border[1], sd->x, sd->y + sd->h - sd->border_size[1]);
+ evas_object_resize(sd->border[1], sd->w, sd->border_size[1]);
+ }
+
+ /* left border */
+ if (sd->border[2])
+ {
+ evas_object_move(sd->border[2], sd->x, sd->y + sd->border_size[0]);
+ evas_object_resize(sd->border[2], sd->border_size[2],
+ sd->h - sd->border_size[0] - sd->border_size[1]);
+ }
+
+ /* right border */
+ if (sd->border[3])
+ {
+ evas_object_move(sd->border[3], sd->x + sd->w - sd->border_size[3],
+ sd->y + sd->border_size[0]);
+ evas_object_resize(sd->border[3], sd->border_size[3],
+ sd->h - sd->border_size[0] - sd->border_size[1]);
+ }
+}
+
static void
_ecore_evas_wl_common_smart_add(Evas_Object *obj)
{
EE_Wl_Smart_Data *sd;
Evas *evas;
+ int i;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -475,10 +531,11 @@ _ecore_evas_wl_common_smart_add(Evas_Object *obj)
sd->w = 1;
sd->h = 1;
- sd->frame = evas_object_rectangle_add(evas);
- evas_object_color_set(sd->frame, 249, 249, 249, 255);
- evas_object_show(sd->frame);
- evas_object_smart_member_add(sd->frame, obj);
+ for (i = 0; i < 4; i++)
+ {
+ sd->border[i] = NULL;
+ sd->border_size[i] = 0;
+ }
sd->text = evas_object_text_add(evas);
evas_object_color_set(sd->text, 0, 0, 0, 255);
@@ -493,16 +550,37 @@ static void
_ecore_evas_wl_common_smart_del(Evas_Object *obj)
{
EE_Wl_Smart_Data *sd;
+ int i;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(sd = evas_object_smart_data_get(obj))) return;
evas_object_del(sd->text);
- evas_object_del(sd->frame);
+ for (i = 0; i < 4; i++)
+ {
+ evas_object_del(sd->border[i]);
+ }
_ecore_evas_wl_frame_parent_sc->del(obj);
}
static void
+_ecore_evas_wl_common_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
+{
+ EE_Wl_Smart_Data *sd;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ _ecore_evas_wl_frame_parent_sc->move(obj, x, y);
+
+ if (!(sd = evas_object_smart_data_get(obj))) return;
+ if ((sd->x == x) && (sd->y == y)) return;
+ sd->x = x;
+ sd->y = y;
+
+ evas_object_smart_changed(obj);
+}
+
+static void
_ecore_evas_wl_common_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
EE_Wl_Smart_Data *sd;
@@ -513,7 +591,20 @@ _ecore_evas_wl_common_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
if ((sd->w == w) && (sd->h == h)) return;
sd->w = w;
sd->h = h;
- evas_object_resize(sd->frame, w, h);
+
+ evas_object_smart_changed(obj);
+}
+
+void
+_ecore_evas_wl_common_smart_calculate(Evas_Object *obj)
+{
+ EE_Wl_Smart_Data *sd;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(sd = evas_object_smart_data_get(obj))) return;
+
+ _border_size_eval(obj, sd);
}
static void
@@ -521,7 +612,9 @@ _ecore_evas_wl_frame_smart_set_user(Evas_Smart_Class *sc)
{
sc->add = _ecore_evas_wl_common_smart_add;
sc->del = _ecore_evas_wl_common_smart_del;
+ sc->move = _ecore_evas_wl_common_smart_move;
sc->resize = _ecore_evas_wl_common_smart_resize;
+ sc->calculate = _ecore_evas_wl_common_smart_calculate;
}
Evas_Object *
@@ -532,6 +625,47 @@ _ecore_evas_wl_common_frame_add(Evas *evas)
return evas_object_smart_add(evas, _ecore_evas_wl_frame_smart_class_new());
}
+/*
+ * Size is received in the same format as it is used to set the framespace
+ * offset size.
+ */
+void
+_ecore_evas_wl_common_frame_border_size_set(Evas_Object *obj, int fx, int fy, int fw, int fh)
+{
+ EE_Wl_Smart_Data *sd;
+ Evas *e;
+ int i;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(sd = evas_object_smart_data_get(obj))) return;
+
+ e = evas_object_evas_get(obj);
+
+ sd->border_size[0] = fy;
+ sd->border_size[1] = fh - fy;
+ sd->border_size[2] = fx;
+ sd->border_size[3] = fw - fx;
+
+ for (i = 0; i < 4; i++)
+ {
+ if ((sd->border_size[i] <= 0) && (sd->border[i]))
+ {
+ evas_object_del(sd->border[i]);
+ sd->border[i] = NULL;
+ }
+ else if ((sd->border_size[i] > 0) && (!sd->border[i]))
+ {
+ sd->border[i] = evas_object_rectangle_add(e);
+ evas_object_is_frame_object_set(sd->border[i], EINA_TRUE);
+ evas_object_color_set(sd->border[i], 249, 249, 249, 255);
+ evas_object_show(sd->border[i]);
+ evas_object_smart_member_add(sd->border[i], obj);
+ }
+ }
+ evas_object_raise(sd->text);
+}
+
void
_ecore_evas_wl_common_raise(Ecore_Evas *ee)
{
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 90e07463ff..cbad243525 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,
if (ee->prop.draw_frame)
{
wdata->frame = _ecore_evas_wl_common_frame_add(ee->evas);
+ _ecore_evas_wl_common_frame_border_size_set(wdata->frame, fx, fy, fw, fh);
evas_object_is_frame_object_set(wdata->frame, EINA_TRUE);
evas_object_move(wdata->frame, 0, 0);
- evas_object_layer_set(wdata->frame, EVAS_LAYER_MIN);
+ evas_object_layer_set(wdata->frame, EVAS_LAYER_MAX - 1);
}
_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 dabd6ce85e..7ecb098fb5 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);
void _ecore_evas_wl_common_render_updates(void *data, Evas *evas, void *event);
Evas_Object * _ecore_evas_wl_common_frame_add(Evas *evas);
+void _ecore_evas_wl_common_frame_border_size_set(Evas_Object *obj, int fx, int fy, int fw, int fh);
#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
void _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 4a62a121de..384c710712 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,
ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_common_pre_free);
- if (ee->prop.draw_frame)
+ if (ee->prop.draw_frame)
{
wdata->frame = _ecore_evas_wl_common_frame_add(ee->evas);
+ _ecore_evas_wl_common_frame_border_size_set(wdata->frame, fx, fy, fw, fh);
evas_object_is_frame_object_set(wdata->frame, EINA_TRUE);
evas_object_move(wdata->frame, 0, 0);
- evas_object_layer_set(wdata->frame, EVAS_LAYER_MIN);
+ evas_object_layer_set(wdata->frame, EVAS_LAYER_MAX - 1);
}
ee->engine.func->fn_render = _ecore_evas_wl_common_render;